refactor: reduce complexity of build_conclusion_job in agentic_pipeline.rs#1646
Draft
github-actions[bot] wants to merge 1 commit into
Draft
Conversation
…ne.rs Extract apply_tool_config_envs and apply_conclusion_tool_config helpers to flatten the 5-6 level deep per-tool config loop inside build_conclusion_job. Before: a single 65-line loop body with nested if/if-let/if-let/if-let/if-let chains for each of noop/missing-tool/missing-data. After: the loop body is a 3-line call to apply_conclusion_tool_config, which delegates to apply_tool_config_envs for the object-form config. The string- field fan-out is further condensed into a data-driven slice iteration so new config keys only require one entry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.rscontained a 65-line loop body that applied per-tool conclusion env vars fornoop,missing-tool, andmissing-data. The body had 5–6 levels of nesting:The string-field fan-out (
title-prefix,work-item-type,area-path,iteration-path) was repeated verbatim five times.What changed
Two private helpers extracted:
apply_tool_config_envs(step, env_prefix, obj) -> BashStepHandles the object-form config for one tool. String fields are driven by a data-table slice so adding a new config key requires one entry, not a new
if letblock.apply_conclusion_tool_config(step, tool_key, tool_config) -> BashStepHandles the bool/object dispatch for one tool: derives
env_prefix, handles thefalse-bool early-return, then delegates toapply_tool_config_envs.The per-tool loop in
build_conclusion_jobbecomes:Verification
cargo test)cargo clippy --all-targets --all-features)Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
spsprodeus21.vssps.visualstudio.comSee Network Configuration for more information.