You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
packages/core/android/src/main/java/io/sentry/react/RNSentryStart.java:186 calls configureAndroidProfiling(options, rnOptions, logger), which reads _experiments.profilingOptions and wires three fields onto SentryAndroidOptions:
This works correctly today. It has no test coverage.packages/core/android/src/test/ doesn't exist — the Android side of the SDK ships no JUnit tests for the init path at all. The audit run while investigating the iOS profiling bug (#6012) confirmed this gap.
Why this matters
We just finished fixing two iOS bugs (#6012, #6014) where option-parsing code was added to a file that was no longer on the live init path, and XCTest kept passing because it was exercising the dead surface. On Android today, the active init path is correct — but if someone refactors configureAndroidProfiling out of RNSentryStart.startWithOptions, or introduces a parallel init path (as happened on iOS), there is literally no test to catch it. We'd find out from a customer report.
Pinning the wiring with tests would have caught the analogous iOS bug.
What to do
Set up the Android test harness under packages/core/android/src/test/java/io/sentry/react/ with a Robolectric or plain JUnit + Mockito setup (whichever aligns with the rest of the Sentry Android SDK's test conventions — check sentry-java for the pattern).
Wire the test target into packages/core/android/build.gradle so ./gradlew test runs it.
No _experiments / no profilingOptions → defaults preserved, no calls made.
Invalid types (non-number rate, non-string lifecycle, non-boolean startOnAppStart) → warning logged, value ignored (verify via the logger stub).
Also consider pinning _experiments.enableUnhandledCPPExceptionsV2 handling on Android since it has the same silent-drop risk. (Double-check Android wires it correctly first — the iOS audit only covered iOS.)
Wire the test step into CI (.github/workflows/native-tests.yml has an Android section).
Acceptance
./gradlew test under packages/core/android runs and passes the new tests.
CI's Android native-tests workflow runs them too.
Deliberately breaking configureAndroidProfiling (e.g. commenting out one of the three options.set… calls) causes the suite to go red.
Notes
Not user-visible, but this is the only place we can catch a future refactor-induced regression early.
Context
packages/core/android/src/main/java/io/sentry/react/RNSentryStart.java:186callsconfigureAndroidProfiling(options, rnOptions, logger), which reads_experiments.profilingOptionsand wires three fields ontoSentryAndroidOptions:profileSessionSampleRate→options.setProfileSessionSampleRate(...)(line 241)lifecycle→options.setProfileLifecycle(ProfileLifecycle.MANUAL|TRACE)(line 258 / 261)startOnAppStart→options.setStartProfilerOnAppStart(...)(line 274)This works correctly today. It has no test coverage.
packages/core/android/src/test/doesn't exist — the Android side of the SDK ships no JUnit tests for the init path at all. The audit run while investigating the iOS profiling bug (#6012) confirmed this gap.Why this matters
We just finished fixing two iOS bugs (#6012, #6014) where option-parsing code was added to a file that was no longer on the live init path, and XCTest kept passing because it was exercising the dead surface. On Android today, the active init path is correct — but if someone refactors
configureAndroidProfilingout ofRNSentryStart.startWithOptions, or introduces a parallel init path (as happened on iOS), there is literally no test to catch it. We'd find out from a customer report.Pinning the wiring with tests would have caught the analogous iOS bug.
What to do
Set up the Android test harness under
packages/core/android/src/test/java/io/sentry/react/with a Robolectric or plain JUnit + Mockito setup (whichever aligns with the rest of the Sentry Android SDK's test conventions — checksentry-javafor the pattern).Wire the test target into
packages/core/android/build.gradleso./gradlew testruns it.Add
RNSentryStartTest(or similar) with at least these cases, mirroring the iOS tests added in fix(profiling): iOS UI profiling on v8 #6012:_experiments.profilingOptions = { profileSessionSampleRate: 1.0, lifecycle: "trace", startOnAppStart: true }results inoptions.getProfileSessionSampleRate() == 1.0,options.getProfileLifecycle() == ProfileLifecycle.TRACE,options.isStartProfilerOnAppStart() == true.lifecycle: "manual"→ProfileLifecycle.MANUAL._experiments/ noprofilingOptions→ defaults preserved, no calls made.Also consider pinning
_experiments.enableUnhandledCPPExceptionsV2handling on Android since it has the same silent-drop risk. (Double-check Android wires it correctly first — the iOS audit only covered iOS.)Wire the test step into CI (
.github/workflows/native-tests.ymlhas an Android section).Acceptance
./gradlew testunderpackages/core/androidruns and passes the new tests.configureAndroidProfiling(e.g. commenting out one of the threeoptions.set…calls) causes the suite to go red.Notes