Repository navigation
feat: [SDK-5538] remote kill switch with a placeholder OneSignalImpV2 - #2801
abdulraqeeb33 wants to merge 1 commit into
Conversation
📊 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)139/430 touched executable lines covered (32.3% — requires ≥ 80%) Per-file detail (informational; gate is aggregate above):
❌ Coverage Check FailedAggregate coverage on touched lines is 32.3% (minimum 80%). |
NeverCrashKillSwitch reads the feature flags cached by the previous run at process start (ActivityLifecycleInitializer) and picks the IOneSignal implementation once per process: sdk_never_crash_disabled present means OneSignalImp, otherwise OneSignalImpV2. A fresh install, a locked device, an unreadable cache, or first use before evaluation keep OneSignalImpV2. OneSignalImpV2 is a verbatim copy of OneSignalImp for now, so behavior is unchanged either way. The never-crash init lands on it later in this stack. Co-authored-by: Cursor <cursoragent@cursor.com>
7ae3908 to
e9399ee
Compare
edb8cc8 to
351a26f
Compare
sherwinski
left a comment
There was a problem hiding this comment.
Throwing out this comment for consideration:
The device can only read this flag after a successful init call, since that is when flags are fetched and cached. The description says that installs whose init never succeeds keep the new behavior but those are the installs producing the "Must call 'initWithContext'" crashes. So the switch can only restore the old code for devices that were already working, and the old code it restores is the crash. Let me know if my understanding here is off or I missed anything.
|
@sherwinski your read of the mechanics is right, and the description should have been clearer about intent. The switch is not for the crashing installs; for them legacy is the crash and V2 is the only fix. It is for everyone whose init already works: PR 4 changes init and the getters for all apps, and if that has a happy-path bug (deadlock, bad replay, behavior change after init) the flag puts them back on One more point: most "Must call initWithContext" crashes are per-launch ordering, not installs that never init, so those devices do cache flags on their other launches. |
Stack (base
feat/never-crash, merged tomainas one unit; split out of #2793):Description
One Line Summary
A remote kill switch that picks the
IOneSignalimplementation at process start, withOneSignalImpV2as a placeholder copy ofOneSignalImp.Details
Motivation
Part of SDK-5538. The never-crash init (PR 4) rewrites init and the manager getters for every app. The switch protects installs where init already works from a regression in that rewrite: flipping the flag puts them back on
OneSignalImpon the next cold start without a release. It cannot reach installs whose init never succeeds, because they never cache flags; for them the old behavior is the crash, so there is nothing to restore andOneSignalImpV2is the only fix.Scope
NeverCrashKillSwitchreads the feature flags cached by the previous run fromActivityLifecycleInitializer(androidx.startup, beforeApplication.onCreate), once per process. A backend change applies on the next cold start.sdk_never_crash_disabledin the cachedsdkRemoteFeatureFlags(any casing) selectsOneSignalImp; otherwiseOneSignalImpV2.OneSignalImpV2.OneSignalcreates its implementation through the switch.OneSignalImpV2is a verbatim copy ofOneSignalImp(only the class name differs), so behavior is unchanged either way. PR 4's diff on it then reads as the change from the old code.localOverrideinNeverCrashKillSwitchforces either implementation for local testing.Known gaps (follow-ups)
OneSignalprefs file on the main thread beforeApplication.onCreate.OneSignalImpV2.Testing
Unit testing
NeverCrashKillSwitchTests: the flag selectsOneSignalImpin any casing; no flag, a fresh install, an unreadable cache, a locked device and first use before evaluation selectOneSignalImpV2. All suites, spotless, detekt and apiCheck pass.Manual testing
Not yet tested on a device.
Affected code checklist
Checklist
Overview
Testing
Final pass