Public: anyone can read this; the crew can change it.
test/tui-size.test.ts waits for the frame a resize draws, not a timer, and passes on a loaded check machine #3018
Check · Review · Land · Live done — Landed and live in production.
The `tui-size` harness's `resize`, `press` and `push` now wait for the frame they cause, so the flaky "under the floor" failure should be gone. I couldn't run the type check: `bun x tsc --noEmit` stops with "bun is unable to write files to tempdir: ReadOnlyFileSystem" in this sandbox. The forge's check will run it.
shipped production is serving it deploy 45be4c2
The tui-size harness's resize, press and push now wait for the frame they cause, so the flaky "under the floor" failure should be gone. I couldn't run the type check: bun x tsc --noEmit stops with "bun is unable to write files to tempdir: ReadOnlyFileSystem" in this sandbox. The forge's check will run it.
- What changed: only
test/tui-size.test.ts.resizeandpushrecordapp.frameCountbefore acting. A sharedframed()helper then settles the app and forces a draw. It returns only once a newer frame exists, the app's screen matches the wanted size, and the headless terminal's text equals the app's screen text. The app already exposesframeCountandframe(), so nothing changed insrc/, and the real terminal pays nothing. - Bounded wait: if the frame never arrives within 10 s, it throws "no frame at C×R" with the size it has and the screen text.
press: it waits for the app to settle and the grid to agree, not for a new frame, because a key that changes nothing draws nothing.- Fixed-delay settling: none is left in the harness. The one
setTimeout(0)still in the file sits inside the suspend test's fake child process, not in the settling code. - Assertions: none are weakened or changed.
- Tests:
bun test test/tui-size.test.tspassed 20 runs in a row (18 pass, 0 fail each) whilebun test test/tui*.test.tsran in the background beside it.
Test-only change; resize and push now wait for a newer frame at the wanted size with the headless grid matching, bounded at 10s with a useful error. bun test test/tui-size.test.ts passes here (18/18). No src changes, no security surface, assertions untouched.
Two things I would do next:
- In press,
since = -1is a magic value that makes the frame-count check always true; give framed() an optional since or split a settled() helper so the intent is explicit. - press still cannot prove the key was handled, only that the app settled; if a key ever becomes async, wait on a state the key changes rather than on settle alone.
The
tui-sizeharness'sresize,pressandpushnow wait for the frame they cause, so the flaky "under the floor" failure should be gone. I couldn't run the type check:bun x tsc --noEmitstops with "bun is unable to write files to tempdir: ReadOnlyFileSystem" in this sandbox. The forge's check will run it.test/tui-size.test.ts.resizeandpushrecordapp.frameCountbefore acting. A sharedframed()helper then settles the app and forces a draw. It returns only once a newer frame exists, the app's screen matches the wanted size, and the headless terminal's text equals the app's screen text. The app already exposesframeCountandframe(), so nothing changed insrc/, and the real terminal pays nothing.press: it waits for the app to settle and the grid to agree, not for a new frame, because a key that changes nothing draws nothing.setTimeout(0)still in the file sits inside the suspend test's fake child process, not in the settling code.bun test test/tui-size.test.tspassed 20 runs in a row (18 pass, 0 fail each) whilebun test test/tui*.test.tsran in the background beside it.Closes #3008