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

A repository's new issue, make-it-yours, report and toolbar pages name their Server-Timing phases and answer under 50 ms #4335

Merged opened this

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

Merged

The four pages now name their Server-Timing phases and are off `UNNAMED`, but the phases don't add up to within 1 ms of `total`, so that part of the issue isn't met. `app` is the header's total, and it also covers routing and the security floor, which happen outside the page modules. On the fixture the named phases sum to about 1–1.5 ms less than `app`. The new test checks that the phases never ex…

shipped production is serving it deploy f9c1fcc

opened this

The four pages now name their Server-Timing phases and are off UNNAMED, but the phases don't add up to within 1 ms of total, so that part of the issue isn't met. app is the header's total, and it also covers routing and the security floor, which happen outside the page modules. On the fixture the named phases sum to about 1–1.5 ms less than app. The new test checks that the phases never exceed app, and that over eleven warm requests the median share they cover is at least 0.4 of app. It's the same bound test/front-timing.test.ts uses. I did not touch src/http/server.ts to close the gap.

bun x tsc --noEmit is clean, as is bun scripts/design-lint.ts. The sweep and the new test pass. I also ran the existing issue, report, toolbar and make-it-yours tests: 193 pass.

Phases, in order, signed in:

RoutePhases
/:owner/:name/issues/newsession, repo, render (access also appears when signed out)
…/reportsession, repo, access, render
…/toolbarsession, repo, app-row, live, runs, render (pull also appears on a preview)
…/make-it-yourssession, repo, plan, render

What changed

  • Toolbar and make-it-yours: they already named most phases but skipped render on their 404, sign-in and refused-plan exits, which is why they were still in UNNAMED. Those exits now name render.
  • Toolbar: its production "Live:" line (a git commit-log read) is now the live phase.
  • Make-it-yours: the refusal branches moved into a planRefused function with no change in behaviour.
  • Report: the page body moved into reportBody so the whole render can be timed.
  • Test files: test/server-timing-sweep.test.ts drops the four entries. The new test/repo-pages-timing.test.ts asserts each route's exact phase names and that app is under 50 ms warm on the fixture. It signs in as alice for the first three routes and as a verified bob for make-it-yours.

The HTML is unchanged apart from timing. Wrapping the signed-out and 404 renders in the render phase is the only code-path change, and the existing page tests still pass.

To try it, sign in, open any of the four routes, and read the server-timing response header.

Closes #4321

commented

The four pages now name their Server-Timing phases and are off UNNAMED, but the phases don't add up to within 1 ms of total, so that part of the issue isn't met. app is the header's total, and it also covers routing and the security floor, which happen outside the page modules. On the fixture the named phases sum to about 1–1.5 ms less than app. The new test checks that the phases never exceed app, and that over eleven warm requests the median share they cover is at least 0.4 of app. It's the same bound test/front-timing.test.ts uses. I did not touch src/http/server.ts to close the gap.

bun x tsc --noEmit is clean, as is bun scripts/design-lint.ts. The sweep and the new test pass. I also ran the existing issue, report, toolbar and make-it-yours tests: 193 pass.

Phases, in order, signed in:

RoutePhases
/:owner/:name/issues/newsession, repo, render (access also appears when signed out)
…/reportsession, repo, access, render
…/toolbarsession, repo, app-row, live, runs, render (pull also appears on a preview)
…/make-it-yourssession, repo, plan, render

What changed

  • Toolbar and make-it-yours: they already named most phases but skipped render on their 404, sign-in and refused-plan exits, which is why they were still in UNNAMED. Those exits now name render.
  • Toolbar: its production "Live:" line (a git commit-log read) is now the live phase.
  • Make-it-yours: the refusal branches moved into a planRefused function with no change in behaviour.
  • Report: the page body moved into reportBody so the whole render can be timed.
  • Test files: test/server-timing-sweep.test.ts drops the four entries. The new test/repo-pages-timing.test.ts asserts each route's exact phase names and that app is under 50 ms warm on the fixture. It signs in as alice for the first three routes and as a verified bob for make-it-yours.

The HTML is unchanged apart from timing. Wrapping the signed-out and 404 renders in the render phase is the only code-path change, and the existing page tests still pass.

To try it, sign in, open any of the four routes, and read the server-timing response header.

Approved

Approved. The four pages name their phases, the 404/sign-in/refused exits now name render, and the HTML is unchanged. reportPage keeps the old publicRepo behaviour (loadRepo then canRead as a guest). The preview answers with Server-Timing. Next two: (1) the issue asked for phases within 1 ms of app, and the test only asserts a median share of at least 0.4, so close the gap in src/http/server.ts (name routing and the security floor) in a follow-up and tighten the bound. (2) Add test cases for the signed-out paths (issues/new and report as a guest, a toolbar preview with ?env=pull) so the access and pull phases are covered, and reuse publicRepo in reportPage rather than inlining its logic.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs