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

The boards data page's Server-Timing names its phases: session, each read, render #3541

Merged opened this

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

Merged

`GET /boards/data` now sends a Server-Timing header with four named phases: `session`, `query`, `boards` and `render`. The new test and the existing boards tests pass (131 tests). I couldn't run the type check: `bun x tsc --noEmit` fails in this sandbox with "bun is unable to write files to tempdir". The forge's check will run it on this push.

shipped production is serving it deploy 1f09d72

opened this

GET /boards/data now sends a Server-Timing header with four named phases: session, query, boards and render. The new test and the existing boards tests pass (131 tests). I couldn't run the type check: bun x tsc --noEmit fails in this sandbox with "bun is unable to write files to tempdir". The forge's check will run it on this push.

  • session: the time the server spent resolving the session, from takeSessionTime.
  • query: the chart query. runFor and runQuery are wrapped in timePhase, so their order and errors are unchanged.
  • boards: the listAllBoards read, wrapped in timePhaseAsync.
  • render: the time from after the query to the finished page, minus the boards time. The board list is read midway through building the page, so I subtract it to keep the two phases from overlapping.

The body, status codes and caching are unchanged, and nothing extra is computed for the header. Only src/web/pages/boards.ts and the new test/boards-data-timing.test.ts changed. The test requests the page as an admin and asserts each phase name appears exactly once with a numeric duration. It fails without the change and never checks a wall-clock time.

To try it, sign in as an admin and request /boards/data. The phases are in the Server-Timing response header.

🤖 Generated with Claude Code

Closes #3525

commented

GET /boards/data now sends a Server-Timing header with four named phases: session, query, boards and render. The new test and the existing boards tests pass (131 tests). I couldn't run the type check: bun x tsc --noEmit fails in this sandbox with "bun is unable to write files to tempdir". The forge's check will run it on this push.

  • session: the time the server spent resolving the session, from takeSessionTime.
  • query: the chart query. runFor and runQuery are wrapped in timePhase, so their order and errors are unchanged.
  • boards: the listAllBoards read, wrapped in timePhaseAsync.
  • render: the time from after the query to the finished page, minus the boards time. The board list is read midway through building the page, so I subtract it to keep the two phases from overlapping.

The body, status codes and caching are unchanged, and nothing extra is computed for the header. Only src/web/pages/boards.ts and the new test/boards-data-timing.test.ts changed. The test requests the page as an admin and asserts each phase name appears exactly once with a numeric duration. It fails without the change and never checks a wall-clock time.

To try it, sign in as an admin and request /boards/data. The phases are in the Server-Timing response header.

🤖 Generated with Claude Code

Approved

Follows the pattern already used by settings, boards-view and repo pages: session via takeSessionTime, each read via timePhase/timePhaseAsync, render with the board-list time subtracted so phases do not overlap. Admin gate and body are unchanged, no new dependency, and the test asserts each name once with a numeric dur and no wall-clock value. I could not reach the preview from my sandbox, so I judged from source. Two next steps: (1) the test only covers the admin 200, so add a guest case showing the 404 sends no phases; (2) drop the let boardsMs = 0 pre-declaration in favour of a const set after the read, or wrap the render-minus-reads maths in a small helper shared with the other pages.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs