Skip to content

fix: close replay masking and legacy retry gaps from 4.0 review - #980

Merged
turnipdabeets merged 2 commits into
chore/v4-remove-deprecatedfrom
fix/v4-replay-mask-followups
Nov 16, 2026
Merged

turnipdabeets merged 2 commits into
chore/v4-remove-deprecatedfrom
fix/v4-replay-mask-followups

Conversation

@turnipdabeets

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Follow-up to the review bot findings on #871. All three bugs are in code that is new on the 4.0 branch. Stacked on chore/v4-remove-deprecated.

Finding Change
P1: text painted left of its layout box A negative TextIndent with TextOverflow.Visible starts the line before x = 0 (or past the right edge for RTL text). measureTextPaintedBounds() now widens the mask to each line's start position. getLineLeft/getLineRight don't show the indent, but getHorizontalPosition(lineStart) does: -40px for a -40sp indent, which matched where the pixels were drawn.
P2: getTail on Compose 1.0–1.2 Before 1.3 there are no modifier nodes (LayoutNodeWrapper has no getTail), so reading cleared text semantics threw and every frame of that screen was discarded. Text semantics there are SemanticsModifier elements (SemanticsModifierCore), which we now read first. When getTail is missing, we skip that modifier instead of throwing. Delegating nodes we can't read still discard the frame, as before.
P2: duplicate UUIDs in legacy retries When capture asks to retry a UUID that the 3.x queue holds more than once, only the first copy is re-queued, because capture drops a UUID's later copies in a batch for good.

I left the compliance adapter finding out because it's test-harness code.

No changeset changes: android-v4-replay-and-device.md already says 4.0 masks "Compose text that draws past its layout box in full", and this makes that true for indented text.

💚 How did you test it?

  • New tests in PostHogReplayComposeMaskScopeTest cover LTR and RTL negative-indent overflow. Both fail without the fix and pass with it.
  • New PostHogSendCachedLegacyEventsIntegrationTest case: a retried event stored twice is re-queued once. It fails without the fix.
  • ./gradlew spotlessApply apiCheck :posthog:test :posthog-android:testDebugUnitTest passes.
  • Not tested on Compose 1.0–1.2. The test suite runs on the current Compose BOM. I checked the ui-1.0.0 jar: LayoutNodeWrapper has no getTail, ModifierInfo.getModifier() exists, and SemanticsModifierCore implements SemanticsModifier. SemanticsModifier.getSemanticsConfiguration() is still in ui 1.12.1. I haven't run a sample app on an old Compose runtime.

📝 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.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude Code checked each bot finding against main and the 4.0 branch, wrote failing tests first, and fixed the three findings in shipped code. While probing, it found that unwrapped RTL text stays inside its box, so it dropped that test and tested a negative RTL indent instead.

🤖 Generated with Claude Code

- Mask Compose text that a negative TextIndent paints left of its layout
  box (or right of it, for right-to-left text).
- Read cleared text semantics from SemanticsModifier elements on Compose
  1.0-1.2, which have no getTail, instead of discarding every frame.
- Re-queue one copy per uuid when capture asks to retry legacy events,
  since it drops a uuid's later copies in a batch for good.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@turnipdabeets
turnipdabeets requested a review from a team as a code owner November 13, 2026 22:02
@turnipdabeets turnipdabeets self-assigned this Nov 13, 2026
@veria-ai

veria-ai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Fixed/addressed: 2 · PR risk: 0/10

Reviews

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

posthog-android Compliance Report

Date: 2026-11-13T22:48:08.663445+00:00
Duration: 477325ms

✅ All Tests Passed!

232/232 tests passed


Capture_V1 Tests

✅ 105/105 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 388ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 32ms
Required Headers.Has Authorization Bearer Header ✅ 31ms
Required Headers.Has Content Type Json ✅ 24ms
Required Headers.Has Posthog Sdk Info Format ✅ 22ms
Required Headers.Has Posthog Attempt Header ✅ 23ms
Required Headers.Has Posthog Request Id ✅ 23ms
Required Headers.Has Posthog Request Timestamp ✅ 30ms
Required Headers.Has User Agent ✅ 20ms
Body Format.Body Has Created At And Batch ✅ 21ms
Body Format.No Api Key In Body ✅ 23ms
Body Format.No Sent At In Body ✅ 21ms
Event Format.Event Has Required Root Fields ✅ 22ms
Event Format.Event Uuid Is Valid ✅ 20ms
Event Format.Event Timestamp Is Rfc3339 ✅ 21ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 21ms
Event Format.Distinct Id Is String ✅ 22ms
Event Format.Distinct Id At Root Not Properties ✅ 24ms
Event Format.Custom Properties Preserved ✅ 20ms
Event Format.Set Properties Preserved ✅ 25ms
Event Format.Set Once Properties Preserved ✅ 21ms
Event Format.Groups Properties Preserved ✅ 21ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 24ms
Event Format.Event Has Required Root Fields Batch ✅ 35ms
Event Format.Event Uuid Is Valid Batch ✅ 29ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 29ms
Event Format.Distinct Id Is String Batch ✅ 28ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 29ms
Event Format.Custom Properties Preserved Batch ✅ 29ms
Event Format.Set Properties Preserved Batch ✅ 24ms
Event Format.Set Once Properties Preserved Batch ✅ 24ms
Event Format.Groups Properties Preserved Batch ✅ 29ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 29ms
Batch Behavior.Multiple Events In Single Batch ✅ 50ms
Batch Behavior.Batch Envelope Smoke ✅ 30ms
Batch Behavior.Flush With No Events Sends Nothing ✅ 13ms
Batch Behavior.Flush At Triggers Batch ✅ 1018ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 19ms
Deduplication.Generates Unique Uuids ✅ 40ms
Deduplication.Different Events Same Content Different Uuids ✅ 20ms
Deduplication.Preserves Uuid On Retry ✅ 7016ms
Deduplication.Preserves Timestamp On Retry ✅ 7019ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 7022ms
Deduplication.No Duplicate Events In Batch ✅ 31ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 15ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 12028ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 7017ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 2026ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 7017ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 15ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 21ms
Response Format Validation.Success No Retry After When All Ok ✅ 20ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 2010ms
Response Format Validation.Success No Retry After When Drop Only ✅ 18ms
Response Format Validation.Response Echoes Request Id ✅ 14ms
Retry Behavior.Retries On 408 ✅ 7016ms
Retry Behavior.Retries On 500 ✅ 7015ms
Retry Behavior.Retries On 503 ✅ 7027ms
Retry Behavior.Retries On 504 ✅ 7017ms
Retry Behavior.Retries On 404 ✅ 6012ms
Retry Behavior.Retries On 429 ✅ 7017ms
Retry Behavior.Retries On 502 ✅ 7017ms
Retry Behavior.Retryable Errors Have Retry After ✅ 4013ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 10026ms
Retry Behavior.Does Not Retry On 400 ✅ 4018ms
Retry Behavior.Does Not Retry On 401 ✅ 4018ms
Retry Behavior.Does Not Retry On 402 ✅ 4017ms
Retry Behavior.Does Not Retry On 413 ✅ 4018ms
Retry Behavior.Does Not Retry On 415 ✅ 4023ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 4018ms
Retry Behavior.Implements Backoff ✅ 14019ms
Partial Batch Handling.Handles 200 Full Success ✅ 2020ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3025ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3021ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 3023ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 7017ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 7015ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 7013ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 7016ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 7016ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 7017ms
Partial Batch Handling.Respects Retry After On Partial ✅ 7019ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3022ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 3025ms
Compression.Sends Gzip Content Encoding ✅ 14ms
Compression.No Content Encoding When Disabled ✅ 13ms
Compression.Compressed Body Is Decompressible ✅ 12ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 4016ms
Event Options.Cookieless Mode Override ✅ 15ms
Event Options.Disable Skew Correction Override ✅ 13ms
Event Options.Process Person Profile Override ✅ 15ms
Event Options.Product Tour Id Override ✅ 15ms
Event Options.Unset Options Omitted ✅ 14ms
Event Options.Options Override In Batch ✅ 20ms
Event Options.Unknown Option Passes Through ✅ 16ms
Event Options.Option Value Is Not Converted ✅ 15ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 16ms
Event Options.Option Wins Over Legacy Property ✅ 14ms
Event Options.Legacy Property Fills Unset Option ✅ 15ms
Event Options.Null Option Falls Back To Legacy Property ✅ 18ms
Property Layers.Caller Property Beats Registered Property ✅ 14ms
Property Layers.Before Send Runs Last ✅ 25ms
Fail Open.Empty Api Key Sends Nothing ✅ 3012ms
Fail Open.Personal Api Key Sends Nothing ✅ 3012ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 15ms

Capture_Ai_V1 Tests

✅ 110/110 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 14ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 22ms
Endpoint And Method.Capture Does Not Reroute Ai Named Events ✅ 14ms
Endpoint And Method.Capture Ai Does Not Reroute Non Ai Events ✅ 16ms
Lane Isolation.Failing Ai Lane Does Not Delay Analytics ✅ 7025ms
Required Headers.Has Authorization Bearer Header ✅ 15ms
Required Headers.Has Content Type Json ✅ 25ms
Required Headers.Has Posthog Sdk Info Format ✅ 18ms
Required Headers.Has Posthog Attempt Header ✅ 17ms
Required Headers.Has Posthog Request Id ✅ 15ms
Required Headers.Has Posthog Request Timestamp ✅ 15ms
Required Headers.Has User Agent ✅ 13ms
Body Format.Body Has Created At And Batch ✅ 17ms
Body Format.No Api Key In Body ✅ 13ms
Body Format.No Sent At In Body ✅ 14ms
Event Format.Event Has Required Root Fields ✅ 14ms
Event Format.Event Uuid Is Valid ✅ 15ms
Event Format.Event Timestamp Is Rfc3339 ✅ 17ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 15ms
Event Format.Distinct Id Is String ✅ 17ms
Event Format.Distinct Id At Root Not Properties ✅ 14ms
Event Format.Custom Properties Preserved ✅ 15ms
Event Format.Set Properties Preserved ✅ 14ms
Event Format.Set Once Properties Preserved ✅ 14ms
Event Format.Groups Properties Preserved ✅ 15ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 14ms
Event Format.Event Has Required Root Fields Batch ✅ 18ms
Event Format.Event Uuid Is Valid Batch ✅ 19ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 20ms
Event Format.Distinct Id Is String Batch ✅ 21ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 21ms
Event Format.Custom Properties Preserved Batch ✅ 21ms
Event Format.Set Properties Preserved Batch ✅ 21ms
Event Format.Set Once Properties Preserved Batch ✅ 20ms
Event Format.Groups Properties Preserved Batch ✅ 19ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 18ms
Batch Behavior.Multiple Events In Single Batch ✅ 28ms
Batch Behavior.Batch Envelope Smoke ✅ 27ms
Batch Behavior.Flush At Triggers Batch ✅ 1015ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 15ms
Deduplication.Generates Unique Uuids ✅ 29ms
Deduplication.Different Events Same Content Different Uuids ✅ 15ms
Deduplication.Preserves Uuid On Retry ✅ 7013ms
Deduplication.Preserves Timestamp On Retry ✅ 7016ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 7017ms
Deduplication.No Duplicate Events In Batch ✅ 27ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 12ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 12023ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 7016ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 2022ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 7013ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 13ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 26ms
Response Format Validation.Success No Retry After When All Ok ✅ 21ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 2010ms
Response Format Validation.Success No Retry After When Drop Only ✅ 16ms
Response Format Validation.Response Echoes Request Id ✅ 13ms
Retry Behavior.Retries On 408 ✅ 7012ms
Retry Behavior.Retries On 500 ✅ 7014ms
Retry Behavior.Retries On 503 ✅ 7021ms
Retry Behavior.Retries On 504 ✅ 7014ms
Retry Behavior.Retries On 404 ✅ 7015ms
Retry Behavior.Retries On 429 ✅ 7013ms
Retry Behavior.Retries On 502 ✅ 7015ms
Retry Behavior.Retryable Errors Have Retry After ✅ 4012ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 10014ms
Retry Behavior.Does Not Retry On 400 ✅ 4016ms
Retry Behavior.Does Not Retry On 401 ✅ 4017ms
Retry Behavior.Does Not Retry On 402 ✅ 4017ms
Retry Behavior.Does Not Retry On 413 ✅ 4016ms
Retry Behavior.Does Not Retry On 415 ✅ 4016ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 4016ms
Retry Behavior.Implements Backoff ✅ 14017ms
Partial Batch Handling.Handles 200 Full Success ✅ 2016ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3021ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3022ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 3020ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 7015ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 7015ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 7015ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 7015ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 7015ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 7016ms
Partial Batch Handling.Respects Retry After On Partial ✅ 7020ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3022ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 3021ms
Compression.Sends Gzip Content Encoding ✅ 15ms
Compression.No Content Encoding When Disabled ✅ 14ms
Compression.Compressed Body Is Decompressible ✅ 12ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 4013ms
Event Options.Cookieless Mode Override ✅ 13ms
Event Options.Disable Skew Correction Override ✅ 12ms
Event Options.Process Person Profile Override ✅ 18ms
Event Options.Product Tour Id Override ✅ 12ms
Event Options.Unset Options Omitted ✅ 13ms
Event Options.Options Override In Batch ✅ 19ms
Event Options.Unknown Option Passes Through ✅ 15ms
Event Options.Option Value Is Not Converted ✅ 13ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 12ms
Event Options.Option Wins Over Legacy Property ✅ 13ms
Event Options.Legacy Property Fills Unset Option ✅ 13ms
Event Options.Null Option Falls Back To Legacy Property ✅ 12ms
Event Size.Event Over Ceiling Is Not Sent ✅ 3361ms
Event Size.Over Ceiling Drop Is Reported Or Logged Without Content ✅ 2049ms
Event Size.Batches Close Before Byte Target ✅ 6089ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 16ms
Property Layers.Caller Property Beats Registered Property ✅ 12ms
Property Layers.Before Send Runs Last ✅ 12ms
Fail Open.Empty Api Key Sends Nothing ✅ 1008ms
Fail Open.Personal Api Key Sends Nothing ✅ 1009ms

Feature_Flags Tests

✅ 17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 29ms
Request Payload.Flags Request Uses V2 Query Param ✅ 18ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 17ms
Request Payload.Flags Request Omits Authorization Header ✅ 16ms
Request Payload.Token In Flags Body Matches Init ✅ 16ms
Request Payload.Groups Round Trip ✅ 17ms
Request Payload.Groups Default To Empty Object ✅ 20ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 17ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 16ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 17ms
Request Lifecycle.No Flags Request On Init Alone ✅ 7ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 17ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 24ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 21ms
Retry Behavior.Retries Flags On 502 ✅ 321ms
Retry Behavior.Retries Flags On 504 ✅ 317ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 15ms

- Skip clearAndSetSemantics { text = ... } replacements when looking for
  the text to measure: only semantics with GetTextLayoutResult count.
- A missing getTail is only expected on pre-1.3 layout wrappers. On a
  NodeCoordinator it throws again, so the frame is discarded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved.

The disclosed changes enter privacy-sensitive, ingestion, and build territory, with independent assurance supplied by the author's STRONG familiarity and added regression tests. No substantive unresolved review concerns or other refusal grounds were found; the bot discussion summary is not a current-head review.

  • Author wrote 100% of the modified lines and has 30 merged PRs in these paths (familiarity STRONG).
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
every_file_attested ✓ not a bot PR
size ✓ 50L, 3F substantive, 119L/5F incl. docs/generated/snapshots — within ceiling
tier ✓ T1-agent / T1c-medium (119L, 5F, two-areas, fix)
stamphog 2.9.0 .stamphog/policy.yml @ 739bc26 · reviewed head 739bc26

@turnipdabeets
turnipdabeets merged commit 3433e90 into chore/v4-remove-deprecated Nov 16, 2026
12 checks passed
@turnipdabeets
turnipdabeets deleted the fix/v4-replay-mask-followups branch November 16, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant