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

The admin limits page's Server-Timing names its phases: session, each read, render #3467

Merged opened this

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

Merged

`GET /admin/limits` now sends a `Server-Timing` header with `session`, `limits`, `quotas`, `signup`, `invites` and `render`, next to the existing `app`. The page's body, status codes and caching are unchanged.

shipped production is serving it deploy 5a6a4f7

opened this

GET /admin/limits now sends a Server-Timing header with session, limits, quotas, signup, invites and render, next to the existing app. The page's body, status codes and caching are unchanged.

The new test and the limits and invites suites pass (14 tests). I could not run bun x tsc --noEmit: it failed with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so the type check is unverified here.

  • Phases: each phase is named for what it reads, using notePhase/timePhase the way milestones.ts does. A non-admin still gets the not-found page, with only session and limits timed.
  • Reordered reads: the quotas, signup and invite reads used to sit in the middle of the row-building. I moved them up, right after the limits read, so each could be timed on its own. They run in the same order and nothing new is computed, so errors surface as before. render covers the rest of the page build.
  • Test: test/admin-limits-timing.test.ts signs in as the first admin and requests the page. It checks the status and that each phase name appears with a dur= value. It checks names only, never a wall-clock time.
  • Left out: no other page is touched, and the POST routes on this file are not timed.

To try it, sign in as an admin and run curl -si -b <cookie> $URL/admin/limits | grep -i server-timing.

🤖 Generated with Claude Code

Closes #3443

commented

GET /admin/limits now sends a Server-Timing header with session, limits, quotas, signup, invites and render, next to the existing app. The page's body, status codes and caching are unchanged.

The new test and the limits and invites suites pass (14 tests). I could not run bun x tsc --noEmit: it failed with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so the type check is unverified here.

  • Phases: each phase is named for what it reads, using notePhase/timePhase the way milestones.ts does. A non-admin still gets the not-found page, with only session and limits timed.
  • Reordered reads: the quotas, signup and invite reads used to sit in the middle of the row-building. I moved them up, right after the limits read, so each could be timed on its own. They run in the same order and nothing new is computed, so errors surface as before. render covers the rest of the page build.
  • Test: test/admin-limits-timing.test.ts signs in as the first admin and requests the page. It checks the status and that each phase name appears with a dur= value. It checks names only, never a wall-clock time.
  • Left out: no other page is touched, and the POST routes on this file are not timed.

To try it, sign in as an admin and run curl -si -b <cookie> $URL/admin/limits | grep -i server-timing.

🤖 Generated with Claude Code

Approved

Phases are named as the issue asked (session, limits, quotas, signup, invites, render), using notePhase/timePhase/takeSessionTime the way settings.ts, boards-view.ts and forges.ts already do. Reads keep their order and the page body is unchanged. The test checks names and dur format, not wall-clock times, and would fail without the change. I did not run the preview or bun test; this is a read of the diff. No new dependency, no UI change, so DESIGN.md is not touched.

Two things I would do next: (1) time the POST /admin/limits path the same way; (2) run bun x tsc --noEmit in CI or locally, since the builder could not.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs