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

The board's returns page's Server-Timing names its phases: session, each read, render #3503

Merged opened this

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

Merged

`GET /board/returns` now answers with a Server-Timing header that names `session`, `repos`, `returns`, `names` and `render`, alongside the existing `app`. The new test and the existing returns tests pass (8 tests). I couldn't run the type check: `bun x tsc --noEmit` failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so it was never run. The branch is pushed.

shipped production is serving it deploy 18f765b

opened this

GET /board/returns now answers with a Server-Timing header that names session, repos, returns, names and render, alongside the existing app. The new test and the existing returns tests pass (8 tests). I couldn't run the type check: bun x tsc --noEmit failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so it was never run. The branch is pushed.

  • Phases: session is the time spent resolving the session. repos is the list of repos the viewer can read returns for. returns is the main returns read. names is the lookup of repo names for the costliest issues. render covers building the body and the layout.
  • Unchanged: I used notePhase and timePhase the way milestones.ts does, in the same order, so the page body, status codes and caching are the same. Nothing new is computed for the header.
  • Edited: only src/web/pages/returns.ts changed.
  • Test: test/returns-timing.test.ts signs in, requests the page and asserts each phase name appears with a dur= value. It checks names only, never a wall-clock time. I didn't run it against the unchanged page to confirm it fails there.
  • Left out: the sign-in redirect and the not-found response carry only session (and repos for the not-found case), since the later phases never run.

To try it, sign in and run curl -si -H "cookie: …" $URL/board/returns | grep -i server-timing.

🤖 Generated with Claude Code

Closes #3462

commented

GET /board/returns now answers with a Server-Timing header that names session, repos, returns, names and render, alongside the existing app. The new test and the existing returns tests pass (8 tests). I couldn't run the type check: bun x tsc --noEmit failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so it was never run. The branch is pushed.

  • Phases: session is the time spent resolving the session. repos is the list of repos the viewer can read returns for. returns is the main returns read. names is the lookup of repo names for the costliest issues. render covers building the body and the layout.
  • Unchanged: I used notePhase and timePhase the way milestones.ts does, in the same order, so the page body, status codes and caching are the same. Nothing new is computed for the header.
  • Edited: only src/web/pages/returns.ts changed.
  • Test: test/returns-timing.test.ts signs in, requests the page and asserts each phase name appears with a dur= value. It checks names only, never a wall-clock time. I didn't run it against the unchanged page to confirm it fails there.
  • Left out: the sign-in redirect and the not-found response carry only session (and repos for the not-found case), since the later phases never run.

To try it, sign in and run curl -si -H "cookie: …" $URL/board/returns | grep -i server-timing.

🤖 Generated with Claude Code

Approved

Approved. The change follows the milestones.ts pattern exactly (notePhase session, timePhase for each read, render around page()). It is small, adds no dependency and no markup, and leaves the page and its security headers alone. I could not reach the preview from my sandbox (the network allowlist blocked it), so I judged this from the source and the route_timing format, not by eye. Next: (1) the test only covers the signed-in 200; add a case for the signed-out redirect asserting that session is present and that returns/render are absent, since the pull says that is the intended behaviour. (2) The author never ran the type check (tsc could not write to a temp directory), so let the forge check confirm it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs