Skip to content

[rust-guard] Add tool_names constants for GPG/SSH key and workflow-toggle tools #14626

Description

@github-actions

🦀 Rust Guard Improvement Report

Improvement 1: Add tool_names constants for key-management and workflow-toggle tools

Category: Type Safety / Centralization
File(s): labels/constants.rs, tools.rs, labels/tool_rules.rs, labels/mod.rs
Effort: Small (< 15 min)
Risk: Low

Problem

Following the earlier codespace/gist/deploy-key work, these tool names are still raw literals duplicated across modules:

  • add_gpg_key, add_ssh_key, delete_gpg_key, delete_ssh_key: tools.rs:49,50,69,78,467-470,820-841, labels/tool_rules.rs:982,2614-2617
  • disable_workflow, enable_workflow, sync_fork: tools.rs:81,85,105, labels/tool_rules.rs:911,2702
  • create_agent_task: tools.rs:179,235,502-510, labels/tool_rules.rs:956, labels/mod.rs:6190

A typo in one site would silently drop a tool out of its label arm or blocklist.

Before

"add_gpg_key" | "add_ssh_key" | "delete_gpg_key" | "delete_ssh_key" => {

After

// constants.rs, in tool_names
pub const ADD_GPG_KEY: &str = "add_gpg_key";
// ... ADD_SSH_KEY, DELETE_GPG_KEY, DELETE_SSH_KEY, DISABLE_WORKFLOW, ENABLE_WORKFLOW, SYNC_FORK, CREATE_AGENT_TASK

tool_names::ADD_GPG_KEY | tool_names::ADD_SSH_KEY
    | tool_names::DELETE_GPG_KEY | tool_names::DELETE_SSH_KEY => {

Add matching assert_eq! checks in the constants test module.

Why This Matters

Consistent with the rest of the codebase; compile-time checked names and a single source of truth.


Codebase Health Summary

  • Total Rust files: 10
  • Total lines: ~22,000
  • Areas analyzed: dead code/allow attributes, production unwrap()s (none outside tests/locks), tool-name literals
  • Areas with no further improvements: no #[allow(dead_code)] found

Generated by Rust Guard Improver • Run: 37910666924

Generated by Rust Guard Improver · copilot · auto · 22.5 AIC · ⊞ 11.4K · ◷

  • expires on Oct 16, 2026, 9:22 AM UTC

Activity

  1. linked a pull request that will close this issueCentralize Rust guard tool-name constants #14641on Oct 9, 2026
  2. added a commit that references this issue on Oct 9, 2026
    e40f480
  3. added a commit that references this issue on Oct 10, 2026
    2993925
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions