Skip to content

Derive the assistant verb allowlists from the clap command tree #188

Description

@rominf

Problem

There are four hand-maintained lists of rocm verbs that must each be updated whenever a verb is added:

  • STRUCTURED in treat_as_natural_language (apps/rocm/src/main.rs)
  • chat_rocm_command_action_from_args (apps/rocm/src/main.rs)
  • ensure_rocm_command_is_read_only (apps/rocmd/src/lib.rs)
  • the guard test for treat_as_natural_language, which is itself a hardcoded array

Adding rocm storage in #172 missed two of the four, and the guard test could not catch it because the test enumerates the same list by hand. The lists are fail-closed, so a miss is not a security hole — it shows up as a working read-only command being rejected as unsupported.

Suggested direction

Iterate Cli::command().get_subcommands() plus get_visible_aliases() and assert coverage in a test, so a newly added verb fails CI until it is classified in each list. That makes the whole class visible rather than relying on the author remembering four places.

Context

Out of scope for #172, which fixes the immediate storage omissions in all the lists but does not restructure them. Raised from review feedback on that PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions