Skip to content

[skill] Use Version.Details.xml as VMR snapshot fallback for manual backflow#124129

Open
lewing wants to merge 3 commits intomainfrom
lewing/vd-xml-fallback
Open

[skill] Use Version.Details.xml as VMR snapshot fallback for manual backflow#124129
lewing wants to merge 3 commits intomainfrom
lewing/vd-xml-fallback

Conversation

@lewing
Copy link
Member

@lewing lewing commented Feb 7, 2026

Follow-up to #124109.

When someone runs darc vmr backflow manually and pushes directly (as happened on dotnet/sdk#52727), the PR body metadata stays stale and commit messages don't use the parseable Backflow from ... / <sha> format. The script previously fell back to the stale PR body SHA, giving inaccurate freshness and fix tracing results.

This promotes eng/Version.Details.xml's <Source Sha=...> to the primary snapshot source — it's what the build actually uses and is always updated by any backflow operation. The file is parsed as XML (with regex fallback), and validated as a 40-character SHA.

Snapshot priority

  1. eng/Version.Details.xml <Source Sha="..."> — ground truth (parsed as XML)
  2. Commit messagesBackflow from ... / <sha> — secondary / forward flow primary
  3. PR body — Maestro's original metadata — last resort

Before (dotnet/sdk#52727 with manual backflow)

After

  • ⚠️ MISMATCH: Version.Details.xml has 87bc0b04 but PR body claims c87e49a
  • VMR is 2 commits ahead
  • Missing: fsharp only
  • ✅ Fix IS in the PR's VMR snapshot

Also handles

  • Conflicted PRs ([main] Source code updates from dotnet/dotnet sdk#52885) — VD.xml correctly reflects pre-codeflow state
  • Closed PRs with deleted branches — graceful degradation
  • Normal codeflow — VD.xml confirms PR body ✅
  • Full SHA from VD.xml — skips redundant API resolve call

Tested against 5 codeflow PRs across dotnet/sdk, dotnet/roslyn, dotnet/aspnetcore, dotnet/runtime, and dotnet/sourcelink.

Copilot AI review requested due to automatic review settings February 7, 2026 07:29
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Feb 7, 2026
@lewing lewing added the area-skills Agent Skills label Feb 7, 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

Improves reliability of GitHub “skills” automation scripts by (1) making VMR snapshot detection resilient to manual backflow commit message formats and (2) working around a Helix API artifact URI bug for subdirectory files.

Changes:

  • Add a fallback to read eng/Version.Details.xml on the PR branch to infer the VMR snapshot SHA when commit messages aren’t parseable.
  • Improve snapshot validation messaging (identify whether snapshot came from commit messages vs Version.Details.xml).
  • Rebuild Helix artifact file URIs from FileName for subdirectory artifacts and document the known Helix API issue.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
.github/skills/vmr-codeflow-status/scripts/Get-CodeflowStatus.ps1 Adds Version.Details.xml fallback and refines snapshot validation/status output.
.github/skills/azdo-helix-failures/scripts/Get-HelixFailures.ps1 Workaround for broken Helix artifact URIs for files in subdirectories by reconstructing URLs.
.github/skills/azdo-helix-failures/references/helix-artifacts.md Documents the Helix API bug and the script’s workaround.

@lewing lewing force-pushed the lewing/vd-xml-fallback branch 2 times, most recently from b9b70b4 to 3090c43 Compare February 7, 2026 07:40
Copilot AI review requested due to automatic review settings February 7, 2026 07:40
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@lewing lewing force-pushed the lewing/vd-xml-fallback branch from 3090c43 to 3969355 Compare February 7, 2026 07:47
@lewing lewing changed the title Use Version.Details.xml as VMR snapshot fallback for manual backflow [skill] Use Version.Details.xml as VMR snapshot fallback for manual backflow Feb 7, 2026
@lewing lewing removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Feb 7, 2026
Copilot AI review requested due to automatic review settings February 7, 2026 07:52
@lewing lewing force-pushed the lewing/vd-xml-fallback branch from 3969355 to b5e3166 Compare February 7, 2026 07:52
@lewing lewing force-pushed the lewing/vd-xml-fallback branch 2 times, most recently from 2fa670d to 33ae35f Compare February 7, 2026 07:55
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

@lewing lewing force-pushed the lewing/vd-xml-fallback branch from 33ae35f to 0062b79 Compare February 7, 2026 07:59
@lewing lewing force-pushed the lewing/vd-xml-fallback branch from 0062b79 to c0c18fd Compare February 7, 2026 16:59
Copilot AI review requested due to automatic review settings February 7, 2026 17:10
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

Version.Details.xml's <Source Sha=...> is the authoritative record of
which VMR commit a product repo branch is based on. Previously the script
treated it as a fallback after commit message parsing. Now it's checked
first, with commit messages as secondary confirmation.

This correctly handles:
- Manual backflow (darc vmr backflow pushed directly)
- Normal codeflow (Maestro-managed)
- Conflicted PRs (VD.xml reflects pre-codeflow state)
- Forward flow PRs (skips VD.xml, uses commit messages)

Tested against sdk#52727 (manual backflow) and sdk#52885 (conflicted).
-CheckMissing now scans open forward flow PRs (product repo → dotnet/dotnet)
in addition to missing backflow PRs. For each forward flow PR it detects:
- Conflict (Maestro 'Conflict detected' comment)
- Staleness (opposite codeflow merged while PR was open)
- Healthy (no issues)

Summary section now shows both directions.

Also fixes: dotnet-maestro comment author matching (gh CLI returns
'dotnet-maestro' not 'dotnet-maestro[bot]' for login field).

Tested against dotnet/sdk (4 forward PRs: 2 healthy, 1 stale, 1 conflict)
and dotnet/runtime (3 forward PRs: 2 healthy, 1 stale).
@lewing lewing force-pushed the lewing/vd-xml-fallback branch from 5cc04ae to adc8cb1 Compare February 7, 2026 17:19
Copilot AI review requested due to automatic review settings February 7, 2026 17:21
- Use 2>$null instead of 2>&1 for gh pr view to prevent stderr
  corrupting JSON stream
- Wrap ConvertFrom-Json in try/catch for forward flow PR details
- Tighten regex fallback to require exactly 40-char hex SHA
- Use case-insensitive StringComparison for SHA matching
@lewing lewing force-pushed the lewing/vd-xml-fallback branch from 6daddd0 to 9d21ee3 Compare February 7, 2026 17:23
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

.github/skills/vmr-codeflow-status/scripts/Get-CodeflowStatus.ps1:265

  • Forward-flow lookup derives $repoShortName by stripping only the dotnet/ prefix. If -Repository is ever used with a non-dotnet/* repo, this produces an invalid search string (e.g., dotnet/otherOwner/repo). Consider deriving the repo name via ($Repository -split '/',2)[1] (or parsing owner/name once) so the search is robust and independent of the owner.
            Write-Host "    ✅ Open backflow PR #$($openBranches[$branchName]) exists" -ForegroundColor Green
            $coveredCount++

Comment on lines 495 to +499
$branchVmrCommit = $null
$commitMsgVmrCommit = $null
$versionDetailsVmrCommit = $null

# First: check eng/Version.Details.xml on the PR branch (authoritative source)
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

Invoke-GitHubApi -Raw currently merges stderr into stdout (2>&1). If gh api emits non-fatal warnings on stderr, they can get mixed into $vdContent and break XML/regex parsing here. Consider changing Invoke-GitHubApi (or this callsite) to keep stderr separate for successful raw responses.

Copilot uses AI. Check for mistakes.
Comment on lines 602 to 605
# Get current branch HEAD (URL-encode branch name for path segments with /)
$encodedBranch = [uri]::EscapeDataString($vmrBranch)
$branchHead = Invoke-GitHubApi "/repos/$freshnessRepo/commits/$encodedBranch"
if ($branchHead) {
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

$vmrCommit.StartsWith($versionDetailsVmrCommit) is case-sensitive by default. Since earlier comparisons use OrdinalIgnoreCase, this can mislabel the snapshot source when the SHA casing differs. Use an explicit StringComparison.OrdinalIgnoreCase (or normalize SHAs) for consistent behavior.

Copilot uses AI. Check for mistakes.
Comment on lines 268 to +272

# --- Forward flow: check PRs from this repo into the VMR ---
$repoShortName = $Repository -replace '^dotnet/', ''
Write-Host ""
Write-Section "Forward flow PRs ($Repository → dotnet/dotnet)"
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

The forward-flow scan can trigger up to 50 per-PR gh pr view calls (each requesting comments). This can be slow and can hit GitHub API rate limits. Consider lowering the search limit and/or avoiding fetching full comment lists unless needed to keep -CheckMissing responsive.

Copilot uses AI. Check for mistakes.
Comment on lines 263 to 266
Write-Host " Branch: $branchName" -ForegroundColor White
Write-Host " ✅ Open backflow PR #$($openBranches[$branchName]) exists" -ForegroundColor Green
$coveredCount++
}
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

PR description/title focus on Version.Details.xml snapshot fallback, but this hunk also adds a new forward-flow PR scan in -CheckMissing output. Please update the PR description to mention this additional behavior (or split it into a separate PR) so scope/intent are clear.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-skills Agent Skills

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant