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

The API's comment pages names its Server-Timing phases: session, comments, render #4939

Merged opened this

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

Merged

`GET /api/v1/repos/:owner/:name/issues/:number/comments` now answers a `Server-Timing` header naming `session`, `comments` and `render`, in that order. The `tsc --noEmit` check, the new test and the existing `test/api*` tests pass. I did not run the full `bun test`, which the forge's check runs on push.

shipped production is serving it deploy fc82d1a

opened this

GET /api/v1/repos/:owner/:name/issues/:number/comments now answers a Server-Timing header naming session, comments and render, in that order. The tsc --noEmit check, the new test and the existing test/api* tests pass. I did not run the full bun test, which the forge's check runs on push.

  • Handler: only this handler in src/http/api.ts changed. It notes session with takeSessionTime, wraps the listComments read and page slice in a comments phase, and builds the JSON in a render phase. The response body is unchanged.
  • Test: test/api-comments-timing.test.ts follows the branches timing test. It creates an issue with one comment and asserts the header names exactly session, comments, render. Dropping any of the three fails it.
  • Left out: loadConversation is not its own phase, since the issue didn't ask for one. A 404 for a missing issue or repository therefore names only session, and I didn't add a test for that case.

Closes #4923

commented

GET /api/v1/repos/:owner/:name/issues/:number/comments now answers a Server-Timing header naming session, comments and render, in that order. The tsc --noEmit check, the new test and the existing test/api* tests pass. I did not run the full bun test, which the forge's check runs on push.

  • Handler: only this handler in src/http/api.ts changed. It notes session with takeSessionTime, wraps the listComments read and page slice in a comments phase, and builds the JSON in a render phase. The response body is unchanged.
  • Test: test/api-comments-timing.test.ts follows the branches timing test. It creates an issue with one comment and asserts the header names exactly session, comments, render. Dropping any of the three fails it.
  • Left out: loadConversation is not its own phase, since the issue didn't ask for one. A 404 for a missing issue or repository therefore names only session, and I didn't add a test for that case.
Approved

Does what #4923 asks and nothing else. Only the one handler changed: it notes session with takeSessionTime, wraps the listComments read and the slice in comments, and builds the JSON in render. This follows the branches and pulls handlers. The response body is unchanged, and so are the limit/after checks and the loadConversation visibility gate, which still runs before any read.

Security: nothing new. There is no new input, the header carries only phase names and durations, no identity or data leaks into it, and a sealed or private thread is still a 404.

Preview: a guest asking for a missing or unseen thread gets a 404 with server-timing: app;dur=…, session;dur=…, as the pull description says. The preview has no public repository a guest can open, so I checked the 200 path through the new test: it asserts the exact [session, comments, render] order and fails if any phase is dropped.

Nit, not blocking: there is a stray double blank line before the test.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs