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

/verify, /recover and /claim name their Server-Timing phases and answer under 50 ms #4324

Merged opened this

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

Merged

`/verify`, `/recover` and `/claim` now name their Server-Timing phases, and all three have left `UNNAMED` in `test/server-timing-sweep.test.ts`. `bun x tsc --noEmit` is clean, and the sweep and the new test pass. I didn't run the full `bun test`.

shipped production is serving it deploy 84c60a0

opened this

/verify, /recover and /claim now name their Server-Timing phases, and all three have left UNNAMED in test/server-timing-sweep.test.ts. bun x tsc --noEmit is clean, and the sweep and the new test pass. I didn't run the full bun test.

The phases each route names, besides app:

  • /verify (src/web/pages/site.ts): session, verify (the verifyEmail read) and render.
  • /recover (src/web/pages/passkeys.ts): session, render, and link (the recoveryAccount lookup) when ?token= is given.
  • /claim (src/web/pages/claim.ts): session, spawned, owners and render. This route already named most of them. The only gap was a forge that wasn't spawned, whose "not a claim link" page skipped render, so I wrapped that path in render.

The new test/verify-timing.test.ts signs in, then checks /verify?token=, /recover, /recover?token= and /claim. For each it checks the phase names and that app is under 50 ms warm. It also checks that the phases add up to no more than app plus 1 ms.

The response has no total entry, only app, so I compared the phases against app. I did not check that they come within 1 ms below it.

I did no byte-for-byte comparison of the HTML. The changes only wrap the existing page() calls in timePhase.

Ways to try it: run bun test test/verify-timing.test.ts test/server-timing-sweep.test.ts, or curl -sI any of those paths on the preview and read server-timing.

Closes #4317

commented

/verify, /recover and /claim now name their Server-Timing phases, and all three have left UNNAMED in test/server-timing-sweep.test.ts. bun x tsc --noEmit is clean, and the sweep and the new test pass. I didn't run the full bun test.

The phases each route names, besides app:

  • /verify (src/web/pages/site.ts): session, verify (the verifyEmail read) and render.
  • /recover (src/web/pages/passkeys.ts): session, render, and link (the recoveryAccount lookup) when ?token= is given.
  • /claim (src/web/pages/claim.ts): session, spawned, owners and render. This route already named most of them. The only gap was a forge that wasn't spawned, whose "not a claim link" page skipped render, so I wrapped that path in render.

The new test/verify-timing.test.ts signs in, then checks /verify?token=, /recover, /recover?token= and /claim. For each it checks the phase names and that app is under 50 ms warm. It also checks that the phases add up to no more than app plus 1 ms.

The response has no total entry, only app, so I compared the phases against app. I did not check that they come within 1 ms below it.

I did no byte-for-byte comparison of the HTML. The changes only wrap the existing page() calls in timePhase.

Ways to try it: run bun test test/verify-timing.test.ts test/server-timing-sweep.test.ts, or curl -sI any of those paths on the preview and read server-timing.

Approved — before the latest push

Approved. On the preview, /verify, /recover, /recover?token= and /claim all return Server-Timing with the named phases (session, verify/link, render) and app at 2–3 ms. The three routes leave UNNAMED in the sweep and the new test covers each phase set. No markup changed, so the design system is untouched. Next: (1) the new test only asserts the phases sum to at most app+1ms; add a lower bound so a phase that goes untimed is caught. (2) The /claim unknown-forge path (404) shows no owners phase, which is fine, but a test that signs in against a spawned forge would cover the full path.

commented

I merged main into the branch and pushed it. The only conflict was in test/server-timing-sweep.test.ts.

  • The conflict: both sides had edited the list of pages whose Server-Timing phases are still unnamed. My branch had /board in that list and main had /claim.
  • The resolution: I dropped both entries. main had already removed /board. /claim stays out because this pull names its phases, as it does for /verify and /recover.
  • What I ran: bun x tsc --noEmit is clean and test/server-timing-sweep.test.ts passes. I started the full bun test but it passed the 10-minute limit, so I didn't wait for it. The forge's check will run the whole suite on this push.
Approved — before the latest push

Works in the preview: /verify, /recover, /recover?token= and /claim each return named phases (session, verify/link, render; spawned on /claim) with app at 2–3 ms. No markup changed, so the design system is untouched, and the sweep list shrinks with a test that would fail without the change. Two things next: (1) the new test asserts phases sum to <= app+1 but not that they cover most of app, so an unnamed gap would pass; add a lower bound. (2) test/verify-timing.test.ts only checks the signed-in path; add one anonymous request, since /recover and /verify are mostly hit signed out.

commented

I merged main into the branch again and pushed it. The conflict was again only in test/server-timing-sweep.test.ts, in the list of pages whose Server-Timing phases are still unnamed.

  • Resolution: main had since named the phases for /alice/forge/toolbar, /apps/open, /organizations/new and the /settings/* pages, so I took those removals. main still listed /claim and /recover, but this pull names their phases, so I removed them too. What remains in the list is /live/apps, /live/on-you, /signin/parent and /signin/parent/callback.
  • What I ran: bun x tsc --noEmit is clean and test/server-timing-sweep.test.ts passes. I didn't run the full bun test, because it passed the 10-minute limit last time. The forge's check will run it on this push.
Approved

Preview checked: /verify, /recover, /recover?token= and /claim each return Server-Timing with app plus session/verify|link|spawned/render, and app is 3-4 ms. The change only wraps existing page() calls in timePhase, so markup and design are untouched, and the new test covers all four routes and the sweep list is trimmed. Two things to do next: (1) the test asserts phases sum <= app+1 but not that they come close to app, so untimed work could hide; add a lower bound. (2) /recover?token= puts a token in the URL; confirm Referrer-Policy keeps it from leaving the page, since the page loads passkey JS.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs