rust-guard: dedupe PR/issue response-path setup and add gist/notification path-label tests - #8778
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Extract shared setup context for PR/issues arms and add list_gists tests
rust-guard: dedupe PR/issue response-path setup and add gist/notification path-label tests
Jul 6, 2026
lpcox
marked this pull request as ready for review
July 6, 2026 13:03
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the Rust guard’s path-labeling logic to remove duplicated PR/issue response setup and adds unit tests covering previously untested secrecy/integrity behaviors for gists and notifications. This reduces divergence risk in repo-scope/secrecy defaults while improving confidence in response-path labeling for additional GitHub API collection tools.
Changes:
- Introduced
RepoItemsContextandresolve_repo_item_context(...)to centralize shared PR/issue collection extraction, repo-scope fallback, default secrecy selection, and bounded iteration. - Updated PR and issue labeling arms to consume the shared context helper while preserving per-item labeling behavior.
- Added unit tests validating
list_gistssecrecy branching (public vs private) andlist_notificationssecrecy/integrity semantics.
Show a summary per file
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/labels/response_paths.rs | Deduplicates PR/issue response collection setup via a shared helper and adds gist/notification path-label unit tests. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Low
This was referenced Jul 6, 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.
label_response_pathshad duplicated PR/issue collection setup logic, creating a divergence risk for repo scope, secrecy defaults, and empty-search handling. It also lacked direct tests forlist_gistssecrecy branching andlist_notificationslabel semantics in the path-labeling codepath.Refactor: shared repo-item collection context
RepoItemsContext+resolve_repo_item_context(...)inresponse_paths.rs.items_pathdefault_repo/default_repo_privatelimit_items_with_log)Coverage: path-label tests for gists and notifications
response_paths.rsfor:private_user_label()Code shape / readability
tool_namevssearch_tool_namesemantics.