Skip to content

fix: exclude a kit whose configuration throws while parsing - #937

Merged
thomson-t merged 1 commit into
mainfrom
fix/kit-config-parse-exceptions
Oct 14, 2026
Merged

thomson-t merged 1 commit into
mainfrom
fix/kit-config-parse-exceptions

Conversation

@thomson-t

Copy link
Copy Markdown
Contributor

Why

An integration whose settings contain a default mapping with no match rules still crashes the app while the settings load. Because the settings are saved and loaded again at start-up, the app can then crash every time it starts. Once this lands, the SDK skips just that integration and logs why, and the app and every other integration keep working.

Programme

Standalone fix, no programme.

What changes

Before: mParticle/mparticle-android-sdk#928 excluded a kit whose settings threw a JSONException or NumberFormatException while parsing. Any other exception escaped on the kit thread, for example the IndexOutOfBoundsException that a default projection with an empty matches list raises.

After: KitManagerImpl.parseKitConfigurations catches any exception thrown while parsing one kit's settings. That kit is excluded through the existing kitExcluded path, and the log line now carries the exception's stack trace.

Start reading at the catch in parseKitConfigurations, and check first that a kit excluded there never starts. Deliberately left alone: the parsers themselves, which still assume well-formed input, since guarding their one caller covers every case; and the order in which the settings are saved and then parsed. No documentation or changelog change is needed; the release notes are generated from the commit message.

Linked work

Related: mParticle/mparticle-android-sdk#928, which this extends.

Rollout

Path: merging changes main only. The fix ships in the next release of android-kit-base, which ships with the core SDK, and apps get it when they upgrade. It is live as soon as an app runs that release, with no switch and no ordering constraint.

Feature flags: none.

Turning it off: revert this pull request and publish a new release. A published version cannot be recalled, so apps on the release that carries it keep the change until they upgrade again.

What we watch: nothing monitors this path. We watch the issues reported on this repository after the release that carries it, and the Unit Tests, Lint Checks and Kotlin Lint Checks jobs on this pull request.

Risks

  • an integration with malformed settings stops loading instead of crashing the app; that is the intended trade; the log line Exception while starting kit names it, with the stack trace
  • a genuine bug in a settings parser now excludes that one integration instead of crashing the app; contained to that integration; visible in the same log line and through kitExcluded

Risk class: low.

Who

Written by: an automated coding agent (Claude Code), working for a maintainer who asked for this fix.

Code reviewed before opening: an independent review agent, 14 October 2026; it found nothing blocking, and its suggestion to log the stack trace is applied.

Design reviewed before opening: no one.

Decision this implements: a maintainer's request on 14 October 2026; there is no public record.

Checked: the extended KitManagerImplTest case, which fails without the change and passes with it, plus the android-kit-base unit tests, ktlintCheck and lint, on 14 October 2026.

Not checked: the instrumented tests, and malformed settings served to a device.

Size

Hand-written: 12 lines changed (added plus removed) in 2 files.

Generated: none.

🤖 Generated with Claude Code

A kit configuration could still crash the app at start-up. A default
projection with an empty "matches" list threw an
IndexOutOfBoundsException while the kit configurations were parsed on
the kit thread, and because the configuration is cached, the crash
repeated on every launch. Any exception thrown while parsing one kit's
configuration now excludes that kit and is logged, and the other kits
still start.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Kotlin migration progress

No change to the Java left to convert.

Module Kotlin LOC Java LOC Java staying (facade) Java left to convert Kotlin share
android-core 3,249 22,594 9,650 12,944 12.6%
android-kit-base 601 5,405 1,651 3,754 10.0%
Total 3,850 27,999 11,301 16,698 12.1%

Conversion progress: 0.0% (16,698 of 16,550 baseline Java LOC left to convert). 132 Java files and 36 Kotlin files in scope.

@github-actions

Copy link
Copy Markdown

Binary compatibility

  • ✅ android-core is compatible with 6.1.8 (115 classes compared, 0 with additions only).
  • ✅ android-kit-base is compatible with 6.1.8 (44 classes compared, 2 with additions only).

Compares the release AAR against the same artifact at the last version published to Maven Central; R8-renamed classes and members are excluded (see the script docstring). Full japicmp HTML/XML reports are attached as the api-compat-reports workflow artifact. This check is not in the required-check set yet, so a red result here does not block merging.

@github-actions

Copy link
Copy Markdown

📦 SDK Size Impact Report

What the SDK adds to a minified release APK.

mParticle Core SDK

Measured against an empty baseline app. Unlike the Rokt kit, android-core ships no Compose and no resources, so there is nothing here that a host app would already provide.

Metric Target branch This PR Change
APK size 120.30 KB 120.29 KB -6 bytes
Download size 118.11 KB 118.11 KB -6 bytes
Dex bytes 214.54 KB 214.54 KB 0 bytes

mParticle Core + Rokt kit

Measured against a Compose + Material3 reference app, so these are the costs on top of an app that already ships Compose. The reference app's dependencies are a documented convention, not a measured average: see size-report-rokt/README.md.

Metric Target branch This PR Change
APK size 1.26 MB 1.26 MB 0 bytes
Download size 1.24 MB 1.24 MB +74 bytes
Dex bytes 2.23 MB 2.23 MB -36 bytes

Rokt SDK+ umbrella (adds the payment extension)

Metric Target branch This PR Change On top of mParticle Core + Rokt kit
APK size 6.55 MB 6.55 MB 0 bytes +5.29 MB
Download size 6.43 MB 6.43 MB -88 bytes +5.19 MB
Dex bytes 7.11 MB 7.11 MB -32 bytes +4.88 MB

➡️ SDK size impact change is minimal.

Raw measurements

core, Target branch:

{"baseline_dex_bytes": 0, "baseline_download_bytes": 2513, "baseline_install_bytes": 7529, "core_dex_bytes": 219692, "core_download_bytes": 123460, "core_install_bytes": 130712}

core, This PR:

{"baseline_dex_bytes": 0, "baseline_download_bytes": 2511, "baseline_install_bytes": 7525, "core_dex_bytes": 219692, "core_download_bytes": 123452, "core_install_bytes": 130702}

rokt, Target branch:

{"baseline_dex_bytes": 1829108, "baseline_download_bytes": 1240062, "baseline_install_bytes": 1300934, "kit_dex_bytes": 4163396, "kit_download_bytes": 2544133, "kit_install_bytes": 2623275, "sdkplus_dex_bytes": 9284332, "sdkplus_download_bytes": 7981260, "sdkplus_install_bytes": 8165359}

rokt, This PR:

{"baseline_dex_bytes": 1829108, "baseline_download_bytes": 1240062, "baseline_install_bytes": 1300934, "kit_dex_bytes": 4163360, "kit_download_bytes": 2544207, "kit_install_bytes": 2623275, "sdkplus_dex_bytes": 9284300, "sdkplus_download_bytes": 7981172, "sdkplus_install_bytes": 8165359}

Measured 943d7f2 merged into 998eb29

@thomson-t
thomson-t marked this pull request as ready for review October 14, 2026 18:59
@thomson-t
thomson-t requested a review from a team as a code owner October 14, 2026 18:59
@thomson-t
thomson-t merged commit 0ad67ca into main Oct 14, 2026
46 checks passed
@thomson-t
thomson-t deleted the fix/kit-config-parse-exceptions branch October 14, 2026 20:24
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.

2 participants