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

The model settings page's Server-Timing names its phases: session, each read, render #3473

Merged opened this

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

Merged

`GET /settings/model` now sends a Server-Timing header with four phases: `session`, `subscription`, `budget` and `render`. The two new tests pass, but I couldn't run the type check: `bun x tsc --noEmit` failed here with `bun is unable to write files to tempdir: ReadOnlyFileSystem`.

shipped production is serving it deploy 2e641a3

opened this

GET /settings/model now sends a Server-Timing header with four phases: session, subscription, budget and render. The two new tests pass, but I couldn't run the type check: bun x tsc --noEmit failed here with bun is unable to write files to tempdir: ReadOnlyFileSystem.

  • src/web/pages/model.ts: session comes from takeSessionTime. The ownSubscription read is wrapped in timePhase as subscription, and budgetLine as budget. render is the time spent building the page, measured the same way milestonesPage does.
  • Read order: the page ran budgetLine inside the body template, after building the form. I moved it to run right after ownSubscription so it could be timed. Both reads only read, and nothing new is computed for the header.
  • Unchanged: the body, status codes and caching are the same. No other page is touched.
  • test/model-timing.test.ts: it requests the page as an admin. It asserts that each of the four phase names appears exactly once with a numeric duration, and never checks a time. It fails without the change.
  • Tests run: bun test test/model-timing.test.ts test/model-grant-pages.test.ts gives 6 passing, 0 failing.

The page makes only those two reads, so there are no further phases to name. ceilingCard and grantCard serve other pages and stay untimed, as the issue limits this to the model page.

Closes #3445

commented

GET /settings/model now sends a Server-Timing header with four phases: session, subscription, budget and render. The two new tests pass, but I couldn't run the type check: bun x tsc --noEmit failed here with bun is unable to write files to tempdir: ReadOnlyFileSystem.

  • src/web/pages/model.ts: session comes from takeSessionTime. The ownSubscription read is wrapped in timePhase as subscription, and budgetLine as budget. render is the time spent building the page, measured the same way milestonesPage does.
  • Read order: the page ran budgetLine inside the body template, after building the form. I moved it to run right after ownSubscription so it could be timed. Both reads only read, and nothing new is computed for the header.
  • Unchanged: the body, status codes and caching are the same. No other page is touched.
  • test/model-timing.test.ts: it requests the page as an admin. It asserts that each of the four phase names appears exactly once with a numeric duration, and never checks a time. It fails without the change.
  • Tests run: bun test test/model-timing.test.ts test/model-grant-pages.test.ts gives 6 passing, 0 failing.

The page makes only those two reads, so there are no further phases to name. ceilingCard and grantCard serve other pages and stay untimed, as the issue limits this to the model page.

Approved

Follows the milestonesPage pattern exactly (session via takeSessionTime, timePhase per read, render measured around page()). Body, status and caching unchanged; the test asserts each of the four names once with a numeric dur and would fail without the change. I could not reach the preview from my sandbox (host blocked), so this is judged from source and test only. Two things next: (1) move the route_timing import up beside the other ../../core imports to keep import order tidy; (2) run bun x tsc --noEmit in CI, since the builder could not.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs