Repository: dotnet/runtime
File: .github/skills/vmr-codeflow-status/scripts/Get-CodeflowStatus.ps1 (PowerShell)

Code before:
            $commitMsgVmrCommit = $Matches[1]
            break
        }
    }
    # For forward flow (no Version.Details.xml source), commit messages are primary
    if (-not $branchVmrCommit -and $commitMsgVmrCommit) {
        $branchVmrCommit = $commitMsgVmrCommit
    }
}

if ($branchVmrCommit -or $vmrCommit) {
    Write-Section "Snapshot Validation"
    $usedBranchSnapshot = $false

    if ($branchVmrCommit) {
        # We have a branch-derived snapshot (from Version.Details.xml or commit message)
        $branchShort = Get-ShortSha $branchVmrCommit
        $sourceLabel = if ($versionDetailsVmrCommit -and $branchVmrCommit -eq $versionDetailsVmrCommit) { "Version.Details.xml" } else { "branch commit" }

        if ($vmrCommit) {
            $bodyShort = Get-ShortSha $vmrCommit
            if ($vmrCommit.StartsWith($branchVmrCommit) -or $branchVmrCommit.StartsWith($vmrCommit)) {
                Write-Host "  ✅ $sourceLabel ($branchShort) matches PR body ($bodyShort)" -ForegroundColor Green
            }
            else {
                Write-Host "  ⚠️  MISMATCH: $sourceLabel has $branchShort but PR body claims $bodyShort" -ForegroundColor Red
                Write-Host "  PR body is stale — using $sourceLabel for freshness check" -ForegroundColor Yellow
            }
        }
        else {
            Write-Host "  ℹ️  PR body has no commit reference — using $sourceLabel ($branchShort)" -ForegroundColor Yellow
        }

        # Resolve to full SHA for accurate comparison (skip API call if already full-length)
        if ($branchVmrCommit.Length -ge 40) {
            $vmrCommit = $branchVmrCommit
            $usedBranchSnapshot = $true
        }
        else {
            $resolvedCommit = Invoke-GitHubApi "/repos/$freshnessRepo/commits/$branchVmrCommit"
            if ($resolvedCommit) {
                $vmrCommit = $resolvedCommit.sha
                $usedBranchSnapshot = $true
            }
            elseif ($vmrCommit) {
                Write-Host "  ⚠️  Could not resolve $sourceLabel SHA $branchShort — falling back to PR body ($(Get-ShortSha $vmrCommit))" -ForegroundColor Yellow
            }
            else {
                Write-Host "  ⚠️  Could not resolve $sourceLabel SHA $branchShort" -ForegroundColor Yellow
            }
        }

Review comment (bug):
SHA comparisons use `.StartsWith(...)` which is case-sensitive; since the PR body and commit messages allow `[a-fA-F0-9]+`, the same SHA with different casing can be incorrectly reported as a mismatch. Normalize both SHAs (e.g., `.ToLowerInvariant()`) or use the `StartsWith(..., StringComparison.OrdinalIgnoreCase)` overload for snapshot validation (and the later snapshot source labeling).

Code after:
            }
        }
    }
}

# Second: scan commit messages for "Backflow from" / "Forward flow from" SHAs
if ($prCommits) {
    $reversedCommits = @($prCommits)
    [Array]::Reverse($reversedCommits)
    foreach ($c in $reversedCommits) {
        $msg = $c.messageHeadline
        if ($msg -match '(?:Backflow|Forward flow) from .+ / ([a-fA-F0-9]+)') {
            $commitMsgVmrCommit = $Matches[1]
            break
        }
    }
    # For forward flow (no Version.Details.xml source), commit messages are primary
    if (-not $branchVmrCommit -and $commitMsgVmrCommit) {
        $branchVmrCommit = $commitMsgVmrCommit
    }
}

if ($branchVmrCommit -or $vmrCommit) {
    Write-Section "Snapshot Validation"
    $usedBranchSnapshot = $false

    if ($branchVmrCommit) {
        # We have a branch-derived snapshot (from Version.Details.xml or commit message)
        $branchShort = Get-ShortSha $branchVmrCommit
        $sourceLabel = if ($versionDetailsVmrCommit -and $branchVmrCommit -eq $versionDetailsVmrCommit) { "Version.Details.xml" } else { "branch commit" }

        if ($vmrCommit) {
            $bodyShort = Get-ShortSha $vmrCommit
            if ($vmrCommit.StartsWith($branchVmrCommit, [StringComparison]::OrdinalIgnoreCase) -or $branchVmrCommit.StartsWith($vmrCommit, [StringComparison]::OrdinalIgnoreCase)) {
                Write-Host "  ✅ $sourceLabel ($branchShort) matches PR body ($bodyShort)" -ForegroundColor Green
            }
            else {
                Write-Host "  ⚠️  MISMATCH: $sourceLabel has $branchShort but PR body claims $bodyShort" -ForegroundColor Red
                Write-Host "  PR body is stale — using $sourceLabel for freshness check" -ForegroundColor Yellow
            }
        }
        else {
            Write-Host "  ℹ️  PR body has no commit reference — using $sourceLabel ($branchShort)" -ForegroundColor Yellow
        }

        # Resolve to full SHA for accurate comparison (skip API call if already full-length)
        if ($branchVmrCommit.Length -ge 40) {
            $vmrCommit = $branchVmrCommit
            $usedBranchSnapshot = $true
        }
        else {