fix(replay): prevent cross-route frame attribution - #18
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens replay frame attribution by introducing immutable frame provenance (capture session + route epoch + route + timing + state) and ensuring interactions only attach frames that are compatible with the current route epoch, preventing cross-route screenshot reuse.
Changes:
- Introduces capture request context + per-frame provenance tracking and enforces compatibility when attaching
beforeFrame/afterFrameto events. - Updates capture scheduling/coalescing to preserve ordering across incompatible route contexts (only adjacent compatible captures coalesce).
- Expands characterization tests to assert explicit frame unavailability and provenance immutability; bumps SDK version to
0.4.4.
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 | Adds capture context/provenance + compatibility checks, updates scheduling, attachment behavior, and trimming behavior. |
| packages/tugboat/test/replay_coherence_characterization_test.dart | Updates and adds tests to validate no cross-route frame attribution and explicit unavailability diagnostics. |
| packages/tugboat/test/helpers/replay_coherence_harness.dart | Extends harness to support maxFrames and routes/state setup for provenance-driven tests. |
| packages/tugboat/pubspec.yaml | Bumps package version to 0.4.4. |
| packages/tugboat/lib/src/sdk_version.dart | Keeps internal SDK version constant in sync with pubspec (0.4.4). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Bind accepted frames to immutable session, route-epoch, route, trigger, timing, and state evidence. Prevent cross-route attachment and coalescing, preserve compatible reuse provenance, and retain tombstones for referenced trimmed frames.
Chinmay-KB
force-pushed
the
fix/replay-route-capture-barrier
branch
from
July 25, 2026 16:46
61df854 to
1159a5a
Compare
Chinmay-KB
force-pushed
the
fix/replay-frame-provenance
branch
from
July 25, 2026 16:46
072d74d to
2abd919
Compare
Chinmay-KB
changed the base branch from
fix/replay-route-capture-barrier
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
Replay events no longer borrow whichever screenshot happens to be session-global latest. Every accepted frame now has immutable capture-session, route-epoch, route, trigger, timing, and state provenance; taps and scrolls attach only compatible evidence and explicitly report when none exists.
Capture coalescing and frame reuse remain ordered and provenance-aware, superseded work cannot become current for a newer route, and trimming retains unavailable tombstones for still-referenced frame IDs. Settled events also pair
afterFramewith the state observed by that same completed capture.This bumps the SDK to 0.4.4 and is stacked on #17.
Related: #8
Validation
flutter analyze— no issues.flutter test test/replay_coherence_characterization_test.dart— 51 tests passed.flutter test test/sdk_version_test.dart— passed.61df854) because those legacy tests do not initialize capture but expect payloads without its existingcaptureOutcome: failedfield.Fixes #8.