refactor(compile): split agentic-pipeline shape out of standalone_ir.rs and lift Agent-job conditions into Declarations#995
Conversation
…tic_pipeline.rs Move every per-job builder, condition builder, variable hoist, dependency wiring, helper step builder, StandaloneCtx, JobPrefix, BuiltPipelineContext, build_pipeline_context, and build_canonical_jobs out of standalone_ir.rs (2,385 lines) into a new src/compile/agentic_pipeline.rs. standalone_ir.rs shrinks back to its one-screen wrapper, parallel to the existing job_ir.rs / stage_ir.rs / onees_ir.rs target wrappers. Imports in those wrappers retargeted at super::agentic_pipeline::build_pipeline_context. Doc-comment references in extensions/ado_script.rs and extensions/exec_context/ updated to the new module path. Pure file move — zero behaviour change. All 1832 tests pass, no .yml fixture drift, clippy clean. Part of the work for issue #987. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ations Add `agent_conditions: Vec<Condition>` to `Declarations`. The canonical-jobs builder folds every extension's contribution into a single `Condition::And([Succeeded, ...])` via the new `fold_agent_conditions` helper inside `agentic_pipeline::build_agent_job`; an empty contribution set leaves the Agent job unconditional (matching pre-lift behaviour). Move every clause previously built by `build_agentic_condition` into `AdoScriptExtension::build_agent_conditions()` — which already owns `pr_filters`, `pipeline_filters`, and the synth-PR trigger: - synth-PR-skip (Ne synthPr.AW_SYNTHETIC_PR_SKIP, 'true') - PR-filter gate (Or with synth carve-out when synthetic_pr_active) - pipeline-filter gate (Or Build.Reason != ResourceTrigger, ...) - User `expression:` escape hatches (Condition::Custom) `build_agentic_condition` is deleted. `agentic_pipeline` no longer hard-codes knowledge of `synthPr` / `prGate` / `pipelineGate` step IDs or signals; future cross-extension Agent-job gating signals plug in declaratively via `Declarations::agent_conditions`. New unit tests in `extensions/ado_script.rs` pin the contribution shape per trigger configuration; new `fold_agent_conditions` tests in `agentic_pipeline` pin the leading-Succeeded fold contract. Closes the second half of issue #987 (the first half — file move from standalone_ir.rs to agentic_pipeline.rs — landed in the previous commit). Zero `.yml` fixture drift, 1841 tests pass (was 1832 + 9 new), clippy clean. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔍 Rust PR ReviewSummary: Looks good — clean, well-tested refactor with zero behaviour change. Two minor observations worth a quick cleanup pass before merge. Findings
|
|
@copilot address feedback and suggestions |
Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com>
Addressed in 3e7bdce.
Validation run: targeted |
Summary
This PR delivers two related refactors in the compile pipeline path:
Extract canonical agentic pipeline shape into
src/compile/agentic_pipeline.rsstandalone_ir.rs.standalone_ir.rsas a thin wrapper, aligned withjob_ir.rs/stage_ir.rs/onees_ir.rs.Lift Agent-job condition construction into extension declarations
agent_conditions: Vec<Condition>toDeclarations.AdoScriptExtension::build_agent_conditions().build_agentic_conditionand introducesfold_agent_conditionsto fold extension-contributed clauses with leadingCondition::Succeeded.Follow-up review feedback is also addressed in
src/compile/agentic_pipeline.rs:#[allow(unused_imports)]block/comment.wire_explicit_dependenciesto resolve Teardown throughprefix.id("Teardown")?for consistent typed ID handling.No intended behavior change from the review-follow-up cleanup; fixture outputs remain unchanged.
Test plan
cargo buildcargo testcargo clippy --all-targets -- -D warningscargo test agentic_pipelinecargo test fold_agent_conditionscargo test --test bash_lint_testssrc/compile/agentic_pipeline.rs(no findings)