refactor(compile): reduce complexity of build_conclusion_job in agentic_pipeline.rs - #2037
Draft
github-actions[bot] wants to merge 1 commit into
Draft
Conversation
…ic_pipeline.rs Extracted two helper functions from build_conclusion_job: - apply_conclusion_tool_config_env: applies a single per-tool (noop/ missing-tool/missing-data) config as flat AW_<TOOL>_* env vars - hoist_conclusion_job_results: hoists upstream job results (Agent/ Detection/SafeOutputs[/_Reviewed]/custom jobs) into job-level variables and wires them onto the Conclusion step No behavior change. Reduces the too_many_lines lint from 195/100 for build_conclusion_job. Full test suite (3229 tests) and clippy pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
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 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.
What was complex
build_conclusion_jobinsrc/compile/agentic_pipeline.rswas flagged by Clippy'stoo_many_lineslint at 195/100 lines. It mixed several distinct concerns in one function body: building the Conclusion job's steps, applying per-tool (noop/missing-tool/missing-data) config as flat env vars, and hoisting upstream job results (Agent/Detection/SafeOutputs[/_Reviewed]/custom jobs) into job-level variables + step env wiring.What changed
Extracted two well-named helper functions, keeping
build_conclusion_job's public signature and behavior unchanged:apply_conclusion_tool_config_env— applies a single per-tool config (noop/missing-tool/missing-data) onto the Conclusion step as flatAW_<TOOL>_*env vars, using early returns (let-else) instead of nestedif letchains.hoist_conclusion_job_results— hoists upstream job$[dependencies...]results into job-levelJobVariables and wires the corresponding$(name)macro env vars onto the Conclusion step, returning(Vec<JobVariable>, BashStep).build_conclusion_jobnow calls these helpers in a loop / single call instead of inlining ~150 lines of logic.Before / after
build_conclusion_jobflagged at 195/100 lines byclippy::too_many_lines.too_many_linesclippy report for this file at all.Verification
cargo test --bin ado-aw— all 3229 tests pass (1 ignored, unrelated to this change).cargo clippy --all-targets --all-features— clean except one pre-existing, unrelated warning increate_work_item.rs.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.