Skip to content

fix(replay): prevent cross-route frame attribution - #18

Merged
Chinmay-KB merged 3 commits into
mainfrom
fix/replay-frame-provenance
Jul 25, 2026
Merged

fix(replay): prevent cross-route frame attribution#18
Chinmay-KB merged 3 commits into
mainfrom
fix/replay-frame-provenance

Conversation

@Chinmay-KB

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

Copy link
Copy Markdown
Collaborator

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 afterFrame with 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.
  • Full serial package run: 184 passed and 3 inherited route-payload assertions failed. All three reproduce on the exact Fix route capture and tap settlement coherence #17 base commit (61df854) because those legacy tests do not initialize capture but expect payloads without its existing captureOutcome: failed field.

Fixes #8.

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 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/afterFrame to 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.

Comment thread packages/tugboat/lib/src/controller.dart
Comment thread packages/tugboat/lib/src/controller.dart
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
Chinmay-KB force-pushed the fix/replay-route-capture-barrier branch from 61df854 to 1159a5a Compare July 25, 2026 16:46
@Chinmay-KB
Chinmay-KB force-pushed the fix/replay-frame-provenance branch from 072d74d to 2abd919 Compare July 25, 2026 16:46
@Chinmay-KB
Chinmay-KB changed the base branch from fix/replay-route-capture-barrier to main July 25, 2026 19:18
@Chinmay-KB
Chinmay-KB merged commit a63c081 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] Track frame provenance and prevent cross-route frame attribution

2 participants