{{ message }}
refactor(rust-guard): replace reaction_kind: &str with ReactionKind enum; collapse issue_dependency_read double guard#8279
Merged
Conversation
…um; collapse issue_dependency_read double guard - Add ReactionKind enum with as_str() and warning_emitted() methods - Update has_maintainer_reaction_with_callback to accept ReactionKind - Replace dead-arm string match with reaction_kind.warning_emitted() dispatch - Update has_maintainer_endorsement/disapproval callers to use enum variants - Update all 18 test call sites from string literals to enum variants - Collapse double guard + double extraction in issue_dependency_read arm Closes #8276
Copilot
AI
changed the title
[WIP] Replace
refactor(rust-guard): replace Jun 29, 2026
reaction_kind: &str with ReactionKind enumreaction_kind: &str with ReactionKind enum; collapse issue_dependency_read double guard
1 task
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the Rust GitHub Guard’s labeling/helpers code by (1) making maintainer-reaction evaluation type-safe via a ReactionKind enum and (2) simplifying issue_dependency_read labeling logic to remove redundant guards and duplicate extraction.
Changes:
- Introduce
ReactionKindenum and refactorhas_maintainer_reaction_with_callbackto use it instead of&str. - Update endorsement/disapproval call sites (including tests) to pass
ReactionKindvariants. - Collapse the double guard in
issue_dependency_readand reuse a single extracted issue number for bothdescand author integrity enrichment.
Show a summary per file
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Low
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This was referenced Jun 30, 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.

Two type-safety and duplication improvements to the Rust Guard.
ReactionKindenum (helpers.rs)has_maintainer_reaction_with_callbackpreviously acceptedreaction_kind: &strconstrained only by a comment, leaving a dead_ => falsearm that would silently swallow any typo at a future call site.Before:
After:
All 18 call sites updated (
has_maintainer_endorsement,has_maintainer_disapproval, and 16 test sites).Collapse double guard in
issue_dependency_read(tool_rules.rs)The arm checked
!owner.is_empty() && !repo.is_empty()and calledextract_number_as_stringtwice. The second block is now nested inside the first, removing the redundant guard and allocation.