fix(compile): repair synthetic-PR gate + Stage step env var plumbing#956
fix(compile): repair synthetic-PR gate + Stage step env var plumbing#956jamesadevine wants to merge 1 commit into
Conversation
Two interlocking ADO behaviours were silently collapsing the synthetic-PR
path on CI-triggered builds:
1. **Same-job gate step (Setup/prGate)**: env values used macro
concatenation `$(System.PullRequest.PullRequestId)$(synthPr.AW_SYNTHETIC_PR_ID)`.
On non-PR builds ADO leaves undefined predefined macros as the
literal string `"$(System.PullRequest.PullRequestId)"`, so the
concatenated value parsed as NaN in gate.js's pr_metadata fact —
the check failed with "Missing ADO env vars …", pr_is_draft was
skipped, and SHOULD_RUN defaulted to true (gate bypassed real
evaluation). Switched to runtime expressions
`$[ coalesce(variables['System.PullRequest.X'], variables['AW_SYNTHETIC_PR_X']) ]`,
which silently substitute empty for undefined vars. To make the
right-hand side readable as a regular variable, exec-context-pr-synth
now emits each AW_SYNTHETIC_PR* via both setOutput (cross-job)
AND setVar (same-job, new helper in shared/vso-logger).
2. **Cross-job Stage step (Agent/"Stage PR execution context")**: env
values referenced `$[ coalesce(dependencies.Setup.outputs['synthPr.X'], '') ]`
at step-env scope. Empirically (msazuresphere/4x4 build #612290) this
form resolves to the empty string even when the same expression works
at job-condition scope, causing the bash guard to short-circuit on
a synth-promoted build and the agent to emit noop. Switched to the
documented safe pattern: hoist via a new `{{ agent_job_variables }}`
marker (Agent-job-level `variables:` block) that pulls
`dependencies.Setup.outputs[...]` at JOB scope, then consume from
step-env via the `$(name)` macro / `variables['name']` runtime
expression. Job-level variables are the documented safe location
for cross-job output references.
Validates against build #612290 (synthetic PR matched #38551 but agent
emitted noop). All 281 bundle tests + 1815+ Rust tests + clippy pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔍 Rust PR ReviewSummary: Looks good — the fix correctly addresses the two ADO behavioral constraints. Design is sound and well-documented. Findings
|
fix(compile): repair synthetic-PR gate + Stage step env var plumbing
Two interlocking ADO behaviours were silently collapsing the synthetic-PR
path on CI-triggered builds:
Same-job gate step (Setup/prGate): env values used macro
concatenation
$(System.PullRequest.PullRequestId)$(synthPr.AW_SYNTHETIC_PR_ID).On non-PR builds ADO leaves undefined predefined macros as the
literal string
"$(System.PullRequest.PullRequestId)", so theconcatenated value parsed as NaN in gate.js's pr_metadata fact —
the check failed with "Missing ADO env vars …", pr_is_draft was
skipped, and SHOULD_RUN defaulted to true (gate bypassed real
evaluation). Switched to runtime expressions
$[ coalesce(variables['System.PullRequest.X'], variables['AW_SYNTHETIC_PR_X']) ],which silently substitute empty for undefined vars. To make the
right-hand side readable as a regular variable, exec-context-pr-synth
now emits each AW_SYNTHETIC_PR* via both setOutput (cross-job)
AND setVar (same-job, new helper in shared/vso-logger).
Cross-job Stage step (Agent/"Stage PR execution context"): env
values referenced
$[ coalesce(dependencies.Setup.outputs['synthPr.X'], '') ]at step-env scope. Empirically (msazuresphere/4x4 build #612290) this
form resolves to the empty string even when the same expression works
at job-condition scope, causing the bash guard to short-circuit on
a synth-promoted build and the agent to emit noop. Switched to the
documented safe pattern: hoist via a new
{{ agent_job_variables }}marker (Agent-job-level
variables:block) that pullsdependencies.Setup.outputs[...]at JOB scope, then consume fromstep-env via the
$(name)macro /variables['name']runtimeexpression. Job-level variables are the documented safe location
for cross-job output references.
Validates against build #612290 (synthetic PR matched #38551 but agent
emitted noop). All 281 bundle tests + 1815+ Rust tests + clippy pass.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com