Skip to content

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

Merged
turnipdabeets merged 4 commits into
fix/replay-flag-securefrom
refactor/replay-mask-rule
Oct 30, 2026
Merged

turnipdabeets merged 4 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.

@marandaneto marandaneto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good; no qualifying findings. Verdict: correct.

Moves #914's ph-no-capture descendant masking into the shared classifier as a NO_CAPTURE rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@turnipdabeets
turnipdabeets merged commit cc97d4b into fix/replay-flag-secure Oct 30, 2026
11 checks passed
@turnipdabeets
turnipdabeets deleted the refactor/replay-mask-rule branch October 30, 2026 15:29
turnipdabeets added a commit that referenced this pull request Oct 30, 2026
…able masked views (#910)

* fix(replay): discard legacy frames with an unplaceable masked view

* fix(replay): record FLAG_SECURE windows as a fully masked screenshot

* fix(replay): read FLAG_SECURE null-safely and cover reused bitmaps and nested masked views

* test(replay): cover plain masked text in the legacy transient-state discard

* fix(replay): drop touches on FLAG_SECURE windows in screenshot mode

Also splits the legacy discard log so a transient-state discard says why, documents the FLAG_SECURE behaviour on the screenshot option, and points the duplicated mask rules at each other.

* fix(replay): mask the frame when a window turns secure during the copy

* fix(replay): guard the touch interceptor map and test secure touches through the window

* test(replay): register the secure-touch test's window through mocked Curtains roots

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

* refactor(replay): share one mask classifier between the mask walk and the discard check

* test(replay): cover Compose and hidden children in the mask classifier parity test

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(replay): honour FLAG_SECURE in wireframe mode (#912)

* fix(replay): record FLAG_SECURE windows as a black wireframe and drop their touches in all modes

* fix(replay): mask the wireframe when a window turns secure during the walk

* test(replay): cover the wireframe secure check before the walk

* fix(replay): treat no-capture descendants as maskable in the discard check

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

2 participants