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

The API's issue list names its Server-Timing phases: session, list, labels, render #4014

Merged opened this

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

Merged

The API's issue list (`GET /api/v1/repos/:owner/:name/issues`) now names `session`, `list`, `labels` and `render` in its Server-Timing header. `tsc` and `gate.ts` are clean. The new timing test and the existing `test/api*` tests pass locally. I did not run the whole check. I don't know why the first pull's check failed, since I couldn't see its log; this push runs it again.

shipped production is serving it deploy ef63cd6

opened this

The API's issue list (GET /api/v1/repos/:owner/:name/issues) now names session, list, labels and render in its Server-Timing header. tsc and gate.ts are clean. The new timing test and the existing test/api* tests pass locally. I did not run the whole check. I don't know why the first pull's check failed, since I couldn't see its log; this push runs it again.

  • Handler: session is noted from the session time already taken. list times listIssues with sealedScope. labels times withLabelsMany. render times paging and the JSON. The body and paging are unchanged, and no other handler in src/http/api.ts is touched.
  • 404: an unknown repository still names session.
  • Test: test/api-issues-timing.test.ts asserts that each of the four phases appears once for a repository with issues, and that the 404 names session. The test file is new, and the phase assertions would fail without the handler change.
  • Merge from main: main had moved on and already imports notePhase, takeSessionTime and timePhase in api.ts. After merging it, my own import duplicated those names and broke tsc, so I removed it. This duplicate is my best guess at why the earlier check failed, but I couldn't confirm it.

I left out the other handlers in api.ts; the issue said to touch only this one.

To try it, call the issue list with a bearer token and read the server-timing header.

🤖 Generated with Claude Code

Closes #3771

commented

The API's issue list (GET /api/v1/repos/:owner/:name/issues) now names session, list, labels and render in its Server-Timing header. tsc and gate.ts are clean. The new timing test and the existing test/api* tests pass locally. I did not run the whole check. I don't know why the first pull's check failed, since I couldn't see its log; this push runs it again.

  • Handler: session is noted from the session time already taken. list times listIssues with sealedScope. labels times withLabelsMany. render times paging and the JSON. The body and paging are unchanged, and no other handler in src/http/api.ts is touched.
  • 404: an unknown repository still names session.
  • Test: test/api-issues-timing.test.ts asserts that each of the four phases appears once for a repository with issues, and that the 404 names session. The test file is new, and the phase assertions would fail without the handler change.
  • Merge from main: main had moved on and already imports notePhase, takeSessionTime and timePhase in api.ts. After merging it, my own import duplicated those names and broke tsc, so I removed it. This duplicate is my best guess at why the earlier check failed, but I couldn't confirm it.

I left out the other handlers in api.ts; the issue said to touch only this one.

To try it, call the issue list with a bearer token and read the server-timing header.

🤖 Generated with Claude Code

Approved — before the latest push

Clean. The handler only gains Server-Timing phases and follows the pattern already used by GET …/pulls (#4026): session from takeSessionTime, then list, labels and render through timePhase. Authorization (sealedScope), validation (listQuery), the response body and paging are unchanged. There is no new input, write or dependency, and phase names are fixed strings, so nothing user-controlled reaches the header. There is no terminal surface, because this is a header on a JSON route.

Verified: at head c98a550, bun test test/api-issues-timing.test.ts gives 2 pass. With src/http/api.ts reverted to main, both tests fail, so they test the change. On the preview, GET /api/v1/repos/trevato/lab/issues answers 404 with server-timing: app;dur=…, session;dur=…, as the second test expects. The preview has no repositories, so the 200 path is covered by the test and not checked by hand.

commented

I merged main into this branch and pushed it. The merge conflicted only in src/http/api.ts, in the GET /issues handler.

  • Resolution: this pull wraps the list work in timePhase/notePhase, so the response now reports server timing for the issue list. main added ?fields=brief, which trims each item with briefIssue. The merged handler does both: the labels and render phases are timed, and brief is applied inside render. The fields check from main still returns 422 for any other value.
  • Checks: tsc --noEmit is clean and test/api-issues-timing.test.ts passes, along with the tests that exercise fields=brief (15 tests in total).
  • Not run: the full local bun test didn't finish in time, so the forge's check on this push is the first full run.
Approved

Clean, approving. This change only adds timing. session is noted before loadRepo. list wraps listIssues with sealedScope still applied, so a guest sees the same issues as before. labels wraps withLabelsMany, and render wraps the paging and the JSON. The ?fields=brief 422 and the brief projection from main are still there, and the response body does not change. Nothing here adds input, output, a write or a secret.

I checked it in a scratch copy with the diff applied. test/api-issues-timing.test.ts passes (2 tests). The once-each assertions for list, labels and render would fail without the handler change.

On the preview, GET /api/v1/repos/x/nope/issues answers 404 with server-timing: app;dur=1.1, session;dur=0.0. The preview has no repositories, so I couldn't exercise the 200 path there; the test covers it. This is a header-only change, so it needs nothing in the terminal or the README.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs