rust-guard: collapse duplicated repo-write match arms and add pre-emptive tool coverage#6587
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Merge 12 identical repo-scoped write match arms in apply_tool_labels
rust-guard: collapse duplicated repo-write match arms and add pre-emptive tool coverage
May 27, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the rust-guard tool labeling rules by consolidating many repo-scoped write tool match arms that shared identical secrecy/integrity behavior, and adds targeted tests for two pre-emptive write tool groups to ensure they get writer integrity and repo-visibility-derived secrecy handling.
Changes:
- Collapsed multiple duplicated repo-scoped write match arms in
apply_tool_labelsinto a single consolidated arm while preserving category grouping via inline comments. - Added unit tests covering repo-scoped write labeling for issue comment edit/delete and release management tools.
Show a summary per file
| File | Description |
|---|---|
guards/github-guard/rust-guard/src/labels/tool_rules.rs |
Consolidates repo-scoped write tool labeling into one match arm and adds explicit unit tests for issue comment edit/delete and release management tool labeling. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
Co-authored-by: Copilot Autofix powered by AI <175728472+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.
apply_tool_labelshad 12 consecutive repo-scoped write arms with identicalS(repo) + writerbehavior, creating avoidable duplication and making future additions error-prone. This PR consolidates those arms and adds explicit coverage for two pre-emptive write tool groups that previously had no direct tests.Match-arm consolidation (repo-scoped writes)
Pre-emptive write tool test coverage
apply_tool_labels_issue_comment_edit_delete_is_repo_scoped_writefor:update_issue_comment,delete_issue_commentapply_tool_labels_release_management_is_repo_scoped_writefor:create_release,edit_release,delete_releaseBehavior shape after refactor (unchanged semantics)