Repository navigation
fix(app): await WAL timer Futures before capture-replay settle (load-sensitive flake) - #14331
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
CaptureReplayWorld.settle()treated coordinator-idle as a durable WAL write.ManualSchedulerdiscarded theFuturereturned by production's async periodic_flush/_chunkcallbacks, so process-kill reconstruction could reload empty WALs whilewriteAsByteswas still in flight. The scheduler now tracks those Futures;settle/disposeawait 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"whilebash app/test.shran): 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.shlooping 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 acrosselapseand assertshasInFlightIountilwaitForCallbackIo. Would have caught the class.process kill mid-captureis 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.waitForCallbackIoplusCaptureReplayWorld.settleawaiting 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
ManualScheduleris the one placeelapsefires 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 fullbash app/test.shrunning 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