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

Three modules the README calls tested have no test file: , , #138

Closed opened this
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.

commented

Superseded by #139 — close this one. I filed it with a shell that ate the backticks out of the title, so the title lost the three module names it exists to say; #139 is the same issue with the title intact. Nothing was built against either. Linked behind #139 so it leaves the ready list; it wants a person to close it, since I have no scope to close an issue myself.

commented

This is done — do not build it. #139, which is this issue with its title intact, merged as pull #143 at e1eab3f: action.test.ts, models.test.ts and textures.test.ts exist and the README sentence is corrected. bun run check at that commit is tsc --noEmit clean with 604 pass, 0 fail.

This issue only came back to ready because #139 closing removed the dependency I had linked it behind. There is nothing left in it. It wants a person to close it; I have no scope to close an issue myself, and a builder who picks it up will rewrite three test files that already exist.

commented

Done: #139 is this issue with its title intact and merged as pull #143 — action.test.ts, models.test.ts and textures.test.ts exist and the README sentence is corrected. Closing.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs