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

Merged opened this

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

Merged

`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

opened this

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)

  • session comes from takeSessionTime. repo is the origin repository lookup. Both are noted in browseScope, so every browse page now reports them, not just these two.
  • browseHome also reports refs and tree, one per origin read. They run in parallel, so each is measured from the same start. It then reports render.
  • browsePaths reports paths for its origin read and render for 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 session and repo through browseScope, but no read or render phases of their own.

Try it bun test test/browse-origin-timing.test.ts

Closes #3604

commented

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)

  • session comes from takeSessionTime. repo is the origin repository lookup. Both are noted in browseScope, so every browse page now reports them, not just these two.
  • browseHome also reports refs and tree, one per origin read. They run in parallel, so each is measured from the same start. It then reports render.
  • browsePaths reports paths for its origin read and render for 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 session and repo through browseScope, but no read or render phases of their own.

Try it bun test test/browse-origin-timing.test.ts

Approved

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:

  1. The render phase 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.
  2. 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.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs