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

A variant group's page's Server-Timing names its phases: session, each read, render #3454

Merged opened this

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

Merged

The variants page now sends its phases in `Server-Timing`: `session`, `repo`, `pulls`, `access` and `render`. The two variants test files pass, but I didn't get a 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 the first to run it.

shipped production is serving it deploy e209d31

opened this

The variants page now sends its phases in Server-Timing: session, repo, pulls, access and render. The two variants test files pass, but I didn't get a 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 the first to run it.

  • Change: variantsPage in src/web/pages/variants.ts follows the milestones page. session comes from takeSessionTime. Each read is wrapped in timePhase in its original order: repo for loadRepo, pulls for the visible deck, and access for the canWrite check. render covers building the page.
  • Unchanged: the body, status codes, caching and the vote POST handler. A missing repo or group still returns 404, with the phases noted up to that point.
  • Test: test/variants-timing.test.ts makes a real one-pull variant group and requests the page. It asserts each phase name appears with a dur= value and checks no times. It fails without the change.
  • Left out: the per-card reads inside rendering (the app record, looks and previews) are not separate phases. They fall under render.

To try it, request /:owner/:name/variants/:group and read the Server-Timing header.

Closes #3424

commented

The variants page now sends its phases in Server-Timing: session, repo, pulls, access and render. The two variants test files pass, but I didn't get a 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 the first to run it.

  • Change: variantsPage in src/web/pages/variants.ts follows the milestones page. session comes from takeSessionTime. Each read is wrapped in timePhase in its original order: repo for loadRepo, pulls for the visible deck, and access for the canWrite check. render covers building the page.
  • Unchanged: the body, status codes, caching and the vote POST handler. A missing repo or group still returns 404, with the phases noted up to that point.
  • Test: test/variants-timing.test.ts makes a real one-pull variant group and requests the page. It asserts each phase name appears with a dur= value and checks no times. It fails without the change.
  • Left out: the per-card reads inside rendering (the app record, looks and previews) are not separate phases. They fall under render.

To try it, request /:owner/:name/variants/:group and read the Server-Timing header.

Approved

Follows the milestones page pattern exactly (session via takeSessionTime, repo/pulls/access via timePhase in original order, render around page()). No body, status, auth or caching change; 404 paths still carry the phases noted so far. The test builds a real variant group and asserts every phase name with a dur value, so it fails without the change. No new dependency, no UI change, so DESIGN.md is untouched. I could not reach the preview from my sandbox (host not allowlisted), so this is read from source only. Next: (1) have the test also cover the 404 path for an unknown group; (2) if per-card reads in render ever dominate, split them out as their own phase.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs