Skip to content

test: expose explicit test seams for package-private core internals - #845

Merged
nickolas-dimitrakas merged 1 commit into
mainfrom
test/testutils-visibility-seams
Oct 6, 2026
Merged

nickolas-dimitrakas merged 1 commit into
mainfrom
test/testutils-visibility-seams

Conversation

@nickolas-dimitrakas

Copy link
Copy Markdown
Contributor

Problem

The unpublished testutils module reaches package-private members of android-core by declaring helper classes in the same package names across the module boundary (com.mparticle.AccessUtils, com.mparticle.identity.AccessUtils, com.mparticle.internal.AccessUtils, MockServer). Kotlin has no package-private visibility, so those seams break the moment any of the core classes involved is converted.

Change

The members testutils depends on become public, each annotated @VisibleForTesting and @RestrictTo(LIBRARY_GROUP):

  • MessageHandler (class), MessageManager.mMessageHandler and mInstallType, BaseHandler.await
  • UploadHandler.mApiClient and setApiClient
  • ConfigManager.deleteConfigManager and clearMpid
  • KitFrameworkWrapper.mKitManager, getFrameworkLoadAttempted, setKitManager, setKitsLoaded
  • MParticleIdentityClientImpl endpoint path constants and getUrl overloads, MParticleUserImpl.setUserIdentities
  • MParticleBaseClientImpl.mApiKey

No behaviour, name, type or nullability changes. Facade classes (MParticle, MParticleOptions, IdentityApi, MPUrl) and every class proguard.pro keeps in full are untouched; PushRegistrationHelper.setPushRegistration stays package-private for that reason. MessageHandler uses @VisibleForTesting(otherwise = PACKAGE_PRIVATE) because the default scope is not valid on a class.

Verification

  • testutils and the core and kit-base unit and androidTest source sets compile.
  • :android-core:testDebugUnitTest 310/310 and :android-kit-base:testDebugUnitTest 89/89, matching main; ktlintCheck and core lint pass with 0 errors.
  • javap -public of the R8-processed release classes.jar is identical to main for every class proguard.pro names, except MParticleIdentityClientImpl, where the two internally used getUrl overloads now appear public under their obfuscated names. No class kept with { *; } changed.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

📦 SDK Size Impact Report

What the SDK adds to a minified release APK.

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.

mParticle Core SDK

Metric Target branch This PR Change
APK size 119.77 KB 119.79 KB +18 bytes
Download size 117.59 KB 117.60 KB +16 bytes
Dex bytes 213.77 KB 213.75 KB -12 bytes

➡️ SDK size impact change is minimal.

Raw measurements

Target branch:

{"baseline_dex_bytes": 0, "baseline_download_bytes": 2516, "baseline_install_bytes": 7532, "core_dex_bytes": 218896, "core_download_bytes": 122926, "core_install_bytes": 130177}

This PR:

{"baseline_dex_bytes": 0, "baseline_download_bytes": 2513, "baseline_install_bytes": 7529, "core_dex_bytes": 218884, "core_download_bytes": 122939, "core_install_bytes": 130192}

Measured 5cc29ef merged into 89e392b

@nickolas-dimitrakas
nickolas-dimitrakas force-pushed the test/testutils-visibility-seams branch from 5940248 to 4f6fd62 Compare September 24, 2026 04:47
@nickolas-dimitrakas
nickolas-dimitrakas changed the base branch from main to test/replace-powermock-with-mockito September 24, 2026 04:47
@nickolas-dimitrakas
nickolas-dimitrakas added this pull request to stack #851 September 24, 2026 05:47
@nickolas-dimitrakas nickolas-dimitrakas self-assigned this Sep 24, 2026
@nickolas-dimitrakas
nickolas-dimitrakas marked this pull request as ready for review October 6, 2026 18:21
@nickolas-dimitrakas
nickolas-dimitrakas requested a review from a team as a code owner October 6, 2026 18:21
@cursor

cursor Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Visibility modifications and test annotations with no behavioral or business logic changes.

Overview
Updates several package-private classes, fields, and methods in android-core to public visibility to support cross-module test utilities.

All updated members are annotated with @VisibleForTesting and @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) to restrict external usage while preserving access across internal modules and tests without altering runtime behavior.

Reviewed by Cursor Bugbot for commit 5cc29ef. Bugbot is set up for automated code reviews on this repo. Configure here.

@nickolas-dimitrakas
nickolas-dimitrakas force-pushed the test/testutils-visibility-seams branch 3 times, most recently from 2ab1576 to a1f60cf Compare October 6, 2026 21:04
Base automatically changed from test/replace-powermock-with-mockito to main October 6, 2026 21:31
The testutils module reaches package-private members of android-core by declaring helper classes in the same package names across the module boundary, which only works while those classes stay in Java. This makes the members testutils depends on public and marks each with @VisibleForTesting and @RestrictTo(LIBRARY_GROUP): the MessageHandler class, UploadHandler.mApiClient and setApiClient, ConfigManager.deleteConfigManager and clearMpid, MessageManager.mMessageHandler and mInstallType, BaseHandler.await, KitFrameworkWrapper.mKitManager, getFrameworkLoadAttempted, setKitManager and setKitsLoaded, MParticleIdentityClientImpl's endpoint path constants and getUrl overloads, MParticleUserImpl.setUserIdentities, and MParticleBaseClientImpl.mApiKey. No behaviour, names, types or nullability change, and the classes kept in full by proguard.pro are untouched, so the published API surface is unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@nickolas-dimitrakas
nickolas-dimitrakas force-pushed the test/testutils-visibility-seams branch from a1f60cf to 5cc29ef Compare October 6, 2026 21:31
@nickolas-dimitrakas
nickolas-dimitrakas merged commit eb2b44b into main Oct 6, 2026
87 of 88 checks passed
@nickolas-dimitrakas
nickolas-dimitrakas deleted the test/testutils-visibility-seams branch October 6, 2026 21:45
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