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

GET …/runs/{id} names its Server-Timing phases: session, run, render #5333

Merged opened this

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

Merged

Server-Timing on `GET /api/v1/repos/:owner/:name/runs/:id` now names `session`, `run` and `render`, but I couldn't confirm the branch is on the forge. `git push` answers "Everything up-to-date", yet `git ls-remote` doesn't list `scout/5316-…`. My attempts to push to it explicitly gave the same answer. Check that the branch exists before relying on this. If it doesn't, the commit is `b6d9b1a2`.

shipped production is serving it deploy f0961d3

opened this

Server-Timing on GET /api/v1/repos/:owner/:name/runs/:id now names session, run and render, but I couldn't confirm the branch is on the forge. git push answers "Everything up-to-date", yet git ls-remote doesn't list scout/5316-…. My attempts to push to it explicitly gave the same answer. Check that the branch exists before relying on this. If it doesn't, the commit is b6d9b1a2.

What changed (src/http/api.ts, only the single-run handler; the log handler below it is untouched)

  • session is marked first, so a missing repository gives a 404 that names only session.
  • run wraps getRepoRun and carriedBy. An unknown run gives a 404 naming session and run.
  • render wraps the JSON answer.
  • The answer body is the same as before: the run plus carries.

Tests (test/api-runs-timing.test.ts)

  • One test asserts a found run gives 200, the names session, run, render in that order, and carries equal to []. A second asserts an unknown run gives a 404 with the names session, run.
  • The file passes (4 tests). test/studio-runs.test.ts passes (43 tests); that's where the two earlier pulls failed, and I don't think this change causes those failures.
  • I did not run the full bun test.
  • bun x tsc --noEmit couldn't check types here: it reports the type definitions for bun as missing, and I didn't run bun install first.

Left out: the log handler, which #3782 covers.

To try it: curl -si $URL/api/v1/repos/alice/r/runs/<id> and read the Server-Timing header.

🤖 Generated with Claude Code

Closes #5316

commented

Server-Timing on GET /api/v1/repos/:owner/:name/runs/:id now names session, run and render, but I couldn't confirm the branch is on the forge. git push answers "Everything up-to-date", yet git ls-remote doesn't list scout/5316-…. My attempts to push to it explicitly gave the same answer. Check that the branch exists before relying on this. If it doesn't, the commit is b6d9b1a2.

What changed (src/http/api.ts, only the single-run handler; the log handler below it is untouched)

  • session is marked first, so a missing repository gives a 404 that names only session.
  • run wraps getRepoRun and carriedBy. An unknown run gives a 404 naming session and run.
  • render wraps the JSON answer.
  • The answer body is the same as before: the run plus carries.

Tests (test/api-runs-timing.test.ts)

  • One test asserts a found run gives 200, the names session, run, render in that order, and carries equal to []. A second asserts an unknown run gives a 404 with the names session, run.
  • The file passes (4 tests). test/studio-runs.test.ts passes (43 tests); that's where the two earlier pulls failed, and I don't think this change causes those failures.
  • I did not run the full bun test.
  • bun x tsc --noEmit couldn't check types here: it reports the type definitions for bun as missing, and I didn't run bun install first.

Left out: the log handler, which #3782 covers.

To try it: curl -si $URL/api/v1/repos/alice/r/runs/<id> and read the Server-Timing header.

🤖 Generated with Claude Code

Approved

Clean, and it matches the pattern the neighbouring routes use (GET …/runs, profiles, /user). The route now reports session up front, puts the run lookup and its carriedBy read inside run, and serialises inside render.

Security: nothing about access changes. getRepoRun still gets ctx.auth.user and the loaded repo, so private runs stay hidden. carriedBy only runs when the read succeeded, so an unknown or hidden run returns the same 404 as before and the timing header only says that a lookup happened. The response body is the same as before.

Tests: at head b6d9b1a2, bun test test/api-runs-timing.test.ts passes 4/4. Both new cases would fail without the change: the 200 case names session/run/render and checks that id and carries are unchanged, and the 404 case names session/run.

Preview: the preview has no repositories, so I could only try the not-found door. An unknown repo's run returns 404 with server-timing: app, session, as the existing test expects. The 200 path is covered by the test. No page or tty surface is involved; this is an API timing header only.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs