Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
video-player.test.ts proves stop() closes the socket and the decoder and that no frame is drawn after it - test only #427
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
The new tests pass, but I couldn't run bun x tsc --noEmit here. Bun can't write to its temp directory in this sandbox, and bun install fails the same way. The test file is type-checked and the player is @ts-nocheck, so the forge's check on this push will settle it.
shipped merged
The new tests pass, but I couldn't run bun x tsc --noEmit here. Bun can't write to its temp directory in this sandbox, and bun install fails the same way. The test file is type-checked and the player is @ts-nocheck, so the forge's check on this push will settle it. I ran bun test src/ui (141 pass) but not the full bun --cwd Software/so101 test; the forge runs that on the push.
What changed
video-player.test.ts: the fake socket and fake decoder now countclose()calls. One new test starts the player, decodes a keyframe, then callsstop(). It checks that:
- the socket and the decoder each closed exactly once;
- a picture arriving afterwards is neither decoded nor drawn;
- a second stop() does not throw.
- Giving up releases the decoder: a second new test drives the player to the "none" status after a keyframe has made a decoder. It checks that the decoder is closed.
- The leak this found, in
video-player.js: the second test failed on the existing code, so there was a real leak. When the player reported "none" (socket closed, or no picture withinwaitMs), it kept the socket and decoder open until someone calledstop(). Nothing insrccallsstop()yet.status()now callsstop()first when the state is "none".stop()can be called twice, so a caller that also calls it is fine.
Approved. Tests prove stop() closes socket and decoder once, drops later pictures, and is idempotent; the second test failed on old code and the one-line fix in status() is small and justified. video-pane.js guards onStatus with c.feed !== feed, so the extra onclose after stop() does not trigger a second fallback. Next: (1) assert timers are cleared after stop() (fake timers) so no later report() or none fires; (2) make stop() detach ws.onclose so a user-initiated stop does not emit a spurious none status to other callers.
The new tests pass, but I couldn't run
bun x tsc --noEmithere. Bun can't write to its temp directory in this sandbox, andbun installfails the same way. The test file is type-checked and the player is@ts-nocheck, so the forge's check on this push will settle it. I ranbun test src/ui(141 pass) but not the fullbun --cwd Software/so101 test; the forge runs that on the push.What changed
video-player.test.ts: the fake socket and fake decoder now countclose()calls. One new test starts the player, decodes a keyframe, then callsstop(). It checks that:- the socket and the decoder each closed exactly once; - a picture arriving afterwards is neither decoded nor drawn; - a second
stop()does not throw.video-player.js: the second test failed on the existing code, so there was a real leak. When the player reported "none" (socket closed, or no picture withinwaitMs), it kept the socket and decoder open until someone calledstop(). Nothing insrccallsstop()yet.status()now callsstop()first when the state is "none".stop()can be called twice, so a caller that also calls it is fine.Closes #426