Repository navigation
fix: send the push unregister DELETE even after opt-out (#746) - #759
Merged
Merged
Conversation
Contributor
posthog-ios Compliance ReportDate: 2026-08-10 19:58:39 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
Contributor
Prompt To Fix All With AI### Issue 1
PostHogTests/PostHogPushOptOutReproTest.swift:13
**Regression test missing from Xcode target**
The new regression suite is absent from the Xcode test target’s Sources phase, so `test-ios-simulator` and local Xcode test runs silently omit it. Add this file to the `PostHogTests` target so the advertised iOS simulator coverage executes.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(push): add missing isEnabledProvider..." | Re-trigger Greptile |
marandaneto
reviewed
Aug 10, 2026
marandaneto
approved these changes
Aug 10, 2026
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.
Problem
Opting out did not stop Workflows push.
unregisterdeferred onguard isAllowedProvider()(false while opted out) and re-checked it after the async identity-token mint. The normal opt-out flow —unregisterPushNotificationToken()thenoptOut()— parked the DELETE: the persisted intent kept deferring on every retry while opted out. The server-side subscription stayed active for the whole opted-out period, so Workflows kept delivering to a device that opted out (#746).Change
Split the cleanup gate from the send gate. Added an
isEnabledProvider(SDK enabled, ignoring opt-out) and gated the unregister DELETE on it, instead ofisAllowedProvider(enabled and not opted out). A DELETE removes data, so opt-out must block registration and sends but not cleanup. The register and send paths keepisAllowedProvider.How did you test this code?
PostHogPushOptOutReproTest: registers a token, parks the unregister's identity mint, flips opt-out mid-flight via the logout path (unregisterCurrentToken), then releases the mint. Asserts the DELETE reaches the mock server. Fails on the pre-fix code (reproduces the bug), passes with the fix.unregisterGuardedtest into "disabled, no DELETE" and "opted out, DELETE still sent". These run in CI ontest-ios-simulator.unregisterPushNotificationToken()thenoptOut()) with the identity mint delayed to force the race. The DELETE reached the backend (200). Rebuilt with the pre-fixisAllowedProviderguard and the same flow sent no DELETE. The fix is what stops the strand.Not in this PR
#746 also reports that opting back in does not refetch the APNs token or re-register. That half is fixed separately in #760.
Note
Draft. Directed by @dmarchuk; implemented and verified locally by Claude while @ioannisj is out.