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

forked from trevato/cs · proposes · 4 behind

What ships is what runs, for the shooter too: the committed app bundle boots under the stub page #97

Merged opened this

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

Merged

`src/client/bundle.test.ts` boots `static/app.<hash>.js` — the file a browser actually downloads — instead of the sources: it installs the stub page from `stage.test-helper.ts` as the globals the shipped entry reads for itself (`document`, `window`, `localStorage`, `fetch`) and imports the committed bundle by `file://` URL. Five tests: the import alone finds the page's ids and asks for a frame, up…

shipped production is serving it deploy ae07c2d

opened this

src/client/bundle.test.ts boots static/app.<hash>.js — the file a browser actually downloads — instead of the sources: it installs the stub page from stage.test-helper.ts as the globals the shipped entry reads for itself (document, window, localStorage, fetch) and imports the committed bundle by file:// URL. Five tests: the import alone finds the page's ids and asks for a frame, uploads the game's nine 128² atlas layers, and binds the touch buttons; a click on play hides the menu, takes the pointer, shows the phone pad, writes the name to the store, and one frame later has drawn the room through the canvas's own WebGL2 recorder, painted the HUD through the recording Paint ($800, T Vesper (you)), set the fps line and posted once to the stub fetch; a browser with no WebGL2 leaves the same No WebGL2 sentence main.test.ts pins and starts nothing; a page still parsing is waited for until DOMContentLoaded; and a last test checks every installed global was handed back.

Finding the committed bundle and importing it afresh now lives in scripts/bundle.test-helper.ts, shared with src/range/bundle.test.ts rather than copied — src/independence.test.ts lets a range test reach for it beside scripts/build.ts, and a range module still may not. Nothing here rebuilds the bundle; freshness stays scripts/build.test.ts's rule.

The one thing the issue did not expect: src/client/stage.test-helper.ts needed more than new exports. boot(host) is handed a renderer, but the shipped entry builds its own from the canvas it finds, so the stub scene canvas now answers getContext("webgl2") with a glRecorder (null under webgl: false, the same switch as before), the stub document carries readyState, and install() puts the four globals in place and hands back their undo. main.test.ts is untouched and unaffected.

How I checked it bites: truncating the committed bundle to its first 30 KB for one run fails two tests with error: Unexpected end of file; editing a copy so the entry looks for "touchy" instead of "touch" fails the match test with TypeError: null is not an object (evaluating 'q.hidden = !V'). Both were run against an edited copy and the original restored — static/ is unchanged in this branch. No network, no database, no FORGE_APP_*; bun test is 508 pass / 0 fail and goes from ~4.8 s to ~5.2 s.

🤖 Generated with Claude Code

Closes #43

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs