Skip to content

Normalise server route handlers and reply messages - #1424

Merged
Kevinjohn merged 7 commits into
mainfrom
feature/route-handlers
Oct 1, 2026
Merged

Kevinjohn merged 7 commits into
mainfrom
feature/route-handlers

Conversation

@Kevinjohn

@Kevinjohn Kevinjohn commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Part of #1409 (T12). Merge predecessor: #1423 (this PR's base branch, feature/test-scaffolding).

  • Error strings the client matches are a frozen wire contract in shared/src/api/replyMessages.ts; src/data/sync/lifecycleOps.ts imports the constant instead of repeating the text. Every other server message lives in server/src/routes/replyErrors.ts, in sentence case with a full stop.
  • One body-parsing style (the ParseResult parser pattern), typed route generics instead of req.query/req.params casts, and every reply returned as return reply.code().send().
  • New pins: the lifecycle 404 body equals the frozen text; a scoped delete with a missing or repeated accountId is refused with 400 and leaves the row. The missing-accountId test previously used a lifecycle entity and never reached that check.

Wire shapes, status codes and frozen messages are unchanged; conformance pins were updated deliberately.

Validation: Integrated Batch 4 tip (all five Batch 4 branches): pnpm run gate:all and pnpm run e2e (290 passed) on Node 24.16.0. Later changes on the stack touch only comments, the comment checker and two reference pages; on the final tip typecheck, lint, format, the comment-voice check and its test, ui:check, docs:build and pnpm run gate:server pass. Independently reviewed; findings applied. pnpm run test:account-conformance passes (302 tests).

Merge order

  1. Route support to Discussions and remove PR screenshots #1411, Add project status, comparison, testing and philosophy pages #1412, Archive changelog sections before 0.41.0-alpha.3 #1414 (independent)
  2. Add a first-change path for contributors #1413 (after Archive changelog sections before 0.41.0-alpha.3 #1414), Restate the comment standard as numbered voice rules #1415, Reduce configuration and hide password MFA #1416
  3. Rename SMALLSASS_ACCOUNT_ settings to CAPACITYLENS_ #1417 → Add an init command that writes the environment file #1418
  4. Retire unused settings and derive engagement grouping #1419 → Move diagnostics to an Owner and Admin page #1420 → Reshape the documentation into four role guides #1421 → Use @/ for app imports that leave their folder #1422 → Consolidate server test scaffolding #1423 → Normalise server route handlers and reply messages #1424 → Apply the comment-voice rules and check them in the gate #1425 (Apply the comment-voice rules and check them in the gate #1425 also after Restate the comment standard as numbered voice rules #1415) → Name the tenant boundary account in code #1426

Merge predecessor for this PR: #1423.

Record the one reply text the browser matches ("Not found", used by the
lifecycle archive sync) as a frozen wire contract in
shared/src/api/replyMessages.ts, and gather every other route message in
server/src/routes/replyErrors.ts as a sentence-case sentence with a full
stop.

Route handlers now type params and query strings through Fastify route
generics instead of casts, parse bodies through ParseResult parsers, and
return every reply as reply.code(...).send(...). Replies that echoed a
thrown error's message send a fixed message instead; a rejected import
logs the parser's reason and replies with a fixed sentence.

A scoped DELETE whose accountId query repeats now gets the existing 400
instead of reaching authorization with an array.

Refs #1409

Signed-off-by: Kevinjohn Gallagher <kevinjohngallagher@hotmail.com>
Assert the lifecycle 404 body carries the frozen wire text the client
matches, cover a scoped DELETE whose accountId query repeats, and rename
the route-unavailable 404 message key so it cannot be mistaken for the
frozen constant. Message text is unchanged.

Refs #1409

Signed-off-by: Kevinjohn Gallagher <kevinjohngallagher@hotmail.com>
Signed-off-by: Kevinjohn Gallagher <kevinjohngallagher@hotmail.com>
@Kevinjohn

Copy link
Copy Markdown
Owner Author

Polish review: no P1/P2 findings.

  • Independent review: no client-matched message, status code or wire shape changed. Every reply returns, and no parser became stricter or looser.
  • Ladder passes on Node 24: format, lint, typecheck, file sizes and server tsc, the app API, data and shared suites, and the full server suite. Four server tests (migration rehearsal and member-link concurrency) timed out under machine load and pass in isolation.

Merge order for this batch: #1411, #1412, #1414 → #1413, #1415, #1416 → #1417 → #1418, #1419 → #1420 → #1421 → #1422 → #1423 → #1424 → #1425 → #1426. Predecessor: #1423.

@Kevinjohn Kevinjohn added polish-done Polish review complete and removed polish-in-progress Polish review running labels Oct 1, 2026
@Kevinjohn
Kevinjohn merged commit 9f9542d into main Oct 1, 2026
4 checks passed
@Kevinjohn
Kevinjohn deleted the feature/route-handlers branch October 1, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

polish-done Polish review complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant