diff --git a/.github/agents/release-readiness-agent.agent.md b/.github/agents/release-readiness-agent.agent.md index a00f1be7f5ad..79bbf69a0c00 100644 --- a/.github/agents/release-readiness-agent.agent.md +++ b/.github/agents/release-readiness-agent.agent.md @@ -80,7 +80,7 @@ If the user wants the raw deterministic report with no judgment layer (e.g. for **If the user named a specific release** (or the current branch is a release branch), inspect it: -- `release/.0.1xx-sr` → **SR lane** → `Get-ReleaseReadiness.ps1` (`-Candidate` if the branch doesn't exist yet) +- `release/.0.1xx-sr` → **SR lane** → `Get-ReleaseReadiness.ps1` (`-Candidate` if the branch doesn't exist yet; `-Shipped` if that SR cycle has a stable tag) - `release/.0.1xx-preview` → **Preview lane** → `Get-PreviewReadiness.ps1` (`-Mode candidate -SurveyRef net.0` if the preview branch doesn't exist yet) **If the user asked a portfolio / cross-release question** (plural "releases", "status overview", "what needs attention across releases", "what's next" — no single branch named) → **Portfolio path (§0a)**. Do NOT ask "which release?" — the whole point is they may not know which releases exist. @@ -112,7 +112,7 @@ When the user wants status **across all active releases**, read the live tracker - **Generated report** (verdict, CI table, port candidates) — authoritative *as of the issue's `updatedAt`*. - **Release Captain Notes** (between `` and `:end -->`) — **human authority that supersedes the automated verdict.** Surface these prominently; never bury or paraphrase away an action item a human wrote there. -3. **Judge staleness before trusting content for a ship call.** The cron refresh runs weekdays 08:30 UTC. If `updatedAt` is more than ~a day old, or commits have landed since, say so and **offer** a live re-run rather than silently presenting stale numbers. (SR bodies embed ``; an unchanged hash across runs means the last run was a no-op — not that work has stalled.) +3. **Judge staleness before trusting content for a ship call.** Scheduled refreshes run every three hours from 08:30–20:30 UTC daily, with additional targeted refreshes on release pushes and relevant issue/milestone events. If `updatedAt` is unexpectedly old or commits have landed since, say so and **offer** a live re-run rather than silently presenting stale numbers. (SR bodies embed ``; an unchanged hash across runs means the last run was a no-op — not that work has stalled.) 4. **Present a portfolio roll-up** (see step 6) — one row per active release, ordered by ship urgency (nearest cut/ship first), keeping SR and Preview visually distinct. Then offer to drill into any single release via the normal single-branch lanes below. @@ -121,6 +121,13 @@ When the user wants status **across all active releases**, read the live tracker - Use the branch the user named, OR the current branch if it matches a release shape, OR ask. - Confirm it exists: `git rev-parse --verify origin/`. - If missing → switch to **Candidate mode** (step 1b). Do NOT silently substitute another branch. +- For an existing SR branch, resolve its lifecycle before running the report: + 1. Run `Find-ReleaseReadinessTrackers.ps1 -MajorVersion ` and use the matching branch descriptor when one is emitted. + 2. If its `mode` is `shipped`, pass `-Shipped -ShippedTag `. + 3. Older shipped SRs are intentionally omitted from the active detector matrix. If no descriptor is emitted, inspect stable tags in the branch's SR patch decade (`SR` owns patches `N*10..N*10+9`). If any matching stable tag exists, pass `-Shipped` and let the script select the latest immutable tag in that decade. + 4. Only an existing SR with no stable tag in its cycle uses the default in-flight semantics. + +Never infer shipped state from branch existence or the branch's current `PatchVersion` alone; a live branch can already have a shipped tag and can advance to an unpublished hotfix. ### 1b. Candidate mode (branch not cut yet) @@ -159,7 +166,7 @@ Never silently accept inferred labels for the final report. ### 3. Run the script -Use the routing decision from step 0. See SKILL.md for the full parameter contract. Tell the user the script is running — for large repos this is 60-120s. +Use the routing and lifecycle decision from steps 0-1. For the SR lane, append the resolved `-Candidate` or `-Shipped [-ShippedTag ]` arguments; do not run an existing tagged SR with default in-flight semantics. See SKILL.md for the full parameter contract. Tell the user the script is running — for large repos this is 60-120s. ### 4. Read the JSON output @@ -187,7 +194,7 @@ Both lanes may emit `UNKNOWN` rows when a tool isn't available in the running en | `BAR default-channel mapping ( → .NET SDK)` | `maestro_default_channels` with `repository: https://github.com/dotnet/maui` | Mapping present + enabled → `READY`. Missing/disabled → `BLOCKED` + surface the `darc add-default-channel` command from the script's `Next action`. | | `BAR build for HEAD ()` | `maestro_builds` with `commit: ` and `repository: https://github.com/dotnet/maui` | Filter returned builds to the requested SR branch **before** patching: accept only builds whose branch metadata is `` (or `refs/heads/`). A same-SHA build from `main` or another branch does **not** count. Matching SR build → `READY` and cite buildNumber/id. Empty/no SR-branch match → `WATCH` (transient, CI still running). | | `Ship Assessment validation feed` | `maestro_builds` / BAR asset details for the verified SR-branch build | Patch to `READY` only after verifying the SR-branch build has a published `NugetFeed` location for the `Microsoft.Maui.Controls` asset (the per-build `darc-pub-dotnet-maui-` endpoint). If the build exists but the `NugetFeed` location is absent/unconfirmed, leave/patch as `WATCH` and tell the captain to wait for BAR asset publishing rather than linking a guessed feed URL. | -| `Milestone hygiene (API failure)` | Re-run `gh auth status` and retry — milestone checks use plain `gh api`, so this UNKNOWN means gh isn't scoped right. | +| `Milestone hygiene (API failure)` | Re-run `gh auth status`, then retry the query — milestone checks use plain `gh api`, and this UNKNOWN can mean missing scope or a transient GitHub API/network failure. | | `Milestone hygiene (branch shape)` | **Not** an auth issue — the surveyed branch name has an unrecognized pre-release ordinal (e.g. `…-preview0`) that maps to no milestone title. Re-running `gh auth` will not help; verify the branch follows `release/.0.xx-preview` with `n >= 1` (the row's `Details` names the offending ordinal). | Always cite the MCP query result in your write-up (e.g. *"Verified via `maestro_default_channels`: SR8 is **not** in the mapping list — see darc command above"*). @@ -202,6 +209,20 @@ Lead with a 1-2 sentence overall verdict (Ready 🟢 / Conditionally Ready 🟡 - Surface fresh ci-scan WATCH signals if the scanner just flagged something - For preview candidates, frame as "what would ship if we cut today," not "is this ready" +**Preview action-plan ordering (mandatory).** Follow the canonical dependency-ordered +list in the release-readiness SKILL.md **Preview action ordering** section. Do not +restate or reorder it here; that section owns the production-ingestion check and the +rule that SDK/VMR reconciliation is local rather than a VMR subscription. + +If the official SDK/runtime build is unavailable under the access-tier workflow, +report the public-feed build as display-only and leave VMR validation `UNKNOWN`. +Never recommend a pin update or render VMR as matched from that fallback. + +Then list the current-preview build/promotion and CI validation work. Keep the report +strictly scoped to Preview N: do **not** mention the `netN.0` Preview N+1 bump, +`main → netN.0` PRs, the next milestone, or other next-preview housekeeping. Those +belong only in the Preview N+1 readiness report. + **Portfolio roll-up (cross-release path from §0a).** When answering a portfolio question, lead with a one-screen table — one row per active release — then a prioritized next-actions list: | Release | Lane | Mode | Verdict | Top blocker(s) | Captain-note action items | Last refreshed | diff --git a/.github/aw/actions-lock.json b/.github/aw/actions-lock.json index ba52ef18ea41..bde701ce1b4e 100644 --- a/.github/aw/actions-lock.json +++ b/.github/aw/actions-lock.json @@ -30,10 +30,10 @@ "version": "v7.0.1", "sha": "043fb46d1a93c77aae656e7c1c64a875d1fc6a0a" }, - "github/gh-aw-actions/setup@v0.82.14": { + "github/gh-aw-actions/setup@v0.83.4": { "repo": "github/gh-aw-actions/setup", - "version": "v0.82.14", - "sha": "b6d1443e05b8716267fa19425b99aa4f12006b4a" + "version": "v0.83.4", + "sha": "e89c65e17eb281bbd5ff2ff9e9199a03e96654c7" } } } diff --git a/.github/docs/maui-ci-facts.md b/.github/docs/maui-ci-facts.md index d637136a19cb..93a8e1dcf701 100644 --- a/.github/docs/maui-ci-facts.md +++ b/.github/docs/maui-ci-facts.md @@ -271,10 +271,13 @@ modifies that visual test or the affected snapshot/platform. The automated `/review tests` lane gathers failed UI result IDs from the public `vstmr.dev.azure.com/.../testresults/resultsbybuild` endpoint, then reads the public result-detail and attachment APIs. It publishes validated baseline/actual/diff PNGs to -the repository's `review-tests-assets` branch. A trusted post-step inserts as many -complete expandable comparison panels as fit inside the single test-failure analysis -comment while enforcing gh-aw's URL, mention, and character limits; excess panels are -reported as omitted rather than creating another comment. Visual publishing is +the repository's orphan, asset-only `review-tests-assets-v2` branch. The legacy +`review-tests-assets` branch remains intact so existing commit-pinned image URLs stay +reachable; it is not used for new publications because its inherited repository tree +contains workflow files that `GITHUB_TOKEN` cannot update. A trusted post-step inserts +as many complete expandable comparison panels as fit inside the single test-failure +analysis comment while enforcing gh-aw's URL, mention, and character limits; excess +panels are reported as omitted rather than creating another comment. Visual publishing is supplementary evidence only: missing images never raise or lower the deterministic verdict ceiling. Each panel also shows a conservative relationship label derived from the exact test-and-platform `deterministicAttribution` plus exact changed snapshot/test diff --git a/.github/scripts/CiScanMutation.Tests.ps1 b/.github/scripts/CiScanMutation.Tests.ps1 new file mode 100644 index 000000000000..f1c8b3b234cb --- /dev/null +++ b/.github/scripts/CiScanMutation.Tests.ps1 @@ -0,0 +1,444 @@ +#!/usr/bin/env pwsh +#Requires -Modules Pester + +<# + Mutation coverage for the CI scanner marker controls. + + Ordinary tests prove the validator and publisher behave correctly today. They + do not prove the behaviour is *caused* by the controls we think it is — a + suite can keep passing after a guard is deleted if nothing exercises it. That + is exactly how the marker regression shipped: the prompt told the agent to + emit markers, gh-aw never delivered that instruction, and nothing failed. + + Each test below takes the real source, applies one named mutation, and shows + that the mutant either fails closed or produces the bad payload the control + exists to prevent. Every mutation asserts that it actually changed the source + first, so a rename cannot silently turn these into no-ops. +#> + +BeforeAll { + . (Join-Path $PSScriptRoot 'CiScanTwins.Helpers.ps1') + + $script:ValidatorPath = Join-Path $PSScriptRoot 'Validate-CiScanManifest.ps1' + $script:ValidatorSource = Get-Content -LiteralPath $script:ValidatorPath -Raw + + $script:Mutations = @{ + # The publisher stops adding the canonical marker block. + 'no-injection' = @{ + Find = '$publishedBody = (New-CanonicalMarkerBlock ` + -Fingerprint $Fingerprint ` + -MatchCount $trustedEvidenceProof.MatchCount ` + -EvidenceKey $trustedEvidenceProof.EvidenceKey) + "`n`n" + $body' + Replace = '$publishedBody = $body' + } + # The fingerprint marker is sourced from agent-controlled body text + # instead of the validated manifest structure. + 'fingerprint-from-body' = @{ + Find = '$publishedBody = (New-CanonicalMarkerBlock ` + -Fingerprint $Fingerprint ` + -MatchCount $trustedEvidenceProof.MatchCount ` + -EvidenceKey $trustedEvidenceProof.EvidenceKey) + "`n`n" + $body' + Replace = '$publishedBody = (New-CanonicalMarkerBlock ` + -Fingerprint ([regex]::Match($rawBody, ''(?m)^claimed-fingerprint: (.+)$'').Groups[1].Value) ` + -MatchCount $trustedEvidenceProof.MatchCount ` + -EvidenceKey $trustedEvidenceProof.EvidenceKey) + "`n`n" + $body' + } + # The count marker is no longer the frozen-evidence recount. + 'untrusted-count' = @{ + Find = '-MatchCount $trustedEvidenceProof.MatchCount ` + -EvidenceKey $trustedEvidenceProof.EvidenceKey) + "`n`n" + $body' + Replace = '-MatchCount ($trustedEvidenceProof.MatchCount + 7) ` + -EvidenceKey $trustedEvidenceProof.EvidenceKey) + "`n`n" + $body' + } + # Validation happens only before injection: the post-injection assertion + # over the exact published payload is removed. + 'no-post-injection-check' = @{ + Find = ' Assert-CanonicalPublishedBody ` + -Body $publishedBody `' + Replace = ' Assert-NoOpPublishedBody ` + -Body $publishedBody `' + } + # Pre-existing / duplicate / evasive marker content is accepted from the agent. + 'no-duplicate-rejection' = @{ + Find = ' if (Test-MarkerLikeContent -Value $rawBody) {' + Replace = ' if ($false) {' + } + # Marker-like match patterns can replay trusted publisher state. + 'no-marker-pattern-rejection' = @{ + Find = ' if (Test-MarkerLikeContent -Value $matchPattern) {' + Replace = ' if ($false) {' + } + # Synthetic framing is put back into the countable raw segment set. + 'synthetic-framing-counted' = @{ + Find = ' -TrustedEvidencePath $TrustedEvidencePath) + foreach ($segment in $segments) {' + Replace = ' -TrustedEvidencePath $TrustedEvidencePath) + $segments += [pscustomobject]@{ content = "===== AzDO log $BuildId/$sourceLogId =====" } + foreach ($segment in $segments) {' + } + # Run-specific AzDO transport timestamps remain part of evidence identity. + 'timestamp-sensitive-identity' = @{ + Find = ' if ($StripAzdoTransportTimestamp) { + # Azure DevOps prepends a run-specific UTC timestamp to every stored log + # line. Segment provenance decides whether it is transport framing; the + # same timestamp in Helix or other evidence remains part of the message. + $normalized = [regex]::Replace( + $normalized, + ''^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,7})?Z[ \t]+'', + '''' + ) + }' + Replace = '' + } + } + + function New-MutatedValidator { + param( + [Parameter(Mandatory = $true)][string[]]$Mutation, + [Parameter(Mandatory = $true)][string]$Path + ) + + $source = $script:ValidatorSource + foreach ($name in $Mutation) { + $definition = $script:Mutations[$name] + if (-not $definition) { + throw "Unknown mutation '$name'." + } + if (-not $source.Contains($definition.Find)) { + throw "Mutation '$name' no longer matches the validator source; update the mutation." + } + $source = $source.Replace($definition.Find, $definition.Replace) + } + + # Stand-in for the removed post-injection assertion, so the mutant runs + # instead of dying on a missing command. + $source = $source.Replace( + 'function Assert-CanonicalPublishedBody {', + "function Assert-NoOpPublishedBody { param(`$Body, `$Fingerprint, `$MatchCount, `$EvidenceKey, `$EvidenceLineHashes, `$MatchPattern, `$PipelineName, `$BuildId) }`n`nfunction Assert-CanonicalPublishedBody {") + + Set-Content -LiteralPath $Path -Value $source -Encoding utf8 + return $Path + } + + function New-ProbeManifest { + param( + [string]$Path, + [string]$Body, + [string]$MatchPattern = 'Assertion failed' + ) + + $fingerprint = 'ci-scan-net11|net11.0|maui-pr|sample test|assertion failed|windows' + $manifest = [pscustomobject]@{ + pipelines = @( + [pscustomobject]@{ + name = 'maui-pr' + definition_id = 302 + status = 'scanned' + build_id = 123456 + signatures = @( + [pscustomobject]@{ + fingerprint = $fingerprint + disposition = 'filed' + source_log_ids = @(1001) + title = 'Sample test fails on Windows' + match_pattern = $MatchPattern + body = $Body + } + ) + } + [pscustomobject]@{ name = 'maui-pr-devicetests'; definition_id = 314; status = 'scanned'; build_id = 123457; signatures = @() } + [pscustomobject]@{ name = 'maui-pr-uitests'; definition_id = 313; status = 'scanned'; build_id = 123458; signatures = @() } + ) + } + + Set-Content -LiteralPath $Path -Value ($manifest | ConvertTo-Json -Depth 12) + return $Path + } + + function New-ProbeEvidence { + param( + [string]$Root, + [string[]]$Lines = @('Assertion failed', 'Assertion failed') + ) + + $directory = Join-Path $Root 'maui-pr' + New-Item -ItemType Directory -Path $directory -Force | Out-Null + Set-Content ` + -LiteralPath (Join-Path $directory '123456-1001.log') ` + -Value $Lines + [pscustomobject]@{ + schema_version = 1 + pipeline = 'maui-pr' + build_id = 123456 + log_id = 1001 + segments = @( + [pscustomobject]@{ + kind = 'azdo-log' + source = '123456/1001' + content = $Lines -join "`n" + } + ) + } | ConvertTo-Json -Depth 6 | Set-Content ` + -LiteralPath (Join-Path $directory '123456-1001.evidence.json') + return $Root + } + + function Invoke-ValidatorProbe { + param( + [string[]]$Mutation = @(), + [string]$Body = "## Summary`nRecurring sample failure.`n`n## Build Information`n- **Pipeline**: maui-pr`n- **Build ID**: 123456`n`n## Error Message`nAssertion failed", + [string]$MatchPattern = 'Assertion failed', + [string[]]$EvidenceLines = @('Assertion failed', 'Assertion failed') + ) + + $work = Join-Path $TestDrive ('mutation-' + [guid]::NewGuid().ToString('n')) + New-Item -ItemType Directory -Path $work -Force | Out-Null + + $validator = if ($Mutation.Count -eq 0) { + $copy = Join-Path $work 'Validate-CiScanManifest.ps1' + Set-Content -LiteralPath $copy -Value $script:ValidatorSource -Encoding utf8 + $copy + } else { + New-MutatedValidator -Mutation $Mutation -Path (Join-Path $work 'Validate-CiScanManifest.ps1') + } + + $manifestPath = New-ProbeManifest ` + -Path (Join-Path $work 'manifest.json') ` + -Body $Body ` + -MatchPattern $MatchPattern + $evidencePath = New-ProbeEvidence ` + -Root (Join-Path $work 'evidence') ` + -Lines $EvidenceLines + $probePath = Join-Path $work 'probe.ps1' + + Set-Content -LiteralPath $probePath -Value @' +param([string]$ValidatorPath, [string]$ManifestPath, [string]$EvidencePath) +$ErrorActionPreference = 'Stop' +. $ValidatorPath +try { + $manifest = Get-Content -Raw -LiteralPath $ManifestPath | ConvertFrom-Json + $plan = Test-CiScanManifest -Manifest $manifest -TrustedEvidencePath $EvidencePath + $body = if (@($plan.issues).Count -gt 0) { $plan.issues[0].Body } else { '' } + Write-Output ('RESULT ' + (ConvertTo-Json -Compress -InputObject @{ ok = $true; body = $body })) +} catch { + Write-Output ('RESULT ' + (ConvertTo-Json -Compress -InputObject @{ ok = $false; error = "$($_.Exception.Message)" })) +} +'@ + + # A child process keeps each mutant's function definitions out of the + # test session, so one mutation cannot leak into the next assertion. + $output = & pwsh -NoProfile -File $probePath $validator $manifestPath $evidencePath 2>&1 + $line = @($output | Where-Object { "$_" -like 'RESULT *' }) | Select-Object -Last 1 + if (-not $line) { + throw "validator probe produced no result: $output" + } + + return ("$line".Substring(7) | ConvertFrom-Json) + } + + $script:CanonicalMarker = '' +} + +Describe 'CI scanner marker mutation coverage' { + It 'baseline: the real validator injects exactly one canonical marker block' { + $result = Invoke-ValidatorProbe + + $result.ok | Should -BeTrue + ([regex]::Matches($result.body, '$' + } + + It 'mutation "no-injection": removing injection cannot produce a marked issue' { + $result = Invoke-ValidatorProbe -Mutation @('no-injection') + + $result.ok | Should -BeFalse + $result.error | Should -BeLike '*does not begin with the canonical marker block*' + } + + It 'mutation "no-injection + no-post-injection-check": reproduces the unmarked-issue incident' { + # This is the production failure mode, reconstructed: with both the + # injection and the post-injection assertion gone, a perfectly valid-looking + # run publishes an issue with neither marker and reports success. + $result = Invoke-ValidatorProbe -Mutation @('no-injection', 'no-post-injection-check') + + $result.ok | Should -BeTrue + $result.body | Should -Not -Match '$' + } + + It 'mutation "no-duplicate-rejection": a pre-marked body is rejected downstream' { + $body = "$script:CanonicalMarker`n## Summary`nRecurring sample failure.`n`n## Build Information`n- **Pipeline**: maui-pr`n- **Build ID**: 123456`n`n## Error Message`nAssertion failed" + $result = Invoke-ValidatorProbe -Mutation @('no-duplicate-rejection') -Body $body + + $result.ok | Should -BeFalse + $result.error | Should -BeLike '*exactly one canonical fingerprint marker*' + } + + It 'mutation "no-duplicate-rejection + no-post-injection-check": duplicate markers would ship' { + $body = "$script:CanonicalMarker`n## Summary`nRecurring sample failure.`n`n## Build Information`n- **Pipeline**: maui-pr`n- **Build ID**: 123456`n`n## Error Message`nAssertion failed" + $result = Invoke-ValidatorProbe -Mutation @('no-duplicate-rejection', 'no-post-injection-check') -Body $body + + $result.ok | Should -BeTrue + ([regex]::Matches($result.body, ' + +## Summary +Something failed. + +## Build Information +- **Pipeline**: $Pipeline (ID 313) +- **Build ID**: $BuildId +- **Branch**: net11.0 +- **Occurrences**: $Occurrences + +## Affected Legs +$legLines + +## Error Message +boom +"@ + if ($StateJson) { $body += "`n`n" } + return $body + } + + function New-StateJson { + param( + [int[]]$Absent = @(), + [int[]]$Present = @(), + [string]$Label = 'ci-scan-net11', + [string]$Branch = 'net11.0', + [string]$Pipeline = 'maui-pr-uitests', + [string]$ClockStart = '2026-06-01T00:00:00Z', + [string]$LastPresent = $null, + [int]$Version = 1 + ) + $o = [ordered]@{ + v = $Version; label = $Label; branch = $Branch; pipeline = $Pipeline + absent_builds = @($Absent); present_builds = @($Present) + clock_start_at = $ClockStart; candidate_notified = $false; runs = 5 + } + if ($LastPresent) { $o.last_present_at = $LastPresent } + return ($o | ConvertTo-Json -Compress) + } + + function New-Coverage { + param([int[]]$Verified = @(), [switch]$Unverifiable, [string]$Reason = '') + return @{ VerifiedAbsentBuilds = @($Verified); Unverifiable = [bool]$Unverifiable; Reason = $Reason } + } +} + +Describe 'Get-CiScanTwinConfig' { + It 'binds each label to exactly one branch' { + (Get-CiScanTwinConfig -Label 'ci-scan').Branch | Should -Be 'main' + (Get-CiScanTwinConfig -Label 'ci-scan-net11').Branch | Should -Be 'net11.0' + } + It 'rejects an unknown label rather than inventing a config' { + # Pinned to the message, not just to throwing. A bare `-Throw` is satisfied by any + # refusal, including a StrictMode property error from a half-broken lookup -- which + # is the failure this test exists to distinguish from a deliberate rejection. + { Get-CiScanTwinConfig -Label 'ci-scan-evil' } | + Should -Throw -ExpectedMessage '*Unknown ci-scan twin label*' + } + It 'returns a copy so callers cannot poison the shared table' { + $a = Get-CiScanTwinConfig -Label 'ci-scan' + $a.Branch = 'attacker-branch' + (Get-CiScanTwinConfig -Label 'ci-scan').Branch | Should -Be 'main' + } +} + +Describe 'Test-CiScanFingerprint' { + It 'accepts a well-formed fingerprint for the matching twin' { + $r = Test-CiScanFingerprint -Fingerprint $script:GoodFingerprint -Config $script:Net11 + $r | Should -Not -BeNullOrEmpty + $r.Pipeline | Should -Be 'maui-pr-uitests' + } + It 'rejects a net11 fingerprint when reconciling the main twin' { + Test-CiScanFingerprint -Fingerprint $script:GoodFingerprint -Config $script:Main | Should -BeNullOrEmpty + } + It 'rejects a branch that does not belong to the label' { + $fp = 'ci-scan-net11|main|maui-pr|a|b|c' + Test-CiScanFingerprint -Fingerprint $fp -Config $script:Net11 | Should -BeNullOrEmpty + } + It 'rejects an unconfigured pipeline' { + Test-CiScanFingerprint -Fingerprint 'ci-scan-net11|net11.0|maui-evil|a|b|c' -Config $script:Net11 | Should -BeNullOrEmpty + } + It 'rejects the wrong number of fields' { + Test-CiScanFingerprint -Fingerprint 'ci-scan-net11|net11.0|maui-pr|a|b' -Config $script:Net11 | Should -BeNullOrEmpty + Test-CiScanFingerprint -Fingerprint 'ci-scan-net11|net11.0|maui-pr|a|b|c|d' -Config $script:Net11 | Should -BeNullOrEmpty + } + It 'rejects empty fields' { + Test-CiScanFingerprint -Fingerprint 'ci-scan-net11|net11.0|maui-pr||b|c' -Config $script:Net11 | Should -BeNullOrEmpty + } + It 'rejects a Cyrillic homoglyph label (charset is ASCII-only by design)' { + # U+0441 CYRILLIC SMALL LETTER ES looks identical to ASCII 'c'. + $spoofed = ([char]0x0441) + 'i-scan-net11|net11.0|maui-pr|a|b|c' + Test-CiScanFingerprint -Fingerprint $spoofed -Config $script:Net11 | Should -BeNullOrEmpty + } + It 'rejects uppercase (fingerprints are lowercase by construction)' { + Test-CiScanFingerprint -Fingerprint 'CI-SCAN-NET11|net11.0|maui-pr|a|b|c' -Config $script:Net11 | Should -BeNullOrEmpty + } + It 'rejects markup that could break out of the HTML comment' { + Test-CiScanFingerprint -Fingerprint 'ci-scan-net11|net11.0|maui-pr|a|b|