Skip to content

fix(compile): use macro form for same-job synthPr gate refs#944

Merged
jamesadevine merged 2 commits into
mainfrom
copilot/fix-synthetic-pr-gate-issue
Jun 10, 2026
Merged

fix(compile): use macro form for same-job synthPr gate refs#944
jamesadevine merged 2 commits into
mainfrom
copilot/fix-synthetic-pr-gate-issue

Conversation

Copilot AI commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

The synthetic-PR gate was silently bypassed on real CI builds. prGate runs in the Setup job alongside the synthPr step that emits AW_SYNTHETIC_PR* outputs, but the gate's env: read them via the same-job runtime expression $[ variables['synthPr.AW_SYNTHETIC_PR'] ] — which ADO resolves to empty (step outputs aren't exposed to runtime expressions in the producing job). gate/bypass.ts therefore always took the "not a PR build — pass automatically" branch.

Changes in compile_gate_step_external (src/compile/filter_ir.rs):

  • Macro form for same-job synth refs — reference synthPr outputs via $(synthPr.X), which expands from the job's output-variable namespace (empty when the step was skipped/unmatched, never a stray literal):
    AW_SYNTHETIC_PR: "$(synthPr.AW_SYNTHETIC_PR)"
    ADO_PR_ID:        "$(System.PullRequest.PullRequestId)$(synthPr.AW_SYNTHETIC_PR_ID)"
    ADO_SOURCE_BRANCH:"$(System.PullRequest.SourceBranch)$(synthPr.AW_SYNTHETIC_PR_SOURCEBRANCH)"
    ADO_TARGET_BRANCH:"$(System.PullRequest.TargetBranch)$(synthPr.AW_SYNTHETIC_PR_TARGETBRANCH)"
  • Mutually-exclusive concatenation replaces coalesce(...) for the branch/id vars: synthPr only runs on non-PR builds and System.PullRequest.* is empty on non-PR builds, so exactly one side is ever non-empty. (Runtime expressions $[ ] must occupy the whole value and can't be concatenated, so the old coalesce form couldn't carry the macro.)
  • Cross-job exec-context wiring in the Agent job (dependencies.Setup.outputs['synthPr.X']) is correct and left unchanged.
  • Updated the doc comment and the regression guard test_pr_filter_synth_mode_gate_step_uses_same_job_synth_ref to assert the macro form and reject both the variables['synthPr.X'] and cross-job forms inside the Setup-job gate step.

Test plan

  • cargo test — full suite green; updated synth gate-step regression test
  • Manual: compiled pr-filter-tier1-agent.md and confirmed the Setup-job prGate env emits the macro form and the output YAML parses

Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix synthetic PR gate being silently bypassed fix(compile): use macro form for same-job synthPr gate refs Jun 10, 2026
Copilot AI requested a review from jamesadevine June 10, 2026 10:23
@jamesadevine jamesadevine marked this pull request as ready for review June 10, 2026 10:30
@jamesadevine jamesadevine merged commit 51ae40e into main Jun 10, 2026
33 of 35 checks passed
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.

Synthetic PR gate silently bypassed: same-job $[ variables['synthPr.AW_SYNTHETIC_PR'] ] resolves to empty

2 participants