refactor(safe-outputs): reduce complexity of execute_impl in create_github_issue.rs - #2181
Closed
github-actions[bot] wants to merge 1 commit into
Closed
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
…ithub_issue.rs Extract label validation, title-prefix/length enforcement, and API response handling into dedicated helper functions: - validate_agent_labels(): allowed-labels allowlist check - build_final_title(): applies title-prefix and enforces MAX_FINAL_TITLE_LEN - CreateGithubIssueResult::handle_issue_response(): interprets the GitHub API response and registers temporary_id on success No behavioural changes; all 46 module tests and the full 3360-test suite pass, and clippy is clean. The clippy::too_many_lines warning (168/100) on execute_impl no longer fires. 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. |
Collaborator
|
Closed as partially superseded by aggregate PR #2189, which retains the isolated create_github_issue complexity refactor. Unrelated or overlapping cumulative changes were intentionally omitted. |
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
CreateGithubIssueResult::execute_implinsrc/safe_outputs/create_github_issue.rswas flagged by Clippy'stoo_many_lineslint at 168/100 lines. This PR extracts three logically distinct blocks into dedicated helper functions, with no behavioural change:validate_agent_labels(labels, config) -> Result<(), String>— the allowed-labels allowlist check (default-deny semantics, wildcard support, disallowed-label error formatting).build_final_title(title, config) -> Result<String, String>— appliestitle-prefixand enforcesMAX_FINAL_TITLE_LEN.CreateGithubIssueResult::handle_issue_response(ctx, target_repo, response) -> anyhow::Result<ExecutionResult>— interprets the GitHub API response (success/failure, issue number/URL extraction, temporary_id registration).execute_implitself is now a straight-line sequence of guard checks followed by delegation to these helpers, which are independently readable and (in principle) independently testable.Before / after
clippy::too_many_lineswarning, 168/100 lines, onexecute_impl.too_many_lines(or any other) Clippy warning for this file.Verification
cargo check --all-targets— clean.cargo clippy --all-targets --all-features— clean, no warnings anywhere in the crate.cargo test --bin ado-aw— full suite: 3360 passed, 0 failed, 1 ignored.cargo test --bin ado-aw create_github_issue— all 46 module tests pass unchanged.rustfmtapplied to the touched file only; no unrelated formatting changes.No public API signatures changed; no observable behaviour changed.
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.