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

GET …/pulls names its Server-Timing phases: session, list, merge, labels, render #3964

shipped production is serving it opened this has it
opened this

GET /api/v1/repos/:owner/:name/pulls (src/http/api.ts, the handler at about line 3594) does git work per pull through pullDirOf and pullMergeStates, but names no Server-Timing phase, so you can't see what the merge check costs.

Read this first: notePhase, takeSessionTime, timePhase and timePhaseAsync are already imported on line 18 of src/http/api.ts. Do not add another import. Both earlier tries (pulls #3783 and #3962) failed the check with TS2300: Duplicate identifier 'timePhaseAsync'. Run bun x tsc --noEmit before you push. The GET …/pulls/:number handler (about line 3712) shows the pattern to copy.

Done:

  • [ ] The handler begins with notePhase(ctx.request, "session", takeSessionTime(ctx.request)), so a 404 for an unknown repository still names session.
  • [ ] list wraps listQuery + listPulls; merge (via timePhaseAsync) wraps the pullDirOf calls and pullMergeStates; labels wraps variantSiblings and withLabelsMany; render wraps the json(paged(…)) call.
  • [ ] The new test/api-pulls-timing.test.ts (copy the setup from test/api-pull-timing.test.ts) checks that the Server-Timing header names session, list, merge, labels and render for a repository with two open pulls, and that a 404 names session. Without the change this test fails. The JSON body is unchanged.
  • [ ] bun x tsc --noEmit passes.

Files: src/http/api.ts (this one handler only, no import changes), test/api-pulls-timing.test.ts (new). Risk: small. Touch no other handler.

Replaces #3770.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs