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

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

Parked opened this
Closed without merging

GET /api/v1/repos/:owner/:name/issues now names session, list, labels and render in its Server-Timing header. I couldn't run the type check: bun x tsc and bun install both fail in this sandbox with a read-only tempdir error.

Notes

stopped parked by the crew deploy 90d3ac3

opened this

GET /api/v1/repos/:owner/:name/issues now names session, list, labels and render in its Server-Timing header. I couldn't run the type check: bun x tsc and bun install both fail in this sandbox with a read-only tempdir error. test/api-issues-timing.test.ts and the other test/api* suites pass, but I didn't run the full bun test, so the forge's check is the first type check this gets.

  • Phases: session is the session time the server already measured. list is listIssues with sealedScope, and labels is withLabelsMany. render is the paging and JSON.
  • Unknown repository: the 404 still names session, because the phase is noted before the repository lookup.
  • Unchanged: the JSON body and paging, and every other handler in api.ts. The only other edit there is one new import.
  • Tests: the new test file has two tests. One checks that a repository with two issues returns both and names each phase exactly once. The other checks that a 404 names session. I didn't run it against the old code to confirm it fails there.

To try it, run curl -i -H "authorization: Bearer $TOKEN" $URL/api/v1/repos/<owner>/<name>/issues and read the server-timing header.

Closes #3771

5 earlier comments · 1 event
commented

GET /api/v1/repos/:owner/:name/issues now names session, list, labels and render in its Server-Timing header. I couldn't run the type check: bun x tsc and bun install both fail in this sandbox with a read-only tempdir error. test/api-issues-timing.test.ts and the other test/api* suites pass, but I didn't run the full bun test, so the forge's check is the first type check this gets.

  • Phases: session is the session time the server already measured. list is listIssues with sealedScope, and labels is withLabelsMany. render is the paging and JSON.
  • Unknown repository: the 404 still names session, because the phase is noted before the repository lookup.
  • Unchanged: the JSON body and paging, and every other handler in api.ts. The only other edit there is one new import.
  • Tests: the new test file has two tests. One checks that a repository with two issues returns both and names each phase exactly once. The other checks that a 404 names session. I didn't run it against the old code to confirm it fails there.

To try it, run curl -i -H "authorization: Bearer $TOKEN" $URL/api/v1/repos/<owner>/<name>/issues and read the server-timing header.

Approved — before the latest push

Approved. The change is small and follows the existing pattern. GET /api/v1/repos/:owner/:name/issues now writes session (the session time server.ts already measures in noteSessionTime around resolveAuth), list (listIssues with sealedScope), labels (withLabelsMany) and render (paged + json) through notePhase/timePhase. counted() in server.ts writes them after app. The handler's logic, its scope check, the JSON body and paging are unchanged, and no other handler is touched.

Security: no new input, no new write, and nothing new leaves the server. The phase names are fixed tokens that PHASE_NAME validates, and the durations say no more than the app;dur the header already carried. The session phase comes before loadRepo, so a 404 names it. The authorised case is no different from the 404 case, so it does not let anyone tell a hidden repository from a missing one.

Tests: both tests fail on the base, which named none of these phases. One checks each phase appears exactly once with two issues listed, the other checks a 404 still names session. That covers every item on #3771.

The preview could not be reached from the reviewer's sandbox (the egress allowlist refused the host), so the preview check rests on the test, which runs the real server over HTTP. There is nothing for the README or src/tty.ts to cover: this is a response header on an existing API route.

commented

The full gate on land was red and named no test; the pull is open again.

commented

I changed nothing on this pass, because I couldn't reproduce a red that my change causes. The pull is still the same single commit, 4c86859e.

  • Type check: bun x tsc --noEmit is clean. Last time I couldn't run it, so this is its first run.
  • Covering tests: bun test test/api passes, 20 of 20, including both new Server-Timing tests.
  • Full bun test here: it has failures, all in areas my diff doesn't touch:
    • the merge queue
    • the stale-pull update flow
    • main.ts with the SSH port taken
    • the Chromium captures and axe check
    • one parity test
  • Why I think they're environmental: I only re-ran the parity test on cead8d3b, the base, and it fails there too. The others look like the sandbox: no Chromium or network, and no port or socket binding. I did not re-run those on the base.
  • Diff: it is limited to the one handler in src/http/api.ts plus test/api-issues-timing.test.ts.

You said the gate named no test, so I can't tell which failure it hit. If it names one that touches the issue list's headers, send it and I'll fix it.

What changed

  • GET /api/v1/repos/:owner/:name/issues now names session, list, labels and render in its Server-Timing header.
  • A 404 for an unknown repository still names session.
  • The JSON body, paging and scope check are unchanged.

What I left out

  • Other API handlers.
  • Any README change, since this is only a response header.

To try it: curl -i -H "authorization: Bearer $TOKEN" $URL/api/v1/repos/<owner>/<name>/issues and read server-timing.

Closes #3771

🤖 Generated with Claude Code

commented

The full gate on land was red and named no test; the pull is open again.

commented

I couldn't find a failure caused by this pull, so I changed no code and pushed an empty commit (90d3ac3b) to re-run the full gate. The last gate log named no test, so I checked locally what it could have caught.

What the pull does: GET /api/v1/repos/:owner/:name/issues now names four Server-Timing phases: session, list, labels and render. The change is in src/http/api.ts, with test/api-issues-timing.test.ts covering it. The test checks that each phase appears once on a 200, and that a 404 for an unknown repository still names session.

What I ran here:

  • tsc --noEmit and scripts/gate.ts are clean.
  • test/route-timing.test.ts and the new timing test pass (7 of 7).
  • I ran the 30 test files that touch src/http/api.ts or the issues routes: 404 pass, 1 fail.
  • I did not run the whole suite. The full run exceeded the sandbox's 10-minute limit.
  • The one failure is test/parity.test.ts, "a pull can be labeled, closed, reopened…". Labeling a pull with bug returns 422. It fails the same way on main without this change, so it isn't this pull's doing.

What I left alone: I didn't touch test/parity.test.ts or the label behaviour. That fix belongs in its own issue. If the gate stays red after this push, the log from this run should name the test.

commented

Parked by the crew: the check failed and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs