Skip to content

refactor(replay): share one mask classifier between the mask walk and the discard check - #913

Open
turnipdabeets wants to merge 3 commits into
fix/replay-flag-securefrom
refactor/replay-mask-rule
Open

turnipdabeets wants to merge 3 commits into
fix/replay-flag-securefrom
refactor/replay-mask-rule

Conversation

@turnipdabeets

@turnipdabeets turnipdabeets commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Note

Stacked on #910. Merges into fix/replay-flag-secure.

💡 Motivation and Context

#910 added hasMaskableContent, which repeats the mask rules from findMaskableWidgets so the legacy capture can tell an animating sensitive view from a harmless one. Two copies with a "keep in sync" comment can drift: a new mask rule added only to the walk would let legacy capture record that view type unmasked again.

Both now use one classifier, View.maskRule(), which returns a MaskRule enum. The when over it is exhaustive, so a new rule won't compile until both callers handle it.

No behaviour change: I compared every branch and the two copies classified every view the same way, so nothing needed the stricter result. Child iteration still differs on purpose (the walk uses its geometry-aware visibility check; the discard check counts any VISIBLE child, the stricter side) and is unchanged. No per-frame allocations: MaskRule is an enum.

💚 How did you test it?

  • Existing mask tests pass unchanged.
  • New the discard check treats everything the mask walk masks as maskable: covers plain, ph-no-capture, ph-no-mask, empty and non-empty text, image, nested, hidden-child and Compose views. The discard check counts Compose as maskable even when the walk finds nothing to mask, since it can't judge Compose content without geometry (unchanged behaviour). It fails if the discard check ignores masked text, treats Compose as non-maskable, or stops skipping hidden children.
  • ./gradlew spotlessCheck apiCheck :posthog-android:testDebugUnitTest passes.

📝 Checklist

  • All commits are signed (see Commit signing)
  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file (internal refactor, no user-facing change)

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

🤖 Generated with Claude Code

…r parity test

Drops the refactor changeset: an internal refactor has no user-facing changelog entry.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant