Skip to content

Comments

Tests: validate prerelease identifier when matrix version is prerelease#19

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/resolve-latest-prerelease-versions
Closed

Tests: validate prerelease identifier when matrix version is prerelease#19
Copilot wants to merge 2 commits intomainfrom
copilot/resolve-latest-prerelease-versions

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

The prerelease matrix entry verified the installed version matched the API-resolved tag, but never asserted the resolved version was actually a prerelease — a stable fallback would pass silently.

Changes

  • $isPrereleaseRequest flag — captured before $requested is overwritten by the API resolution, so the original matrix intent (prerelease) is preserved for downstream checks.
  • Prerelease identifier assertion — after the existing equality check, when $isPrereleaseRequest is true, asserts the installed version matches the regex -preview|-(rc|alpha|beta)\., failing explicitly if a stable version slipped through.
if ($isPrereleaseRequest) {
    if ($installed -notmatch '-preview|-(rc|alpha|beta)\.') {
        throw "Failed: expected a prerelease version but got $installed"
    }
    Write-Host "Prerelease identifier check passed: $installed"
}

latest and pinned-version paths are unchanged.

Original prompt

This section details on the original issue you should resolve

<issue_title>Tests: Resolve latest and prerelease versions live and validate preview version format</issue_title>
<issue_description>## Summary

The verification step in Action-Test.yml should resolve the expected version live from the GitHub Releases API for both the latest and prerelease matrix entries, rather than relying on any hardcoded version strings. The test for a successful install is simply that the installed version matches the version we asked to install.

Additionally, the prerelease test must assert that the installed version is actually a prerelease by regex-matching the version string for a prerelease identifier (e.g. -preview, -rc).

Current behaviour

The verify step already calls the GitHub Releases API to resolve latest and prerelease to a concrete version, then compares with an exact string match. However, for the prerelease case it does not validate that the resolved/installed version actually contains a prerelease tag — it only checks equality.

Desired behaviour

  1. latest — Fetch the latest stable release tag from PowerShell/PowerShell at test time, install it, and verify the installed $PSVersionTable.PSVersion matches.
  2. latest + Prerelease: true — Fetch the latest prerelease release tag live, install it, and verify:
    • The installed version matches the resolved version (same as today).
    • The installed version string matches a prerelease pattern, e.g.:
      $installed -match '-preview|-(rc|alpha|beta)\.'
      This ensures we are actually testing a prerelease build and not accidentally falling back to a stable version.
  3. Pinned versions (e.g. 7.4.7, 7.5.0, 7.4.0-preview.5) — Continue to compare the installed version against the exact requested string.

Acceptance criteria

  • The latest verification resolves the expected version from the GitHub Releases API at runtime (no hardcoded version).
  • The prerelease verification resolves the expected version from the GitHub Releases API at runtime.
  • The prerelease verification additionally asserts (via regex) that the installed version contains a prerelease identifier (e.g. -preview., -rc.).
  • Pinned version tests continue to do a simple exact-match comparison.
    </issue_description>

Comments on the Issue (you are Copilot in this section)

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix version verification for latest and prerelease tests Tests: validate prerelease identifier when matrix version is prerelease Feb 20, 2026
@MariusStorhaug Marius Storhaug (MariusStorhaug) marked this pull request as ready for review February 20, 2026 10:40
Copilot AI review requested due to automatic review settings February 20, 2026 10:40
Copy link

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 adds prerelease identifier validation to the test workflow to ensure that when the matrix entry prerelease is used, the installed PowerShell version is actually a prerelease build and not a stable version that might have been returned incorrectly.

Changes:

  • Captures $isPrereleaseRequest flag before API resolution to preserve the original matrix intent
  • Adds regex validation to assert prerelease versions contain identifiers like -preview or -rc
  • Maintains existing behavior for latest and pinned version matrix entries

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

@MariusStorhaug Marius Storhaug (MariusStorhaug) deleted the copilot/resolve-latest-prerelease-versions branch February 20, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants