Skip to content

fix(test): bound the winit window lifecycle test instead of hanging CI - #2843

Merged
Xuepoo merged 1 commit into
mainfrom
ctx-1662-fix-winit-hang
Nov 1, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
ctx-1662-fix-winit-hang

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Priority: P1 | Area: ci | Labels: fix,P1,area:ci,area:testing | Milestone: v0.0.31 | RFC: none | Task: CTX-1662

Closes #2842

The Linux X11 (xvfb) job hung for 18 minutes in cargo test -p bitty-platform --test winit_window (run 41280906272) and was cancelled, which also starved the M1 artifact upload and failed the aggregate.

Root cause: the test creates a hidden window and depends on the redraw requested from Resumed arriving. When that request is lost, the default ControlFlow::Wait blocks with no pending events, about_to_wait is never called again, and the existing watchdog (counting AboutToWait ticks) can never reach its threshold.

Fix (test-only, crates/bitty-platform/tests/winit_window.rs):

  • keep the WindowHandle alive for the whole loop;
  • on AboutToWait without progress, re-request the redraw and re-arm set_wait_until(now + 50 ms) so the loop keeps ticking;
  • replace the tick counter with a 20 s time budget; on expiry the handler exits, main prints the diagnosis and returns exit code 1.

Verification:

  • cargo test -p bitty-platform: 217 + 7 + 8 + 4 tests pass;
  • live path on a real compositor: created=true resized=Some(785x939) redraw=true, 0.5 s;
  • forced no-progress path fails in 2.5 s with a clear message instead of hanging;
  • cargo fmt --check, cargo clippy -p bitty-platform --tests -D warnings clean.

Summary by CodeRabbit

  • Tests
    • Improved automated window integration test stability by monitoring for progress, retrying redraw requests when needed, and enforcing a bounded timeout. The test now exits directly when resize or redraw activity is observed, helping stalled runs fail rather than wait indefinitely.

@Xuepoo Xuepoo added this to the v0.0.31 milestone Nov 1, 2026
@Xuepoo Xuepoo added fix Bug fix P1 Priority: high area:ci CI area:testing labels Nov 1, 2026
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 615a19e5-9034-47d1-be6b-f9521be80b1e
Commits

Reviewing files that changed from the base of the PR and between 0d9515d and ef74d3b.

Files selected for processing: 1
  • crates/bitty-platform/tests/winit_window.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The winit integration test now retries redraw requests and schedules watchdog wakes until resize or redraw progress occurs. If progress does not occur within 20 seconds, the test exits with a failure status.

Changes: winit window test watchdog

Layer / File(s) Summary
Bounded resize and redraw progress
crates/bitty-platform/tests/winit_window.rs
The test retains the window handle and retries redraw requests during AboutToWait. It schedules another wake after 50 milliseconds and exits when resize or redraw progress occurs. If no progress occurs within 20 seconds, it records a timeout and the test process fails.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • Issue 2842 describes the winit_window test hanging when a hidden-window redraw does not produce progress. This change adds redraw retries and a bounded timeout to that test.
  • Issue 2830 describes a product-level bounded-recovery problem. This change bounds the test watchdog but does not add the product-level watchdog.

Possibly related PRs

  • bitty-terminal/bitty#2700: Adds redraw tracking and a synthetic occlusion edge for hidden windows, related to the hidden-window redraw condition handled by this test.
  • bitty-terminal/bitty#2834: Adds a production hang watchdog and hidden-surface repair probes, separate from this test-only timeout.

Suggested labels: area:platform

Merge Risk: Minimal · up to ef74d

The window test retries redraws and fails on timeout. No merge-blocking risk is evident.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding a bounded failure path to prevent the winit window lifecycle test from hanging CI.
Linked Issues check Passed The directly linked issue [#2842] requires a test-only bounded failure path. The diff keeps a WindowHandle in WinitWindowTest, retries request_redraw() on no progress, re-arms `set_wait_until(In…
Out of Scope Changes check Passed The change is limited to crates/bitty-platform/tests/winit_window.rs. The added comments, state changes, watchdog logic, and timeout reporting directly support the CI test fix in [#2842]. No product…
Full details: Linked Issues check

Explanation

The directly linked issue [#2842] requires a test-only bounded failure path. The diff keeps a WindowHandle in WinitWindowTest, retries request_redraw() on no progress, re-arms set_wait_until(Instant::now() + WATCHDOG_TICK) with a 50 ms interval, and replaces the tick counter with a 20-second PROGRESS_BUDGET. On expiry, the handler exits, main prints a diagnostic, and the process returns exit code 1. These changes satisfy the stated coding requirements.

Full details: Out of Scope Changes check

Explanation

The change is limited to crates/bitty-platform/tests/winit_window.rs. The added comments, state changes, watchdog logic, and timeout reporting directly support the CI test fix in [#2842]. No product-level safety-net work or unrelated file changes are present in the reviewed diff.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 1 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Xuepoo
Xuepoo merged commit 009e18c into main Nov 1, 2026
20 checks passed
@Xuepoo
Xuepoo deleted the ctx-1662-fix-winit-hang branch November 1, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI area:testing fix Bug fix P1 Priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

winit_window CI job hangs: AboutToWait tick counter is not a timeout

1 participant