Skip to content

Replace fixed settle-sleeps in tmux tests with polling#283

Merged
andyrewlee merged 1 commit into
mainfrom
tmux-poll-not-sleep
Jun 8, 2026
Merged

Replace fixed settle-sleeps in tmux tests with polling#283
andyrewlee merged 1 commit into
mainfrom
tmux-poll-not-sleep

Conversation

@andyrewlee

Copy link
Copy Markdown
Owner

Close-the-loop stack — PR 12/12 (final)

Problem

The real-tmux integration tests waited fixed windows (50/100/200ms) for a session to settle before capturing and asserting. Those flake on a loaded/slow CI runner — and worse, a fixed window gives a real send/capture-latency regression room to hide: as long as the bug fits inside the sleep, the test stays green.

Change

Add an eventually(timeout, cond) helper and convert the clear "settle then capture/assert" sites — the SendKeys round-trip echo check and four capture/pane-id resolution tests — to poll for the observable condition. Polling for the actual state is strictly better than a fixed wait: faster on a fast host, and it can't mask a latency regression behind a generous sleep.

The remaining structural settle-sleeps (e.g. after split-window before an error-shape assertion) are left as-is; this converts the content/readiness waits where polling is an obviously-correct transformation.

Verification note

These tests skip on local macOS tmux 3.6a (empty tmux servers self-exit, defeating the shared start-server probe — a deeper issue than this PR), so they're verified by the tmux-e2e CI job (where the probe works), now also running on both 3.2a and 3.6a via PR 5. The conversions compile, vet, and lint clean locally; they are mechanically poll-until-condition, which only improves on a fixed sleep.

🤖 Generated with Claude Code

@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from 79049bc to f2baf94 Compare June 8, 2026 02:26
@andyrewlee andyrewlee force-pushed the tmux-poll-not-sleep branch from 9eb8b2b to 4bdb0e4 Compare June 8, 2026 02:26
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from f2baf94 to eb748fe Compare June 8, 2026 02:30
@andyrewlee andyrewlee force-pushed the tmux-poll-not-sleep branch from 4bdb0e4 to eb1854c Compare June 8, 2026 02:30
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from eb748fe to 2e4fb8a Compare June 8, 2026 02:39
@andyrewlee andyrewlee force-pushed the tmux-poll-not-sleep branch from eb1854c to 7daadef Compare June 8, 2026 02:39
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from 2e4fb8a to aa9c340 Compare June 8, 2026 02:42
@andyrewlee andyrewlee force-pushed the tmux-poll-not-sleep branch 2 times, most recently from 7e0d7c7 to 616d227 Compare June 8, 2026 02:45
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from aa9c340 to 022ca0b Compare June 8, 2026 02:45
@andyrewlee andyrewlee force-pushed the tmux-poll-not-sleep branch from 616d227 to 9c864b6 Compare June 8, 2026 02:50
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch from 022ca0b to a7dab8a Compare June 8, 2026 02:50
@andyrewlee andyrewlee force-pushed the tmux-poll-not-sleep branch from 9c864b6 to b6dc7b8 Compare June 8, 2026 02:58
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch 2 times, most recently from 89e338c to 695663d Compare June 8, 2026 03:02
@andyrewlee andyrewlee force-pushed the tmux-poll-not-sleep branch 2 times, most recently from 0ce5a16 to ee68ce9 Compare June 8, 2026 03:05
@andyrewlee andyrewlee force-pushed the tmux-version-detection branch 2 times, most recently from 428c742 to 5bca605 Compare June 8, 2026 03:08
@andyrewlee andyrewlee force-pushed the tmux-poll-not-sleep branch from ee68ce9 to 26457e4 Compare June 8, 2026 03:08
The real-tmux integration tests waited fixed windows (50/100/200ms) for
a session to settle before capturing and asserting. Those flake on a
loaded or slow CI runner, and worse, a fixed window gives a real send/
capture-latency regression room to hide: as long as the bug fits inside
the sleep, the test stays green.

Add an `eventually(timeout, cond)` helper and convert the clear
"settle then capture/assert" sites — the SendKeys round-trip echo check
and four capture/pane-id resolution tests — to poll for the observable
condition instead. Polling for the actual state is strictly better than
a fixed wait: faster when the host is fast, and it does not mask a
latency regression behind a generous sleep.

The remaining structural settle-sleeps (e.g. after split-window before an
error-shape assertion) are left as-is; this converts the content/readiness
waits where polling is an obviously-correct transformation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@andyrewlee andyrewlee force-pushed the tmux-poll-not-sleep branch from 26457e4 to b3e3cc1 Compare June 8, 2026 03:12
@andyrewlee andyrewlee changed the base branch from tmux-version-detection to main June 8, 2026 03:12
@andyrewlee andyrewlee merged commit da225a4 into main Jun 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant