webviews: chatOpenTrips test waits on conditions, not fixed time (base red from #27755)
Fixes a base red that hides signal. On feat-cmux-next, bun run check:pieces in webviews/ stops at check:fixed-waits, so vp fmt --check, vp lint and tsc never run on any webviews PR.
Cause: webviews/src/agent-session/acpmux/chatOpenTrips.test.ts (added by #27755) had await new Promise((resolve) => setTimeout(resolve, 10)) in the idle branch of openCountingWaves. That is one fixed wait, plus one for each of the helper's 3 call sites: 4 in total, against a baseline of 0.
Fix: when nothing is waiting to go to the daemon, the waves loop now waits until the page sends its next request or paints its first frame with rows. daemon.send and the snapshot callback both call wake(). The wait has no wall-clock delay, so idle time is still never counted as a wave. The test's intent stays the same: a chat's first frame waits on the handshake plus one daemon round trip. All three assertions are unchanged. No // fixed-wait: marker, no baseline change. Only this test file changes.
If the page hangs without sending or painting, the test now fails on bun's test timeout. Before, it failed on expect(painted) after 40 idle polls.
check:fixed-waits | chatOpenTrips.test.ts |
|---|---|
| before (base) | 4 unmarked fixed waits, baseline 0: fails |
| after (51b6fd00, run 41052999585) | 0 fixed waits: passes; the chatOpenTrips test and the full bun run check:pieces (fmt, lint, tsc) also pass in the same run |
No capture: test-only change.
Agent session: agent session
š¤ Generated with Claude Code