fix(replay): Fix Compose masking on obfuscated/minified builds#5503
Merged
Conversation
📲 Install BuildsAndroid
|
f48172d to
b8d52cb
Compare
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 2387c2c | 317.04 ms | 354.60 ms | 37.56 ms |
| 91bb874 | 310.68 ms | 359.24 ms | 48.56 ms |
| cf708bd | 408.35 ms | 458.98 ms | 50.63 ms |
| 2195398 | 321.31 ms | 391.66 ms | 70.35 ms |
| e2dce0b | 315.85 ms | 369.20 ms | 53.35 ms |
| 991b33b | 326.08 ms | 397.82 ms | 71.73 ms |
| 4c04bb8 | 350.71 ms | 413.63 ms | 62.92 ms |
| 3699cd5 | 423.60 ms | 495.52 ms | 71.92 ms |
| 70118e9 | 380.00 ms | 475.72 ms | 95.72 ms |
| 694d587 | 312.37 ms | 402.77 ms | 90.41 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 2387c2c | 1.58 MiB | 2.13 MiB | 559.54 KiB |
| 91bb874 | 1.58 MiB | 2.13 MiB | 559.07 KiB |
| cf708bd | 1.58 MiB | 2.11 MiB | 539.71 KiB |
| 2195398 | 0 B | 0 B | 0 B |
| e2dce0b | 0 B | 0 B | 0 B |
| 991b33b | 0 B | 0 B | 0 B |
| 4c04bb8 | 0 B | 0 B | 0 B |
| 3699cd5 | 1.58 MiB | 2.10 MiB | 533.45 KiB |
| 70118e9 | 1.58 MiB | 2.29 MiB | 719.84 KiB |
| 694d587 | 1.58 MiB | 2.19 MiB | 620.06 KiB |
fffae5c to
9eb8255
Compare
Add an internal SentryReplayDebug.failFast switch (gated on the io.sentry.replay.compose.fail-fast system property) that re-throws the exceptions ComposeViewHierarchyNode normally swallows in fromComposeNode and fromView. Enabled in the sentry-samples-android app and the on-device ReplayTest/ReplaySnapshotTest so our release/obfuscated builds running on real devices in CI crash instead of silently degrading masking. Defaults off, so customers are unaffected. Also add consumer proguard keep rules for the LayoutNode internals (getChildren/getOuterCoordinator/getCollapsedSemantics) that are looked up via reflection on Compose < 1.10, so R8 doesn't strip or rename them. Also guard the on-device tests against GitHub-hosted emulators, which can't capture screenshots reliably. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9eb8255 to
bfc18bd
Compare
runningcode
approved these changes
Jun 8, 2026
Contributor
runningcode
left a comment
There was a problem hiding this comment.
That's a good way to enhance our tests for this!
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.
📜 Description
Fixes Compose view masking on obfuscated/minified (R8) builds, plus adds a CI mechanism to catch such regressions early.
LayoutNodemembers to walk the node tree. On Compose < 1.10 these are looked up via reflection by their mangled names (getChildren$ui_release,getOuterCoordinator$ui_release,getCollapsedSemantics$ui_release). Since they aren't referenced directly, R8 could strip or rename them, silently breaking masking on minified builds. Added consumer proguard keep rules for them.SentryReplayDebug.failFastswitch (gated on theio.sentry.replay.compose.fail-fastsystem property) that re-throws the exceptionsComposeViewHierarchyNodenormally swallows. It's enabled in the sample app and the on-deviceReplayTest/ReplaySnapshotTest, so our release/obfuscated builds running on real devices in Sauce Labs crash instead of silently under-masking. Defaults off, so customers are unaffected.💡 Motivation and Context
On obfuscated/minified builds, R8 could rename/strip the reflected Compose internals, which silently degraded or disabled Compose masking. Because the SDK swallows these errors to avoid crashing customer apps, the regression was invisible in our CI until now.
💚 How did you test it?
Unit tests + on-device
ReplayTest/ReplaySnapshotTestrunning on release/obfuscated builds on real devices (Sauce Labs), which now fail fast if masking breaks.Example replay: https://sentry-sdks.sentry.io/explore/replays/6783b073aef442a8b4ad8731bf6901fa
📝 Checklist
sendDefaultPIIis enabled.