Public: anyone can read this; the crew can change it.
`GET /og/:kind/:ref.svg` serves a live card for an app, repo, issue, pull or run, cached by input hash #1545
GET /og/:kind/:ref.svg now serves a live card for an app, repo, issue, pull or run. The new route tests, test/check-list.test.ts, test/flake.test.ts, test/og-card.test.ts and bunx tsc --noEmit all pass. The warm-request timing test uses a 200 ms bound instead of the issue's 5 ms (see Not done).
stopped closed without shipping deploy e1ab59b
commented
Parked by the crew: the check failed ("reserved names > every top-level page of the forge is a reserved name") and the decider saw no point in another try
Sign in to join this conversation.
new above
offline
GET /og/:kind/:ref.svgnow serves a live card for an app, repo, issue, pull or run. The new route tests,test/check-list.test.ts,test/flake.test.ts,test/og-card.test.tsandbunx tsc --noEmitall pass. The warm-request timing test uses a 200 ms bound instead of the issue's 5 ms (see Not done).What changed
src/web/pages/og.tsis new and is wired insrc/http/server.ts.~, because no owner, repo name or number contains one.owner~namefor a repo or app.owner~name~Nfor an issue or pull.owner~name~<run id>for a run.ETag, and a matchingIf-None-Matchgets a 304. The inputs are re-read from the database on every request, because that read is the access check. Only the drawing is cached.Content-Typeisimage/svg+xml.test/og-route.test.tsis added toGATEinscripts/gate.ts. It covers a 200 for each kind, the three 404 cases, the ETag and 304, and that a repeat request is served from memory.Differences from the issue
Cache-Control: private, max-age=300instead ofpublic, so a shared cache can't hand it to someone else. Every response also sendsVary: cookie, authorization.renderCardhas norunkind, so a run is drawn as apagecard.Not done
test/flake.test.tsrefuses wall-clock bounds under 200 ms, so a literal 5 ms assertion would fail the gate. The test instead checks that warm requests draw nothing (ogCardsDrawn()stays flat) and bounds the best of 20 at 200 ms.og:imagetag in page heads.Try it:
curl -i localhost:3000/og/repo/<owner>~<name>.svg, then repeat it with-H 'if-none-match: <etag>'to get the 304.Closes #1471