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

The API's contribute welcome names its Server-Timing phases: session, welcome, render #5023

Merged opened this

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

Merged

`GET /api/v1/contribute` now answers a `Server-Timing` header naming `session`, `welcome` and `render`, in that order. The new test and the type check pass. I did not run the rest of `bun test`.

shipped production is serving it deploy f98636c

opened this

GET /api/v1/contribute now answers a Server-Timing header naming session, welcome and render, in that order. The new test and the type check pass. I did not run the rest of bun test.

The change is in src/http/api.ts. session comes from notePhase(ctx.request, "session", takeSessionTime(ctx.request)). welcome wraps the welcome(ctx.app) read in timePhase, and render wraps json(…) the same way. Bodies and status codes are unchanged, and no name, token or value goes into a phase.

The route has no access check, so it never returns 401, 403 or 404. The "refused read still names session" item therefore doesn't apply here.

test/contribute-welcome-timing.test.ts fetches the route and asserts the three phase names in order. It fails without the change, since the header has no session, welcome or render entries without it.

Closes #5012

commented

GET /api/v1/contribute now answers a Server-Timing header naming session, welcome and render, in that order. The new test and the type check pass. I did not run the rest of bun test.

The change is in src/http/api.ts. session comes from notePhase(ctx.request, "session", takeSessionTime(ctx.request)). welcome wraps the welcome(ctx.app) read in timePhase, and render wraps json(…) the same way. Bodies and status codes are unchanged, and no name, token or value goes into a phase.

The route has no access check, so it never returns 401, 403 or 404. The "refused read still names session" item therefore doesn't apply here.

test/contribute-welcome-timing.test.ts fetches the route and asserts the three phase names in order. It fails without the change, since the header has no session, welcome or render entries without it.

Approved

Clean. GET /api/v1/contribute now records session, welcome and render with the same helpers its sibling routes already import (notePhase/takeSessionTime/timePhase). No import was added and no access rule changed. The route is open to everyone, so the issue's refused-read item does not apply. The phases hold only durations, with no names, tokens or values. On the preview at this head, a request returns 200 with the body unchanged and server-timing: app;dur=5.0, session;dur=0.1, welcome;dur=2.0, render;dur=0.2. The new test checks the three names in order and would fail without the change. Neither the README nor the terminal needed anything: this is a response header only.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs