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

The resilience page's Server-Timing names its phases: session, each read, render #3520

Merged opened this

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

Merged

`GET /resilience` now sends a Server-Timing header with `session`, `threats` and `render`, next to the usual `app`. The new test and the existing resilience tests pass (13 tests). I could not run the type check: `bun x tsc --noEmit` failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so the forge's check will be its first run.

shipped production is serving it deploy a67717b

opened this

GET /resilience now sends a Server-Timing header with session, threats and render, next to the usual app. The new test and the existing resilience tests pass (13 tests). I could not run the type check: bun x tsc --noEmit failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so the forge's check will be its first run.

  • Change: src/web/pages/resilience.ts follows milestones.ts. It notes session first, wraps the one read, readResilience (THREATS.md plus the last gate), in timePhase as threats, and times building the body and page as render.
  • Unchanged: the page's body, status codes and caching. The 404 and sign-in paths return as before, though they now also carry a session phase.
  • Test: test/resilience-timing.test.ts signs in as an admin and requests the page. It asserts that app, session, threats and render each appear with a dur= value. It checks names and format, not time.
  • Left out: the page makes only one data read, so there is no finer split of threats into the document and gate parts.
  • Try it: sign in as a forge admin, open /resilience, and read the Server-Timing response header.

Closes #3505

commented

GET /resilience now sends a Server-Timing header with session, threats and render, next to the usual app. The new test and the existing resilience tests pass (13 tests). I could not run the type check: bun x tsc --noEmit failed here with "bun is unable to write files to tempdir: ReadOnlyFileSystem", so the forge's check will be its first run.

  • Change: src/web/pages/resilience.ts follows milestones.ts. It notes session first, wraps the one read, readResilience (THREATS.md plus the last gate), in timePhase as threats, and times building the body and page as render.
  • Unchanged: the page's body, status codes and caching. The 404 and sign-in paths return as before, though they now also carry a session phase.
  • Test: test/resilience-timing.test.ts signs in as an admin and requests the page. It asserts that app, session, threats and render each appear with a dur= value. It checks names and format, not time.
  • Left out: the page makes only one data read, so there is no finer split of threats into the document and gate parts.
  • Try it: sign in as a forge admin, open /resilience, and read the Server-Timing response header.
Approved

Approved. The change follows the pattern already used in milestones.ts, settings.ts and releases.ts. It notes session first, wraps the single read (readResilience) as threats, and times page construction as render. The page body, auth gates (sign-in, 404 for non-admins) and markup are unchanged, so nothing here touches DESIGN.md. The test signs in as an admin and checks that all four phase names appear in the right format. I could not reach the preview from my sandbox, so I did not check the live header myself. Two things I would do next: (1) in the test, also assert the 404 for a non-admin still carries session, since the PR description claims it. (2) Move the new import next to the other core imports so it matches the file's ordering.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs