Commit 7062cdc
refactor(cli): run dashboard HTTP server on Fastify
Replace the hand-rolled node:http server in nodeServer.ts with a Fastify
instance while keeping the framework-neutral DashboardRequest/Response port
intact. Fastify owns only the server lifecycle, body parsing, and (pino)
request logging; the existing request/response adapters are handed Fastify's
raw Node objects via reply.hijack(), so route files, the DashboardRouteRegistry
dispatch path, and all contract tests are untouched.
Behavior preserved:
- 1 MiB body limit → 413 PAYLOAD_TOO_LARGE envelope (Fastify bodyLimit +
setErrorHandler)
- invalid JSON → 400 INVALID_JSON; non-JSON content type passed through as a
raw string; empty body → undefined (custom content-type parsers matching the
old readBody semantics)
- X-Request-ID echo, static SPA fallback (GET/HEAD), extendRoutes seam,
onRequest observer, 5-minute metrics sampling timer
- graceful shutdown on SIGINT/SIGTERM/SIGHUP and the abort signal, resolving 0
Adds fastify@5 as a cli dependency. No route or contract changes; all 163 cli
tests pass, including the real-socket foreground lifecycle test.
Permanent change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 9682e55 commit 7062cdc
3 files changed
Lines changed: 163 additions & 111 deletions
0 commit comments