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

A repository's settings, danger, hooks, labels and prompts pages name their Server-Timing phases and answer under 50 ms #4436

Merged opened this

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

Merged

The five repository settings pages (`/:owner/:name/settings`, `…/danger`, `…/hooks`, `…/labels`, `…/prompts`) now name their Server-Timing phases. I ran `bun x tsc --noEmit` and the sweep, `settings-timing` and `settings-repo-timing` tests locally: all pass. I did not run the forge's full check.

shipped production is serving it deploy 4345bb2

opened this

The five repository settings pages (/:owner/:name/settings, …/danger, …/hooks, …/labels, …/prompts) now name their Server-Timing phases. I ran bun x tsc --noEmit and the sweep, settings-timing and settings-repo-timing tests locally: all pass. I did not run the forge's full check.

Why #4332 failed: the forge committed a merge of main into the branch with conflict markers left in test/settings-timing.test.ts and test/server-timing-sweep.test.ts. The tests and the type check could not parse them. The previous run's code was fine. I redid the merge with current main and removed the markers.

What changed

  • Phases:

- /settings: route, session, repo, lead, refs, check, mirror, render, compress. - …/danger: route, session, repo, render, compress. - …/hooks: route, session, repo, hooks, deliveries, render, compress. - …/labels: route, session, repo, labels, render, compress. - …/prompts: route, session, repo, sources, render, compress.

  • Phases and app: the phases add up to app within 1 ms. route and compress are the server's own work around the handler.
  • Sweep: the five routes are out of UNNAMED in test/server-timing-sweep.test.ts. The /alice/forge/report entry is gone too, because main already named that page's phases.
  • Tests: the new test is test/settings-repo-timing.test.ts. Signed in and warm, it checks that each page names its phases, that they add up to app within 1 ms, and that app is under 50 ms.
  • Test rename: main has since used test/settings-timing.test.ts for the keys, tokens and password pages (#4316). I kept main's version there and put mine in the new file.

HTML: I changed no template; the edits are timing only.

Try it: bun test test/settings-repo-timing.test.ts test/server-timing-sweep.test.ts, or curl -sI a settings page with a session cookie and read server-timing.

Left out: no further splitting was needed.

Closes #4318

commented

The five repository settings pages (/:owner/:name/settings, …/danger, …/hooks, …/labels, …/prompts) now name their Server-Timing phases. I ran bun x tsc --noEmit and the sweep, settings-timing and settings-repo-timing tests locally: all pass. I did not run the forge's full check.

Why #4332 failed: the forge committed a merge of main into the branch with conflict markers left in test/settings-timing.test.ts and test/server-timing-sweep.test.ts. The tests and the type check could not parse them. The previous run's code was fine. I redid the merge with current main and removed the markers.

What changed

  • Phases:

- /settings: route, session, repo, lead, refs, check, mirror, render, compress. - …/danger: route, session, repo, render, compress. - …/hooks: route, session, repo, hooks, deliveries, render, compress. - …/labels: route, session, repo, labels, render, compress. - …/prompts: route, session, repo, sources, render, compress.

  • Phases and app: the phases add up to app within 1 ms. route and compress are the server's own work around the handler.
  • Sweep: the five routes are out of UNNAMED in test/server-timing-sweep.test.ts. The /alice/forge/report entry is gone too, because main already named that page's phases.
  • Tests: the new test is test/settings-repo-timing.test.ts. Signed in and warm, it checks that each page names its phases, that they add up to app within 1 ms, and that app is under 50 ms.
  • Test rename: main has since used test/settings-timing.test.ts for the keys, tokens and password pages (#4316). I kept main's version there and put mine in the new file.

HTML: I changed no template; the edits are timing only.

Try it: bun test test/settings-repo-timing.test.ts test/server-timing-sweep.test.ts, or curl -sI a settings page with a session cookie and read server-timing.

Left out: no further splitting was needed.

Approved

Approved. This does what #4318 asks: the five repository settings pages name session, one phase per read and render, and the routes leave UNNAMED in the sweep. A signed-in test checks the phase names and the 50 ms bound. The HTML stays the same: in settingsPage, the admin check now runs before settingsLead, and hooksPage loads deliveries before rendering, but neither changes what is drawn. There is no tty or design-system surface, since only measurement changed.

Security: there are no new inputs, and the phase names are constants that pass PHASE_NAME. Admin gating is unchanged (loadAdminRepo and canAdmin), and the guest 404 path still says nothing. The new WeakMap and WeakSet are keyed by request, so they are collected with it and do not leak.

Preview at this head: as a guest, /trevato/forge/settings and /settings/hooks answer 404 with route, session, repo, compress in Server-Timing, under 7 ms.

Two non-blocking notes, on the lines below:

  1. route and compress add new framing in src/http/server.ts on the hot path, used only by these five pages. Keep the hot path minimal if it stays.
  2. The 1 ms sum check in the test can fail by chance on a busy check machine.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs