Skip to content

fix(app): await WAL timer Futures before capture-replay settle (load-sensitive flake) - #14331

Merged
Git-on-my-level merged 1 commit into
mainfrom
task/msd-harness-flake-capture-replay
Sep 17, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
task/msd-harness-flake-capture-replay

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

What changed and why

CaptureReplayWorld.settle() treated coordinator-idle as a durable WAL write. ManualScheduler discarded the Future returned by production's async periodic _flush/_chunk callbacks, so process-kill reconstruction could reload empty WALs while writeAsBytes was still in flight. The scheduler now tracks those Futures; settle/dispose await them. No sleeps, retries, or widened timeouts.

Product invariants affected

none

How it was verified

BEFORE (unfixed, 50 sequential flutter test --plain-name "process kill mid-capture" while bash app/test.sh ran): 43 pass / 7 fail. Failures at iters 4, 5, 7, 19, 36, 37, 41. Concurrent suite pid 32300, 2026-09-17T08:31:53Z–08:33:18Z; later fails still reproduced after the suite exited.

AFTER (same 50, app/test.sh looping from 09:39:41Z covering iters 13–50): 50 pass / 0 fail.

Also: flutter test test/unit/virtual_capture_time_test.dart test/unit/capture_recovery_replay_scenarios_test.dart → 00:03 +20: All tests passed!

Tests

  • app/test/unit/virtual_capture_time_test.dart — parks an async periodic callback on a Completer across elapse and asserts hasInFlightIo until waitForCallbackIo. Would have caught the class.
  • Existing process kill mid-capture is now a durable-IO test rather than a race.

Failure class (fixes)

Failure-Class: new

Failure-class transition narrative (only when needed)

Violated contract: virtual-time idle / coordinator-idle is not durable filesystem quiescence while a fired timer callback still has an unawaited Future performing the write.

Canonical guard: ManualScheduler.waitForCallbackIo plus CaptureReplayWorld.settle awaiting it. Artifact: app/test/support/capture/virtual_capture_time.dart, app/test/unit/virtual_capture_time_test.dart.

Definition added in this PR: .github/failure-classes/FC-virtual-idle-before-durable-io.json (evidence_prs: []).

New guards (only when adding a check or ratchet)

This is the scheduler's own Future-tracking seam, not a new CI check. A shared "await every discarded async Timer callback" primitive does not exist in the capture harness; putting it on ManualScheduler is the one place elapse fires those callbacks.


Part of the mobile self-driving program (Harness lane). Implemented by Cursor cursor-grok-4.6-high. The flake was seen independently by three agents today under host load. Lane measurement: 50 iterations of "process kill mid-capture" with a full bash app/test.sh running concurrently — 43 pass / 7 fail before, 50 / 0 after. Coordinator verification on the head commit: the two affected test files pass (20 tests); the fix adds no sleeps, retries, or widened timeouts — settle() now awaits the Futures returned by the production timer callbacks instead of treating coordinator-idle as a durable write. I did not re-run the 50-iteration loop.

🤖 Generated with Claude Code

Review in cubic

Failure-Class: new

ManualScheduler discarded the Future from LocalWalSync's async periodic
flush, so settle() returned on coordinator-idle while writeAsBytes was
still in flight.

Co-authored-by: Cursor <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 5c30644 into main Sep 17, 2026
41 checks passed
@Git-on-my-level
Git-on-my-level deleted the task/msd-harness-flake-capture-replay branch September 17, 2026 11:30
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