Skip to content

fix(replay): keep route transitions from blocking capture work - #16

Merged
Chinmay-KB merged 3 commits into
mainfrom
fix/replay-nonblocking-route-scheduling
Jul 25, 2026
Merged

fix(replay): keep route transitions from blocking capture work#16
Chinmay-KB merged 3 commits into
mainfrom
fix/replay-nonblocking-route-scheduling

Conversation

@Chinmay-KB

@Chinmay-KB Chinmay-KB commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

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 — clean
  • flutter test — 169 tests passed
  • The new deterministic cases cover queue progress during a transition, supersession, lifecycle/session cancellation, blocked and failed captures, and late-frame rejection.
  • Existing observer-backed navigation tests, including push-and-remove stack cleanup with a non-zero transition, remain green.

Fixes #6.

Schedule transition deadlines outside serialized event work, cancel obsolete deadlines and captures across lifecycle/session changes, and fence late screenshots from replacement sessions.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/tugboat/lib/src/controller.dart
Comment thread packages/tugboat/lib/src/controller.dart Outdated
@Chinmay-KB
Chinmay-KB changed the base branch from cursor/replay-characterization-harness-0912 to main July 25, 2026 19:18
@Chinmay-KB
Chinmay-KB merged commit 545906b into main Jul 25, 2026
1 check passed
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.

[Replay] Remove transition waits from the serialized controller queue

2 participants