Skip to content

fix(text): route external raster kinds around the Worker font-bake plan - #73

Open
thejustinwalsh wants to merge 3 commits into
feat/column-flowfrom
feat/external-runtime-bake
Open

fix(text): route external raster kinds around the Worker font-bake plan#73
thejustinwalsh wants to merge 3 commits into
feat/column-flowfrom
feat/external-runtime-bake

Conversation

@thejustinwalsh

@thejustinwalsh thejustinwalsh commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

What

Repairs the third-party runtime-bake route — the benchmark:external-raster proof lane was failing on main (verified pre-existing in a clean origin/main worktree before fixing; not a stack regression).

Mechanism

The runtime shoveled every requested raster into the Worker font-bake plan, and the Worker's embedded baker switch (bitmap | msdf | slug) correctly rejected kinds it doesn't carry — which killed the whole load, even though the host-side path through technique.runtimeBaker exists for exactly this case and every technique (including the published example) already declares its baker.

Fix

One declared routing authority: workerRasterKinds, exported from @pmndrs/text/runtime-bake. Worker plans carry only Worker-embedded kinds; every other technique's raster deliberately misses in the baked artifact and bakes host-side through the baker its own declaration names. The Worker's switch remains as the realization of the set — its rejection now guards protocol violations, not routing.

Evidence

  • Node red-green against the published example package: a strict stub enforcing the Worker's contract (throws on undeclared kinds) fails before the fix and passes after — worker plan carries only ['bitmap'], and the external raster decodes from its host-baked, provenance-checked artifact.
  • The restored browser lane: external-raster-proof-ready on WebGPU and WebGL2 with identical deterministic frame hashes (817495c4…), 2/2 frames each.

@github-actions

Copy link
Copy Markdown

size-limit report 📦

Path Size
Core JS (gzip) 18.7 KB (+1.3% 🔺)
Shaper Wasm (gzip) 418.48 KB (0%)
Three.js adapter JS (gzip) 60.95 KB (+0.42% 🔺)
Inter font · Bitmap (gzip) 545.26 KB (0%)
Inter font · MTSDF (gzip) 6.48 MB (0%)
Inter font · Slug (gzip) 604.06 KB (0%)
Font Awesome icons · Bitmap (gzip) 439.53 KB (0%)
Font Awesome icons · MTSDF (gzip) 6.89 MB (0%)
Font Awesome icons · Slug (gzip) 642.64 KB (0%)
Font validator JS (gzip) 134.24 KB (0%)
Runtime bake host JS (gzip) 5.4 KB (+0.4% 🔺)
Runtime bake Worker JS (gzip) 142.47 KB (+0.02% 🔺)
Font baker JS (gzip) 2.41 KB (0%)
Font baker Wasm (gzip) 379.63 KB (0%)
Bitmap baker JS (gzip) 4.66 KB (0%)
Bitmap baker Wasm (gzip) 228.3 KB (0%)
MTSDF baker JS (gzip) 5.39 KB (0%)
MTSDF baker Wasm (gzip) 209.22 KB (0%)
Slug baker JS (gzip) 4.01 KB (0%)
Slug baker Wasm (gzip) 181.24 KB (0%)

The runtime shoveled every requested raster into the Worker font-bake
plan, and the Worker's embedded baker switch correctly rejected kinds
it does not carry — killing the whole load even though the host-side
path through technique.runtimeBaker exists for exactly this case. The
routing authority is now one declared set, workerRasterKinds, exported
from the runtime-bake subpath: Worker plans carry only Worker-embedded
kinds, and every other technique's raster deliberately misses in the
baked artifact and bakes host-side through the baker its own
declaration names. Proven red-green in Node against the published
example package with a strict stub enforcing the Worker contract, and
by the restored browser lane: deterministic external raster frames on
WebGPU and WebGL2. Verified pre-existing on a clean origin/main
worktree before fixing.
@thejustinwalsh
thejustinwalsh force-pushed the feat/external-runtime-bake branch from 6d2d88f to 0d93370 Compare August 13, 2026 06:22
…re-subpath ceilings

The routing change grew the renderer-neutral core bundle by +1,786 raw /
+919 minified bytes, but the generated size evidence was not refolded, so
the growth first surfaced in the CI runtime gate's fresh build: 228,199
raw / 155,956 minified against the 227,000 / 155,500 ceilings, byte-
identical across linux-x64 and darwin. Re-price the two exceeded ceilings
to the measured actuals with the usual tight headroom; gzip and Brotli
still fit under their prior ceilings. The evidence refold itself rides the
measure-entry branch (841ff05).
…ings

The external-raster routing bundles into the Three adapter as well as the
core subpath, so the same unrecorded growth surfaced there once the gate
progressed past the re-priced core entry: 370,521 raw / 241,995 minified
against the 370,000 / 241,500 ceilings (+1,786 raw / +914 minified over
the last recorded evidence). Gzip and Brotli still fit. Same shape as the
core re-price one commit down; the evidence refold rides feat/measure-entry.
* the realization of this set; its rejection of anything else guards protocol
* violations, not routing.
*/
export const workerRasterKinds: readonly string[] = Object.freeze(['bitmap', 'msdf', 'slug']);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete. Holding two versions of baking routing still.

@thejustinwalsh
thejustinwalsh marked this pull request as ready for review August 14, 2026 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant