Skip to content

[release/v7.6] Fix macOS preview package identifier detection to use version string#26709

Merged
daxian-dbw merged 1 commit intoPowerShell:release/v7.6from
daxian-dbw:backport/release/v7.6/26690-5fdc2a023
Jan 21, 2026
Merged

[release/v7.6] Fix macOS preview package identifier detection to use version string#26709
daxian-dbw merged 1 commit intoPowerShell:release/v7.6from
daxian-dbw:backport/release/v7.6/26690-5fdc2a023

Conversation

@daxian-dbw
Copy link
Member

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

  • Required tooling change
  • Optional tooling change (include reasoning)

Customer Impact

  • Customer reported
  • Found internally

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.

  • Yes
  • No

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.

  • High
  • Medium
  • Low

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.

@daxian-dbw daxian-dbw requested review from a team and jshigetomi as code owners January 20, 2026 22:40
@daxian-dbw daxian-dbw added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Jan 20, 2026
Copilot AI review requested due to automatic review settings January 20, 2026 22:40
@daxian-dbw daxian-dbw added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Jan 20, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-MacOSPackageIdentifierInfo function 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.

@daxian-dbw daxian-dbw merged commit 9f65a8e into PowerShell:release/v7.6 Jan 21, 2026
45 checks passed
@daxian-dbw daxian-dbw deleted the backport/release/v7.6/26690-5fdc2a023 branch January 21, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants