Skip to content

Centralize remaining Rust guard tool names - #14835

Merged
lpcox merged 3 commits into
mainfrom
copilot/rust-guard-add-tool-names-constants-again
Oct 13, 2026
Merged

lpcox merged 3 commits into
mainfrom
copilot/rust-guard-add-tool-names-constants-again

Conversation

Copilot AI commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Several tool names were still raw string literals in DIFC rules and tests, making typos easy to miss. Cache-test cleanup also used lock().unwrap(), which could cause cascading panics after mutex poisoning.

  • Tool-name constants: Added constants for the eight remaining names and used them in label rules, tests, and synthetic write classification.
    // Before
    "list_projects"
    
    // After
    tool_names::LIST_PROJECTS
  • Cache test cleanup: Added a helper that removes cached permissions only when the mutex lock succeeds.

Copilot AI changed the title [WIP] Add tool_names constants for remaining raw tool-name literals Centralize remaining Rust guard tool names Oct 13, 2026
Copilot AI requested a review from lpcox October 13, 2026 21:25
@lpcox
lpcox marked this pull request as ready for review October 13, 2026 22:04
Copilot AI balanced review requested due to automatic review settings October 13, 2026 22:04

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 changes consistently centralize literals without altering behavior and safely address cleanup lock poisoning.

0 open findings

What changed in this PR

Centralizes remaining Rust guard tool names and makes cache-test cleanup resilient to mutex poisoning.

Changes:

  • Added and adopted eight canonical tool-name constants.
  • Reused constants across DIFC rules and tests.
  • Added non-panicking cache cleanup for tests.
File Description
labels/​constants.rs Defines and verifies new constants.
labels/​tool_rules.rs Uses constants in rules and tests.
labels/​mod.rs Updates integration-style label tests.
labels/​backend.rs Adds safe cache cleanup helper.
tools.rs Uses the constant for synthetic writes.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@lpcox

lpcox commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

@copilot merge main and resolve conflicts

…d-tool-names-constants-again

# Conflicts:
#	guards/github-guard/rust-guard/src/labels/backend.rs

Co-authored-by: lpcox <[email protected]>

Copilot AI commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

@copilot merge main and resolve conflicts

Merged main and resolved the duplicate cache-helper conflict in 8785ebe, preserving the tool-name cleanup. make agent-finished passed and final review found no issues. golangci-lint was unavailable; CodeQL found no Go alerts but timed out before all languages completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rust-guard] Rust Guard: Add tool_names constants for remaining raw tool-name literals

3 participants