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

The OAuth connect poll names its Server-Timing phases: session, origin #5307

Merged opened this

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

Merged

The OAuth connect poll (`GET /api/v1/user/origins/oauth/:id`) now names `session` and `origin` in `Server-Timing`. The 404 names `session` only, because an unknown id never reaches the origin. The answer body and the 404 are unchanged.

shipped production is serving it deploy d5b2fe2

opened this

The OAuth connect poll (GET /api/v1/user/origins/oauth/:id) now names session and origin in Server-Timing. The 404 names session only, because an unknown id never reaches the origin. The answer body and the 404 are unchanged.

  • Failed check: test/snappy.test.ts passes here in isolation, and again alongside observability-budget after merging main. I never saw the check's log, so I can't confirm why it failed. It is a p95 timing-budget test, so a loaded runner is the likely cause, and my change doesn't touch what it measures.
  • Merge: I merged current main into the branch rather than rebasing, because force pushes are refused. That brings in the new OpenAPI route-coverage test, which my change doesn't trip, since it adds no route. The merge is pushed.
  • Verification: the new test/oauth-poll-timing.test.ts and test/origins-oauth.test.ts passed before the merge, and the timing test passed again after it. tsc --noEmit was clean before the merge and I didn't re-run it after.
  • If it fails again: if snappy fails again on the forge, it is worth parking separately as a flaky test.

I changed nothing in snappy.test.ts.

To try it, run bun test test/oauth-poll-timing.test.ts, or poll a pending flow and read the server-timing response header.

Closes #5290

commented

The OAuth connect poll (GET /api/v1/user/origins/oauth/:id) now names session and origin in Server-Timing. The 404 names session only, because an unknown id never reaches the origin. The answer body and the 404 are unchanged.

  • Failed check: test/snappy.test.ts passes here in isolation, and again alongside observability-budget after merging main. I never saw the check's log, so I can't confirm why it failed. It is a p95 timing-budget test, so a loaded runner is the likely cause, and my change doesn't touch what it measures.
  • Merge: I merged current main into the branch rather than rebasing, because force pushes are refused. That brings in the new OpenAPI route-coverage test, which my change doesn't trip, since it adds no route. The merge is pushed.
  • Verification: the new test/oauth-poll-timing.test.ts and test/origins-oauth.test.ts passed before the merge, and the timing test passed again after it. tsc --noEmit was clean before the merge and I didn't re-run it after.
  • If it fails again: if snappy fails again on the forge, it is worth parking separately as a flaky test.

I changed nothing in snappy.test.ts.

To try it, run bun test test/oauth-poll-timing.test.ts, or poll a pending flow and read the server-timing response header.

Approved

Clean, and it follows the pattern used on the other ~29 timed routes in api.ts. requireAccount still runs first, so the auth gate and the 404 body are unchanged. notePhase/takeSessionTime/timePhaseAsync are already imported from core/route_timing.ts. The new test would fail without the change: it checks that session and origin appear on a real pending flow polled through the fake GitHub origin. In the preview, the unauthenticated poll still answers 401 with only app timing, as it should.

One small correction to the description: an unknown id does still go through timePhaseAsync, so the 404 most likely names origin too, not session only. The test only asserts session, so nothing breaks, but the wording overstates what the code does. Not blocking. No security, tty or README surface is touched.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs