Skip to content

chore(example): Add replay playground screen - #4056

Merged
lucas-zimerman merged 10 commits into
mainfrom
lz/replay-playground
Oct 13, 2026
Merged

lucas-zimerman merged 10 commits into
mainfrom
lz/replay-playground

Conversation

@lucas-zimerman

@lucas-zimerman lucas-zimerman commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

📜 Description

Adds a Replay Playground screen to the Flutter example app (opened from the Other screen) for eyeballing Session Replay masking in the Sentry dashboard. Example-only change, no SDK code touched.

The screen includes:

  • Masked content in motion: a moving ball and a bouncing fake-3D cube, each with a switch to wrap it (or only the cube's red face) in SentryMask. The scene boxes shrink to fit narrow screens.

  • Masked text probes: four "This text should be masked" texts: static, zooming (Transform.scale), spinning (Transform.rotate), and deliberately clipped (sliding past the edges of a ClipRect). They render red but are styled black, so their masks are black and any red visible in a replay is a leak.

  • Navigation test: buttons that reopen the playground on top of itself (title shows the depth, e.g. "Replay Playground remove sub-seconds from the timestamp format #2") at the same scroll position and with the same mask switches, 1 s after the tap, using a chosen page transition:

    • a custom card swipe (SwipePageTransitionsBuilder, built from Transform widgets, 6 s),
    • Flutter's built-in Zoom, Fade forwards, Predictive back, Open upwards, Fade upwards and Cupertino transitions,
    • Zoom slowed to 6 s (SlowPageTransitionsBuilder).

    The two 6 s options (both ways, push and pop) give slow replay capture (1 fps on mobile) several frames mid-transition; the built-in ones run at their normal length. Only the pushed page uses the chosen transition: the page underneath animates with its own route's transition. Tapping adds a ui.navigation_test breadcrumb naming the transition (sent at the tap, before the delay); buttons stay disabled until the opened page is closed. Pushed pages use the ReplayPlayground route name, so they show up as navigation breadcrumbs.

  • SentryUnmask and text field examples (masked by default vs. unmasked).

The example's minimum Flutter version is raised from 3.24 to 3.29, where FadeForwardsPageTransitionsBuilder and the PageTransitionsBuilder duration getters first appear. CI builds the example on stable and beta only.

💡 Motivation and Context

While working on web replay masking, we kept needing a repeatable scene to check masks against moving, scaled, rotated and clipped content and page transitions. It already surfaced that masks don't follow ZoomPageTransitionsBuilder (its zoom is applied in a SnapshotPainter, invisible to getTransformTo). It's useful on its own, so it's split out from the web replay work.

💚 How did you test it?

  • flutter analyze --fatal-warnings and dart format pass on the example.
  • A throwaway widget test (not committed) at 360 px width: scene boxes fit the screen, taps are ignored while a navigation is pending, and the swipe keeps its direction when a push is interrupted by a pop.
  • Exercised manually on an Android emulator and on web (Chrome) during development.

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec
  • No breaking changes

🔮 Next steps

  • Fix masking during ZoomPageTransitionsBuilder (and other painter-based) transitions in the SDK; this screen reproduces it.

lucas-zimerman and others added 2 commits September 29, 2026 21:47
Adds a Replay Playground screen, opened from the Other screen, for
eyeballing Session Replay masking in the Sentry dashboard: moving,
zooming and spinning masked text, a bouncing 3D cube with a maskable
face, and a navigation test that reopens the page with different page
transitions (a custom swipe plus Flutter's built-in ones).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

⚪ None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

lucas-zimerman and others added 2 commits September 29, 2026 21:56
Replay capture is slow, so give the slowed zoom transition twice as long
to land more frames mid-transition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Match the slowed zoom, so the swipe also lands more replay frames
mid-transition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 390.37 ms 421.62 ms 31.25 ms
Size 14.77 MiB 16.08 MiB 1.31 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
8a8dc49 362.43 ms 361.82 ms -0.61 ms
1777727 438.67 ms 447.11 ms 8.44 ms
cdf371b 367.64 ms 377.02 ms 9.38 ms
1fff351 423.68 ms 408.96 ms -14.72 ms
1e46846 419.06 ms 429.65 ms 10.59 ms
73dca78 476.53 ms 522.21 ms 45.68 ms
98b29fe 406.81 ms 446.74 ms 39.93 ms
694da33 406.30 ms 403.51 ms -2.79 ms
3f47ea3 368.20 ms 388.14 ms 19.94 ms
d5a1225 377.37 ms 366.56 ms -10.81 ms

App size

Revision Plain With Sentry Diff
8a8dc49 14.77 MiB 16.08 MiB 1.31 MiB
1777727 14.30 MiB 15.49 MiB 1.19 MiB
cdf371b 13.93 MiB 15.18 MiB 1.25 MiB
1fff351 14.31 MiB 15.49 MiB 1.19 MiB
1e46846 14.31 MiB 15.56 MiB 1.25 MiB
73dca78 6.54 MiB 7.69 MiB 1.15 MiB
98b29fe 14.55 MiB 15.87 MiB 1.31 MiB
694da33 14.31 MiB 15.49 MiB 1.19 MiB
3f47ea3 13.93 MiB 15.18 MiB 1.25 MiB
d5a1225 14.31 MiB 15.49 MiB 1.19 MiB

Previous results on branch: lz/replay-playground

Startup times

Revision Plain With Sentry Diff
b896323 373.72 ms 394.91 ms 21.19 ms
e6d15c4 409.48 ms 414.86 ms 5.38 ms
ae340c4 364.48 ms 354.59 ms -9.89 ms
8f07336 409.34 ms 410.38 ms 1.04 ms
cf4ca54 353.34 ms 350.89 ms -2.45 ms

App size

Revision Plain With Sentry Diff
b896323 14.77 MiB 16.02 MiB 1.25 MiB
e6d15c4 14.77 MiB 16.02 MiB 1.25 MiB
ae340c4 14.77 MiB 16.02 MiB 1.25 MiB
8f07336 14.77 MiB 16.02 MiB 1.25 MiB
cf4ca54 14.77 MiB 16.02 MiB 1.25 MiB

@cursor cursor Bot 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.

Stale Bugbot comment from a previous run.

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1263.15 ms 1272.19 ms 9.04 ms
Size 5.91 MiB 6.35 MiB 450.06 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
a69a51f 1231.73 ms 1233.15 ms 1.42 ms
e2d675d 1238.48 ms 1242.76 ms 4.28 ms
98188da 1252.31 ms 1251.41 ms -0.90 ms
ebccb5b 1245.39 ms 1249.31 ms 3.92 ms
0265ce5 1261.66 ms 1250.42 ms -11.24 ms
6b69699 1254.80 ms 1273.31 ms 18.52 ms
caa8620 1261.15 ms 1262.62 ms 1.46 ms
d2356d0 1257.04 ms 1257.94 ms 0.89 ms
6287dc4 1262.46 ms 1241.96 ms -20.50 ms
cd94e79 1266.86 ms 1252.40 ms -14.47 ms

App size

Revision Plain With Sentry Diff
a69a51f 5.53 MiB 6.01 MiB 487.38 KiB
e2d675d 7.86 MiB 9.44 MiB 1.58 MiB
98188da 5.83 MiB 6.28 MiB 459.62 KiB
ebccb5b 5.53 MiB 5.96 MiB 444.86 KiB
0265ce5 5.66 MiB 6.09 MiB 448.36 KiB
6b69699 7.86 MiB 9.44 MiB 1.58 MiB
caa8620 5.73 MiB 6.17 MiB 455.47 KiB
d2356d0 5.66 MiB 6.09 MiB 448.38 KiB
6287dc4 5.53 MiB 5.96 MiB 444.81 KiB
cd94e79 5.83 MiB 6.28 MiB 459.39 KiB

Previous results on branch: lz/replay-playground

Startup times

Revision Plain With Sentry Diff
cf4ca54 1236.08 ms 1241.35 ms 5.27 ms
8f07336 1257.52 ms 1263.33 ms 5.81 ms
e6d15c4 1251.59 ms 1257.50 ms 5.91 ms
ae340c4 1275.02 ms 1276.67 ms 1.65 ms
b896323 1236.67 ms 1238.13 ms 1.46 ms

App size

Revision Plain With Sentry Diff
cf4ca54 5.91 MiB 6.35 MiB 450.92 KiB
8f07336 5.91 MiB 6.35 MiB 450.92 KiB
e6d15c4 5.91 MiB 6.35 MiB 450.91 KiB
ae340c4 5.91 MiB 6.35 MiB 450.93 KiB
b896323 5.91 MiB 6.35 MiB 450.92 KiB

Newer Flutter moved CupertinoPageTransitionsBuilder from material.dart
to cupertino.dart, so the example failed to build on current stable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.88%. Comparing base (c7d9639) to head (944e8b5).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4056      +/-   ##
==========================================
+ Coverage   88.76%   92.88%   +4.12%     
==========================================
  Files         348      114     -234     
  Lines       12563     4570    -7993     
==========================================
- Hits        11151     4245    -6906     
+ Misses       1412      325    -1087     
Flag Coverage Δ
sentry ?
sentry_dio ?
sentry_drift ?
sentry_file ?
sentry_firebase_remote_config 100.00% <ø> (ø)
sentry_flutter 92.60% <ø> (ø)
sentry_grpc ?
sentry_hive ?
sentry_isar ?
sentry_link ?
sentry_logging ?
sentry_sqflite ?
sentry_supabase 97.48% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Fit the scene boxes to narrow screens; the ball and cube were
  clipped away on phones, which looked like a replay bug.
- Add a deliberate clipped probe: masked text sliding past the edges
  of a clipping box.
- Keep the transition buttons disabled until the opened page is gone,
  and ignore taps while one is pending.
- Lock the swipe direction per phase, so a push interrupted by a pop
  retraces instead of jumping to the other side.
- Forward delegatedTransition in SlowPageTransitionsBuilder.
- Share the 6s and 1s durations instead of repeating literals; drop
  the unused swipe tilt parameter; document maskRedFace.
- Move the transitions next to the screen as
  replay_playground_transitions.dart.
- Raise the example's Flutter floor to 3.29, where
  FadeForwardsPageTransitionsBuilder and the PageTransitionsBuilder
  duration getters first appear.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lucas-zimerman added a commit that referenced this pull request Oct 2, 2026
The replay playground has its own PR (#4056). This PR now targets
that branch, so the example still has the playground for testing
without duplicating it here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit eaad22a. Configure here.

@buenaflor

Copy link
Copy Markdown
Contributor

Nice! let's rebase to v10-branch (since v10 will be releasing shortly)

lucas-zimerman and others added 2 commits October 12, 2026 19:55
# Conflicts:
#	packages/flutter/example/pubspec.yaml
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lucas-zimerman
lucas-zimerman merged commit bf9e9f2 into main Oct 13, 2026
75 checks passed
@lucas-zimerman
lucas-zimerman deleted the lz/replay-playground branch October 13, 2026 21:05
buenaflor added a commit that referenced this pull request Nov 2, 2026
* feat(flutter): Add web canvas replay

Enable an internal Flutter Web option for JS Replay canvas recording
and attach the active replay ID to Dart events sent through the web
transport.

Co-Authored-By: GPT-5.5 <noreply@openai.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(flutter): Sync web scope to JS replay

Mirror Dart scope mutations into the browser JS SDK on web so native
JavaScript events receive Flutter scope data.

Emit replay-compatible breadcrumbs for Flutter cases that the JS replay
bundle filters from its generic breadcrumb handler.

Co-Authored-By: GPT-5.5 <noreply@openai.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(flutter): Mask Flutter Web session replay

Capture masked frames with the Flutter screenshot recorder and draw
them onto a shadow canvas that the JS SDK's replay canvas integration
snapshots manually. Flutter's own canvas is blocked by selector, since
it lives in flt-glass-pane's shadow DOM.

- Register ReplayIntegration on web; the JS SDK handles error mode
- Map replay quality to a web capture scale (0.5x/0.7x/1.0x)
- Drop the JS SDK's flutter-view click breadcrumbs in replays
- Enable web replay from the replay sample rates instead of the
  internal enableWebCanvasRecording flag
- Add a replay playground screen to the example app

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(example): Drop playground, now in #4056

The replay playground has its own PR (#4056). This PR now targets
that branch, so the example still has the playground for testing
without duplicating it here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Harden web replay start and teardown

- Script loader: track scripts as they load and remove them if a
  later one fails, so close() cleans up and a retry doesn't inject
  duplicates
- SentryWeb.close(): await the replay recorder's stop before closing
  the JS SDK, so an in-flight capture can't snapshot into it
- setReplayConfig: mark the recorder started only after start()
  succeeds, so a failed start is retried on the next config

Adds a createReplayCanvasBridge seam to SentryWeb for testing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Keep web replay cadence on resize

A window drag or rotation changes the replay config every frame, and
each change restarted the capture scheduler, which captures on the
next frame. The shadow canvas was resized at frame rate while rrweb
throttled the matching snapshots, so recordings got canvas sizes out
of sync with their content.

While running with an unchanged frame rate, store the new config
without restarting: capture() reads it on every run, so the next
scheduled capture already uses the new size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Replace web replay canvas on resize

Sentry's replay player clones a canvas on its first recorded draw and
keeps drawing into that clone, so later width/height changes never
reach it. After a resize, smaller frames only covered the clone's
top-left corner, leaving the previous frame around them (duplicated
widgets) and squishing content to one side.

Once the shadow canvas has been snapshotted, a size change now swaps
in a new element, which the player clones fresh at the new size. Its
first snapshot waits a task, until rrweb has registered the node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(flutter): Control web replay via replay API

SentryFlutter.replay's start, startBuffering, stop and flush now drive
the JS SDK's replay on web instead of logging "not supported", and
start or stop the Flutter recorder with it. A stopped replay stays
stopped across config changes (e.g. a window resize) until started
again. pause/resume remain no-ops: the JS SDK can't pause a replay.

The real-binding tests clear the JS SDK's stored replay session first;
a session left by another test on the same origin resumed in `session`
mode, so stop() hung uploading to the fake DSN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Drop labels from web replay crumbs

Tap breadcrumbs carry the widget's label and the labels in its touch
path when sendDefaultPii is on. The replay copy kept them, so text the
replay video masks showed up in the replay timeline. Strip them from
the replay breadcrumb only; the event breadcrumb is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(flutter): Cover release web script selection

Assert the production script lists in release mode, with and without
replay; always picking the debug lists used to pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Convert web error replays on Dart errors

Dart events reach the JS SDK through client.sendEnvelope(), which
skips the afterSendEvent hook that client.sendEvent() runs. Replay
switches a buffering replay to a session from that hook, so with
onErrorSampleRate a Dart error never uploaded the buffered replay;
only JS errors did.

Pass the events and transactions in each envelope to the binding,
which emits afterSendEvent for them once the envelope is sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Harden web replay error paths

- Catch errors from the deferred snapshot of a replaced replay canvas;
  it runs outside the recorder's error handling.
- close() closes the JS SDK even if stopping the recorder fails.
- stopReplay() during an in-flight recorder start now stops the
  recorder once the start completes, instead of leaving it capturing.

Tests: wrap the canvas bridge tests in one subject group, match JS
integration names exactly, and close the SDK after replay-enabled mock
tests so their schedulers stop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(flutter): Tighten web replay test assertions

- The cadence test measures from a rendered frame to the next capture
  instead of waiting a fixed 50ms, so a slow capture can't hide a
  scheduler restart.
- Pin the replay block selector as a literal, not the production
  constant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Stop web replay if recorder fails

If stopping the replay recorder threw, stopReplay() skipped stopping
the JS replay and left the recorder marked as started, so a later
startReplay() never restarted it. Always stop the JS replay, and mark
the recorder stopped before stopping it.

Also folds the replay controls test group into its parent to keep
test nesting within three levels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(flutter): Deflake web replay cadence test

The scheduler's interval starts when a capture starts, so asserting a
wall-clock gap after a test-triggered frame failed when a capture was
slow. Assert instead that no capture lands right after the config
changes, and that the next one uses the new size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Guard web scope sync JS calls

Web now registers NativeScopeObserver, so every scope change reaches
SentryWeb, which called JS unguarded. Scope observers are called
without error handling, so a JS failure surfaced in the user's
addBreadcrumb or configureScope call. Wrap the calls in tryCatchSync
like the other native calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Keep web replay stopped after close

close() stopped the recorder without marking the replay stopped, so a
setReplayConfig still in flight could start the recorder after the JS
SDK was closed. Set the flag before stopping, as stopReplay() does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(flutter): Move web replay processor

Move WebReplayEventProcessor and its test beside the web replay
feature, out of the event_processor/ type-bucket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Keep web replay stopped on restart

_startReplay cleared the stop flag after awaiting the JS call, so a
stopReplay() or close() that ran during that await (e.g. while the JS
flush was pending) was undone and the recorder started anyway. Count
stops and skip starting the recorder if one ran in the meantime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Send web replay with feedback

captureReplay() returned early on web, and the JS SDK only sends a
buffered replay for errors and transactions, so feedback events were
tagged with the ID of a buffered replay that was never uploaded.

On web, flush the active replay for feedback, as the JS SDK's own
feedback integration does. Error replays stay with the JS SDK, and the
sample-rate gate matches the other platforms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(flutter): Skip copying web replay events

beforeAddRecordingEvent runs for every rrweb event, including full DOM
snapshots and canvas frames with base64 image data, and dartify()
deep-copied each one on the main thread just to find the flutter-view
click breadcrumb. Read the event type in place and only copy custom
events.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(flutter): Skip web capture when not recording

The web recorder captured and masked frames whenever replay was
enabled, even when the JS replay wasn't recording: an unsampled
session, or one the JS SDK stopped on its own (session expiry, max
duration). That cost main-thread time on every interval for frames
nothing recorded.

Add a protected shouldCapture hook to ScheduledScreenshotRecorder and
have the web recorder skip captures while the JS replay has no ID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(flutter): Decode web events only for replay

captureStructuredEnvelope decoded every event and transaction to emit
the JS SDK's afterSendEvent hook, which only Replay uses. Skip that
work when replay isn't supported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Remove web replay processor on close

WebReplayEventProcessor was added in init() and never removed, so it
kept querying the closed JS SDK for every event after close().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(flutter): Correct web replay test claims

The canvas bridge docs claimed an integration test that doesn't exist;
the real bridge has a browser unit test. The recorder test header said
video recording isn't supported, which this PR changes. Also wrap the
recorder tests in a top-level group per the test guidelines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ref(flutter): Tidy web replay internals

Mark WebReplayEventProcessor @internal and document it, name its test
group after the type, drop a duplicated comment in the JS binding, and
log the errors the binding swallowed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Load web replay bundle only if used

The replay bundle and replay-canvas were picked from replay.isEnabled
alone, while SentryWeb only records when screenshots are supported
(CanvasKit or Skwasm). With another renderer, apps downloaded the
heavier bundle and nothing recorded. Use the same gate for both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(flutter): Await failing web script load

The failure test didn't await its expectation, so the failed load ran
concurrently with the next one, and its cleanup could remove the
scripts that load had just added (flaky on CI).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Allow web replay restart after stop

When stopReplay() ran while the recorder was starting, the deferred
stop cleared _replayRecorderStarted only after recorder.stop(). If
that threw, the flag stayed set and later starts returned early. Clear
it first, as stopReplay() does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Handle web envelope send rejection

captureEnvelope only attached a rejection handler when the envelope
had events, so an attachment-only envelope whose send rejected (e.g.
a throwing beforeEnvelope listener) left an unhandled rejection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(flutter): Cover unsampled web replay IDs

The fake binding ignored onlyIfSampled, so dropping it from
WebReplayEventProcessor (attaching unsampled replay IDs) passed.
Mirror the JS SDK and assert unsampled IDs aren't added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(flutter): Avoid session replay in JS test

The real-binding options test set sessionSampleRate, which could
sample a session replay that uploads to the fake DSN on close. Keep it
in buffer mode and check the session rate mapping with the mock
binding instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(flutter): Fix recorder doc comment placement

Inserting shouldCapture below _canStartCapture's doc comment moved
that comment onto the new getter. Give each its own doc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Feed only the web replay frame bytes

data.buffer.asUint8List() ignored the ByteData view's offset and
length. If rawRgbaData is backed by a larger buffer (e.g. Wasm
memory), ImageData rejects the frame. Pass the bounded view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Wait for web replay stop on start

A start that ran while stopReplay() was still stopping the recorder
could start it, and the finishing stop then removed the bridge while
the recorder stayed marked started. Starts now wait for an in-flight
stop. The new test checks the end state; it doesn't reproduce the
interleaving deterministically.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Guard web afterSendEvent emission

The rejection handler only covered a failed send; an exception from
jsify() or emit() in the success callback escaped as an unhandled
async error. Catch and log it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(flutter): Note web replay start requirement

Manual start on Web needs a sample rate above 0, since the Replay JS
bundle only loads then. Unlike Android/iOS, where explicit start
bypasses sampling entirely.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Serialize web replay calls

Replay start, stop, flush, config changes and close now run one at
a time in call order, replacing the flags that tracked their
interleavings. Document the JS SDK behavior the web replay relies
on, and model buffer mode in the event processor test fake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(flutter): Address web replay review findings

- Always stop the web replay recorder on close, so a failed start
  doesn't leave the shadow canvas in the DOM.
- Add ReplayTelemetryIntegration on web and check replay support
  when it runs: the replay sample rates are set after the default
  integrations are created.
- Read back the captured image before yielding to the event loop.
- Pin a supported renderer in the replay script loading tests.

Co-Authored-By: Lucas Zimerman Fraulob <lzfstudio+sentry@hotmail.com>

* fix(flutter): Read web replay buffering from JS

Nothing puts the JS replay's ID on the Dart scope, so
ReplayTelemetryIntegration marked every web replay as buffering.
Bindings can now report whether the replay is buffering; web asks the
JS Replay for its recording mode, as the JS SDK does for
sentry._internal.replay_is_buffering. Native bindings return null and
keep inferring it from the scope.

* test(flutter): Signal web replay bridge start

Replace the microtask spin loops waiting for bridgeStart with a
Completer on the fake bridge, bounded by a timeout, so a start that
never runs fails the test instead of hanging it.

* fix(flutter): Log failed JS envelope sends as errors

A rejected client.sendEnvelope() drops the envelope, so log it at error
level with its stack trace instead of debug.

Also tighten the web replay tests: pin the shadow canvas id as a
literal and check that the block selector spares it while matching
other canvases, and keep the real-binding replay tests in buffer mode
so they never upload to the test DSN.

* test(flutter): Tighten web replay envelope tests

Enable replay in the attachment-only envelope test, so event
collection is on and the empty-events check means something. Assert
that the manual canvas integration has enableManualSnapshot set.

* fix(flutter): Capture web replay while unfocused

Flutter Web reports inactive when a visible page loses focus. The
resumed-only capture guard, meant for native GPU surface teardown,
froze the replay canvas then. Let the web recorder also capture while
inactive.

* test(flutter): Address low Warden review findings

Rename web replay tests to plain verb phrases, split the scope
payload test per method, pin the JS SDK name and replay-canvas
URLs as literals, and clarify the isReplayBuffering null contract.

Co-Authored-By: Lucas Zimerman Fraulob <lzfstudio+sentry@hotmail.com>

* fix(flutter): Address web replay review comments

- Clear the shadow canvas before drawing each frame so transparent
  pixels don't keep the previous frame
- Pick the replay bundle from the binding's supportsReplay
- Drop the unused name-based replayCanvas integration
- Add a regression test feeding a real JS SDK flutter-view click
  through the replay click filter

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(flutter): Address Warden review findings

- Drop the no-replay script test, already covered by the default
  supportsReplay stub
- Name the click filter tests with verb phrases

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(flutter): Gate web replay behind flag

Add the experimental `options.replay.enableWebReplay` flag, off by
default. Web Session Replay now only starts when it is set alongside a
replay sample rate; otherwise init logs how to enable it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Giancarlo Buenaflor <giancarlobuenaflor97@gmail.com>
Co-authored-by: GPT-5.5 <noreply@openai.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Lucas Zimerman Fraulob <lzfstudio+sentry@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants