Skip to content

fix(routes): size tripwire compares against the readable source - #1392

Merged
oddharsh merged 2 commits into
mainfrom
claude/nav-js-size-tripwire
Oct 17, 2026
Merged

oddharsh merged 2 commits into
mainfrom
claude/nav-js-size-tripwire

Conversation

@oddharsh

Copy link
Copy Markdown
Owner

The route oracle's /nav.js row capped the served body at 65,000 B to catch a deploy that skipped build.ts. The readable src/client/nav.js is 61,284 B, so a bypass passed the size check and only the "minified at deploy" banner marker stood in its way.

The cap went dead in August. It was set on 2026-08-11 (#319), when the readable source was 102,009 B. A week later the islands split out and the source fell to 49,704 B, under the cap.

What changed

A fixed cap has to sit between two sizes that both move, so this swaps the caps for a check that keeps the gap by construction. Each shell row now names its readable source (readable: "src/client/nav.js"), and the served body must come in at or under MINIFIED_MAX_RATIO (0.8) of that file's size, read at check time. Serving the source itself is ratio 1.0 and fails.

Measured 2026-10-17, served bytes against readable bytes:

asset served readable ratio old cap
nav.js 19,106 61,284 0.31 65,000 (above readable)
nav-run.js 16,573 33,459 0.50 25,000
nav-tray.js 6,239 11,135 0.56 10,000
nav-pipes.js 10,266 22,560 0.46 20,000
nav-tips.js 6,718 11,251 0.60 10,000
tooltip.js 7,001 26,824 0.26 18,000
luna.css 43,643 99,322 0.44 50,000

nav-tray.js and nav-tips.js had about 1.1 KB between their caps and their readable size, so a comment trim would have killed those two the same way. The loosest ratio is 0.60, so 0.8 leaves room for the minifier to do worse.

I also corrected a nearby comment: it said maxBytes catches truncation, but an upper bound can't flag a short body.

Control

I pointed the oracle (VERIFY_BUILT=1) at a small local server in three modes:

  • Built bytes from .build/public: all 7 rows pass.
  • Readable source with the banner stamped on, so only the size check can fail: this branch fails all 7 on size, while main's oracle passes /nav.js. That pass is the bug, reproduced.
  • Bare readable source: this branch fails all 7, on marker and size both.

Checks

  • bun run routes:check: 362 routes, 0 hard failures.
  • bun run check:fast under the pinned Bun (1.4.3-canary.20261013.1): lint clean, typecheck at its 641-error baseline, 1,515 tests passing with 0 failures.

The /nav.js row capped the served body at 65,000 B to catch a deploy that
skipped build.ts, but the readable src/client/nav.js is 61,284 B, so serving
it passed the size check. The cap was set on 2026-08-11 when the source was
102,009 B; a week later the islands split out and it fell to 49,704 B.

Every shell row now names its readable source and must serve at most 0.8 of
that file's size, read at check time. Measured 2026-10-17, the loosest row
is nav-tips.js at 0.60. luna.css moves to the same check.

Control: against a server returning each readable source with the deploy
banner stamped on (so only size can fail), main's oracle passes /nav.js and
this one fails all 7 rows; both pass the real build.
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Wire-size diff vs merge base

2a069b6b0a7dbe54fb9ed7522e67e79f7dec74e2 → d1e0323fedad441cf949f812d0b8921bf95a2fc8

Brotli q11, the quality the edge serves. Every number here is deterministic:
an unchanged file produces no row. Advisory — this check fails on nothing.

Client assets

No change. 39 files, 206.14 KiB Brotli total.

Pages

No change. 74 files, 670.40 KiB Brotli total.

Worker bundle

No change. 288.40 KiB gzip.

Dictionary transport

Family dictionary acquisition: no change, 14.50 KiB q11.

pd/: no change. 365 deltas, 475.86 KiB total.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
aadhar-sh 38208e6 Commit Preview URL

Branch Preview URL
Oct 17 2026, 07:59 PM

…ipwire

# Conflicts:
#	tools/verify-routes.ts
@oddharsh
oddharsh merged commit 2fe1d13 into main Oct 17, 2026
8 checks passed
@oddharsh
oddharsh deleted the claude/nav-js-size-tripwire branch October 17, 2026 20:32
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