feat: build daemon command registry from descriptors, delete the hand table — Phase 1 step 2

Merged
TH
5mo ago
+38-173

What

Phase 1 step 2 of the command-descriptor migration (ADR-0008), stacked on #906 (feat/command-descriptor-registry).

The daemon command registry now builds from the derived descriptors instead of a hand-authored literal:

  • src/daemon/daemon-command-registry.ts — replaced the DAEMON_COMMAND_DESCRIPTORS array literal (plus its private descriptor/descriptors builders and the isRecordingStartRequest/isShardedTestRequest closures, now living in descriptor/registry.ts) with:
    export const DAEMON_COMMAND_DESCRIPTORS: readonly DaemonCommandDescriptor[] =
      deriveDaemonCommandDescriptors(commandDescriptors);
    
    The hand literal is deleted. The DaemonCommandDescriptor type, the predicate accessors, and buildDaemonCommandRegistry are unchanged and consume DAEMON_COMMAND_DESCRIPTORS as before.
  • src/commands/descriptor/__tests__/parity.test.ts — the slice-1 DAEMON parity assertion would now be a tautology (derived-vs-derived), so it was replaced with an invariant assertion: no duplicate command names, every descriptor has a route, and the derived command set still covers every public command (minus the two intentionally unrouted app-switcher/install-from-source). The capability-matrix and batch-name parity tests are kept as-is (those hand tables still exist for later slices).

Behaviorless

The daemon registry's routes + request-policy traits are identical — #906's parity test proved deriveDaemonCommandDescriptors(commandDescriptors) is byte-equal to the deleted literal. No predicate accessor or consumer changed.

Cycle check

No runtime import cycle: daemon-command-registry.ts (value) → descriptor/derive.ts + descriptor/registry.ts (values); the back-edges from derive.ts and descriptor/types.ts to this module's DaemonCommandDescriptor are type-only imports, erased at runtime. tsc --noEmit is clean (exit 0) and a runtime import() of the module loads cleanly (57 descriptors).

Verification

  • tsc -p tsconfig.json --noEmit: exit 0
  • oxfmt --write + oxlint --deny-warnings on changed files: exit 0
  • vitest run daemon: 94 files, 902 tests passed
  • vitest run commands/descriptor: 1 file, 5 tests passed

Stacked on #906 — merge that first.