Found by the review round on #144.
The OG image URL for a commit permalink is always built with a 7-character SHA:
ogImageUrl() → commitImageUrl(..., shortSha(result.canonicalSha), ...)
(packages/web/src/ui/og-meta.tsx:65; shortSha is sha.slice(0, 7) at :115).
So web-og calls /internal/result/:owner/:repo/<7 chars> and that endpoint computes
the cache key part sha:<7 chars>.
The public permalink route keys on the SHA as it appears in the request URL, and
/lookup deliberately redirects to the full SHA (packages/web/src/index.ts:138 —
"Use the FULL SHA in the permalink (not a 7-char prefix)").
Concrete flow, which is the primary search → view → share path:
- A user searches
honojs/hono@<40-char sha>.
- They land on
/r/honojs/hono/c/<40>, which warms cacheKey('res', repo, 'sha:<40>', 'cull', 'nopre').
- They share that URL. The unfurl fetches the OG image, which resolves
sha:<7> —
a different slot. Still cold, still a full lookup.
#144 fixed the write-back half (the OG path now self-heals into sha:<7>, so it is cold
at most once) and made /internal use the public routes' key shape and policy. This is the
remaining half: the two sides spell the same commit two different ways, so a warm public
entry is never reused for the first unfurl.
Why it is not folded into #144
The fix lives in files #144 does not touch (ui/og-meta.tsx, routes/result.tsx), and
either direction changes the public routes' key namespace, which is a cache-invalidation
event for every existing entry and deserves its own review surface:
- Normalise to short on both sides — possible pre-lookup (
sha.slice(0, 7)), but changes
the public routes' cache key.
- Normalise to full on both sides — not possible pre-lookup for a 7-char input: you do not
know canonicalSha until the lookup has run. Would need a second keyed write after resolve.
Short-on-both is the smaller change. Needs a test that seeds the slot a full-SHA permalink
writes and asserts the OG path reads that entry.
Found by the review round on #144.
The OG image URL for a commit permalink is always built with a 7-character SHA:
ogImageUrl()→commitImageUrl(..., shortSha(result.canonicalSha), ...)(
packages/web/src/ui/og-meta.tsx:65;shortShaissha.slice(0, 7)at:115).So web-og calls
/internal/result/:owner/:repo/<7 chars>and that endpoint computesthe cache key part
sha:<7 chars>.The public permalink route keys on the SHA as it appears in the request URL, and
/lookupdeliberately redirects to the full SHA (packages/web/src/index.ts:138—"Use the FULL SHA in the permalink (not a 7-char prefix)").
Concrete flow, which is the primary search → view → share path:
honojs/hono@<40-char sha>./r/honojs/hono/c/<40>, which warmscacheKey('res', repo, 'sha:<40>', 'cull', 'nopre').sha:<7>—a different slot. Still cold, still a full lookup.
#144 fixed the write-back half (the OG path now self-heals into
sha:<7>, so it is coldat most once) and made
/internaluse the public routes' key shape and policy. This is theremaining half: the two sides spell the same commit two different ways, so a warm public
entry is never reused for the first unfurl.
Why it is not folded into #144
The fix lives in files #144 does not touch (
ui/og-meta.tsx,routes/result.tsx), andeither direction changes the public routes' key namespace, which is a cache-invalidation
event for every existing entry and deserves its own review surface:
sha.slice(0, 7)), but changesthe public routes' cache key.
know
canonicalShauntil the lookup has run. Would need a second keyed write after resolve.Short-on-both is the smaller change. Needs a test that seeds the slot a full-SHA permalink
writes and asserts the OG path reads that entry.