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

forked from trevato/cs

src/rooms/ is held by this repository's own rules: four modules, four test files, and one line that says whose the directory is #320

shipped production is serving it opened this has it
opened this

Multiplayer landed as four modules under src/rooms/ with one 507-line rooms.test.ts, and their docstrings already name the files they expect: code.ts is tested by "code.test.ts", the hub says "hub.test.ts runs a hub with five members", the room says "room.test.ts plays a whole round", the wire says "every claim in wire.test.ts". None of those files exist. Give them the four files, and put the directory under the import rule that holds every other directory here — because the next step moves two of these modules into the engine, and a move is only safe when a test reads the sources and says who may import whom.

Done looks like

  • [ ] src/rooms/rooms.test.ts becomes src/rooms/code.test.ts, wire.test.ts, room.test.ts and hub.test.ts, each testing the module it is named for, with no assertion lost — the suite's count does not fall.
  • [ ] The shared fixtures (a room with members, a busy ten-body world) live in src/rooms/stage.test-helper.ts, the way both games do it, rather than being copied four times.
  • [ ] The snapshot-size measurement keeps printing its line (544 bytes — 8.7 kB/s a member at 16 Hz) from wherever the wire is tested, because that number is the argument for the rate.
  • [ ] src/independence.test.ts says whose src/rooms/ is. Today gameOf("src/rooms/room.ts") is null — the app — so room.ts may import src/range/ as freely as src/client/, which is exactly the sharing that file exists to refuse. room.ts and wire.ts are the shooter's: ALSO.app gains src/rooms, and a test asserts importsAnotherGame("src/rooms/room.ts", "../range/targets.ts") is refused while "../client/world.ts" is allowed.
  • [ ] code.ts and hub.ts import no game today. A test reads their sources and says so, so the extraction in the issue that follows starts from a fact rather than a reading.
  • [ ] Every docstring under src/rooms/ names a test file that exists, and a test holds that claim by reading the sources — the habit this repository already has for the seam table.
  • [ ] The seam table itself is left to #116, which owns it; this issue does not edit src/engine/GUIDE.md except where it names a file that is not there.
  • [ ] bun test and tsc --noEmit pass.

Files

src/rooms/rooms.test.ts (deleted), src/rooms/{code,wire,room,hub}.test.ts (new), src/rooms/stage.test-helper.ts (new), src/independence.test.ts, and the four modules' docstrings.

Risks

A split that drops a case is worse than the file it replaced: count the tests before and after and say both numbers in the pull. ALSO.app gaining a directory widens what the shooter may reach for — check that nothing under src/rooms/ imports src/rl/ on the way through.

Torque.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs