refactor(#596): drop dead projection metadata in state-command-router (#633)

cjsFallbackHandler was a no-op pass-through returning only its last
argument, and state-command-router was its sole consumer — every handler
wrapped a thunk in a 5-arg projection tuple whose first four args
(registryCommand, registryArgs, legacyArgs, rawFormatter) were
constructed and immediately discarded (rawFormatter null at 100% of
sites). The SDK-dispatch path the metadata was nominally for is a retired
shim.

- Collapse all 20 state handlers to plain () => state.cmd*(...) thunks,
  matching the post-#298 inline convention used by the verify/roadmap/
  phases routers (complete-phase already used this form).
- Remove the local fallback() helper and Handler type from
  state-command-router.cts.
- Drop cjsFallbackHandler from cjs-command-router-adapter.cts exports —
  no remaining consumers.

Behavior-preserving: each thunk body is unchanged. No test referenced
cjsFallbackHandler. Adapter test (8/8), state-routing tests (36/36), and
the full unit suite (3435 pass / 0 fail) stay green.

Source-only diff; gsd-core/bin/lib/*.cjs are built-at-publish per ADR-457.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
This commit is contained in:
Joe
2026-06-02 22:32:10 -05:00
committed by GitHub
parent 14e9aea47f
commit 3cf112b3de
2 changed files with 94 additions and 234 deletions

View File

@@ -135,19 +135,7 @@ function routeHubCommandFamily({
error((result as { message: string }).message);
}
/**
* Projection helper for family routers that still declare SDK registry metadata
* but execute the CJS fallback path at this seam.
*
* Accepts variable argument shapes so routers can pass legacy projection tuples
* (`registryCommand`, `registryArgs`, `legacyArgs`, optional `rawFormatter`, `cjsFallback`).
*/
function cjsFallbackHandler(...projectionArgs: unknown[]): unknown {
return projectionArgs[projectionArgs.length - 1];
}
export = {
routeCjsCommandFamily,
routeHubCommandFamily,
cjsFallbackHandler,
};