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

forked from trevato/cs · proposes · 4 behind

The engine has one door: src/engine/index.ts is the surface, and nothing outside reaches past it #28

Merged opened this

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

Merged

`src/engine/index.ts` is now the engine's only door: it re-exports the public names of all eight modules — values and types, one docstring per module — and holds no logic and no constants of its own. Every import of the engine from `src/client/`, `src/rl/`, their tests and `scripts/train.ts` goes through it (29 deep imports became 22 door imports; where swapping the specifier left a file importing…

shipped production is serving it deploy ae07c2d

opened this

src/engine/index.ts is now the engine's only door: it re-exports the public names of all eight modules — values and types, one docstring per module — and holds no logic and no constants of its own. Every import of the engine from src/client/, src/rl/, their tests and scripts/train.ts goes through it (29 deep imports became 22 door imports; where swapping the specifier left a file importing the same path two or three times, those lines were merged into one). Inside the engine, modules still import each other directly.

src/engine/boundary.test.ts grew the rules that hold it: no file under src/ or scripts/ may name a path inside the engine other than index.ts; every non-test module under src/engine/ is behind the door and the door re-exports nothing else; no engine module goes through its own door; and the sorted list of the 76 names the door offers is written out in the test, so adding, removing or renaming one fails and is read in review. Each rule has a unit test for the predicate itself beside the sweep over the sources, and one test checks the re-exported values are identical to the modules' own.

No two modules exported the same name, so nothing is aliased. Nothing grew and nothing moved: the bundle went from 68220 to 68224 bytes (app.90bb5b2a7e.js → app.3fa56501a8.js, rebuilt and committed), src/client/replay.test.ts's digests are untouched, and bun test is 226 pass / 0 fail. tsc --noEmit --strict reports the same three pre-existing errors as main and no resolution or missing-export errors. The README's shape section gains a bullet naming the door, listing the surface and stating the rule.

What I left alone: nothing in the engine does work at import time today and I added nothing that does, but the test that would prove it stays #26's. Worth a look in the preview: / still renders and serves the new bundle (200, ~20 ms locally).

🤖 Generated with Claude Code

Closes #25

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs