Repository navigation
feat(server): serve the Express app through a Fastify 5 shell - #129
Merged
Merged
Conversation
Phase 2a step 2. Fastify 5 is the HTTP front door; the whole V2 Express app is mounted inside it with @fastify/express, so routes can leave Express one group at a time. One code path: no switch back to Express alone (rollback is reverting this change). - `createApp()` is now async and returns the shell as a Node request listener; `buildExpressApp()` is the Express app on its own. Server, unit and integration callers await it. - The transition probe's two fixes ship with their tests: Fastify never parses bodies while Express owns parsing (a body sent to an unknown route used to hang), and Fastify trusts exactly the proxies Express trusts, through Express's compiled trust function (the client IP behind nginx used to be the proxy's). Both tests fail when their fix is removed. - Unit tests compare V2 alone and through the shell (public route and security headers, refused-call shape, 404, body limits, streaming and Range); an integration test checks Socket.io on the shell's server and a signed webhook raw body. - Known until step 3, pinned by a test: Express routes lose their ETag (no 304) and the echoed x-request-id through the shell, and an unknown path answers Fastify's JSON 404 instead of Express's HTML. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
YvigUnderscore
enabled auto-merge
December 4, 2026 00:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Phase 2a step 2 (
logs/phase-2a/plan-2a.md): Fastify 5 becomes the HTTP front door, with the whole V2 Express app mounted inside it through@fastify/express. No route moves yet.apps/server/src/http/fastify-shell.ts: builds the shell around an Express app.createApp()is async and returns the shell as a Node request listener;buildExpressApp()is the Express app alone.server.ts, unit and integration callers await it.fastify5.12.8,@fastify/express4.0.14 (+socket.io-clientdev, for the integration check); notices regenerated.Why
Approved on 1 Dec (
probes/fastify/REPORT.md): Fastify 5 replaces Express 5 by mounting V2 inside it. The probe's conditions for this step: its two shell fixes and their tests from day one. One code path, noHTTP_SHELLswitch (agent call in the plan, accepted with it).The two fixes (probe findings 1 and 2)
@fastify/expressreplacesreq.ipwith Fastify's. Fastify gets Express's compiled trust function (a bare hop count gave the proxy's address, and Fastify 5 now refuses a number). Hop-based like V2; safe because nginx is the only service publishing a port.Both tests fail when their fix is removed (checked by reverting each fix locally).
Known until step 3 (pinned by a test that step 3 flips)
Through the shell, Express routes lose their
ETag(no 304) and the echoedx-request-id; an unknown path answers Fastify's JSON 404 instead of Express's HTML page. Security headers, CORS and error bodies are unchanged. Step 3 moves helmet/CORS, request id, error format and ETag to the Fastify side. Nothing reachesmainbefore step 3.How verified
pnpm validate: green./health200 with the Helmet headers, unknown path 404,/api/projects401.Risks
createApp()changed signature (async, returns a request listener): every caller in this repo updated; no other consumer.Migration notes
None (no schema, env or config change).
🤖 Generated with Claude Code