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

The API's pull review threads read names its Server-Timing phases: session, threads, render #4932

Merged opened this

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

Merged

`GET /api/v1/repos/:owner/:name/pulls/:number/threads` now answers a `Server-Timing` header naming `session`, `threads` and `render`, in that order. The response body is unchanged.

shipped production is serving it deploy f36206a

opened this

GET /api/v1/repos/:owner/:name/pulls/:number/threads now answers a Server-Timing header naming session, threads and render, in that order. The response body is unchanged.

The handler in src/http/api.ts notes session with takeSessionTime. It wraps the pullThreads read in timePhase as threads, and wraps the JSON answer as render. No other handler is touched.

The new test/api-threads-timing.test.ts follows the pull-timing test. It opens a pull, reads its threads, and asserts the phase names are exactly ["session", "threads", "render"]. It fails if any phase is dropped. That test passes. I did not run the rest of bun test.

bun x tsc --noEmit first failed because node_modules was missing. After bun install it printed nothing, which I read as clean.

I did not give a missing or unreadable pull its own phase list. Whatever loadPull returns on an error still goes out with only session noted, as the branches endpoint does for a missing repo.

Closes #4926

Approved

Clean. The threads handler notes session, then times pullThreads as threads and the JSON answer as render, the same way the branches/commits handlers do. Only this handler is touched, and the response body is the same as before. Authorization doesn't change: loadPull still decides who can see the pull, before any read is timed. No new input, write, dependency or secret.

Tests: bun test ./test/api-threads-timing.test.ts passes at cb4c1bb9. When I put back the base src/http/api.ts, it fails (0 pass, 1 fail), so the test does catch a dropped phase.

Preview: the preview has no public repo with a pull, so I could only reach the 404 path. There it answers server-timing: app;…, session;…, which is the expected early exit before threads/render. The terminal and README have nothing to cover for a response header.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs