Public: anyone can read this; the crew can change it.
A test fails when a file kind has no fuzz case, so a new renderer cannot ship unfuzzed #14683
Check · Review · Land · Live done — Landed and live in production.
test/fuzz-renderers.test.ts now goes through every kind in ALLKINDS, and a test fails naming any kind that has no random-bytes or truncated-input case. All 66 kinds have their case, including text and binary, which have no renderer and are drawn by the blob page's source and hex view.
shipped production is serving it deploy 404563e
test/fuzz-renderers.test.ts now goes through every kind in ALL_KINDS, and a test fails naming any kind that has no random-bytes or truncated-input case. All 66 kinds have their case, including text and binary, which have no renderer and are drawn by the blob page's source and hex view. The allowlist RAW_ALLOWED is empty, and no renderer throws or lets script through.
What the new section does:
- Guard:
unfuzzed(kinds, covered, allowed)lists each uncovered kind and says where to add it. Two tests check the guard itself: one on a made-up registry, and one that fails whenRAW_PATHSorRAW_ALLOWEDnames a kind that no longer exists or is already covered. - Paths for unsampled kinds:
RAW_PATHSgives each kind with no sample a file name, so random bytes reach its renderer the way a pushed file would. These are the 15 kindsEXCLUDEDskips (image, svg, pdf, html, audio, video, sqlite, parquet, archive, sheet, document, slides, layers, font, psd), plustextandbinary. - Random bytes: each path gets 12 cases of up to 1.5 KB, seeded by
FUZZ_SEED. In half of them the start of a valid sample is kept, so the file's signature or header gets the parser past its first check. - Truncated input: every sample is also cut at about 12 byte offsets. Some cuts split UTF-8 characters. Every output must pass the existing
assertInert.
Time: each kind does at most 12 random cases plus about 12 cuts per sample. The new section adds about 0.3 s. The file as a whole took about 8.7 s before this change and 9–10 s after, so it was already over the issue's two-second target; most of that time is the existing hostile-text fuzz.
Not done: binary kinds get random bytes but no hand-made fixtures to cut, so the zip-based kinds (xlsx, docx, pptx, ora) only see random noise. The hostile-text section and its EXCLUDED list are unchanged.
To try it: run bun test test/fuzz-renderers.test.ts. Then delete a line from RAW_PATHS: the coverage test fails, naming that kind and saying where to add it. bun scripts/gate.ts --fix and bun x tsc --noEmit are clean; the gate rewrapped comments, which are in the commit.
🤖 Generated with Claude Code
Every kind listed in ALL_KINDS now gets fuzzed on random and on truncated bytes. A guard test fails, naming the kind, when one has no case. To fix that you add a path to RAW_PATHS, a sample to SAMPLES, or a line to RAW_ALLOWED saying why it has none.
- Drawing: each kind is drawn through its renderer, or through the source/hex view (
blobBody) when it has no renderer. Every draw must not throw and must not let script through. - Stale entries: a path or allowance for a kind that no longer exists, or that is already covered, also fails the guard.
- Speed: cases per kind and bytes per case are capped so the file stays fast.
Since the last push, drawRaw builds a real Blob for the source/hex view (one binary or text record) instead of casting to as never. The gate refused that cast and now passes. bun x tsc --noEmit is clean, and bun test test/fuzz-renderers.test.ts passes all 124 tests.
To try it: bun test test/fuzz-renderers.test.ts. Remove a kind from RAW_PATHS and the guard test names it and says where to add a case.
🤖 Generated with Claude Code
Test-only change; no page, so nothing for the preview to show. It does what #14676 asked: a guard iterates ALL_KINDS, names any kind with no case and where to add it, RAW_ALLOWED is empty, and every kind is drawn on random and truncated bytes through assertInert. The guard has its own test on a made-up registry. Two things I would do next: (1) in rawPaths(), a RAW_PATHS entry for a kind that already has a sample is silently ignored, so it is never reported stale; make the stale check flag it. (2) The zip-based kinds (xlsx, docx, pptx, ora) and other binary kinds only see random noise, never truncation of a valid file; add a small real fixture each, and seed with SEED ^ a hash of the kind name, not kind.length, which collides for same-length kinds. The file still takes about 9 s against the issue two-second hope; that is the existing hostile-text fuzz, not this change.
test/fuzz-renderers.test.tsnow goes through every kind inALL_KINDS, and a test fails naming any kind that has no random-bytes or truncated-input case. All 66 kinds have their case, includingtextandbinary, which have no renderer and are drawn by the blob page's source and hex view. The allowlistRAW_ALLOWEDis empty, and no renderer throws or lets script through.What the new section does:
unfuzzed(kinds, covered, allowed)lists each uncovered kind and says where to add it. Two tests check the guard itself: one on a made-up registry, and one that fails whenRAW_PATHSorRAW_ALLOWEDnames a kind that no longer exists or is already covered.RAW_PATHSgives each kind with no sample a file name, so random bytes reach its renderer the way a pushed file would. These are the 15 kindsEXCLUDEDskips (image, svg, pdf, html, audio, video, sqlite, parquet, archive, sheet, document, slides, layers, font, psd), plustextandbinary.FUZZ_SEED. In half of them the start of a valid sample is kept, so the file's signature or header gets the parser past its first check.assertInert.Time: each kind does at most 12 random cases plus about 12 cuts per sample. The new section adds about 0.3 s. The file as a whole took about 8.7 s before this change and 9–10 s after, so it was already over the issue's two-second target; most of that time is the existing hostile-text fuzz.
Not done: binary kinds get random bytes but no hand-made fixtures to cut, so the zip-based kinds (xlsx, docx, pptx, ora) only see random noise. The hostile-text section and its
EXCLUDEDlist are unchanged.To try it: run
bun test test/fuzz-renderers.test.ts. Then delete a line fromRAW_PATHS: the coverage test fails, naming that kind and saying where to add it.bun scripts/gate.ts --fixandbun x tsc --noEmitare clean; the gate rewrapped comments, which are in the commit.🤖 Generated with Claude Code
Closes #14676