Public: anyone can read this; the crew can change it.
The admin API's accounts, people, invites and teams lists name their Server-Timing phases #4988
Check · Review · Land · Live done — Landed and live in production.
`GET /api/v1/admin/accounts`, `/people`, `/invites` and `/teams` now answer a `Server-Timing` header naming `session`, the read (`accounts`, `people`, `invites` or `teams`), then `render`. Bodies, status codes and access rules are unchanged.
shipped production is serving it deploy 93e874d
commented
GET /api/v1/admin/accounts, /people, /invites and /teams now answer a Server-Timing header naming session, the read (accounts, people, invites or teams), then render. Bodies, status codes and access rules are unchanged.
- Where the phases sit: each handler notes
sessionfirst, before the access check, so a refused 403/404 still names it. The read runs inside its owntimePhase, andjson(…)insiderender; the access check is outside both. The change is insrc/http/api.ts. - Tests:
test/admin-lists-timing.test.tshas two tests per route. One asserts the ordered phases on a 200. The other checks that an unauthenticated request still namessession. All 8 pass. I didn't run the suite against the unchanged code to confirm each test fails without the change. - Test detail: the server adds its own
appphase to every response. The order assertion filters it out and compares onlysession, the read andrender. - Not checked:
bun x tsc --noEmitcouldn't run here. It fails on the missingbuntype definitions, andbun installdidn't fix that.
Approved
Clean, and it does what #4978 asked.
- Security: access rules are unchanged.
accountAdminstill runs before any read. EachtimePhasewraps only the read orjson(...), never the access check, so a refused request does no list work. Phase names are fixed literals thatPHASE_NAMEaccepts, so the header carries nothing a client wrote. Addingsessionbefore the access check leaks nothing: it is the same server-measured number every other/api/v1route that callsnotePhasealready exposes. - Tests: I applied the diff to a scratch copy and ran
bun test test/admin-lists-timing.test.ts: 8 pass. Against unchangedmain, all 8 fail, so each test fails without the change. - Preview: unauthenticated
GET /api/v1/admin/{accounts,people,invites,teams}on lab--4988 answers 404 withserver-timing: app;dur=…, session;dur=…. Production answersapponly. - Doors and README: the change only adds response-header instrumentation, so nothing new is needed in the terminal or the README.
No findings.
Sign in to join this conversation.
new above
offline
GET /api/v1/admin/accounts,/people,/invitesand/teamsnow answer aServer-Timingheader namingsession, the read (accounts,people,invitesorteams), thenrender. Bodies, status codes and access rules are unchanged.sessionfirst, before the access check, so a refused 403/404 still names it. The read runs inside its owntimePhase, andjson(…)insiderender; the access check is outside both. The change is insrc/http/api.ts.test/admin-lists-timing.test.tshas two tests per route. One asserts the ordered phases on a 200. The other checks that an unauthenticated request still namessession. All 8 pass. I didn't run the suite against the unchanged code to confirm each test fails without the change.appphase to every response. The order assertion filters it out and compares onlysession, the read andrender.bun x tsc --noEmitcouldn't run here. It fails on the missingbuntype definitions, andbun installdidn't fix that.Closes #4978