feat: [SDK-5230] purge anonymous operations on start when Identity Verification is active - #1498
Merged
Merged
Conversation
sherwinski
added this pull request to stack #1499
September 17, 2026 22:17
sherwinski
force-pushed
the
sherwin/sdk-5230
branch
from
September 17, 2026 22:44
07d768a to
8cd28b1
Compare
Merged
16 tasks
sherwinski
force-pushed
the
sherwin/sdk-5230
branch
2 times, most recently
from
September 21, 2026 20:03
05cda88 to
13b125d
Compare
fadi-george
approved these changes
Sep 21, 2026
…is active Operations persisted while the requirement was off or unknown may carry no externalId. Once the requirement hydrates to on, an anonymous user has no JWT, so these operations can never pass the dispatch gate. Remove them from the queue and the store right after the saved operations load. - OperationRepo._start runs _purgeAnonymousOperations after _loadSavedOperations when IV behavior is active - Removed operations wake any waiter with the _Suppressed reason - Surviving LoginUserOperations lose existingOnesignalId; IV never transfers anonymous state, and a stale local id would keep _canStartExecute false forever - Models are untouched; the local push subscription folds into the create-user request at login
sherwinski
force-pushed
the
sherwin/sdk-5230
branch
from
September 21, 2026 23:12
13b125d to
71d13a7
Compare
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.
Description
1 Line Summary
Purge queued anonymous operations after the saved operations load when IV behavior is active, and clear
existingOnesignalIdon the surviving login operations.Details
Seventh and last M2 pull request for Identity Verification for Web SDK. Stacked on #1497 (SDK-5229). Targets
sherwin/sdk-5229now; retarget tofeat/identity-verificationafter the earlier PRs merge.Mirrors Android
removeOperationsWithoutExternalId()andonJwtConfigHydrated()inOperationRepo.kt:293-332. Follows decision D4 on SDK-5215: the purge removes queued operations, never models.Why a purge when SDK-5229 already suppresses at enqueue. Operations persisted while the requirement was off or unknown can carry no
externalId. On the next start with the requirement on, they load into the queue past the enqueue check. An anonymous user has no JWT, so they can never pass the dispatch gate and would block the queue.Where the hydrate point is on web. Android awaits
initializedinsideonJwtConfigHydratedso the purge runs after saved operations load. On the page,OneSignal.initfetches the config and persists the requirement beforeCoreModuleexists, so the requirement is already known whenOperationRepo._startruns. The purge goes right after_loadSavedOperationsin_start, which gives the same order with no event.src/core/operationRepo/OperationRepo.ts_startcalls_purgeAnonymousOperations()after_loadSavedOperations()whenisIvBehaviorActive(), then starts the timer.isIvBehaviorActiveimpliesisIvCodePathEnabled, so one check is enough._purgeAnonymousOperationsfilters the queue for items with noexternalId, removes each one from the store throughOperationModelStore._remove, and wakes any waiter withfalseand_Suppressed. Then every survivingLoginUserOperationwith anexistingOnesignalIdhas it cleared. Two short debug logs:OpRepo: purged N/M anonymous opsandOpRepo: purge cleared existingOnesignalId.src/core/operations/LoginUserOperation.ts_clearExistingOnesignalId(). IV never transfers anonymous state, so the login must create. A stale local id would also keep_canStartExecutefalse forever, because the anonymous login that would have resolved it is gone. The change persists through the model store's change listener.Multi-tab.
ModelStore._persistrewrites the whole list. The purge uses the same_removepath as the existing drop path, so it adds no new race. Cross-tab work is SDK-5248 (M5).Bundle size. Adds about 130 B gzipped to
page.es6.js. The page limit moves to the measured 44.23 kB. Across the 7 M2 PRs the page bundle grows from 43.44 kB to 44.23 kB (about 790 B). SDK-5252 (M6) tracks the budget for the whole IV project.Systems Affected
Validation
Tests
Info
src/core/operationRepo/OperationRepo.test.ts, newanonymous operation purge on startblock. The store is seeded before_startso_loadSavedOperationspicks the operations up, the same as rows persisted by an earlier session. MirrorsOperationRepoTests.kt:1045-1094.LoginUserOperationare removed from the queue and the store; an identified operation survives.LoginUserOperationwith a localexistingOnesignalIdhas it cleared,_canStartExecuteflips totrue, and the key is gone from its JSON._loadSavedOperationsruns before the first store removal, so the purge sees the loaded rows.existingOnesignalIdis kept.vp check,vp test(682 tests), andvp run build:prodpass on the stack tip.Checklist
Programming Checklist
Interfaces:
Functions:
Typescript:
Other:
elem of arraysyntax. PreferforEachor usemapcontextif possible. Instead, we can pass it to function/constructor so that we don't callOneSignal.contextScreenshots
Info
Not needed. No UI change.
Checklist
Related Tickets