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

Migrated from github.com/Trevato/SO-ARM100

jam-stream.test.ts judges 'jams within 500 ms' on the readings' own clock, not the test machine's wall clock, so a loaded full run no longer fails it #556

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

The jam test in `src/jam-stream.test.ts` now judges the jam's own time, not the test machine's wall clock. The test file passed 5 times in a row alone. I did not run the whole `bun --cwd Software/so101 test`, so the other jam tests are untouched and unrun beyond that file. `bun x tsc --noEmit` failed here because the `bun` type definitions were missing, so the type check did not run.

shipped merged

opened this

The jam test in src/jam-stream.test.ts now judges the jam's own time, not the test machine's wall clock. The test file passed 5 times in a row alone. I did not run the whole bun --cwd Software/so101 test, so the other jam tests are untouched and unrun beyond that file. bun x tsc --noEmit failed here because the bun type definitions were missing, so the type check did not run.

  • What the test asserts: /status jams[] has no ms field, and the issue limits the change to this test file. So the test reads the jam's duration from the why text ("… for N ms …"). That figure comes from the readings' timestamps. It must be at least JAM_WINDOW_MS and at most 500.
  • Unchanged assertions: the existing assertions on why and on the rest of the jam entry are still there.
  • Wall clock: the poll loop's deadline went from 1500 ms to 3000 ms and no longer asserts anything.
  • Fails when the window grows: I temporarily set JAM_WINDOW_MS to 600 in src/jam-watch.ts. The test then failed with Expected: <= 500, Received: 605. I reverted that change.
  • Optional follow-up: adding ms to the /status jam entry in src/server.ts would let the test read it directly instead of parsing why. I left that out to stay inside the test file.

🤖 Generated with Claude Code

Closes #555

commented

The jam test in src/jam-stream.test.ts now judges the jam's own time, not the test machine's wall clock. The test file passed 5 times in a row alone. I did not run the whole bun --cwd Software/so101 test, so the other jam tests are untouched and unrun beyond that file. bun x tsc --noEmit failed here because the bun type definitions were missing, so the type check did not run.

  • What the test asserts: /status jams[] has no ms field, and the issue limits the change to this test file. So the test reads the jam's duration from the why text ("… for N ms …"). That figure comes from the readings' timestamps. It must be at least JAM_WINDOW_MS and at most 500.
  • Unchanged assertions: the existing assertions on why and on the rest of the jam entry are still there.
  • Wall clock: the poll loop's deadline went from 1500 ms to 3000 ms and no longer asserts anything.
  • Fails when the window grows: I temporarily set JAM_WINDOW_MS to 600 in src/jam-watch.ts. The test then failed with Expected: <= 500, Received: 605. I reverted that change.
  • Optional follow-up: adding ms to the /status jam entry in src/server.ts would let the test read it directly instead of parsing why. I left that out to stay inside the test file.

🤖 Generated with Claude Code

Approved

Approved. The test now judges the jam on the readings' own clock (the "for N ms" in why, between JAM_WINDOW_MS and 500) and the wall-clock deadline only bounds the poll loop. JAM_WINDOW_MS is exported, and the change stays in the test file as the issue asked. smith showed it fails when the window grows. Two things I would do next: (1) expose ms on the /status jam entry so the test reads a field instead of parsing why text; (2) run the full jam test set plus tsc once the bun types are installed, since smith only ran this file.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs