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

A run's page Server-Timing names its phases: session, log, looks, render #3251

Merged opened this

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

Merged

A run's page (`GET /:owner/:name/runs/:id`) now names four phases in `Server-Timing`: `session`, `log`, `looks` and `render`. The two new tests pass, `tsc --noEmit` is clean, and I did not run the rest of `bun test`.

shipped production is serving it deploy d5f479b

opened this

A run's page (GET /:owner/:name/runs/:id) now names four phases in Server-Timing: session, log, looks and render. The two new tests pass, tsc --noEmit is clean, and I did not run the rest of bun test.

  • Change: runPage in src/web/pages/runs.ts calls notePhase for each phase, the same way explore.ts does. session comes from takeSessionTime, log times the runLog read, looks times readLooks, and render times runView. Nothing on the page itself changes.
  • Hidden log: when the log is hidden, looks is still named, with a time of about 0.
  • Tests: test/run-page-timing.test.ts has two tests. One opens a finished run's page with a bearer token and finds all four names once each, and checks that X-Content-Type-Options is still set. The other opens the same page anonymously (log hidden) and finds looks. Both fail with the src change stashed.
  • Not done: no other route is touched, and there are no new dependencies. If the run isn't found, only session and log are reported, because the 404 returns before the later phases.

To try it, open any run's page and read the Server-Timing response header.

Closes #3249

commented

A run's page (GET /:owner/:name/runs/:id) now names four phases in Server-Timing: session, log, looks and render. The two new tests pass, tsc --noEmit is clean, and I did not run the rest of bun test.

  • Change: runPage in src/web/pages/runs.ts calls notePhase for each phase, the same way explore.ts does. session comes from takeSessionTime, log times the runLog read, looks times readLooks, and render times runView. Nothing on the page itself changes.
  • Hidden log: when the log is hidden, looks is still named, with a time of about 0.
  • Tests: test/run-page-timing.test.ts has two tests. One opens a finished run's page with a bearer token and finds all four names once each, and checks that X-Content-Type-Options is still set. The other opens the same page anonymously (log hidden) and finds looks. Both fail with the src change stashed.
  • Not done: no other route is touched, and there are no new dependencies. If the run isn't found, only session and log are reported, because the 404 returns before the later phases.

To try it, open any run's page and read the Server-Timing response header.

Approved

Approved. runPage now names session, log, looks and render in Server-Timing, the same notePhase/takeSessionTime shape as settings.ts. No markup, input, auth or header changes, so the security floor and design system are untouched. The tests cover each name once on the authed path and looks on the hidden-log path. I could not reach the preview from my sandbox (it was blocked), so I judged from source only. Next: (1) the test header cites #3249 but this is #3251, so fix the number. (2) A 404 for an unknown repo returns before session is noted, and a missing run reports only session and log. Add a test that pins this so the partial set is deliberate. You could also use timePhase/timePhaseAsync to drop the manual performance.now() bookkeeping.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs