Repository navigation
feat: [SDK-5538] deferred managers that stand in before init - #2802
Draft
abdulraqeeb33 wants to merge 2 commits into
Draft
abdulraqeeb33 wants to merge 2 commits into
abdulraqeeb33 wants to merge 2 commits into
Conversation
Deferred User, Notifications, InAppMessages, Session and Location managers, plus JWT invalidated listeners. Every call re-resolves the real manager through a ManagerSource. Before init, registrations are queued (a removal cancels its queued add, a setting keeps its latest value) and replayed in order once; other calls are logged and dropped. Not wired in yet; OneSignalImpV2 hands these out later in this stack. Co-authored-by: Cursor <cursoragent@cursor.com>
…manager Caps queued listener registrations at 100 per manager; past the cap an add takes the unqueued path and is logged as ignored. Removals and setting changes are never capped, so they still cancel or replace queued entries. After replay, registrations and settings go to the manager already replayed into, so a listener that calls back in during replay, or a registration after init fails post-replay, is not dropped. A failing pushSubscription resolve during replay is logged instead of failing init. Co-authored-by: Cursor <cursoragent@cursor.com>
abdulraqeeb33
force-pushed
the
never-crash/3-deferred-managers
branch
from
November 2, 2026 17:07
dc31a57 to
def35cf
Compare
abdulraqeeb33
force-pushed
the
never-crash/2-kill-switch
branch
from
November 2, 2026 17:07
edb8cc8 to
351a26f
Compare
7 of 18 tasks
Contributor
📊 Diff Coverage ReportDiff Coverage Report (Changed Lines Only)Gate: aggregate coverage on changed executable lines must be ≥ 80% (JaCoCo line data for lines touched in the diff). Changed Files Coverage
Overall (aggregate gate)121/128 touched executable lines covered (94.5% — requires ≥ 80%) |
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.
Stack (base
feat/never-crash, merged tomainas one unit; split out of #2793):Description
One Line Summary
Deferred managers that stand in for
User,Notifications,InAppMessages,Session,Locationand the JWT listeners before init succeeds.Details
Motivation
Part of SDK-5538. Today every accessor throws before init. PR 4 hands these out instead, so calls before init log rather than crash.
Scope
ManagerSource, so a reference captured before init (for example through dependency injection) works after init or after a retry.InAppMessages.pausedandLocation.isShared.pausedandisSharedgetters return the queued value.requestPermission) suspend on init instead of blocking.Replaying 'X' threw; that queued call is lost) and the rest still replay. A failingpushSubscriptionlookup during replay is logged instead of failing init.Testing
Unit testing
DeferredManagersTests: for every manager, non-registration calls are ignored before ready and forward after; registrations queue and replay in order, once; a removal cancels its queued add; a setting keeps its latest value and reads back; suspend members await; a failing replayed call does not stop the rest; the queue is bounded while removals and settings still apply when it is full; after replay, registrations reach the replayed manager, including re-entrant ones during replay. All suites, spotless, detekt and apiCheck pass.Manual testing
Not needed, not wired in.
Affected code checklist
Checklist
Overview
Testing
Final pass