Repository navigation
Closed
Labels
area:ciCI, shared testing infrastructure, development scripts and toolingarea:serverTouches the server areaready-for-agentFully specified, ready for an AFK agent
Description
Problem
With auth and patches ported, Fastify is only a shell around seams. This PR replaces it with Effect's HTTP server, moves serving into its own package, deletes the last pre-port packages and turns the Effect lint rules on.
Do
packages/serving: the serving guarantees (x-robots-tag,referrer-policy, CSP,cache-control,nosniff) as one rawHttpRouter.middleware(…, { global: true }); page routes/,/d/:patchId,/d/:patchId/v/:n,/healthzasHttpRouterroutes reading throughpatches(render.ts,serving-headers.ts,public-url.tsmove here); the trusted-proxy CIDRSchemafeedingHttpMiddleware.xForwardedHeaders; the pre-routing target classification (400/404/414) kept as observable contract inside the raw middleware. Importslimitsonly if ticket 1 found a page rate limit survives.apps/server:HttpApiBuilder.layer(PatchyApi)with theauthandpatchesgroup layers, the API-group middleware doing auth before body (no double rate-limit debit),Layer.mergeAllwith the page router,NodeHttpServer.layer; per-capabilityConfigcomposed here (Redactedsecrets, fail on first missing key); the sweep forked in the server scope withEffect.repeat(job, Schedule.spaced("1 hour")); analytics finalizer on shutdown. Fastify and its plugins removed. Shape:packages/effect-slice/src/server.ts.- Delete
packages/config(withenv-registry.test.ts) andpackages/db; the lastrunPromiseseams go. - Tests:
NodeHttpServer.layerTestfor the headers and status contract as a socket sees them (app.test.tsbecomespackages/servingtests + a thinapps/serverboot test);HttpApiTestfor the API through the real middleware;TestClockreaching the server fiber for the visit top-up. - Lint: the two t3code Effect ESLint rules written locally (namespace imports for service modules; no manual runtimes in tests; no schema compile in hot paths); promote every language-service
warningrule toerrorrepo-wide. - ADR Postgres only in
docs/adr/(JSON driver deleted, embedded-postgres for dev and tests). Move serving-guarantee terms topackages/serving/CONTEXT.md;apps/server/CONTEXT.mdshrinks to wiring. docs/DEVELOPMENT.mdupdated; the dev runner spawns the new server.
Done when
pnpm dev serves pages and the API from Effect with the same headers and status codes; the packed-CLI e2e passes; packages/config, packages/db, fastify are gone from the lockfile; pnpm lint fails on each new rule.
Decisions implemented
Spec §1, §3, §6, §7, §8, §10; vertical slice; #38 (Effect half).
Filed from the Effect v4 port spec (#68) by the map task Write the port spec and file the build tickets.
Metadata
Metadata
Assignees
Labels
area:ciCI, shared testing infrastructure, development scripts and toolingarea:serverTouches the server areaready-for-agentFully specified, ready for an AFK agent
Activity
feat(server): serve on HttpApi and HttpRouter; delete config and db
feat(server): serve on HttpApi and HttpRouter; delete config and db