fix: compute replay mask rects in the same frame as the pixels - #530
Merged
marandaneto merged 6 commits intoAug 18, 2026
Merged
Conversation
Move both mask tree walks into the async capture body, right after `endOfFrame` and before `toImage()`, so mask rects and pixels come from the same frame. A walk done up front froze frame N positions and painted them onto frame N+k, leaking content when the UI moved. Also fail closed: when `maskAllTexts` or `maskAllImages` is on and the walk returns null, drop the frame instead of shipping an unmasked screenshot. Generated-By: PostHog Desktop Task-Id: ba9fae9d-1da9-428b-acb7-d5455b503992
Contributor
posthog-flutter Compliance ReportDate: 2026-08-18 14:19:00 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
A newer analyzer version in CI flags `unawaited_return_in_try_block` at posthog_flutter_web.dart:430, which fails both the Dart analyze and Pub publish dry run required checks. Awaiting the call also lets the surrounding `on Exception catch` handle failures from `handleWebMethodCall`. Generated-By: PostHog Desktop Task-Id: ba9fae9d-1da9-428b-acb7-d5455b503992
…fixreplay-compute-mask-rects-in-the-307182
marandaneto
marked this pull request as ready for review
August 18, 2026 13:56
marandaneto
approved these changes
Aug 18, 2026
marandaneto
deleted the
posthog-self-driving/fixreplay-compute-mask-rects-in-the-307182
branch
August 18, 2026 15:06
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.
💡 Motivation and Context
maskAllTextsormaskAllImagescan ship partially-unmasked replay frames whenever the UI moves during capture — the reporter confirmed masked health data was legible in paused recordings, which halted their production rollout. Affects 5.35.1 and 5.36.1, the default masking path, with no client-side workaround.captureScreenshot()snapshotted the mask rects synchronously up front, then the async body awaited a platform-channel round trip (isSessionReplayActive()) andendOfFramebefore grabbing pixels withtoImage(). The rects are absolute positions frozen at walk time, so frame N's black boxes get painted onto frame N+k's image. Sit still → looks fine. Scroll or navigate fast → content moved out from under the boxes and renders through.null) silently shipped the raw, unmasked image.💚 How did you test it?
flutter analyzeand the widget tests were not executed here — please run CI / a local reviewer pass before merge._collectPlatformViewRects()in the same file, which walks inside the async body.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset fileChanges
getPostHogWidgetWrapperElements()andgetCurrentWidgetsElements()) inside the async body, right afterawait endOfFramewith no await between them andtoImage()— rects and pixels now come from the same frame.maskAllTexts/maskAllImagesis on and the walk returnsnull, drop the frame instead of shipping an unmasked screenshot.🤖 Agent context
Autonomy: Fully autonomous
Created with PostHog Desktop from this inbox report.