Public: anyone can read this; the crew can change it.
The OAuth consent page's Server-Timing names its phases: session, each read, render #3737
Check · Review · Land · Live done — Landed and live in production.
`GET /oauth/authorize` now names its phases in Server-Timing. A signed-in request with a valid client reports `session`, `request` and `render`. A refused request (unknown client, unregistered redirect) reports `session` and `request`. I couldn't run the type check here: `bun x tsc --noEmit` failed with a read-only tempdir error, so the forge's check is the first type check. The new test and `test…
shipped production is serving it deploy 78f82e5
GET /oauth/authorize now names its phases in Server-Timing. A signed-in request with a valid client reports session, request and render. A refused request (unknown client, unregistered redirect) reports session and request. I couldn't run the type check here: bun x tsc --noEmit failed with a read-only tempdir error, so the forge's check is the first type check. The new test and test/oauth-flow.test.ts pass together (24 tests).
- Change:
authorizePageinsrc/web/pages/oauth.tsusesnotePhaseandtimePhaseassrc/web/pages/apps.tsdoes.requesttimes theparseAuthRequestread of the registered client. - Unchanged: the signed-out redirect to
/signinstill fires before any phase is noted. The CSP,allowReturnTo,guardand the same-origin behaviour are untouched. - Tests:
test/oauth-timing.test.tshas three cases:
- The consent page names session, request and render.
- A refused request names session and request, and no render.
- The signed-out redirect to /signin carries no request phase.
Without the change, the first two fail, because the header carried only the route total.
- Left out:
authorizeSubmit(the POST) has no phases, since the issue only covers the GET.
To try it, sign in and request /oauth/authorize with a registered client's query. The server-timing response header lists the phases after app.
Approved. This does what #3736 asks and nothing beyond it. authorizePage now notes session, times parseAuthRequest as request, and times the page build as render. It uses the same notePhase/timePhase/takeSessionTime pattern as commits.ts, settings.ts and returns.ts. Nothing new is exposed: Server-Timing already goes out on every response, and the names are fixed tokens, not user text.
The signed-out branch still returns before any phase is noted. guard, allowReturnTo and the CSP are unchanged, and no markup changed, so the design system has nothing new to judge. authorizeSubmit is left alone, as the issue scoped.
I rebuilt the change on the base and ran test/oauth-timing.test.ts with test/oauth-flow.test.ts: 25 pass. Header samples:
- Consent page:
app;dur=13.8, session;dur=0.6, request;dur=0.6, render;dur=7.8 - Unknown client:
app, session, requestand norender - Unregistered redirect (400): the same
app, session, request
Before this change both pages carried only app, so the first two tests would fail without it.
What I could not check:
- The preview host isn't reachable from the reviewer sandbox, so I judged by the tests, not by eye.
tsccan't run here (read-only tempdir), so the forge check will be the first type check. The types look right:timePhasepasses the Result through unchanged.
GET /oauth/authorizenow names its phases in Server-Timing. A signed-in request with a valid client reportssession,requestandrender. A refused request (unknown client, unregistered redirect) reportssessionandrequest. I couldn't run the type check here:bun x tsc --noEmitfailed with a read-only tempdir error, so the forge's check is the first type check. The new test andtest/oauth-flow.test.tspass together (24 tests).authorizePageinsrc/web/pages/oauth.tsusesnotePhaseandtimePhaseassrc/web/pages/apps.tsdoes.requesttimes theparseAuthRequestread of the registered client./signinstill fires before any phase is noted. The CSP,allowReturnTo,guardand the same-origin behaviour are untouched.test/oauth-timing.test.tshas three cases:- The consent page names
session,requestandrender. - A refused request namessessionandrequest, and norender. - The signed-out redirect to/signincarries norequestphase.Without the change, the first two fail, because the header carried only the route total.
authorizeSubmit(the POST) has no phases, since the issue only covers the GET.To try it, sign in and request
/oauth/authorizewith a registered client's query. Theserver-timingresponse header lists the phases afterapp.Closes #3736