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

A repository's toolbar page's Server-Timing names its phases: session, each read, render #3537

Merged opened this

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

Merged

`GET /:owner/:name/toolbar` now names its phases in `Server-Timing`. The type check didn't run: `tsc` isn't installed here and `bun x tsc` failed on a read-only temp dir. The new test and `test/toolbar-actions.test.ts` pass (18 tests).

shipped production is serving it deploy 40e21c3

opened this

GET /:owner/:name/toolbar now names its phases in Server-Timing. The type check didn't run: tsc isn't installed here and bun x tsc failed on a read-only temp dir. The new test and test/toolbar-actions.test.ts pass (18 tests).

  • Phases:

- session is the time spent resolving the session. - repo is the repository load. - app-row is the app-record lookup. I didn't call it app because app is already the total. - pull appears only when env=pull-N. - runs is the live-run read, so it appears only for a signed-in viewer. - render is page assembly.

  • Signed out: the early return reports session, repo, app-row and render.
  • Unchanged: the body, status codes and caching. Each read still runs in its original order and throws what it threw before; only the wrapping is new.
  • Files: only src/web/studio/toolbar.ts and the new test/toolbar-page-timing.test.ts. The test requests the page signed in and checks that each phase name appears with a duration. It checks names only, never a wall-clock time.
  • Left out: pull is not in that test, since it needs a preview pull. The POST /toolbar/comment handler is untouched.

Try it with curl -si -b <session cookie> localhost:PORT/alice/forge/toolbar | grep -i server-timing.

🤖 Generated with Claude Code

Closes #3529

commented

GET /:owner/:name/toolbar now names its phases in Server-Timing. The type check didn't run: tsc isn't installed here and bun x tsc failed on a read-only temp dir. The new test and test/toolbar-actions.test.ts pass (18 tests).

  • Phases:

- session is the time spent resolving the session. - repo is the repository load. - app-row is the app-record lookup. I didn't call it app because app is already the total. - pull appears only when env=pull-N. - runs is the live-run read, so it appears only for a signed-in viewer. - render is page assembly.

  • Signed out: the early return reports session, repo, app-row and render.
  • Unchanged: the body, status codes and caching. Each read still runs in its original order and throws what it threw before; only the wrapping is new.
  • Files: only src/web/studio/toolbar.ts and the new test/toolbar-page-timing.test.ts. The test requests the page signed in and checks that each phase name appears with a duration. It checks names only, never a wall-clock time.
  • Left out: pull is not in that test, since it needs a preview pull. The POST /toolbar/comment handler is untouched.

Try it with curl -si -b <session cookie> localhost:PORT/alice/forge/toolbar | grep -i server-timing.

🤖 Generated with Claude Code

Approved

Approved. No visible UI change, so docs/DESIGN.md is untouched. Timing is wrapped around the existing reads in their original order, with the same names and helpers as pages/repo.ts. No new write path, dependency or secret. The test covers the signed-in phases. I could not curl the preview: this sandbox blocks the host, so I judged the source and the test only.

Two things I would do next:

  1. Add a signed-out case to the test (session, repo, app-row, render, and no runs). That early return is new behaviour with no test.
  2. Tidy toolbar.ts: the app-row line is over-long and where.pull! is a needless assertion. Narrow where.pull into a const first. Also fold the two render timers into one rendering start.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs