Skip to content

Stabilize TUI diff pipeline test layout synchronization#13678

Draft
warp-dev-github-integration[bot] wants to merge 1 commit into
masterfrom
oz/fix-flaky-diff-pipeline-test
Draft

Stabilize TUI diff pipeline test layout synchronization#13678
warp-dev-github-integration[bot] wants to merge 1 commit into
masterfrom
oz/fix-flaky-diff-pipeline-test

Conversation

@warp-dev-github-integration

Copy link
Copy Markdown
Contributor

Description

Stabilizes diff_pipeline_computes_added_lines_and_ghost_blocks by synchronizing the assertion with completion of the asynchronous ghost-block layout.

Root cause

expand_diffs computes the removed-line temporary blocks synchronously, but RenderState::add_temporary_blocks only enqueues a LayoutTemporaryBlock action. The char-cell render state's ghost list is updated later when the layout channel processes that action.

The test previously polled the ghost list for at most 100 yield_now() calls. Yielding gives other tasks an opportunity to run, but it does not establish that the queued layout action has completed. Under scheduler contention, the loop could exhaust its arbitrary iteration budget while the ghost list was still empty, producing the intermittent left: 0, right: 1 assertion. This is a test synchronization race, not an incorrect diff result.

Fix

Subscribe to CodeEditorModelEvent::LayoutInvalidated before expanding the diff, and resolve a one-shot waiter only when the corresponding render-state snapshot contains ghost blocks. The assertion now has a state-based completion condition instead of a scheduler-dependent polling budget.

Linked Issue

No linked issue; this addresses a reported CI flake.

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

  • Baseline contention reproduction: 512 exact test runs at concurrency 8; 150 failed with an empty ghost list.

  • Fixed contention verification: 512 exact test runs at concurrency 8; all passed.

  • cargo test -p warp_tui diff_pipeline_computes_added_lines_and_ghost_blocks -- --test-threads=1

  • cargo test -p warp_tui --lib (102 passed)

  • cargo clippy -p warp_tui --all-targets --tests -- -D warnings

  • cargo fmt --all -- --check

  • I have manually tested my changes locally with ./script/run (test-only change)

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-NONE

Conversation: https://staging.warp.dev/conversation/82e4d2ed-5e41-49ea-92bd-dc043589797a
Run: https://oz.staging.warp.dev/runs/019f5d59-a819-7a86-bfd1-18060a7b68f9

Co-Authored-By: Oz oz-agent@warp.dev

This PR was generated with Oz.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant