Fix macOS preview package identifier detection to use version string#26690
Merged
TravisEz13 merged 6 commits intomasterfrom Jan 15, 2026
Merged
Fix macOS preview package identifier detection to use version string#26690TravisEz13 merged 6 commits intomasterfrom
TravisEz13 merged 6 commits intomasterfrom
Conversation
- Add LTS parameter to New-MacOSPackage function - Use Test-IsPreview with Version parameter instead of checking Name - Update Start-PSPackage to pass LTS parameter to New-MacOSPackage - Fix both pkgIdentifier and IsPreview usages in New-MacOSPackage This fixes issue #26673 where preview packages incorrectly used the stable package identifier and installed to the wrong location. Co-authored-by: TravisEz13 <[email protected]>
- Add comprehensive tests for Test-IsPreview function - Add tests for Get-MacOSPackageId function - Add integration tests verifying the fix for issue #26673 - Test verifies preview detection uses version string not package name Co-authored-by: TravisEz13 <[email protected]>
Copilot
AI
changed the title
[WIP] Fix macOS preview package installation detection
Fix macOS preview package identifier detection to use version string
Jan 14, 2026
TravisEz13
reviewed
Jan 14, 2026
- Add 4 new tests that verify New-MacOSPackage uses the correct logic - Tests verify Test-IsPreview is called with Version and LTS parameters - Tests demonstrate the difference between the buggy and fixed logic - All 13 tests now passing (9 original + 4 new integration tests) Co-authored-by: TravisEz13 <[email protected]>
- Extract preview detection logic into Get-MacOSPackageIdentifierInfo - This function encapsulates the logic we changed in New-MacOSPackage - Simplify tests by removing redundant test cases (13 -> 9 tests) - All tests now directly test the refactored function - Tests verify the fix for issue #26673 Co-authored-by: TravisEz13 <[email protected]>
TravisEz13
reviewed
Jan 14, 2026
- Removed Get-MacOSPackageId function and inlined its logic - Updated New-MacOSLauncher to use Get-MacOSPackageIdentifierInfo - Updated New-MacOsDistributionPackage to inline package ID logic - Removed tests for Get-MacOSPackageId (7 tests remain, all passing) - All package identifier logic now centralized in Get-MacOSPackageIdentifierInfo Co-authored-by: TravisEz13 <[email protected]>
adityapatwardhan
approved these changes
Jan 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where 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/). The issue was introduced in PR #26268 when native macOS packaging tools replaced fpm.
Changes:
- Centralized preview detection and package identifier logic into a new
Get-MacOSPackageIdentifierInfofunction that uses version string analysis instead of package name checking - Added proper LTS parameter support throughout the macOS packaging pipeline
- Inlined simple package identifier logic in
New-MacOsDistributionPackagefor better maintainability - Added comprehensive unit tests verifying the fix and all scenarios
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tools/packaging/packaging.psm1 | Added Get-MacOSPackageIdentifierInfo function to centralize preview detection logic; updated New-MacOSPackage, New-MacOSLauncher, and New-MacOsDistributionPackage to use the new function; added LTS parameter to New-MacOSPackage |
| test/packaging/packaging.tests.ps1 | Added comprehensive unit tests for Test-IsPreview and Get-MacOSPackageIdentifierInfo functions, including a specific test documenting the bug fix for issue #26673 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
daxian-dbw
pushed a commit
to daxian-dbw/PowerShell
that referenced
this pull request
Jan 20, 2026
…owerShell#26690) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: TravisEz13 <[email protected]>
9 tasks
TravisEz13
added a commit
to TravisEz13/PowerShell
that referenced
this pull request
Feb 10, 2026
…owerShell#26690) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: TravisEz13 <[email protected]>
9 tasks
daxian-dbw
pushed a commit
to daxian-dbw/PowerShell
that referenced
this pull request
Feb 15, 2026
…owerShell#26690) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: TravisEz13 <[email protected]>
9 tasks
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.
Fix macOS preview package identifier bug
This PR fixes issue #26673 where macOS preview packages were incorrectly installing to the stable location instead of the preview location.
Problem
The macOS preview package for PowerShell 7.6.0-preview.6 was installing to
/usr/local/microsoft/powershell/7/(stable location) instead of/usr/local/microsoft/powershell/7-preview/(preview location). This prevented users from having both stable and preview versions installed simultaneously.Root Cause
The bug was introduced in PR #26268 where native macOS packaging tools replaced fpm. The
New-MacOSPackagefunction incorrectly detected preview builds by checking the package name:However, preview builds use the package name
"powershell"(not"powershell-preview"), so this check always returned$false, causing preview packages to use the stable identifiercom.microsoft.powershellinstead ofcom.microsoft.powershell-preview.Solution
Extracted and centralized the preview detection logic into
Get-MacOSPackageIdentifierInfofunction that determines preview status and package identifier based on version string and LTS flag:All package identifier logic is now centralized in this single testable function.
Changes Made
Created and refined
Get-MacOSPackageIdentifierInfofunction (tools/packaging/packaging.psm1):VersionandLTSparametersIsPreviewandPackageIdentifierpropertiesGet-MacOSPackageIdhelper)Modified
New-MacOSPackagefunction (tools/packaging/packaging.psm1):[switch]$LTSparameterGet-MacOSPackageIdentifierInfoto get package infoModified
New-MacOSLauncherfunction (tools/packaging/packaging.psm1):Get-MacOSPackageIdentifierInfoinstead of calling functions separatelyModified
New-MacOsDistributionPackagefunction (tools/packaging/packaging.psm1):Modified
Start-PSPackagefunction (tools/packaging/packaging.psm1):LTS = $LTSto pass the LTS flag toNew-MacOSPackageStreamlined unit tests (
test/packaging/packaging.tests.ps1):Test-IsPreviewfunctionGet-MacOSPackageIdentifierInfofunction (the centralized logic)Expected Behavior After Fix
com.microsoft.powershell-previewand install to/usr/local/microsoft/powershell/7-preview/com.microsoft.powershelland install to/usr/local/microsoft/powershell/7/Testing
Get-MacOSPackageIdentifierInfofunction behaviorValidation
Fixes #26673
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.