Skip to content

test(zero-swift): fix the flaky theRowAJumpLandedOnIsDeleted - #192

Merged
tmm merged 1 commit into
mainfrom
swift-virtual-jump-delete-flake
Nov 13, 2026
Merged

tmm merged 1 commit into
mainfrom
swift-virtual-jump-delete-flake

Conversation

@tmm

@tmm tmm commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

VirtualListViewTests.theRowAJumpLandedOnIsDeleted failed on macOS CI at 02c6ab9 on main and on #180 with on screen: n150, and passed on rerun.

Cause

The test, not ZeroVirtual. After deleting n150 it waited a fixed 2 s of wall-clock time, then checked that n151 had come up. The delete reaches the list over several turns of the main actor (poke playback, the page queries, the layout pass). The other @MainActor suites share the main actor, and HardenStorageTests' busy-write tests hold it for seconds at a time (SQLite's 5 s busy timeout). When a stall covered the 2 s window, the test woke after the window and read the list before the delete had reached it.

Evidence:

  • A traced CI run (5 repeats of the suite) showed the main actor stalled for 15.3 s, and then 1.2 s, during the test. n151 came up about 60 ms of main-actor time after it was free again.
  • In the failing run on main, the failure lands next to aBusyWriteThatStillFailsAtCloseIsReported (15.3 s). Running the two together on a Mac stalls the test's main actor for 10.9 s.
  • Holding the main actor for 2.5 s right after the delete fails the old test 5 times out of 5 with CI's exact message (on screen: n150). The fixed test passes with stalls of 2.5 s, 5 s and 15 s.

Fix

The test now waits for n151 to come up, then checks it stays there. This is how the test already waits for the jump before the delete. It is not a longer timeout: it no longer depends on how long the main actor is busy. It still catches a regression: with the deleted-row reanchor broken, it fails with on screen: n070.

Stability (Mac, Xcode 26.6 / Swift 6.3.3, as CI)

  • 100 runs of the test on its own: 100 passed.
  • 25 runs paired with HardenStorageTests' busy-write tests: 25 passed.
  • 6 runs of the full macOS suite (348 tests): all passed.

Test-only change, so no changeset.

theRowAJumpLandedOnIsDeleted gave the delete a fixed 2 s of wall-clock
time to reach the list. That takes several turns of the main actor, which
the other @mainactor suites share; HardenStorageTests' busy-write tests
hold it for seconds at a time (SQLite's 5 s busy timeout). When such a
stall covered the window, the test woke after it and read the list before
the delete had arrived: "on screen: n150".

It now waits for n151 to come up, then checks it stays, as it waits for the
jump before the delete.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1d36c-588f-74c1-ab26-4bb389433e40
Co-authored-by: tmm <tmm@tmm.dev>
@tmm
tmm force-pushed the swift-virtual-jump-delete-flake branch from 178544f to 0208c83 Compare November 13, 2026 06:55
@tmm
tmm marked this pull request as ready for review November 13, 2026 06:55
@tmm
tmm merged commit cd3536d into main Nov 13, 2026
22 checks passed
@tmm
tmm deleted the swift-virtual-jump-delete-flake branch November 13, 2026 07:11
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.

2 participants