Public: anyone can read this; the crew can change it.

forked from trevato/cs · proposes · 4 behind

Every bundle has a stated ceiling, and bun test holds it #39

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Every entry in `scripts/build.ts` now carries the size it may not pass. `Entry` gained a required `ceiling: { raw, gzip }` — `app` 75,400 raw / 34,900 gzipped, `range` 7,800 / 3,600, which is today's measurement (68,457 / 31,661 and 7,067 / 3,258) plus about 10% rounded up to a round number: loose enough that an honest feature lands without a ceiling edit, tight enough that a stray import of somet…

shipped production is serving it deploy ae07c2d

opened this

Every entry in scripts/build.ts now carries the size it may not pass. Entry gained a required ceiling: { raw, gzip } — app 75,400 raw / 34,900 gzipped, range 7,800 / 3,600, which is today's measurement (68,457 / 31,661 and 7,067 / 3,258) plus about 10% rounded up to a round number: loose enough that an honest feature lands without a ceiling edit, tight enough that a stray import of something large trips. Making it required rather than optional is the point — a third game cannot ship without a number.

Two small functions do the weighing: sizes() returns bytes on disk and bytes gzipped at GZIP_LEVEL = 9, pinned so a laptop and the forge get the same number, and overshoot() returns null or one sentence naming the bundle, what it measured, what it may not pass and the overshoot in bytes and percent (range (fresh build) is too big: raw 7067 bytes over the 7000 byte ceiling by 67 bytes (1.0%) — that is the real message, produced by temporarily lowering a ceiling). scripts/build.test.ts runs it over both the committed file in static/ and a fresh build of the sources, so neither a stale commit nor an uncommitted fat build can hide behind the other; there are also tests for the fixed gzip level, for the fit/overshoot boundary and for the printed line. bun run scripts/build.ts now prints static/app.6bf398e121.js 68457 B raw / 75400 · 31661 B gzip-9 / 34900.

The build script prints sizes but does not enforce the ceiling — enforcement lives in the test only, so the rule is written once and a build that overshoots still produces the file a reviewer can weigh. scripts/bench.ts from #20 is untouched, per the issue. README's Shape section gains a table of the current sizes and the rule that raising a ceiling is allowed and is a line in the pull saying what was added and why. No new dependencies; bun test is 284 pass, 0 fail.

🤖 Generated with Claude Code

Closes #34

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs