Skip to content

Stabilize diff pipeline TUI test#13684

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

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

Conversation

@warp-dev-github-integration

Copy link
Copy Markdown
Contributor

Description

Stabilizes diff_pipeline_computes_added_lines_and_ghost_blocks from the required pre-fix baseline (453f4d30ca962406d7ac6004fa50cd4c879c51e3).

Root cause

The test started two asynchronous diff generations back-to-back:

  1. reset_content emits ContentChanged and computes an empty diff because the reset content matches the new base.
  2. apply_diffs immediately computes the intended replacement diff.

The test's one-shot subscription accepted the first DiffUpdated without identifying which generation completed. Background completion order can vary, and diff results are written without a version guard, so the empty reset result can be observed first or overwrite the edited result. The test then called expand_diffs and allowed only 100 scheduler yields for the downstream temporary-block layout. That bounded polling is also not a completion barrier: under scheduling variance, the intended diff and its ghost-layout action may not settle within 100 yields. The baseline reproduced with ghosts.len() == 0 on run 59 of a tight loop.

Fix

  • Wait for the reset diff to finish before applying the edit, preventing the two diff generations from racing.
  • Wait for the edited diff before expanding it.
  • Replace the fixed 100-yield loop with LayoutInvalidated notifications plus a check of the actual ghost state.

This continues to exercise the real asynchronous diff and char-cell layout pipeline while synchronizing on the relevant generation and observable render state.

Linked Issue

No linked issue; this addresses the reported flaky Rust test.

  • 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

  • cargo test -p warp_tui diff_pipeline_computes_added_lines_and_ghost_blocks -- --nocapture

  • Compiled exact test binary in a 1,000-run loop: 1,000/1,000 passed (baseline failed on run 59)

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

  • cargo fmt --all -- --check

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

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

Agent Mode

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

CHANGELOG-NONE

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

Conversation: https://staging.warp.dev/conversation/7cd7c094-1988-4dfd-bc65-e2f07d3e9c02
Run: https://oz.staging.warp.dev/runs/019f5d5a-e94e-76c2-944b-629b37da970d
Plans:

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