feat(og): per-entity Open Graph cards, rendered in the Worker - #11493
Merged
Conversation
/og/subnets/{netuid}.png and /og/accounts/{ss58}.png, drawn from the published
registry index. Until now every link to any page unfurled the same landing card.
THE BUNDLE ARGUMENT THAT EVICTED THE RENDER IS DEAD, and this does not rest on
that. #6502 moved the render out because workers-og's wasm is ~545 KiB gzipped
and the bundler ships every reachable import. Measured 2026-08-11 this Worker is
944.8 KiB against a 10 MB limit, so ~545 KiB more is ~14.5% of it.
THE ARGUMENT THAT IS LIVE IS STARTUP CPU, and it was measured rather than
assumed. This Worker has failed to deploy four times with `code: 10021 Script
startup exceeded CPU time limit`, always from work at module scope, and wasm
instantiation is exactly that shape. `wrangler versions upload` reports startup
time without routing traffic, so it can be sampled safely:
baseline (no import) 319 315 321 283 314 301 307 326 median 313 ms
a bare dynamic import 362 549 315 313 281 312 297 321 median 313 ms
this feature 328 354 331 303 332 median 331 ms
Identical medians for the import alone -- the module is not evaluated until the
handler runs. The feature adds ~18 ms of module init, leaving ~69 ms against the
~400 ms limit. Both sets carry outliers because the platform validates on a
shared host, which is the same reason those four deploys failed
non-deterministically; that is a property of the 313 ms baseline, not of this
change. A version that exceeds the limit fails at upload and never takes
traffic, so the failure mode here is a failed deploy, not an outage.
CACHED PER ENTITY UNDER A DIGEST OF ITS OWN FACTS. A data change is a new key
rather than an invalidation, so a stale card and a fresh one never share a name,
and a publish that changes nothing drawn re-uses the PNG. Keys live under
`cache/` and not `metagraph/`: objects under the artifact prefix are owned by
the publish, which reconciles what it finds against what it built, and a render
this Worker wrote would look like drift to it.
A RENDER FAILURE IS NEVER A 5xx. Social crawlers do not retry and cache what
they get, so every failure path -- absent facts, unreadable cache, wasm error --
falls back to the branded static card in ASSETS, a different subsystem from the
one that failed. Six tests cover those paths individually.
Absent stays absent: a subnet with no measured readiness shows no readiness
stat, never `0/100`. Subnet names are third-party strings and satori parses the
markup, so they are escaped.
Verified end to end before shipping: the markup rasterises through the same
satori + resvg path scripts/refresh-og-image.ts uses, producing a valid
1200x630 PNG.
Closes #11075
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
metagraphed-registry-sync-api | 167a46d | Aug 19 2026, 10:23 AM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
metagraphed-wss-lb | 167a46d | Aug 19 2026, 10:23 AM |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
metagraphed-data-api | 167a46d | Aug 19 2026, 10:24 AM |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11493 +/- ##
==========================================
- Coverage 95.65% 95.63% -0.03%
==========================================
Files 787 788 +1
Lines 46819 46902 +83
Branches 17198 17223 +25
==========================================
+ Hits 44787 44857 +70
- Misses 526 531 +5
- Partials 1506 1514 +8
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/og/subnets/{netuid}.pngand/og/accounts/{ss58}.png, drawn from the published registry index. Until now every link to any page unfurled the same landing card.(Rendered locally during development: netuid 64 → "Chutes", Readiness 96/100, Surfaces 76, Coverage deep, on the mint brand card.)
The bundle argument is dead, and this does not rest on it
#6502 moved the render out because workers-og's wasm is ~545 KiB gzipped and the bundler ships every reachable import. Measured 2026-08-11 this Worker is 944.8 KiB against a 10 MB limit — ~545 KiB more is ~14.5% of it.
The argument that is live is startup CPU, and I measured it
This Worker has failed to deploy four times with
code: 10021 Script startup exceeded CPU time limit, always from work at module scope, and wasm instantiation is exactly that shape.wrangler versions uploadreports startup time without routing traffic, so it can be sampled safely:Identical medians for the import alone — the module is not evaluated until the handler runs. The feature adds ~18 ms of module init, leaving ~69 ms against the ~400 ms limit.
Both sets carry outliers because the platform validates on a shared host, which is the same reason those four deploys failed non-deterministically. That is a property of the 313 ms baseline, not of this change. And a version that exceeds the limit fails at upload and never takes traffic — the failure mode is a failed deploy, not an outage.
I nearly called this feature unshippable on 3 samples vs 3, where one 549 ms outlier looked like signal. It wasn't; the control had the same tail once sampled equally.
Cached per entity, under a digest of its own facts
A data change is a new key rather than an invalidation, so a stale card and a fresh one never share a name — and a publish that changes nothing drawn re-uses the PNG. That is the difference from the landing card, whose constant key made it re-render an unchanged image on every miss.
Keys live under
cache/, notmetagraph/: objects under the artifact prefix are owned by the publish, which reconciles what it finds against what it built, and a render this Worker wrote would look like drift to it.A render failure is never a 5xx
Social crawlers do not retry and cache what they get. Every failure path — absent facts, unreadable cache, wasm error, failed cache write — falls back to the branded static card in ASSETS, a different subsystem from the one that failed. Six tests cover those paths individually.
Contract discipline
absent is null, never zero: a subnet with no measured readiness shows no readiness stat, never0/100. Subnet names are third-party strings and satori parses the markup, so they are escaped — a test asserts a<script>title comes out inert.Verified end to end
The markup rasterises through the same satori + resvg path
scripts/refresh-og-image.tsuses, producing a valid 1200×630 PNG (33.8 kB). I checked the image, not just the exit code.Acceptance
Full suite 960 files / 22,089 passed, build, lint, format, all 72 CI validators, patch coverage 100%.
Closes #11075