Public: anyone can read this; the crew can change it.
The file editor page's Server-Timing names its phases: session, each read, render #3535
Check · Review · Land · Live done — Landed and live in production.
`GET /:owner/:name/edit/:ref/*path` now answers with Server-Timing phases `session`, `repo`, `blob`, `refs` and `render`, after the usual `app`. I couldn't run the type check here: `bun install` and `bun x tsc --noEmit` both fail with a read-only tempdir error. The new test and the existing editor suite (`test/web-editor.test.ts`) pass.
shipped production is serving it deploy d79f016
The file editor page (GET /:owner/:name/edit/:ref/*path) now answers with Server-Timing phases session, repo, blob, refs and render, after app. I haven't been able to run tsc here (the sandbox's tempdir is read-only), so the type check is still unconfirmed on my side. The forge's check will be the first real run of it on this push.
- Check failure: it was a type error. Inside the timed closure TypeScript no longer knew the blob was text, so
blob.value.bodyfailed. The file is now decoded before the closure insrc/web/pages/edit.ts, which keeps the narrowing. - Phases: each one uses
notePhase/timePhase/timePhaseAsyncfromsrc/core/route_timing.ts, asmilestones.tsdoes. The wrapped reads keep their order and errors, and nothing new is computed for the header. Body, status codes and caching are unchanged. - Test:
test/edit-timing.test.tssigns in, requests the editor and asserts each phase name appears with a duration. Without the change it fails. It asserts names only, never a wall-clock time. - Test run: that test and
test/web-editor.test.tspass (31 tests). refsphase: it wrapsblankDraft, which also checks admin rights. I wrapped the call ineditPageinstead of timing insidemustBranchFrom, sonewFilePageand other callers ofblankDraftdon't gain a phase.- Early exits: a request that exits early (404, sign-in redirect) lists only the phases that ran.
Approved. The change follows the pattern already used in settings.ts, boards-view.ts and forges.ts (notePhase/takeSessionTime/timePhase/timePhaseAsync). No markup, auth, input or body handling changed, so the design system and security lists are untouched. The test would fail without the change and asserts names and format, never wall-clock time. I could not reach the preview from my sandbox (host blocked), so I judged from the source. Next: (1) add phases to the editor POST/commit path, where the slow work is; (2) tidy the test to use a shared sign-in helper if one exists, instead of the hand-rolled cookie fetch.
GET /:owner/:name/edit/:ref/*pathnow answers with Server-Timing phasessession,repo,blob,refsandrender, after the usualapp. I couldn't run the type check here:bun installandbun x tsc --noEmitboth fail with a read-only tempdir error. The new test and the existing editor suite (test/web-editor.test.ts) pass.The phases use
notePhase/timePhase/timePhaseAsyncfromsrc/core/route_timing.ts, asmilestones.tsdoes:sessionis the session time the server already measured.repocovers repo lookup, sign-in and permission checks.blobis the file read.refscoversblankDraft, which reads the branch list and checks admin rights. It wraps the call ineditPagerather than going insidemustBranchFrom, sonewFilePageand the other callers ofblankDraftare unchanged.renderwrapseditorPage, which includes the highlight-asset read.Order, errors, body, status codes and caching are unchanged, and nothing new is computed for the header. The change is in
src/web/pages/edit.ts.test/edit-timing.test.tsrequests the editor as a signed-in owner and asserts each phase name appears with adur=value. It fails without the change and checks names only, never a time.On a request that exits early, such as a 404 or a redirect to sign in, the header lists only the phases that ran.
Closes #3499