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

forked from trevato/cs · proposes · 4 behind

Two games, one engine, no sharing — and a test that says so in both directions #92

Merged opened this

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

Merged

`src/range/independence.test.ts` moves to `src/independence.test.ts` and gains the half that was missing: **a game's sources may not import another game's**, checked in both directions over every source outside the engine. The failure names the offender — `src/client/world.ts imports "../range/targets.ts"; a game may not import another game` — and the range reaching the other way fails the same wa…

shipped production is serving it deploy ae07c2d

opened this

src/range/independence.test.ts moves to src/independence.test.ts and gains the half that was missing: a game's sources may not import another game's, checked in both directions over every source outside the engine. The failure names the offender — src/client/world.ts imports "../range/targets.ts"; a game may not import another game — and the range reaching the other way fails the same way it did before. Who owns which directory comes from the registry (dirname(entry) of each GAMES entry), so a third game is covered by the entry that adds it, and src/rl/ is written down as the shooter's with a sentence of reasoning: it reads src/client/ because that game is the environment it trains in, and for exactly that reason it may not read src/range/. src/server.ts and src/pages/ belong to no game and are held to neither rule — the app is allowed to know about every game on it.

One file, not two, and one mechanism: the symmetric rule and the range's stricter one (engine door, src/pages/shell.ts, its own siblings, nothing else) are one question — who may import whom, once you are outside the engine — so they live in one place, and both read the sources with outsideSources/sources/specifiersOf imported from src/engine/boundary.test.ts rather than a third copy of the regex. The range's rule is the stricter of the two and stays stricter on purpose: the shooter cannot be held to it (it shares src/result.ts with the server, legitimately), and the range is the proof that the engine suffices, so it pays the higher price.

Two existing assertions had to move with the file rather than pass unchanged: the range's "has the sources this test is about" sentinel is now targets.test.ts instead of the test file that left the directory, and boundary.test.ts's synthetic door examples name src/independence.test.ts at its new depth. No real offence existed in the tree, so the rule was proved by adding one to src/client/hud.ts, watching it fail by name, and reverting it. bun test is green (503 tests), / and /range answer 200, and the README gains the src/independence.test.ts entry plus the src/rl/ sentence; src/engine/GUIDE.md is untouched, since the claim is about this repository's layout rather than about building a game on the package.

🤖 Generated with Claude Code

Closes #68

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs