Repository navigation
Rust guard: share PR integrity labels and simplify visibility decoding - #17173
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write leaked in any part. Part B is INCONCLUSIVE because gh-aw sets GITHUB_READ_ONLY=1 for tools.github blocks, so the backend never registers write tools (add_issue_comment, star_repository, issue_write, create_branch, create_or_update_file, create_pull_request all absent from the 23-tool catalog) - this proves backend config, not mcpg's own DIFC/guard layer. Parts D/E are INCONCLUSIVE because gh is unauthenticated in this environment (gh auth status reports not logged in; a live POST attempt returned an auth error, not a permission/gateway error), so the token-scope write boundary could not be exercised. No destructive actions, retries, or cleanup were attempted.
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the allocation-sharing and visibility-decoding changes.
No open issues 🎉
What changed in this PR
This PR reduces repeated allocations in Rust guard pull-request labeling and simplifies repository visibility decoding while preserving existing behavior.
Changes:
- Share integrity labels across PR status/content items and default labels.
- Replace decoding matches with
let...else, retaining warnings and cached fallbacks. - Add regression tests for allocation sharing, label values, item limits, and malformed-response handling.
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/labels/response_paths.rs | Reuses shared integrity labels and tests allocation sharing and labeling behavior. |
| guards/github-guard/rust-guard/src/labels/backend.rs | Simplifies decoding failure branches and tests cached visibility fallbacks. |
Review effort: Balanced (adaptive)
PR status labeling rebuilt identical integrity vectors per item; PR content labeling cloned them before wrapping each in an
Arc. Repository visibility decoding also used nested matches for early-return failures.impl Into<SharedLabels>inrepo_default_labels. Build integrity once per PR status/content response, clone the shared handle for items, and reuse it for defaults.let...else, preserving warning messages and cached fallbacks.