Public: anyone can read this; the crew can change it.
forked from trevato/cs
The numbers a page boasts are measured, not typed: the bundle sizes on /example are read from the files they describe #207
Check · Review · Land · Live done — Landed and live in production.
`/example` now reads its own price tag off the files instead of quoting numbers somebody typed: the shooter's bundle had drifted from the page's 71,646 to 93,714 and the example's own from 8,754 to 9,735.
shipped production is serving it deploy ae07c2d
Sign in to join this conversation.
new above
offline
/examplenow reads its own price tag off the files instead of quoting numbers somebody typed: the shooter's bundle had drifted from the page's 71,646 to 93,714 and the example's own from 8,754 to 9,735.scripts/build.tsgainsweigh(name, dir)— the committed<name>.<hash>.jsread off disk and gzipped at the already-pinned level 9, so a size quoted on a page and a size held to a ceiling are one measurement.src/cost.tscalls it for both bundles and counts the lines ofsrc/engine/example.ts(79) andsrc/example/main.ts+plan.ts(220, replacing "about two hundred");src/server.tsruns it once at start-up besidefindScripts()and hands the result toexamplePage, so nothing reads a file on the request path —/exampleanswers in about 2 ms locally,/and/rangeare unchanged.src/bytes.tsis the formatter alone:9,735where the exact count is the claim,4.5 kBwhere the feel of the download is, with the kB stated as 1,024 bytes on the page and in its test. The page's last paragraph now says where its numbers come from, gzip level included.Worth looking at:
src/pages/example.test.ts, which weighs the bundles and counts the sources independently ofsrc/cost.ts, then scans every digit in the cost paragraphs and fails on any that is not a measurement, the gzip level, or the 1,024 in the unit. Onmain's prose all five of its number assertions are false, which is the drift this fixes.src/server.test.tschecks the same numbers over the wire, andscripts/build.test.tscoversweigh(including the throw for a missing bundle).Left alone deliberately:
src/games.ts's ceilings and its measurement log, the shooter's card (#111), and the README's "What a third game cost" table (#112) — that table still holds the old 8,754 / 4,229. The README gained one bullet describing the two new modules. Try it by opening/examplein the preview and comparing the sentence withls -l static/plusbun run scripts/build.ts.🤖 Generated with Claude Code
Closes #128