[release/v7.6] Fix macOS preview package identifier detection to use version string#26709
Merged
daxian-dbw merged 1 commit intoPowerShell:release/v7.6from Jan 21, 2026
Conversation
…owerShell#26690) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: TravisEz13 <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR backports a critical fix from #26690 that corrects macOS preview package identifier detection. The bug caused preview packages to install to the stable location (/usr/local/microsoft/powershell/7/) instead of the preview location (/usr/local/microsoft/powershell/7-preview/), preventing users from having both versions installed simultaneously.
Changes:
- Refactored preview detection logic to use version string instead of package name
- Created a new testable
Get-MacOSPackageIdentifierInfofunction to centralize package identifier logic - Added LTS parameter support throughout the macOS packaging pipeline
- Included comprehensive unit tests with 7 test cases covering all scenarios (preview, stable, LTS)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tools/packaging/packaging.psm1 | Adds new Get-MacOSPackageIdentifierInfo function, refactors New-MacOSPackage to use version-based detection instead of package name, threads LTS parameter through the call chain, and simplifies New-MacOsDistributionPackage logic |
| test/packaging/packaging.tests.ps1 | New test file with comprehensive coverage for Test-IsPreview and Get-MacOSPackageIdentifierInfo functions, including a specific test documenting the bug fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jshigetomi
approved these changes
Jan 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #26690 to release/v7.6
Triggered by @daxian-dbw on behalf of @app/copilot-swe-agent
Original CL Label: CL-BuildPackaging
/cc @PowerShell/powershell-maintainers
Impact
REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.
Tooling Impact
Customer Impact
macOS preview packages were incorrectly installing to the stable location (/usr/local/microsoft/powershell/7/) instead of the preview location (/usr/local/microsoft/powershell/7-preview/). This prevented users from having both stable and preview versions installed simultaneously. The bug was introduced when native macOS packaging tools replaced fpm.
Regression
REQUIRED: Check exactly one box.
Introduced in PR #26268 (merged October 28, 2025) when native macOS packaging tools replaced fpm. The New-MacOSPackage function incorrectly detected preview builds by checking the package name ($Name -like '*-preview') instead of the version string. Since preview builds use the package name 'powershell' (not 'powershell-preview'), the check always returned false, causing preview packages to use the stable identifier.
Testing
The fix has been tested in the original PR with 7 unit tests covering all scenarios (preview, stable, LTS). Tests verify the Get-MacOSPackageIdentifierInfo function correctly identifies preview builds based on version string. A specific test documents the bug fix for issue #26673. The fix can be verified by building a macOS preview package and confirming it uses the com.microsoft.powershell-preview identifier and installs to the preview location.
Risk
REQUIRED: Check exactly one box.
The fix corrects preview detection logic in macOS package creation to use version string instead of package name. The change centralizes logic in a testable function and includes comprehensive unit tests. This only affects macOS packaging and restores the correct behavior that existed before the regression.