Skip to content

Never null feature interfaces, consent removal of only its features, SDK owned [CLY]_ keys - #320

Merged
arifBurakDemiray merged 1 commit into
sdk-behavior-settingsfrom
sbs-consent-and-facades
Oct 22, 2026
Merged

arifBurakDemiray merged 1 commit into
sdk-behavior-settingsfrom
sbs-consent-and-facades

Conversation

@arifBurakDemiray

Copy link
Copy Markdown
Member

Implements the two #275 review decisions (feature interfaces never null, only the SDK's own [CLY]_ keys are internal) and fixes the consent bugs found next to them. Base: sdk-behavior-settings.

What changes

Area Before After
Feature interfaces events(), views() and the other getters returned null before init, without consent or when not enabled They are never null; calls go to the running module once its feature runs and are ignored until then, with an error to callbacks; an interface kept from earlier, or from before a consent change, reaches the module that runs now
Consent removal Removing one consent stopped every feature but sessions and deleted their queued events, crash files and remote config values; device ID and user profile calls then threw (26.8.0) Only the modules of the removed features stop
Crash reporting with consent A crash module built when the consent was given after init never recorded unhandled crashes It is active like one built at init
Location consent removal The location stayed on the server It is erased right away, as the reference SDK does
[CLY]_ keys Any [CLY]_ key skipped cet, the event filters and the limits Only [CLY]_view, [CLY]_nps, [CLY]_survey and [CLY]_star_rating are internal, as in the reference SDK; content events such as [CLY]_content_shown now follow cet and the filters
Timers An exception in a timer run cancelled that timer for good, the SDK timer included It is logged and the timer keeps running; a failing module no longer holds back the others on the same tick

Also in here:

  • Events read the view IDs of the views module that runs now, so a views consent removed and given again no longer leaves stale IDs.
  • Registrations made while their feature does not run are kept: remote config download callbacks are called, and a content display draws, once the feature runs.
  • The deprecated Countly calls and the user editor log no user data before the consent check of their feature.

Tests

  • New: CountlyFacadeTests (interfaces before init, kept interfaces, consent removal, view IDs, timer, logged data), CrashFlowTests, ModuleLocationsTests, ModuleRemoteConfigTests; null assertions turned into "ignores calls" assertions.
  • Each new test fails with its fix reverted.
  • Full suite: 725 of 725 on JDK 8.

Not in here, needs a decision

  • With consent required, user properties are sent without the user profiles consent, as the user profile module always runs. Gating the interface would drop them for apps that never called enableFeatures(UserProfiles), and the user editor saves location through the same path, so this needs its own design.
  • Feedback widget results go through the events module, so they need the events consent; the reference SDK records them under the feedback consent alone.
  • A call racing a consent removal on another thread can still reach a module that is stopping (pre-existing).

🤖 Generated with Claude Code

…d features

- Every feature getter returns an interface whose calls go to the running
  module and are ignored, with an error to callbacks, until it runs. One kept
  from before init or before a consent change reaches the module later.
- onConsentRemoval stops only the modules of the removed features, and
  removing the location consent erases the location on the server.
- A module built for a consent given after init is active, so unhandled
  crashes are recorded.
- Only the SDK's own [CLY]_ keys are internal events.
- A failing timer run no longer ends its timer, and a failing module no longer
  holds back the others on the same tick.
- Events read the view IDs of the views module that runs now.
- Remote config download callbacks and a content display registered before
  the consent are kept for the module that runs later.
- The deprecated Countly calls and the user editor log no user data before
  the consent check of their feature.
@arifBurakDemiray
arifBurakDemiray marked this pull request as ready for review October 22, 2026 15:58
@arifBurakDemiray
arifBurakDemiray merged commit 45315a0 into sdk-behavior-settings Oct 22, 2026
4 of 5 checks passed
@arifBurakDemiray
arifBurakDemiray deleted the sbs-consent-and-facades branch October 22, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant