fix(replay): warn when wireframe capture cannot record a Compose window - #760
Open
posthog[bot] wants to merge 4 commits into
Open
fix(replay): warn when wireframe capture cannot record a Compose window#760posthog[bot] wants to merge 4 commits into
posthog[bot] wants to merge 4 commits into
Conversation
Wireframe capture is the default (sessionReplayConfig.screenshot = false) and View.toWireframe() only walks classic Android View types, so a Jetpack Compose window produces an almost empty wireframe tree that plays back as a blank gray screen. The SDK already detects a Compose root for the screenshot mask path, but said nothing on the wireframe path. Log one warning per process when a Compose root is found while wireframe capture is on, naming sessionReplayConfig.screenshot = true as the fix. Also state the limit and the mask scope in the PostHogSessionReplayConfig KDoc. Generated-By: PostHog Desktop Task-Id: 0206a002-16b5-4fb5-822e-2085e838e802
Contributor
Author
🦔 PostHog Review reviewed this pull requestFound 0 must fix, 1 should fix, 1 consider. Published 2 findings (view the review). Resolved comments: 2 fixed |
Contributor
Author
|
PostHog Review alpha 🦔 If you find any issues helpful - please reply "valid", "invalid", etc., for evaluation purposes 🙏 |
…s on The once-per-process guard was spent by compareAndSet before config.logger.log ran, but PostHogAndroidLogger drops the message unless config.debug is true and debug defaults to false. A developer who called PostHog.debug(true) after the first Compose snapshot could therefore never see the warning. Check config.logger.isEnabled() before spending the guard, so the budget is only consumed on a line that is actually delivered. Reading it first also skips the Compose root check entirely while debug logging is off, which is the common case. Generated-By: PostHog Desktop Task-Id: ff7ca759-b632-4447-9bda-c11574bd8e0b
Compose detection matches an AndroidComposeView at any depth, not just at the window root, so a hybrid screen with one interop ComposeView inside an XML layout trips the warning. On that screen View.toWireframe() still recurses over every ViewGroup child and emits real nodes for TextView, ImageView, ProgressBar, RatingBar, Switch and WebView, so only the Compose subtree comes back as an empty box. Saying "the recording will be blank" overstated it. Reword the line to say Compose content records blank, and that this is the whole recording only when Compose draws the whole screen. The screenshot recommendation is unchanged. No behaviour change. Generated-By: PostHog Desktop Task-Id: ff7ca759-b632-4447-9bda-c11574bd8e0b
ioannisj
marked this pull request as ready for review
September 4, 2026 12:46
Member
|
if our goal is to deprecate wireframes, is it worth doing this? maybe a single warning if screenshot is disabled and its a jetpack compose app check would be enough? |
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
sessionReplayConfig.screenshotdefaults tofalse, so capture builds a wireframe.View.toWireframe()only walks classic View types (TextView,ImageView,Spinner,ViewGroup), and a Compose-rooted window contains none of them, so the tree comes back essentially empty.isComposeView()/containsComposeView()/WindowDrawState.composeRooted), but that detection only fed the screenshot mask path. On the wireframe path it logged nothing and changed nothing.sessionReplayConfig.screenshot = trueChanges
generateSnapshot()now callswarnIfComposeWireframe()on the wireframe branch. It reads the cached Compose-root verdict; when that is unknown it resolves it inline on the main thread, or posts the check without waiting when called from the capture executor and reads the result on the next snapshot. The capture thread never blocks for this log line.logger.isEnabled()first), and a "not Compose" verdict is re-checked after a layout at most once per second, so a classic-View app with debug on pays a small bounded walk and nothing with debug off.AtomicBooleanthat is read before the Compose check, so a warned process never pays for the check again.screenshot,maskAllTextInputsandmaskAllImagesnow states the wireframe limit and that masking applies to both modes.💚 How did you test it?
PostHogReplayIntegrationTest: a Compose-rooted window warns exactly once over two snapshots, and a classic-View window stays quiet.wireframe capture warns once about a compose rooted windowfails; with it restored it passes.:posthog-android:testReleaseUnitTestsuite andspotlessCheck. Both pass.View.toWireframe()covering only classic View types and is the same failure mode addressed for screenshot mode in fix(replay): keep Compose screenshots by routing them onto the verified mask path #713.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Fully autonomous
generateSnapshot()rather than at install time, because a Compose root can be mounted lazily and is only known from the live view tree.Created with PostHog Desktop from this inbox report.