Skip to content

Flaky test: ComposeMaskingOptionsTest "when sentry-unmask modifier is set unmasks the node" #5585

Description

@runningcode

Summary

ComposeMaskingOptionsTest > when sentry-unmask modifier is set unmasks the node fails intermittently on main with:

java.lang.AssertionError: Node with text null should be masked
    at io.sentry.android.replay.viewhierarchy.ComposeMaskingOptionsTest.kt:238

(:sentry-android-replay:testReleaseUnitTest, Java 17 build job.)

Evidence it's flaky, not a regression

Likely mechanism

In ComposeViewHierarchyNode.fromComposeNode (ComposeViewHierarchyNode.kt:178-189), masking is gated on visibility:

val isVisible =
  !SentryLayoutNodeHelper.isTransparent(node) &&
    (semantics == null || !semantics.contains(InvisibleToUser)) &&
    visibleRect.height > 0 && visibleRect.width > 0
...
val shouldMask = isVisible && semantics.shouldMask(isImage = false, options)

visibleRect comes from node.coordinates.boundsInWindow(...). If a node's bounds resolve to empty (width/height == 0), isVisible is false and the node is not masked even with maskAllText = true — exactly the failing assertion (the activity-title node, whose layout isn't a ComposeTextLayout, hence text == null).

Under Robolectric, Compose layout/coordinate resolution after shadowOf(Looper.getMainLooper()).idle() is timing-sensitive; when layout hasn't fully settled (occasionally perturbed by the instrumentation-agent transform failures above), boundsInWindow returns empty bounds → isVisible = false → node not masked → intermittent failure.

Possible fixes

  • Await/assert non-empty bounds for the laid-out nodes before running the masking assertions.
  • Make the masking assertions robust to the non-Compose activity-title node.
  • Investigate the java.lang.instrument transform failure, which may be aggravating layout timing.

Unrelated to the MediaMuxer leak tracked in #5584 / PR #5583.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions