[Repo Assist] fix(rust-guard): set baseline_scope=GITHUB for search_users + add label tests - #9457
Merged
lpcox merged 1 commit intoJul 16, 2026
Conversation
search_users was missing baseline_scope = Cow::Borrowed(scope_names::GITHUB), unlike the parallel search_orgs arm. This meant the tool's project:github integrity label was resolved against the calling repo's scope (or an empty scope) via ensure_integrity_baseline — returning a conservative repo-scoped or none-floor label rather than the intended project:github integrity. Fix: add the same baseline_scope override that search_orgs, security advisory, and github_support_docs_search arms already use. Also adds three new tests: - test_apply_tool_labels_unstar_repository_public_secrecy_github_integrity - test_apply_tool_labels_search_users_public_secrecy_github_integrity - test_apply_tool_labels_search_users_with_repo_context These tests were suggested in issue #9446 and verify that both tools yield empty secrecy and project:github integrity regardless of calling repo context. Resolves part of #9446. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes GitHub-scoped integrity labeling for search_users and adds regression coverage.
Changes:
- Sets the
search_usersintegrity baseline scope to GitHub. - Adds tests for
search_userswith empty and repository contexts. - Adds coverage for
unstar_repositorylabels.
Show a summary per file
| File | Description |
|---|---|
guards/github-guard/rust-guard/src/labels/tool_rules.rs |
Corrects the search_users baseline scope. |
guards/github-guard/rust-guard/src/labels/mod.rs |
Adds label-semantics regression tests. |
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: 0
- Review effort level: Medium
lpcox
deleted the
repo-assist/fix-search-users-scope-and-add-tests-20260716-0149534b19e4dbc0
branch
July 16, 2026 14:13
This was referenced Jul 16, 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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Fixes a missing
baseline_scopeassignment in thesearch_usersarm ofapply_tool_labelsintool_rules.rs, and adds three new tests coveringsearch_usersandunstar_repositorylabel semantics.Partially addresses #9446.
Root Cause
The
search_usersarm setintegrity = project_github_label(ctx)but did not setbaseline_scope = Cow::Borrowed(scope_names::GITHUB). This is inconsistent with the parallel arms forsearch_orgs,list_global_security_advisories, andgithub_support_docs_search, which all set both.Without the
baseline_scopeoverride,ensure_integrity_baselinewas called with whateverrepo_idthe gateway passed in. For calls with a non-empty repo_id (e.g."github/copilot"),max_integrityresolved theproject:github-scoped labels against the repo scope — producing["none:github/copilot"]instead of the intended["none:github", "unapproved:github", "approved:github"]. For an emptyrepo_id, the result was["none"].Fix
One-line addition matching the
search_orgsarm:New Tests
Three new tests in
labels/mod.rs:test_apply_tool_labels_unstar_repository_public_secrecy_github_integrityunstar_repository→ empty secrecy +project:githubintegritytest_apply_tool_labels_search_users_public_secrecy_github_integritysearch_users(empty repo_id) → empty secrecy +project:githubintegritytest_apply_tool_labels_search_users_with_repo_contextsearch_users(with repo_id) → same labels regardless of calling contextTrade-offs
repo_id— the result was already["none"]matching the github-scope none floor.repo_id—search_usersresults now correctly carryproject:githubintegrity instead of a conservative repo-scoped none label.Test Status
✅ All 588 Rust unit tests pass (
cargo testinguards/github-guard/rust-guard/).proxy.golang.orgis firewalled in this environment. Only Rust files were modified; no Go changes were made.Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
awmgmcpgproxy.golang.orgSee Network Configuration for more information.
Add this agentic workflow to your repo
To install this agentic workflow, run