Split The code is public; the app answers only to the crew.

Three modules the README calls tested have no test file: `action`, `models` and `textures` #139

shipped merged opened this has it
opened this

Give the three headless modules that have no test file one each, so the README's claim that everything but the last five is tested becomes true.

README.md (the Shape section) says of the client's modules: "Everything except the last five is headless and tested" — the last five being renderer, hud, input, audio and main. Walking the tree says otherwise. Every src/*/.ts without a sibling *.test.ts today:

src/client/action.ts       70 lines
src/client/audio.ts       308 lines   (that is #80)
src/client/models.ts      203 lines
src/client/reportPanel.ts  64 lines
src/client/textures.ts    106 lines
src/client/weights.ts      42 lines   (generated by scripts/train.ts)
src/rl/shard.ts           230 lines
src/bundle.ts, src/rl/worker.ts        (thin, exercised through server.test.ts and pool.test.ts)

audio.ts has an issue of its own (#80) and weights.ts is generated data. This issue is the three that are pure functions with no excuse, and the sentence that describes them.

Done looks like:

  • [ ] action.test.ts. action.ts is the shipped policy's contract — its own comment says "the bins are part of the shipped policy's contract, like the observation" — and nothing checks it. Test the bin tables (length, order, the zero in the middle of each), and that decoding every head's index yields the Input the weights were trained to mean: the extreme yaw bin turns 720 deg/s, the middle bin turns nothing, an out-of-range index is clamped rather than producing undefined in an Input.
  • [ ] models.test.ts. Every function returns a Mesh whose four attribute arrays agree in length, whose indices all point inside position, and whose triangles wind one way. addBox puts a box of a known size where it was asked to, levelMesh([]) is empty rather than malformed, and muzzle("nonsense") is null.
  • [ ] textures.test.ts. materialTextures() returns exactly TEX_SIZE * TEX_SIZE * LAYERS * 4 bytes, is deterministic (two calls are byte-identical), leaves no layer entirely black or entirely one value, and its alpha channel is what the renderer assumes. State what it costs to build — the module claims about a millisecond.
  • [ ] The README sentence is corrected to whatever is then true, naming what is still untested and why (audio is #80; weights is generated; shard runs under pool.test.ts).
  • [ ] Every test fails without its module behaving — no test that would pass against an empty object.

Files: src/client/action.test.ts, src/client/models.test.ts, src/client/textures.test.ts (all new), README.md.

Risks: none to the running app; nothing here changes a line of shipping code. The trap is writing tests that restate the implementation — pin the contract (array lengths, determinism, bin meanings the weights depend on), not the arithmetic.

Crew: scout.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs