Skip to content

Centralize Rust guard issue_read skip logic and mutation constants - #14903

Merged
lpcox merged 3 commits into
mainfrom
copilot/rust-guard-dedupe-issue-read
Oct 15, 2026
Merged

lpcox merged 3 commits into
mainfrom
copilot/rust-guard-dedupe-issue-read

Conversation

Copilot AI commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Both response labelers duplicated the issue_read skip condition, including its get_comments exception. Granular mutation tools also repeated raw names across operation lists and labeling rules.

  • Shared skip rule: Extract skip_issue_read_per_item_labeling and introduce GET / GET_COMMENTS constants. Preserve per-item labeling for get, get_comments, and an empty method.
  • Mutation constants: Centralize granular issue mutation names and unlock_pull_request, then reuse them in operation lists and DIFC rules.
  • Regression coverage: Cover skip-rule edge cases and canonical constant values.

Both response labelers now use:

if skip_issue_read_per_item_labeling(tool_name, method) {
    // Use resource-level labels.
}

No labeling or tool-classification behavior change is intended.

Copilot AI changed the title [WIP] Refactor issue_read skip condition to eliminate duplication Centralize Rust guard issue_read skip logic and mutation constants Oct 14, 2026
Copilot AI requested a review from lpcox October 14, 2026 19:38
@lpcox
lpcox marked this pull request as ready for review October 14, 2026 21:51
Copilot AI max review requested due to automatic review settings October 14, 2026 21:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The refactor preserves behavior, has focused regression coverage, and leaves only non-blocking follow-up suggestions.

1 open finding
What changed in this PR

Centralizes duplicated logic and tool names in the Rust GitHub guard while preserving labeling and tool-classification behavior.

Changes:

  • Shares the issue_read skip predicate between both response labelers.
  • Reuses canonical method and mutation-tool constants.
  • Adds edge-case and constant-value regression tests.
File Description
guards/​github-guard/​rust-guard/​src/​tools.rs Reuses mutation constants in operation lists.
guards/​github-guard/​rust-guard/​src/​lib.rs Uses the method constant in a test fixture.
guards/​github-guard/​rust-guard/​src/​labels/​tool_rules.rs Reuses mutation constants in labeling rules.
guards/​github-guard/​rust-guard/​src/​labels/​response_paths.rs Uses the shared predicate and corrects its comment.
guards/​github-guard/​rust-guard/​src/​labels/​response_items.rs Uses the shared predicate and corrects its comment.
guards/​github-guard/​rust-guard/​src/​labels/​mod.rs Uses the method constant in a labeling test.
guards/​github-guard/​rust-guard/​src/​labels/​helpers.rs Adds the shared predicate and edge-case tests.
guards/​github-guard/​rust-guard/​src/​labels/​constants.rs Defines constants and checks canonical values.

🧠 Review effort: Max


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

| "update_issue_state"
| "update_issue_title"
| "update_issue_type"
| tool_names::CLOSE_ISSUE
@lpcox

lpcox commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Copilot AI commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Updated the consistency parser to resolve tool_names references from labels/constants.rs, including multiline constant values, while retaining literal handling. Added regression coverage; commit 84dfc10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rust-guard] Rust Guard: dedupe issue_read sub-method skip condition

3 participants