test(ios): wait and TUI scroll tests measure no wall-clock time (fix-forward for #28337)

Merged
TE
5d ago
+32-13

Fix-forward for #28337. Tests only, no product change.

Scope narrowed. The wait-test part of this PR (MacHomeTests: no wall-clock bounds, aWaitCancelledWhileSuspendedEnds) is already on base through #28975 (5fb4ac7b), which carries the same change. The merge of feat-cmux-next took base's MacHomeTests.swift. Against base, this PR now changes only TerminalTUIScrollSurfaceTests.swift.

TerminalTUIScrollSurfaceTests.aSlowDragIsOneReportPerRowAndAFastDragMore

  • The red: it failed 1 of 16 full-kit runs at 86af474a (step b1720d28, TerminalTUIScrollSurfaceTests.swift:119: rig.text → "") and 0 of 14 at base.
  • Not a timing problem in the drag: the drag already uses synthetic velocities (velocityY: 150 / 3000), and TerminalTUIScroll has no clock.
  • The cause is delivery. In mirror mode, TerminalSurfaceView's io_write_cb delivers Ghostty's bytes on the spot only when Ghostty writes on the main thread. Otherwise it delivers them with DispatchQueue.main.async. The tests read rig.text right after the wheel or tap, so a write from Ghostty's own thread read as empty.
  • Fix: Rig.text(awaiting:) waits until the expected bytes have arrived, with a 30 s watchdog against a hang, not a time budget. Every check that expects output uses it.
  • Unchanged: the checks that expect nothing stay synchronous. A late delivery there could only make a check pass falsely, never flake it.

Evidence

All at the exact head 08d84495d8a3dab7b130a7f95160439f75647c41:

  • CmuxMobileTerminalTests/TerminalTUIScrollSurfaceTests on the fleet (step a4a7f7f0): passed 9, failed 0.
  • Full CmuxMobileKit on the fleet (step 297451d8): passed 1781, failed 0, skipped 1. No reds, so none to compare against base.
  • Review (codex gpt-6-astra high, router-review): SHIP at 08d84495d8a3dab7b130a7f95160439f75647c41. Follow-up [P2]: in mode 1003 a pointer-motion report plus one wheel report can reach the expected byte count before the second wheel report arrives; wait for the wheel suffix instead.

Agent session: agent session

šŸ¤– Generated with Claude Code