Skip to content

Handle reserved keywords #84

Closed
Closed

Description

@jenstopp

Like when the dutcl prompt is <devname> <cmdname> help make sure there are no conflicts with namings configured in the dutagent configuration. This information must also be named in the module interface documentation, as a module could not expect any of these keywords as their first argument.

In the future there can also be more keywords like help applying to commands and keywords applying to devices like e.g. <devname> description, so make them maintained in a single place inside the codebase.

Activity

  1. self-assigned this
    on Oct 23, 2025
  2. added
    code health
    on Dec 5, 2025
  3. RiSKeD commented on May 13, 2026

    @RiSKeD
    Contributor

    Reserved-keyword registry

    Problem

    help in <device> <command> help is a reserved word with no enforcement: a dutagent config can today name a command help and shadow it. Planned future keywords ( description, etc.) make this worse — drift between dispatch, server validation, and module docs is inevitable.

    Plan

    Hybrid registry. Two layers, no import cycle.

    pkg/dut/reserved.go — passive list of names, dependency-free:

    var CommandKeywords = []CommandKeyword{{Name: "help", Description: "..."}}
    var DeviceKeywords  = []DeviceKeyword{}
    var ErrReservedName = errors.New("name is reserved")
    

    cmds/dutctl - dispatch table keyed by the same names, with an init() check that every reserved name has a handler. Replaces the hard-coded cmdArgs[0] == "help".

    cmds/dutagent/config.go - reject configs whose device or command names collide with the reserved lists. Surfaces dut.ErrReservedName at startup.

    pkg/module/module.go - doc note: modules must not expect a reserved keyword as their first argument.

    Adding a future keyword

    • Append to pkg/dut/reserved.go.
    • Add handler in dutctl.
    • init() guarantees you didn't forget step 2; dutagent validation and module docs cover themselves.
  4. added
    area: core
    needs design
    on Jul 6, 2026
  5. added theissue type on Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: corecode healthneeds design

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions