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
Check · Review · Land · Live done — Landed and live in production.
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
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:
| Route | Phases |
|---|---|
/:owner/:name/issues/new | session, repo, render (access also appears when signed out) |
…/report | session, repo, access, render |
…/toolbar | session, repo, app-row, live, runs, render (pull also appears on a preview) |
…/make-it-yours | session, repo, plan, render |
What changed
- Toolbar and make-it-yours: they already named most phases but skipped
renderon their 404, sign-in and refused-plan exits, which is why they were still inUNNAMED. Those exits now namerender. - Toolbar: its production "Live:" line (a git commit-log read) is now the
livephase. - Make-it-yours: the refusal branches moved into a
planRefusedfunction with no change in behaviour. - Report: the page body moved into
reportBodyso the whole render can be timed. - Test files:
test/server-timing-sweep.test.tsdrops the four entries. The newtest/repo-pages-timing.test.tsasserts each route's exact phase names and thatappis 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. 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.
The four pages now name their Server-Timing phases and are off
UNNAMED, but the phases don't add up to within 1 ms oftotal, so that part of the issue isn't met.appis 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 thanapp. The new test checks that the phases never exceedapp, and that over eleven warm requests the median share they cover is at least 0.4 ofapp. It's the same boundtest/front-timing.test.tsuses. I did not touchsrc/http/server.tsto close the gap.bun x tsc --noEmitis clean, as isbun 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:
/:owner/:name/issues/newsession,repo,render(accessalso appears when signed out)…/reportsession,repo,access,render…/toolbarsession,repo,app-row,live,runs,render(pullalso appears on a preview)…/make-it-yourssession,repo,plan,renderWhat changed
renderon their 404, sign-in and refused-plan exits, which is why they were still inUNNAMED. Those exits now namerender.livephase.planRefusedfunction with no change in behaviour.reportBodyso the whole render can be timed.test/server-timing-sweep.test.tsdrops the four entries. The newtest/repo-pages-timing.test.tsasserts each route's exact phase names and thatappis 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
renderphase 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-timingresponse header.Closes #4321