fix(replay): keep route transitions from blocking capture work - #16
Merged
Conversation
Schedule transition deadlines outside serialized event work, cancel obsolete deadlines and captures across lifecycle/session changes, and fence late screenshots from replacement sessions.
There was a problem hiding this comment.
Pull request overview
This PR refactors Tugboat’s replay controller route handling so Navigator transition delays no longer occupy the serialized controller queue, allowing pointer/lifecycle/cancellation work to continue while a route deadline is pending.
Changes:
- Move route transition + settle waiting out of the controller’s serialized queue, enqueueing only the final route capture/finalization once the deadline is reached.
- Add cancellable route-deadline and capture waiters, plus generation/session fences to prevent stale capture output from publishing after supersession/session replacement.
- Extend deterministic replay coherence characterization tests to cover queue progress, supersession, lifecycle/session cancellation, and capture failure paths; bump SDK version to
0.4.2.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/tugboat/lib/src/controller.dart | Implements deferred (out-of-queue) route deadlines, cancellable waiters, and stale-capture fences. |
| packages/tugboat/test/helpers/replay_coherence_harness.dart | Adds a cancellable deterministic scheduler seam to drive the new deadline behavior in tests. |
| packages/tugboat/test/replay_coherence_characterization_test.dart | Adds deterministic coverage for non-blocking transition deadlines and cancellation/supersession scenarios. |
| packages/tugboat/pubspec.yaml | Version bump to 0.4.2. |
| packages/tugboat/lib/src/sdk_version.dart | Keeps SDK version constant in sync with pubspec.yaml. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Chinmay-KB
changed the base branch from
cursor/replay-characterization-harness-0912
to
main
July 25, 2026 19:18
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.
Summary
Route animations no longer freeze Tugboat's serialized event pipeline. Pointer, lifecycle, and cancellation work can continue while a transition deadline is pending; only the destination capture and route finalization enter the queue when that deadline is ready.
Obsolete route timers and capture waiters are now cancellable across supersession, backgrounding, disposal, session end, and session replacement. Capture-generation and session-identity fences prevent an already-running stale screenshot from publishing into a replacement session.
This PR is stacked on #15 so the deterministic replay-coherence harness is available to prove the runtime behavior.
Related: #6
Validation
flutter analyze— cleanflutter test— 169 tests passedFixes #6.