Repository navigation
refactor(compile): reduce complexity of build_canonical_jobs in agentic_pipeline.rs - #2311
Draft
github-actions[bot] wants to merge 1 commit into
Draft
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
…ic_pipeline.rs Extracts the Stage 3 safe-output job-shape logic (auto/reviewed tool partitioning, variant selection, and job pushing) from build_canonical_jobs into a new push_safeoutputs_jobs helper returning a small SafeOutputsShape struct. This drops build_canonical_jobs from 116 lines (clippy::too_many_lines, threshold 100) below the flagged threshold with no behavior change — every branch, filter, and ordering is preserved verbatim. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
There was a problem hiding this comment.
Threat detection produced a warning for this pull request output.
These changes need to be scrutinized before merge and only merged after a careful manual review.
- Detection reason:
parse_error - Review workflow run logs: https://github.com/githubnext/ado-aw/actions/runs/37752996165
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.
What happened
The threat detection results could not be parsed.
Review the workflow run logs for details.
What
Refactors
build_canonical_jobsinsrc/compile/agentic_pipeline.rs, which Clippy flagged withclippy::too_many_linesat 116 lines (threshold 100) — the largest untouched, non-duplicated candidate in the codebase (see Context below).Why
The function mixed three distinct concerns in one body: assembling the canonical job list (Setup/Agent/Detection/ManualReview/custom jobs), deciding how Stage 3 safe-output execution splits across automatic vs. manual-review-gated variants (tool partitioning,
create-pull-request/GitHub-issue-tool bucketing, variant construction), and wiring dependencies/the Conclusion job based on that split. The middle concern — safe-output job shape — was ~45 lines of local state threaded through two downstream call sites, making it hard to read or extend independently of the job-assembly orchestration.Changes
Extracted the safe-output job-shape logic into a new helper:
push_safeoutputs_jobs(jobs, front_matter, cfg, p)— partitions configured safe-output tools into automatic/reviewed buckets (excluding custom tools), decides whethercreate-pull-requestand GitHub-issue tools run in the automatic or reviewed variant, and pushes either a singleSafeOutputsjob or a splitSafeOutputs+SafeOutputs_Reviewedpair. Returns a newSafeOutputsShape { has_reviewed_job, waits_for_review }struct.build_canonical_jobsnow calls this helper once and reads the two booleans it needs (previously two separately-named locals:has_reviewed_safeoutputs_job,safeoutputs_waits_for_review) from the returned struct for the Conclusion-job and dependency-wiring calls that follow.Behaviour
No behavior change — this is a pure decomposition. Every filter, partition order, and variant-construction argument is preserved exactly.
Verification
cargo test --bin ado-aw— all 3406 tests pass (0 failed, 1 ignored), including the 79compile::agentic_pipeline::tests::*tests covering job graph shape, dependency wiring, and custom-job classification, unmodified.cargo clippy --all-targets --all-features— clean, no warnings.clippy::too_many_linesre-check:build_canonical_jobsno longer appears in the violations list forsrc/compile/agentic_pipeline.rs(previously 116/100).Before/after
build_canonical_jobspush_safeoutputs_jobs)Context
Checked for existing/duplicate work first: PRs #2272 (
build_agent_job), #2267 (build_safeoutputs_job), and #2243 (check_pipeline) are already open targeting other large functions in this codebase, so this PR picks a different, untouched function. Several closed PRs (#1946, #1895, #1886, #1938) previously targetedcreate_pull_request.rs::execute_impl(the single largest candidate at 599 lines) but were closed as "stale ... conflicts with the current architecture and was unsafe to transplant" per a maintainer comment — that function was deliberately skipped here.Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
spsprodeus21.vssps.visualstudio.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.