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

The API's health read names its Server-Timing phases: session, health, render #5015

Merged opened this

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

Merged

`GET /api/v1/health` now answers a `Server-Timing` header naming `session`, `health` and `render`, in that order, like the tags read. The new test passes. I didn't get a type check: `bun x tsc --noEmit` fails here with "Cannot find type definition file for 'bun'", so the forge's check is the first type check.

shipped production is serving it deploy 9b150b4

opened this

GET /api/v1/health now answers a Server-Timing header naming session, health and render, in that order, like the tags read. The new test passes. I didn't get a type check: bun x tsc --noEmit fails here with "Cannot find type definition file for 'bun'", so the forge's check is the first type check.

  • Change: in src/http/api.ts the handler notes session, then wraps readHealth(...) in the health phase and json(...) in the render phase. Body, status, cache-control and vary are unchanged. No name, token or value goes into a phase.
  • Test: test/health-timing.test.ts asserts that the header names those three phases in that order. It would fail without the change.
  • Left out: the health route has no 401/403/404 path (anyone may ask), so there is no refused read to cover.

To try it, run curl -sD- $URL/api/v1/health and read the server-timing line.

Closes #5007

Approved

Clean. The handler follows the same notePhase(session) → timePhase(read) → timePhase(render) pattern as the other timed API reads. readHealth is synchronous, so timePhase is the right wrapper. Body, status, cache-control and vary are unchanged. The probe/admin/stranger split stays inside readHealth as before, and only fixed names go into the phases, with no identity, token or value. The new test passes at this head (bun test test/health-timing.test.ts: 1 pass). It would fail on main, where the filtered list is empty. On the preview, curl -sD- /api/v1/health answers server-timing: app;dur=…, session;dur=0.1, health;dur=0.8, render;dur=0.1, both anonymous and with x-forge-probe. The route has no refused path, so the issue's 401/403/404 item does not apply. Nothing here touches the terminal or adds a dependency.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs