Public: anyone can read this; the crew can change it.
A connected origin's repository browse pages name their Server-Timing phases: session, the origin read, render #3607
Check · Review · Land · Live done — Landed and live in production.
`browseHome` and `browsePaths` now name their phases in `Server-Timing` instead of reporting one opaque number. The new tests and `test/web-browse.test.ts` pass (24 tests); I couldn't run the type check, because `bun x tsc` failed in the sandbox ("unable to write files to tempdir"). The new tests fail with the `src` change stashed.
shipped production is serving it deploy 20352e6
browseHome and browsePaths now name their phases in Server-Timing instead of reporting one opaque number. The new tests and test/web-browse.test.ts pass (24 tests); I couldn't run the type check, because bun x tsc failed in the sandbox ("unable to write files to tempdir"). The new tests fail with the src change stashed.
What changed (src/web/pages/browse.ts)
sessioncomes fromtakeSessionTime.repois the origin repository lookup. Both are noted inbrowseScope, so every browse page now reports them, not just these two.browseHomealso reportsrefsandtree, one per origin read. They run in parallel, so each is measured from the same start. It then reportsrender.browsePathsreportspathsfor its origin read andrenderfor building the JSON response.- The pages render exactly as before. I added no caching.
Test file name
test/browse-timing.test.ts already exists. It covers the local tree and blob pages (#3224). So the new test is test/browse-origin-timing.test.ts, and I left the old one alone. It serves a fake origin over loopback, connects as the person, GETs both pages, and checks the phase names.
What I left out
- The other browse pages (tree, branches and so on) get
sessionandrepothroughbrowseScope, but no read orrenderphases of their own.
Try it
bun test test/browse-origin-timing.test.ts
Approved. Header-only change: no page markup, no new input, no write path, so design-system, security and JS-off concerns do not apply. It follows the existing notePhase/takeSessionTime pattern, and the new test covers both pages and fails without the src change.
Two things to do next:
- The
renderphase in browsePaths times only building a small JSON object, so it is near zero and says little. Drop it, or name it for what it is. Likewise, the other browse pages (tree, branches, blob) now report session and repo but no read or render phases; give them the same treatment in a follow-up. - refs and tree are both measured from the same start because they run in parallel. Say so once in a short comment or the README so nobody sums them.
browseHomeandbrowsePathsnow name their phases inServer-Timinginstead of reporting one opaque number. The new tests andtest/web-browse.test.tspass (24 tests); I couldn't run the type check, becausebun x tscfailed in the sandbox ("unable to write files to tempdir"). The new tests fail with thesrcchange stashed.What changed (
src/web/pages/browse.ts)sessioncomes fromtakeSessionTime.repois the origin repository lookup. Both are noted inbrowseScope, so every browse page now reports them, not just these two.browseHomealso reportsrefsandtree, one per origin read. They run in parallel, so each is measured from the same start. It then reportsrender.browsePathsreportspathsfor its origin read andrenderfor building the JSON response.Test file name
test/browse-timing.test.tsalready exists. It covers the local tree and blob pages (#3224). So the new test istest/browse-origin-timing.test.ts, and I left the old one alone. It serves a fake origin over loopback, connects as the person, GETs both pages, and checks the phase names.What I left out
sessionandrepothroughbrowseScope, but no read orrenderphases of their own.Try it
bun test test/browse-origin-timing.test.tsCloses #3604