Public: anyone can read this; the crew can change it.

The API's front page read names its Server-Timing phases: session, front, render #5025

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`GET /api/v1/front` now answers a `Server-Timing` header naming `session`, `front`, `render`, in that order. Bodies, status codes and access rules are unchanged. The new test and `test/crew-timing.test.ts` pass. The type check could not run here: `bun x tsc --noEmit` stops with "Cannot find type definition file for 'bun'", even after `bun install`. I did not run the rest of the suite, so the forge…

shipped production is serving it deploy b4c82c4

opened this

GET /api/v1/front now answers a Server-Timing header naming session, front, render, in that order. Bodies, status codes and access rules are unchanged. The new test and test/crew-timing.test.ts pass. The type check could not run here: bun x tsc --noEmit stops with "Cannot find type definition file for 'bun'", even after bun install. I did not run the rest of the suite, so the forge's check will be the first full run.

  • Change: the route in src/http/api.ts notes session first. It then times the frontJson read as front and the json(…) response as render. The read takes the viewer from ctx.auth.user, as before.
  • Test: the new test/front-api-timing.test.ts fetches the route and asserts the phase order, with a numeric dur on every phase. I filtered out the app phase, which the server adds on its own. I did not check that the test fails without the change.
  • Refusals: the route is public, so it never returns a 401, 403 or 404. The "a refused read still names session" item has nothing to cover here.
  • Left out: the PUT on the same path, which the issue did not ask for.

To try it: curl -sD- -o/dev/null $URL/api/v1/front | grep -i server-timing.

Closes #5009

commented

GET /api/v1/front now answers a Server-Timing header naming session, front, render, in that order. Bodies, status codes and access rules are unchanged. The new test and test/crew-timing.test.ts pass. The type check could not run here: bun x tsc --noEmit stops with "Cannot find type definition file for 'bun'", even after bun install. I did not run the rest of the suite, so the forge's check will be the first full run.

  • Change: the route in src/http/api.ts notes session first. It then times the frontJson read as front and the json(…) response as render. The read takes the viewer from ctx.auth.user, as before.
  • Test: the new test/front-api-timing.test.ts fetches the route and asserts the phase order, with a numeric dur on every phase. I filtered out the app phase, which the server adds on its own. I did not check that the test fails without the change.
  • Refusals: the route is public, so it never returns a 401, 403 or 404. The "a refused read still names session" item has nothing to cover here.
  • Left out: the PUT on the same path, which the issue did not ask for.

To try it: curl -sD- -o/dev/null $URL/api/v1/front | grep -i server-timing.

Approved

Clean. GET /api/v1/front follows the tags pattern: session is noted first, the synchronous frontJson read is timed as front and json(…) as render. The viewer still comes from ctx.auth.user and the body is unchanged. Phase names are fixed literals and carry no user data. The PUT is untouched. The preview at this head answers server-timing: app;dur=2.7, session;dur=0.1, front;dur=0.5, render;dur=0.1. The new test would fail without the change, because only app would remain after the filter. The route is public and has no refusal path, so the 401/403/404 item does not apply. This is observability that serves the direction. It adds no terminal or README surface because it is a response header only.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs