refactor(command-registry): name registry descriptor tests for the module they test

Merged
TH
8h ago
+13-9

What

Colocation burn-down for @agent-device/command-registry: 22 tests in src/__tests__/ were named for neither a registry module nor an aspect of one. Every one asserts on commandDescriptors / applyCommandDefaults / resolveCommandDeviceClaimPolicy (all defined in registry.ts) or on flag-registry.ts, so they are renamed <module>-<aspect>.test.ts. No content changes except where noted.

  • Commit 1: 22 pure git mv renames (similarity 100% for 21; platform-execution is paired as R063 after commit 2).
  • Commit 2: platform-execution.test.ts covered two modules (registry.ts and derive.ts), so it is split: registry-platform-execution.test.ts (inventory-use test) and derive-platform-execution.test.ts (daemon-projection test). Bodies are verbatim.
  • One comment path in registry.ts updated to the new registry-device-claim-policy.test.ts name.

Colocation delta

PackageTests not beside a named module, beforeAfter
command-registry220

Measured with a local scan: a test is colocated when <name> equals, or starts with <module>- / <module>. of, a non-test source file in the same directory or in the parent of __tests__. The shrink-only baseline is not on main yet, so there are no entries to delete; this just shrinks what the seed will contain.

Class to flag for the coordinator: 17 of the 22 are one-test-per-command *-runtime-execution files, each pinning one descriptor in registry.ts (registry-<command>-runtime-execution). They are registry-completeness checks, not cross-module integration tests, so I named them for the module under test. If you would rather have them folded into one registry-runtime-execution.test.ts, that is a content merge and I left it out of this pure-rename PR.

Parity

Test counts from vitest run <files> --reporter=json:

filestests passed
before (old names on origin/main)2233 / 33
after (new names)23 (22 renamed + registry-platform-execution half of the split)33 / 33 (32 + 1)

Selection: vitest.config.ts unit-core includes packages/*/src/**/*.test.ts; check:affected --run selected and ran all of the renamed files under |unit-core| (605 files, 4432 tests, all passed). No vi.mock in any moved file, so there is nothing to break-check.

Surface

  • exports count: command-registry 21 -> 21. No new subpaths, barrels or export *. No new dependencies.

Gates

pnpm check:quick, check:layering, check:fallow, check:gate-manifest, pnpm format (repo-wide, clean), check:affected --run: all passed on head.

Self-review: no subagent run; I reread the full diff cold. It is renames, one verbatim split, and one comment path.

🤖 Generated with Claude Code