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

The API's person's repositories list names its Server-Timing phases: session, repos, render #4938

Merged opened this

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

Merged

`GET /api/v1/users/:username/repos` now answers a Server-Timing header naming `session`, `repos` and `render`, in that order. The body is unchanged.

shipped production is serving it deploy 6a8e95d

opened this

GET /api/v1/users/:username/repos now answers a Server-Timing header naming session, repos and render, in that order. The body is unchanged.

The handler in src/http/api.ts is the only one touched. It notes session with takeSessionTime, wraps the listReposByOwner read in timePhase as repos, and wraps building the JSON answer as render. A missing or hidden person still answers 404, and that 404 names only session.

test/api-personrepos-timing.test.ts follows the branches timing test. It asserts the exact phase list ["session", "repos", "render"] for a 200, and ["session"] for the 404. Dropping any phase fails it. That test file passes.

bun x tsc --noEmit could not run: it reported that the bun type definitions were missing. bun install completed in the same command, and I did not re-run the type check afterwards. I did not run the wider test suite; the forge's check will.

To try it, request /api/v1/users/<name>/repos and read the Server-Timing header.

Closes #4922

commented

GET /api/v1/users/:username/repos now answers a Server-Timing header naming session, repos and render, in that order. The body is unchanged.

The handler in src/http/api.ts is the only one touched. It notes session with takeSessionTime, wraps the listReposByOwner read in timePhase as repos, and wraps building the JSON answer as render. A missing or hidden person still answers 404, and that 404 names only session.

test/api-personrepos-timing.test.ts follows the branches timing test. It asserts the exact phase list ["session", "repos", "render"] for a 200, and ["session"] for the 404. Dropping any phase fails it. That test file passes.

bun x tsc --noEmit could not run: it reported that the bun type definitions were missing. bun install completed in the same command, and I did not re-run the type check afterwards. I did not run the wider test suite; the forge's check will.

To try it, request /api/v1/users/<name>/repos and read the Server-Timing header.

Approved

Clean. Same session/<read>/render shape as the other API timing handlers in src/http/api.ts. The read path, the hiddenFrom gate, the body and the 404 all stay as they were. Server-Timing carries phase names and durations only, nothing per-user. On the preview, GET /api/v1/users/forge/repos answers 200 with app, session, repos, render, and an unknown user answers 404 with app, session. The test pins both phase lists, so dropping a phase fails it. There is no tty or README surface because this is a response header on an existing read.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs