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

forked from trevato/cs · proposes

The bins the shipped weights were trained on get the test they never had: src/client/action.ts #201

Merged opened this

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

Merged

`src/client/action.test.ts` now pins the action space the shipped weights were trained on. `decode` is walked over every index of every head — the whole 9·7·3·3·2·3 = 3402 combinations in one loop — against tables of bin values written out by hand in the test, so the expectations agree with the bins and not with `decode`'s own arithmetic restated; the posture head is a literal table of walk / duck…

shipped production is serving it deploy ae07c2d

opened this

src/client/action.test.ts now pins the action space the shipped weights were trained on. decode is walked over every index of every head — the whole 9·7·3·3·2·3 = 3402 combinations in one loop — against tables of bin values written out by hand in the test, so the expectations agree with the bins and not with decode's own arithmetic restated; the posture head is a literal table of walk / duck / neither. Alongside it: HEADS equals PACKED.shape.heads and PACKED.shape.obs equals OBS_SIZE (the one drift that would pass every other test here), decode's at is read out of a buffer holding two samples so an index off by one shows, toInput and STILL are pinned as whole-object literals (toInput(STILL, false) is exactly NO_INPUT, and turning is absent because turning is not Input), and a seeded sweep of 200 observations through the shipped policy — greedy and sample — has to decode to an intent whose every field is in range, never NaN, and never walking and ducking at once.

Every assertion earns itself: deleting any one of the nineteen lines of decode and toInput, one at a time, fails at least one test — including walk: posture === 1, in decode and forward: intent.forward, in toInput, which I checked by deletion. Swapping walk for duck, reading the posture from head 4, moving one yaw bin, and changing a head count all fail too. action.ts itself is untouched.

One thing outside the new test did have to change, and it is a bug this found: bun test was already failing on this branch's base, eight tests, before I wrote a line. #197 and #198 each committed an app bundle and the merge kept both, so static/ had two and every test that reads "the" committed bundle errored. bun run scripts/build.ts rebuilds from the merged source, keeps app.bb7df12ff4.js and drops the stale app.4933b16c8f.js; that deletion is the second commit, and with it bun test is 889 pass, 0 fail.

🤖 Generated with Claude Code

Closes #108

commented

src/client/action.test.ts pins the action space the shipped weights were trained on, now merged with main. decode is walked over every index of every head — the whole 9·7·3·3·2·3 = 3402 combinations in one loop — against tables of bin values written out by hand in the test, so the expectations agree with the bins and not with decode's arithmetic restated; HEADS is checked against PACKED.shape.heads and OBS_SIZE against PACKED.shape.obs (the one drift that would pass every other test here); at is read out of a buffer holding two samples so an index off by one shows; toInput and STILL are whole-object literals, with toInput(STILL, false) exactly NO_INPUT and turning absent because turning is not Input; and a seeded sweep of 200 observations through the shipped policy, greedy and sample, has to decode to an intent in range and never NaN.

The conflict was the whole file, and both sides are kept. main's #200 gave decode a clamp, so its "a bin the head does not have is clamped to the nearest one it does" test is here, rewritten against the same literal tables: an index past the end is 720, a negative one is -240, and a one-element sample decodes to every head's first bin. The two tests #200 edited for tsc are subsumed by the loop and by the STILL test, which assert strictly more.

Every assertion earns itself: deleting any one of the twenty lines of bin, decode and toInput, one at a time, fails at least one test — including walk: posture === 1, in decode and forward: intent.forward, in toInput, which I checked by deletion. Swapping walk for duck, reading posture from head 4, moving one yaw bin, changing a head count and dropping the upper clamp all fail too. Two mutants survive and should: weakening Math.max(index ?? 0, 0) or index ?? 0 inside bin changes nothing a caller can see, because the ?? bins[0] at the end of the same expression already answers a negative or missing index with the first bin — redundant in the sense scripts/mutate-result.ts uses the word, not unpinned. action.ts itself is untouched.

Two things outside the test had to change, and both were already red on main before this branch existed: bun run typecheck failed at src/client/main.test.ts:755, where a textContent (string | null) was compared against level?.name (string | undefined) — it now compares both against the map name the test already computes — and static/ carried three app bundles, none of which is what the current source builds, so bun run scripts/build.ts rebuilt and left app.e24e7af2ef.js. With those, bun run test is typecheck clean and 890 pass, 0 fail.

🤖 Generated with Claude Code

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs