refactor(move): split daemon server http-server.ts by ownership seam
Merged
TH
2mo ago+785+785+012345678901234567890123456789-706-706-012345678901234567890123456789
Summary
src/daemon/server/http-server.ts crossed the 1,016-line architecture-debt line (AGENTS.md: files past 1,000 lines are debt). This splits it along the ownership seams the file already had, with no behavior change:
http-rpc-envelope.ts(92 lines) — the JSON-RPC envelope types, error builders, and plain/NDJSON response writers for/rpc.http-authorization.ts(291 lines) — the auth hook (load + run), token check, tenant-trust gate, auxiliary-route authorization, and remote-surface restrictions.http-rpc-methods.ts(311 lines) — the RPC method vocabulary and the per-method projections intoDaemonRequest.http-server.ts(395 lines) — the listener:/health, auxiliary route dispatch,/rpcbody framing, and the wiring of the gate around each request.
10 touched files; the rest of the diff is the path-keyed enforcement moving with the code (wire-compat manifest/ledger/mutation probes, fallow health baseline, one ADR path reference). No new eager dependencies: the split files' import closures are unions of the original file's imports.
Validation
Tested at 751fb6757 (the pushed head):
pnpm install --frozen-lockfile && pnpm build,pnpm format(clean),pnpm check:quick,pnpm check:layering,pnpm check:fallow,pnpm check:production-exports— pass.- HTTP/server tests:
http-server-{artifacts,limrun-uploaded-apps,rpc-validation,tenant-trust},host-lease-http,human-control-http,request-diagnostics-http,request-save-script-transports,http-instance-precondition(62 tests) and thedaemon-http-*/remote-*provider-scenario suites + daemon-client abort / daemon-proxy / cli-remote-diagnostics (55 tests) — all pass. No test files were moved (nohttp-server.test.tsexisted; the suites importcreateDaemonHttpServer, whose path is unchanged). pnpm check:affected --run— all runnable checks pass.pnpm check:daemon-wire-compat— 191 declarations, 0 changed/removed/added, 27 moved: all 28 wire declarations moved with byte-identical text, so digests are unchanged and the released-surface comparison reads them as file moves (no bump, no ack).- depgraph summary before/after (
pnpm depgraph):- before:
1,817 files / 9,721 edges;dominator summary for src/daemon.ts: 650 of 1817 files loaded eagerly, biggest branch daemon-runtime.ts (647 files, 102035 loc) - after:
1,820 files / 9,738 edges;dominator summary for src/daemon.ts: 653 of 1820 files loaded eagerly, biggest branch daemon-runtime.ts (650 files, 102110 loc) - The +3 modules are the split artifacts themselves (eager-closure gate
eager-closure-budgets.test.tsaccepts this under the ADR-0027 split tolerance: contained closure, novel modules, flat weight). No new eager edge: R4/R5/R6/zone SCCs unchanged.
- before:
- CI: not yet observed; local evidence above. Unresolved risk: none known; provider/coverage lanes stay with CI.