Skip to content

Deduplicate the maintenance_* and ps_* command families #386

Description

@justin808

Summary

Two command families duplicate their structure file-by-file, so any interface or behavior change must be repeated in every sibling:

Proposed fix

  • Introduce a shared intermediate base per family (e.g. MaintenanceCommand < Base providing memoized maintenance_mode + shared OPTIONS; a workload-iteration/wait helper for the ps_* family), keeping each command file as a thin declaration.
  • Constraint to verify first: command discovery works by regex-scanning source files for class X < ...Base (Command::Base.all_commands) — intermediate base classes must still be picked up (the pattern intends to match subclasses of any *Base; add a spec proving discovery still finds all commands, and that the new intermediate classes are NOT registered as commands).
  • One PR per family.

Acceptance criteria

  • Wait/poll logic exists once for the ps_* family; maintenance scaffolding exists once
  • cpflow --help output and commands.md (rake check_command_docs) unchanged
  • Spec asserting command discovery still registers every command and no intermediate bases
  • Behavior-preserving: fast suite green

Priority / size / dependencies

P3. Size: M. Soft-blocked by #384 (sequence after the Command::Base extraction to avoid repeated churn in the same files; can proceed independently if #384 stalls).


Origin: automated codebase health review, 2026-07-02, against 7c96df9.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priority / cleanupenhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions