Skip to content

Conversation

@adityapatwardhan
Copy link
Member

Backport of #26429 to release/v7.6

Triggered by @adityapatwardhan on behalf of @TravisEz13

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)

Fixes test validation for macOS package naming convention. Required to ensure tests correctly validate that preview packages use version string instead of -preview prefix.

Customer Impact

  • Customer reported
  • Found internally

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

Verified the regex pattern matches the validation used in .pipelines/templates/release-validate-packagenames.yml. Updated comments to reflect correct naming convention. No functional testing needed as this is a test pattern fix.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

Low risk as this only fixes a test validation pattern. Does not affect actual package building or runtime behavior, only test validation to ensure package names follow correct convention.

Update test/packaging/macos/package-validation.tests.ps1 with correct regex pattern
for macOS package naming validation. This file was missed in the original backport
PR PowerShell#26562.

Changes:
- Remove (-preview|-lts)? pattern (no more -preview in names)
- Update to (lts-)? - only LTS gets prefix
- Update comments to reflect new naming convention
- Match validation used in release-validate-packagenames.yml
Copilot AI review requested due to automatic review settings December 5, 2025 17:58
@adityapatwardhan adityapatwardhan added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Dec 5, 2025
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 updates the macOS package name validation pattern in the test file to align with the pipeline validation logic. The change removes support for the -preview prefix in package names (e.g., powershell-preview-7.6.0-...), as preview releases now use version strings instead (e.g., powershell-7.6.0-preview.6-...). This ensures test validation correctly matches the actual package naming convention used in the build pipeline.

Key changes:

  • Updated regex pattern to remove -preview prefix option while keeping -lts prefix support
  • Revised example comments to reflect actual package naming patterns (version string for previews vs package name prefix)
  • Added reference comment linking to pipeline validation pattern

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# - powershell-7.6.0-preview.6-osx-x64.pkg (Preview version string)
# - powershell-7.4.13-rebuild.5-osx-arm64.pkg (Rebuild version)
# - powershell-lts-7.4.13-osx-arm64.pkg (LTS package)
$pkgPackageNamePattern = '^powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?osx\-(x64|arm64)\.pkg$'
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The regex pattern has an unescaped dot in the preview/rebuild version capture group ([a-z]*.\d+\-)?. The dot should be escaped as \. to match a literal dot character, not any character.

Current: ([a-z]*.\d+\-)?
Should be: ([a-z]*\.\d+\-)?

Without escaping, the pattern would incorrectly match strings like "preview6" or "previewX6" instead of only matching "preview.6".

Suggested change
$pkgPackageNamePattern = '^powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?osx\-(x64|arm64)\.pkg$'
$pkgPackageNamePattern = '^powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*\.\d+\-)?osx\-(x64|arm64)\.pkg$'

Copilot uses AI. Check for mistakes.
# - powershell-7.6.0-preview.6-osx-x64.pkg (Preview version string)
# - powershell-7.4.13-rebuild.5-osx-arm64.pkg (Rebuild version)
# - powershell-lts-7.4.13-osx-arm64.pkg (LTS package)
$pkgPackageNamePattern = '^powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?osx\-(x64|arm64)\.pkg$'
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The preview/rebuild version capture group uses [a-z]* which allows zero or more letters, making the entire prerelease identifier optional even when present. This would incorrectly match malformed names like "7.6.0-.6-osx-x64.pkg" (missing the word before the dot).

Current: ([a-z]*\.\d+\-)?
Should be: ([a-z]+\.\d+\-)?

Using [a-z]+ (one or more) ensures that if a prerelease identifier is present, it must have at least one letter before the dot.

Suggested change
$pkgPackageNamePattern = '^powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?osx\-(x64|arm64)\.pkg$'
$pkgPackageNamePattern = '^powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]+\.\d+\-)?osx\-(x64|arm64)\.pkg$'

Copilot uses AI. Check for mistakes.
@adityapatwardhan adityapatwardhan merged commit 55b48f7 into PowerShell:release/v7.6 Dec 5, 2025
39 checks passed
@adityapatwardhan adityapatwardhan deleted the backport/release/v7.6/26429-missing-file branch December 5, 2025 19:04
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.

2 participants