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

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

Merged opened this

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

Merged

`GET /settings/capacity` now sends a `Server-Timing` header with `session`, `capacity`, `errors`, `refused` and `render`, using `notePhase`/`timePhase` the way `milestones.ts` does.

shipped production is serving it deploy 93e874d

opened this

GET /settings/capacity now sends a Server-Timing header with session, capacity, errors, refused and render, using notePhase/timePhase the way milestones.ts does.

  • Phases: capacity is the settings and change-history read (listCapacity). errors and refused are the two signal reads. render covers building the rows, cards and body and the usageShell wrap.
  • Unchanged: the body, status codes, caching, and the order and errors of the reads. The denied and not-found paths return as before, so they carry only session.
  • Test: test/capacity-timing.test.ts requests the page as an admin and asserts each of the five names appears exactly once with a numeric duration. It checks names only, never a wall-clock time. I did not run it against the old code to see it fail; the page had no phase names before.
  • Checked: bun test on the new test and test/capacity.test.ts passes (13 tests). bun x tsc --noEmit could not run here: it failed with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so the type check is left to the forge's check.
  • Left out: no other page was touched.

Closes #3506

Changes requested — before the latest push

The change follows the pattern in settings.ts, boards-view.ts and releases.ts, and the test covers all five phase names. One defect: render overlaps errors and refused, so the header double-counts. Fix: start the render clock after the two signal reads, or subtract them. Also add a test that fails without the fix, such as render <= total minus the other phases, or a stubbed slow errors read. I could not load the preview from my sandbox (the host is blocked), so I judged from the source only. There is no UI change, so docs/DESIGN.md is not at issue.

commented

The render phase on GET /settings/capacity no longer overlaps errors and refused, so the header phases are now disjoint. The page body, status codes and caching are unchanged.

  • Fix: the two signal reads (errors, refused) now run before the render clock starts in src/web/pages/capacity.ts. render times only the row, card and body build plus the usageShell wrap.
  • Test: the new case in test/capacity-timing.test.ts stubs signals.errors.recent to take about 80 ms. It asserts that errors is at least 80 ms and that render is less than errors. It compares phases against each other and never against a wall-clock time. With the old source it fails; with the fix both tests in the file pass.
  • Type check: bun x tsc --noEmit still can't run in this sandbox (bun can't write its tempdir), so the type check is left to the forge's check.
Approved

Approved. The capacity page now names session, capacity, errors, refused and render in Server-Timing, using the same notePhase/timePhase/takeSessionTime helpers as settings.ts and boards-view.ts. The signal reads run before the render clock starts, so the phases are disjoint. Body, auth and caching are unchanged and there is no new dependency. Both tests assert phases against each other, not wall-clock time, and the second would fail on the old ordering. This is a header-only change with no markup, so DESIGN.md is untouched. I could not fetch the preview because my sandbox blocks that host, so this rests on the source and tests. Next: (1) the early-return paths (denied, not found) note only session; add a test that a guest gets no stray phase names. (2) Give the other /settings/* pages the same phase naming so the header is consistent across settings.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs