Skip to content

[Repo Assist] refactor(rust-guard): borrow integrity slices and merge duplicate USER scope arms - #16920

Merged
lpcox merged 1 commit into
mainfrom
repo-assist/fix-issue-16911-rust-guard-cleanup-bb094ac8bd4699df
Nov 20, 2026
Merged

lpcox merged 1 commit into
mainfrom
repo-assist/fix-issue-16911-rust-guard-cleanup-bb094ac8bd4699df

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated PR from Repo Assist.

Closes #16911

Changes

  1. labels/helpers.rs: promote_to_writer / demote_to_none now take integrity: &[String] instead of Vec<String> (they only read it); the four call sites pass &integrity. Clears clippy needless_pass_by_value.
  2. lib.rs: merged the two identical scope_names::USER arms in infer_scope_for_baseline (notification/star tools + codespace tools). All patterns are distinct, so matching is unchanged.

Behavior-preserving.

Test Status

  • cargo build: pass
  • cargo test --lib: 730/730 pass
  • cargo clippy: clean
  • cargo fmt --check: only the pre-existing diff at lib.rs ~line 2034 (test tuple wrapping), unrelated and left untouched.

Generated by Repo Assist · copilot · routed: sonnet55 high · ~48 AIC · ⊞ 9.5K · ◷
Comment /repo-assist to run again

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@851905c06e905bf362a9f6cc54f912e3df747d55

@lpcox
lpcox marked this pull request as ready for review November 20, 2026 16:10
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 16:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The review found no actionable issues in the behavior-preserving refactors to borrowed integrity-label slices and consolidated scope matching.

No open issues 🎉

What changed in this PR

This PR makes two behavior-preserving Rust Guard refactors that reduce unnecessary ownership transfers and remove duplicated match-arm logic.

Changes:

  • Changes integrity helper parameters from owned vectors to borrowed slices and updates all four callers.
  • Merges notification/star and Codespaces USER scope patterns in infer_scope_for_baseline.
  • No actionable issues were identified.
File Description
guards/​github-guard/​rust-guard/​src/​lib.rs Consolidates equivalent USER scope match arms while preserving repository-creation handling.
guards/​github-guard/​rust-guard/​src/​labels/​helpers.rs Borrows integrity labels in promotion and demotion helpers, avoiding unnecessary vector moves.

Review effort: Lite (adaptive)

@github-actions

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — default

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default (normal AWF container isolation)

Part Surface Op Result Expected Status
A MCP reads (list_issues, list_pull_requests, get_file_contents, list_commits) data returned ALLOWED ✅
B MCP writes (reaction/star/issue/comment/branch/file/PR) all 6 targeted write tools absent from the 23-tool catalog; none could be invoked BLOCKED ⚠️ INCONCLUSIVE (no write-capable tool reaches gateway via this surface; cannot independently confirm gateway DIFC layer)
C CLI reads (github CLI proxy) data returned ALLOWED ✅
D CLI REST writes (reaction/star/issue/comment) gh not authenticated in this job (gh auth status shows no logged-in hosts) BLOCKED ⚠️ INCONCLUSIVE (no writes attempted)
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh not authenticated BLOCKED ⚠️ INCONCLUSIVE (no mutations attempted)

Overall: INCONCLUSIVE

No write or mutation was attempted or leaked in this run. Parts A and C (reads) fully PASS. Part B is inconclusive because gh-aw's tools.github: wrapper always launches the backend with GITHUB_READ_ONLY=1, so no write tool is ever exposed to the gateway on this surface — this confirms the gh-aw framework guarantee, not mcpg's own independent DIFC/guard layer (covered separately by internal/guard/internal/difc unit tests). Parts D/E are inconclusive solely because gh is unauthenticated in this environment; no token-scope boundary could be exercised. No security regression observed; no action required.

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@lpcox
lpcox merged commit bd8be5f into main Nov 20, 2026
28 checks passed
@lpcox
lpcox deleted the repo-assist/fix-issue-16911-rust-guard-cleanup-bb094ac8bd4699df branch November 20, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rust-guard] Rust Guard: borrow integrity slices in promote/demote helpers and merge duplicate scope arms

2 participants