Skip to content

Poll for self-driven snow frames instead of a fixed sleep - #437

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-5766-snow-flake
Aug 9, 2026
Merged

Poll for self-driven snow frames instead of a fixed sleep#437
TheGreatAxios merged 1 commit into
mainfrom
cl-5766-snow-flake

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • The idle landing snow test used a fixed 3s sleep then a single flush. Under CI load the mount's setInterval can fire after that window, so flush finds nothing scheduled and the capture is still the mount frame — a flake that fails unrelated PRs.
  • Replace the fixed sleep with a poll up to a 5s deadline: flush → check mark rows → 50ms yield. Nothing in the wait path calls paintLanding/renderMark/renderOnce, so a frozen timer still fails the assertion. Early exit drops average suite cost below the old fixed 3s wait.
  • Path is under the post-flatten src/tui/landing.test.ts (rebased onto main after Flatten the OpenTUI shell into src/tui #435).

Fixes CL-5766.

Test plan

  • bun test src/tui/landing.test.ts (25 pass; snow test ~166ms via early exit)
  • bun test ./src ./tests ./evals (4346 pass, 0 fail)
  • CI green on this PR

@linear-code

linear-code Bot commented Aug 9, 2026

Copy link
Copy Markdown

CL-5766

@TheGreatAxios

Copy link
Copy Markdown
Collaborator Author

Self-review

Root cause: fixed 3s sleep + single flush races under CI load when the mount-scoped setInterval fires late. flush only drains already-scheduled renders; if the timer has not fired yet, the capture is still the mount frame and the assertion fails with two identical marks.

Fix: poll until markRows differ or a 5s deadline: flush → compare → 50ms yield. No paintLanding / renderMark / renderOnce in the wait path, so the load-bearing property is intact (frozen timer still fails). Early exit keeps average wall time below the old fixed 3s sleep (local snow test ~166ms).

Scope: single file src/tui/landing.test.ts on post-#435 main. No product code change.

Risks: worst-case wait is 5s instead of 3s if snow never moves (already fails the test). Under normal load this should be cheaper. Ablation property preserved by design — nothing pumps frames.

@TheGreatAxios
TheGreatAxios merged commit ff84297 into main Aug 9, 2026
2 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