Skip to content

[Repo Assist] refactor(rust-guard): remove needless_borrow clippy warnings - #16670

Merged
lpcox merged 1 commit into
mainfrom
repo-assist/eng-rust-guard-clippy-needless-borrow-20261116-645e738108b539c6
Nov 18, 2026
Merged

lpcox merged 1 commit into
mainfrom
repo-assist/eng-rust-guard-clippy-needless-borrow-20261116-645e738108b539c6

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated PR from Repo Assist.

Implements the suggestion in #16661.

Changes

  • Drop redundant & on &str bindings (owner/repo/issue) in tool_rules.rs, backend.rs, response_paths.rs (generated with cargo clippy --fix, reviewed).
  • Use struct-update syntax for PolicyContext in the labels/mod.rs test (fixes field_reassign_with_default).

No behaviour change; purely mechanical.

Test Status

  • cargo clippy --all-targets: 91 warnings → 0
  • cargo test --lib: 724 passed
  • rustfmt --check on src/labels/*.rs: no diffs
  • Not run: wasm32-wasip1 release build (target is not installed here); change only removes borrows.

Closes #16661

Warning

Firewall blocked 4 domains

The following domains were blocked by the firewall during workflow execution:

  • example.com
  • nonexistent.local
  • slow.example.com
  • thishostdoesnotexist12345.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "example.com"
    - "nonexistent.local"
    - "slow.example.com"
    - "thishostdoesnotexist12345.com"

See Network Configuration for more information.

Generated by Repo Assist · copilot · routed: sonnet55 high · ~71 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 18, 2026 15:31
Copilot AI adaptive review requested due to automatic review settings November 18, 2026 15:31

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 identifies only mechanical borrow and test-fixture cleanups, with the reported Clippy warnings addressed and no active issues noted.

No open issues 🎉

What changed in this PR

This pull request performs a mechanical Rust cleanup in the GitHub guard label-processing code by removing redundant borrows and simplifying a test fixture without changing behavior.

Changes:

  • Removes unnecessary borrows in tool, backend, and response-path labeling code.
  • Uses struct-update syntax for the PolicyContext test fixture.
  • Eliminates the reported Clippy warnings.
File Description
guards/​github-guard/​rust-guard/​src/​labels/​tool_rules.rs Removes redundant borrows across tool-specific label rules.
guards/​github-guard/​rust-guard/​src/​labels/​response_paths.rs Removes an unnecessary borrow when generating project-item integrity labels.
guards/​github-guard/​rust-guard/​src/​labels/​mod.rs Uses struct-update syntax for the PolicyContext test fixture.
guards/​github-guard/​rust-guard/​src/​labels/​backend.rs Removes an unnecessary borrow when extracting issue author association.

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 AWF (normal 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 (add_issue_comment/star_repository/issue_write/create_branch/create_or_update_file/create_pull_request) all 6 absent from the 23-tool read-only catalog — never reachable to test gateway-level refusal BLOCKED ⚠️
C CLI reads (github list_issues via CLI proxy) data returned ALLOWED ✅
D CLI REST writes (reaction/star/issue/comment) gh CLI unauthenticated (You are not logged into any GitHub hosts) — not attempted BLOCKED ⚠️
E CLI GraphQL mutations (addReaction/addStar/createIssue) same auth gap as D — not attempted BLOCKED ⚠️

Overall: INCONCLUSIVE

No write, reaction, star, issue, comment, branch, file, or PR leaked in this run. Parts A and C fully confirm read-only access works end-to-end on both surfaces. Part B could not exercise mcpg's own gateway-level write-blocking because gh-aw's tools.github: wrapper always sets GITHUB_READ_ONLY=1, so no write tool was ever present in the backend catalog to attempt — this proves backend/framework config, not independently the gateway's DIFC/guard layer. Parts D/E could not run because gh was unauthenticated in this environment, so the token-scope write-rejection boundary was not exercised this run.

References:

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

@lpcox
lpcox merged commit e4e2e0c into main Nov 18, 2026
28 checks passed
@lpcox
lpcox deleted the repo-assist/eng-rust-guard-clippy-needless-borrow-20261116-645e738108b539c6 branch November 18, 2026 15:58
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] Remove 90 needless_borrow clippy warnings in Rust guard labels code

2 participants