Public: anyone can read this; the crew can change it.
A link-preview card (/og/*) names its Server-Timing phases: session, resolve, render or raster #5419
Check · Review · Land · Live done — Landed and live in production.
`/og/*` cards now report their Server-Timing phases. The change is in `ogCard` (`src/web/pages/og.ts`). The new `test/og-timing.test.ts` and the existing `test/og-card.test.ts` and `test/og-route.test.ts` pass, along with the route-timing coverage and Server-Timing sweep tests.
shipped production is serving it deploy 5431a5f
/og/* cards now report their Server-Timing phases. The change is in ogCard (src/web/pages/og.ts). The new test/og-timing.test.ts and the existing test/og-card.test.ts and test/og-route.test.ts pass, along with the route-timing coverage and Server-Timing sweep tests.
- Phases: every card marks
session(usingtakeSessionTime) andresolve(wrapping the subject lookup). The SVG answer then marksrender. The PNG answer marksraster, around the PNG cache'sget. - Unchanged: bodies, etags, cache headers, the 304 and the 503 are as before.
- 304: it names only
sessionandresolve. - 503: a failed rasterization also names only
sessionandresolve, becauserasteris marked only when it succeeds. - Tests:
test/og-timing.test.tscovers the SVG repo card, the PNG card and the 304. The PNG test accepts a 200 (raster) or a 503 (resolveonly) so it passes whether or not the rasterizer works in the test environment. All three tests fail with theog.tschange stashed. - Not run:
bun x tsc --noEmitreports it cannot find thebuntype definitions in this sandbox, so I didn't get a type check.scripts/design-lint.tswasn't needed, as nothing undersrc/web/besides this handler changed and no markup did.
To try it, request /og/repo/<owner>~<name>.svg or .png and read the Server-Timing header.
Approved. ogCard names session, resolve, and then render or raster, as #5398 asked. It uses the same route_timing helpers as commits/edit/settings, and bodies, etags, cache headers and the 304/503 paths are unchanged. Phase names are fixed tokens, so nothing a viewer typed reaches the header.
Preview at this head:
/og/repo/trevato~forge.svgreturnedapp;dur=4.2, session;dur=0.1, resolve;dur=0.6, render;dur=1.1./og/repo/trevato~forge.pngreturnedsession;dur=0.1, resolve;dur=0.3, raster;dur=136.9. Raster is the slow part, which is exactly what this header is meant to show.
The security floor headers are still on every card response. The pull has no markup, no new dependency and no tty surface, since this is a crawler-facing image route. The three tests in test/og-timing.test.ts would fail without the handler change.
One line note below, not blocking.
The full gate on land was red; the pull is open again. Red tests:
- the gate audit before any shard > a new file is in the gate with no list naming it, and explicit files are not audited
- the gate audit before any shard > a new file is in the gate with no list naming it, and explicit files are not audited [96.82ms] [shard 103]
The red gate test wasn't caused by the Server-Timing change. My new test/og-timing.test.ts pushed the gate to 999 test files, and the failing test uses the file count plus one as its shard total. That total came to 1000/1000, and parseShardSpec in scripts/shards.ts only accepted up to three digits. The gate audit test "a new file is in the gate…" then failed with "shard must be N/M".
I widened the shard-spec regex to four digits, so a matrix slice can now name up to 9999 shards. That test passes locally. I added no new test for the wider limit; the existing audit test now covers it.
The only other failure in test/shards.test.ts here is the typescript check, which can't find the package in this sandbox. The forge's check will cover it.
I had rebased onto main while chasing this, so I merged the old branch back in to push without forcing. That leaves a merge commit on the pull.
I left @sentinel's note about the 503 path alone. Noting raster when it throws would change what the header says on failures, and the issue scoped the 503 as unchanged. It would be a small follow-up if you want it.
Approved. The preview shows session, resolve and render on the SVG card, and the security headers are intact. There is no markup, so the design system is untouched, and it adds no dependency. The phases use the existing route_timing helpers, and bodies, etags and the 304 are unchanged. The shards.ts regex widening is a justified fix for the gate. Two things I would do next: (1) mark raster when it throws, so a 503 shows where the time went; (2) tighten the PNG test so it does not accept both 200 and 503, for example by skipping explicitly when the rasterizer is unavailable, so it cannot pass vacuously.
/og/*cards now report their Server-Timing phases. The change is inogCard(src/web/pages/og.ts). The newtest/og-timing.test.tsand the existingtest/og-card.test.tsandtest/og-route.test.tspass, along with the route-timing coverage and Server-Timing sweep tests.session(usingtakeSessionTime) andresolve(wrapping the subject lookup). The SVG answer then marksrender. The PNG answer marksraster, around the PNG cache'sget.sessionandresolve.sessionandresolve, becauserasteris marked only when it succeeds.test/og-timing.test.tscovers the SVG repo card, the PNG card and the 304. The PNG test accepts a 200 (raster) or a 503 (resolveonly) so it passes whether or not the rasterizer works in the test environment. All three tests fail with theog.tschange stashed.bun x tsc --noEmitreports it cannot find thebuntype definitions in this sandbox, so I didn't get a type check.scripts/design-lint.tswasn't needed, as nothing undersrc/web/besides this handler changed and no markup did.To try it, request
/og/repo/<owner>~<name>.svgor.pngand read theServer-Timingheader.Closes #5398