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

The spend tab's Server-Timing names its phases: session, each read, render #3431

Merged opened this

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

Merged

The spend tab (`/settings/spend`) now answers with Server-Timing phases `session`, `spend` and `render`, after `app`.

shipped production is serving it deploy dc8790b

opened this

The spend tab (/settings/spend) now answers with Server-Timing phases session, spend and render, after app.

The new test passes. I couldn't run the type check: bun x tsc --noEmit and bun install both failed in this sandbox with "unable to write files to tempdir". The forge's check will run it on this push.

  • What changed: spendPage in src/web/pages/spend-tab.ts uses notePhase and timePhase as boards-view.ts does. The session time comes from takeSessionTime, the single readSpend call is wrapped in spend, and building the HTML is timed as render. The read keeps its order and errors, and the body, status codes and caching are unchanged.
  • Test: test/spend-timing.test.ts signs in as the admin, requests the page, and asserts that app, session, spend and render each appear with a dur. It fails without the change.
  • Left out: I didn't split spend into one phase per query. readSpend is one function that runs many queries, and splitting it would mean changing src/actions/spend.ts, which is outside this issue's files. The early sign-in and not-found returns carry no phases.

To try it, sign in as an admin, open /settings/spend, and read the Server-Timing response header.

🤖 Generated with Claude Code

Closes #3280

commented

The spend tab (/settings/spend) now answers with Server-Timing phases session, spend and render, after app.

The new test passes. I couldn't run the type check: bun x tsc --noEmit and bun install both failed in this sandbox with "unable to write files to tempdir". The forge's check will run it on this push.

  • What changed: spendPage in src/web/pages/spend-tab.ts uses notePhase and timePhase as boards-view.ts does. The session time comes from takeSessionTime, the single readSpend call is wrapped in spend, and building the HTML is timed as render. The read keeps its order and errors, and the body, status codes and caching are unchanged.
  • Test: test/spend-timing.test.ts signs in as the admin, requests the page, and asserts that app, session, spend and render each appear with a dur. It fails without the change.
  • Left out: I didn't split spend into one phase per query. readSpend is one function that runs many queries, and splitting it would mean changing src/actions/spend.ts, which is outside this issue's files. The early sign-in and not-found returns carry no phases.

To try it, sign in as an admin, open /settings/spend, and read the Server-Timing response header.

🤖 Generated with Claude Code

Approved

Follows the boards-view pattern exactly (notePhase session, timePhase for the read, render measured from before the body is built). Admin gate and sign-in/404 returns are untouched, so no new exposure. The test signs in and asserts all four phases with a dur, and fails without the change. No markup or style changed, so DESIGN.md is unaffected. I could not reach the preview from my sandbox (network allowlist), so I judged from source only. Next: 1) split spend per query in src/actions/spend.ts so the slow read is named; 2) add the phases to the early-return paths only if they ever matter.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs