Repository navigation
[CI] OneLoc: Resolve MirrorBranch during template expansion - #38650
Conversation
Use a compile-time template expression so the source branch is resolved before it is passed to the OneLoc template. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ca981fa5-8dc6-4a81-91a0-d9205e10180f
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38650Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38650" |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Hey there @@missymessa! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Hey there @missymessa! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
This comment has been minimized.
This comment has been minimized.
|
Warning Your |
|
/azp run |
|
Commenter does not have sufficient privileges for PR 38650 in repo dotnet/maui |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟢 Approval recommended
The change is minimal, matches the stated root cause, and aligns with existing compile-time variable usage patterns already present in the same pipeline file.
Pull request overview
This PR fixes MAUI’s official pipeline OneLoc configuration so the mirror/target branch is evaluated at Azure Pipelines compile time (instead of being passed through as a literal runtime expression), preventing invalid /prtgtbranch values and the resulting “Branch not found” failures during localization.
Changes:
- Switch
MirrorBranchfrom a runtime$[ ... ]expression to a compile-time${{ ... }}template expression so it resolves (e.g.,refs/heads/main→main) before being passed into the nested OneLoc template.
File summaries
| File | Description |
|---|---|
| eng/pipelines/ci-official.yml | Updates OneLoc MirrorBranch to use compile-time template evaluation to avoid passing a literal runtime expression downstream. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
This comment has been minimized.
This comment has been minimized.
|
Warning Your |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
|
Addressed the requested persistent regression coverage in 4c473f7:
This keeps the one-line implementation and adds a persistent guard at the nested-template evaluation boundary identified by the review. |
|
/review android |
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped to CI template evaluation and is backed by a targeted regression test that’s wired into existing script-test CI.
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Lite
This comment has been minimized.
This comment has been minimized.
2 similar comments
|
/review -b improved-reviewer -p android |
This comment has been minimized.
This comment has been minimized.
|
Warning Your |
|
Warning Your |
This comment has been minimized.
This comment has been minimized.
|
Note 🔍
|
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@missymessa — new AI review results are available based on commit
4c473f7.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ⚠️ SKIPPED
No tests were detected in this PR.
Recommendation: Add tests to verify the fix using the write-tests-agent.
📋 Pre-Flight — Context & Validation
PR #38650 Pre-Flight
Context
- PR:
[CI] OneLoc: Resolve MirrorBranch during template expansion - Issue: #38663,
OneLoc official pipeline passes target branch expression literally - Base / materialized review head:
76a01cd019c169aa22fdb6c688561f472ec084a2/54528a0ddabc9e0dadcea02cabb342ba83c5496a - Requested test platform: Android. The defect is Azure Pipelines template expansion and has no Android-specific runtime path.
- Gate: Skipped before STEP 5a because no tests were detected. Do not rerun the gate and do not modify
gate/content.md.
Problem
The official pipeline supplies this runtime expression to the nested Arcade OneLoc template:
MirrorBranch: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ]That value crosses a template boundary without being evaluated and reaches OneLoc literally. In official build 3079785, OneLoc consequently requested:
refs/heads/$[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ]
GitHub returned 404 Branch not found. For refs/heads/main, the nested template must receive main.
Existing PR Approach
The PR changes MirrorBranch to an Azure Pipelines compile-time template expression:
MirrorBranch: ${{ replace(variables['Build.SourceBranch'], 'refs/heads/', '') }}It also adds a Pester assertion for the exact assignment and wires that test and its pipeline file into the PowerShell workflow.
Changed files:
.github/workflows/powershell-script-tests.yml(+3)eng/pipelines/ci-official.Tests.ps1(+18, new file)eng/pipelines/ci-official.yml(+1/-1)
An alternative must use a different mechanism/root-cause strategy rather than relocating the same expression-form substitution.
Bounded Validation
Do not run product, device, UI, integration, or full repository suites. Use only:
- Primary:
eng/pipelines/ci-official.Tests.ps1 - Regression:
eng/pipelines/ci-official-release.Tests.ps1
Run both in one targeted Pester 5.9.0 invocation and fail when Pester reports any failure or discovers zero tests:
$ErrorActionPreference = 'Stop'
Import-Module Pester -RequiredVersion 5.9.0
$result = Invoke-Pester -Path @(
'eng/pipelines/ci-official.Tests.ps1'
'eng/pipelines/ci-official-release.Tests.ps1'
) -PassThru -Output Detailed
if ($result.FailedCount -gt 0 -or $result.TotalCount -lt 1) { exit 1 }Each candidate receives one implementation/test pass and at most one focused correction/retest.
Safety Boundary
The try-fix skill must establish and restore its baseline only with .github/scripts/EstablishBrokenBaseline.ps1. The PR adds eng/pipelines/ci-official.Tests.ps1; if baseline state records any NewFiles, the skill contract requires a truthful Blocked result before editing because restoration is not safe. Do not bypass that guard.
🔬 Code Review — Deep Analysis
Code Review — PR #38650
Independent Assessment
What this changes:
The PR fixes the MirrorBranch value passed into the OneLocBuild template in eng/pipelines/ci-official.yml by switching from runtime expression syntax ($[ ... ]) to compile-time template expression syntax (${{ ... }}), and adds a targeted Pester regression test (eng/pipelines/ci-official.Tests.ps1) plus workflow wiring in .github/workflows/powershell-script-tests.yml so this check runs in script-test CI.
Inferred motivation:
Prevent OneLoc from receiving the literal unevaluated expression string across nested template boundaries (which causes branch resolution failures such as 404 Branch not found).
Reconciliation with PR Narrative
The pre-flight narrative claims exactly this root cause and fix direction. My independent code assessment matches it.
Blast Radius Assessment
- Runs for all instances: No. This path is scoped to the
Localizationstage and only whenisLocHandoffBranch == trueon official builds. - Startup impact: No app/runtime startup impact (pipeline-only change).
- Static/shared state: No runtime static state impact.
CI Status
- Required-check result: undetermined (tool unavailable from this environment for authenticated
gh pr checks --required). - Classification: undetermined.
- Action taken: confidence capped low; no LGTM verdict.
Findings
No actionable file:line defects were found in the reviewed diff.
Failure-Mode Probing
- If this runs on non-handoff branches: Localization stage condition prevents execution; changed expression is inert outside that stage.
- If
Build.SourceBranchis a standardrefs/heads/<name>branch: compile-time expression strips prefix and yields the expected branch token for nested template consumption. - If this is a tag build (
refs/tags/...) and stage somehow runs: replacement is a no-op, preserving the original tag ref text. Given handoff-branch gating, this does not introduce a new regression in intended execution paths.
External Output Contract
Not applicable (the change does not classify external tool output via regex/string token matching).
Verdict: NEEDS_DISCUSSION
Confidence: low
Summary: The code change is sound, minimal, and appropriately regression-tested for the exact pipeline assignment shape. I found no inline defects in modified lines. However, required-check status could not be authoritatively resolved in this environment (gh authentication unavailable), so final merge-readiness remains a discussion item rather than LGTM.
🛠️ Try-Fix — Analysis & Comparison
PR #38650 Try-Fix Aggregate
Candidate 1 — Upstream Branch Normalization
Model: gpt-5.3-codex
Approach: Precompute the normalized branch name in an upstream pipeline variable, then pass a plain scalar to the nested OneLoc template.
Prior PR approach avoided: The PR performs inline compile-time substitution at the parameter site with ${{ replace(variables['Build.SourceBranch'], 'refs/heads/', '') }}.
Mechanism-level difference: This candidate would move normalization earlier in the data flow so the nested template receives already-materialized text and cannot propagate unevaluated expression tokens.
Files changed: None.
Result: Blocked
Test result: Not executed. EstablishBrokenBaseline.ps1 recorded the PR-added eng/pipelines/ci-official.Tests.ps1 in a non-empty NewFiles array. The try-fix restoration contract therefore required the attempt to stop before edits or tests. Restoration completed with Restored True.
Failure analysis: This is a policy/restorability block, not evidence that the proposed mechanism succeeds or fails.
Inline expert self-review: 0 findings.
Candidate diff:
Candidate 2 — Use OneLoc's Literal Default
Model: gpt-5.6-sol
Approach: Remove the MirrorBranch override from eng/pipelines/ci-official.yml and rely on the directly referenced core OneLoc template's declared literal default, MirrorBranch: main.
Prior approaches avoided: The PR passes an inline compile-time ${{ replace(...) }} argument. Candidate 1 planned upstream precomputation of a normalized branch variable. Both preserve an explicit branch value flowing from the official pipeline through the nested wrapper; this candidate would eliminate that caller-supplied value entirely.
Mechanism-level difference: Without a call-site MirrorBranch argument, the wrapper has no override to forward and the core OneLoc template resolves its literal main default before emitting the task's mirrorBranch input. No replacement token or precomputed normalization variable crosses the nested template boundary.
Files changed: None.
Result: Blocked
Test result: Not executed (0 executions). EstablishBrokenBaseline.ps1 again recorded the PR-added eng/pipelines/ci-official.Tests.ps1 in the non-empty NewFiles array, so the try-fix contract prohibited edits and tests. Restoration completed with Restored True.
Failure analysis: This is a policy/restorability block, not evidence that the proposed default-parameter mechanism succeeds or fails. The mechanism remains unvalidated.
Inline expert self-review: 0 findings.
Candidate diff:
🏁 Report — Final Recommendation
⚠️ Final Recommendation: REQUEST CHANGES
Winner: pr
The submitted PR is the single winning candidate. It directly fixes the nested-template data flow by changing MirrorBranch from the unevaluated runtime form to a compile-time template expression, preserves the source branch for main, net*.0, and release/* builds, and adds focused regression coverage plus workflow discovery. The expert review found no actionable defect and produced no reviewer patch.
The recommendation remains REQUEST CHANGES because the trusted Gate was skipped and therefore does not permit approval. The one allowed local candidate validation attempt was also blocked before discovery because Pester 5.9.0 is unavailable. This is a validation-evidence gap, not a demonstrated code or test failure; the PR description's Azure Pipelines dry-run and nine-test Pester results could not be independently reproduced in this environment.
Candidate comparison
| Rank | Candidate | Implementation | Validation | Assessment |
|---|---|---|---|---|
| 1 | pr |
Complete submitted fix and regression test | Author reports successful Azure dry-runs and 9 passing Pester tests; trusted Gate skipped | Best root-cause fit and only complete, independently reviewed implementation |
| 2 | pr-plus-reviewer |
Byte-identical to pr; expert found no actionable change to apply |
Single required invocation blocked because Pester 5.9.0 is absent | No quality improvement over pr, and no additional pass evidence |
| 3 | try-fix-1 |
Proposed upstream branch normalization, but produced no patch | Blocked before editing or testing by the try-fix baseline safety contract | Potentially viable in principle, but too underspecified and wholly unvalidated to outrank working code |
| 4 | try-fix-2 |
Proposed removing the override and relying on the core template's main default, but produced no patch |
Blocked before editing or testing by the try-fix baseline safety contract | Would lose source-branch selection for any eligible non-main handoff build, so it is weaker even aside from having no implementation |
No candidate failed a regression test: both try-fix-* attempts were blocked before tests, and pr-plus-reviewer was blocked by the missing Pester module before discovery. Those blocked outcomes are ranked below the submitted candidate's complete implementation and reported passing evidence without being mislabeled as test failures.
Expert evaluation
- Inline findings: 0
- Raw-PR verdict:
NEEDS_DISCUSSION - Confidence: low, capped by undetermined required-check status
- Reviewer refinement: none
Required follow-up
Obtain trusted required-check or equivalent targeted Pester evidence before approval. No code change from the expert review or either try-fix candidate should replace the submitted implementation.
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
This comment has been minimized.
This comment has been minimized.
Tests Failure Analysis
🧪 CI Analysis — click to expand📋 SummaryPR: #38650 targeting 📊 Pipeline coverageThe pinned PR head is
🔎 Failure attribution
📋 Previous-run comparison
🔬 Code and regression-test evidenceThe pinned diff changes 📋 Coverage and limitationsCoverage: Incomplete - the current device build is inspectable, but the current 🧭 Follow-up — actions and refreshNext action: Inspect build
|
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Fixes OneLoc target-branch evaluation in the official pipeline by using an Azure Pipelines compile-time template expression for
MirrorBranch.In build 3079785, localization and GitHub App authentication succeeded, but the runtime expression was passed literally to OneLoc as part of
/prtgtbranch. GitHub then returned404 Branch not foundfor that invalid branch name.The compile-time expression resolves
refs/heads/maintomainbefore the value is inserted into the nested OneLoc template.Validation
Azure DevOps dry-run previews of the official
dotnet-mauipipeline definition parsed the complete template graph without creating a build:main:mirrorBranch: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ]refs/heads/main:mirrorBranch: mainPersistent regression coverage now verifies that
ci-official.ymlpasses the compile-time expression to the nested OneLoc template:eng/pipelines/ci-official.Tests.ps1with an exactMirrorBranchassignment assertion..github/workflows/powershell-script-tests.ymlfor changes to either the official pipeline or its test.git diff --checkpassed.The MAUI artifact dogfood command does not exercise this change because it affects pipeline template expansion rather than product binaries. A full PR validation build could not be self-authorized: Azure Pipelines rejected the
/azp runrequest for insufficient repository privileges.Existing PR Comparison
Searched open
dotnet/mauipull requests for OneLoc,MirrorBranch, branch, and localization fixes after independently determining the solution. No equivalent open PR was found.Issues Fixed
Fixes #38663