Repository navigation
Centralize Rust guard issue_read skip logic and mutation constants - #14903
Merged
Merged
Conversation
Co-authored-by: lpcox <[email protected]>
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
lpcox
marked this pull request as ready for review
October 14, 2026 21:51
Contributor
There was a problem hiding this comment.
🟢 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_readskip 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 |
Collaborator
|
@copilot address review feedback |
Co-authored-by: lpcox <[email protected]>
Contributor
Author
Updated the consistency parser to resolve |
This was referenced Oct 15, 2026
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.

Both response labelers duplicated the
issue_readskip condition, including itsget_commentsexception. Granular mutation tools also repeated raw names across operation lists and labeling rules.skip_issue_read_per_item_labelingand introduceGET/GET_COMMENTSconstants. Preserve per-item labeling forget,get_comments, and an empty method.unlock_pull_request, then reuse them in operation lists and DIFC rules.Both response labelers now use:
No labeling or tool-classification behavior change is intended.