Skip to content

ref(core): [Hybrid SDK API 1] Mark the non-customer API that hybrid SDKs use - #6785

Open
runningcode wants to merge 3 commits into
no/hybrid-sdk-apifrom
no/java-719-mark-hybrid-sdk-api
Open

runningcode wants to merge 3 commits into
no/hybrid-sdk-apifrom
no/java-719-mark-hybrid-sdk-api

Conversation

@runningcode

@runningcode runningcode commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

PR Stack (Hybrid SDK API)


📜 Description

Adds @HybridSdkApi, a source-retention marker with no attributes. It goes on non-customer API that a hybrid SDK uses: @ApiStatus.Internal types and members, classes in internal packages, and public entry points that only hybrids call, such as the 4-arg ReplayIntegration constructor. Customer-facing API is left unmarked, since semver already covers it.

The list comes from the Android code of React Native, Flutter, .NET, Unity, Unreal, Godot, KMP, Capacitor, and Cordova on their current default branches.

Some of the marked elements are not obvious:

  • Private fields on Breadcrumb, User, App, and Gpu. Unity sets these through JNI by field name.
  • The PersistingScopeObserver and PersistingOptionsObserver file names, and AndroidOptionsInitializer.getCacheDir. Unity reads the persisted scope from disk.
  • DefaultAndroidEventProcessor. .NET finds it by class identity in getEventProcessors().
  • SpanContext.getParentSpanId(). It is @TestOnly, but .NET calls it in production.

Not marked, because they are customer-facing or can't take an annotation: manifest keys, the generated BuildConfig, and the declaration order of the SentryLevel and SentryLogLevel enums, which Unreal maps by ordinal.

💡 Motivation and Context

@ApiStatus.Internal doesn't distinguish hybrid-facing surface from plain SDK plumbing, so a later relocate or remove pass for v9 can break a hybrid without any compiler noticing. Several hybrids call these elements through bindings, JNI, or reflection by name.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

New hybrid-facing API should get the marker when it is added.

🤖 Generated with Claude Code

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

#skip-changelog

@github-actions

Copy link
Copy Markdown
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

@linear-code

linear-code Bot commented Nov 25, 2026

Copy link
Copy Markdown

JAVA-719

@runningcode runningcode changed the title ref(core): Mark the non-customer API that hybrid SDKs use ref(core): [Hybrid SDK API 1] Mark the non-customer API that hybrid SDKs use Nov 26, 2026
@runningcode
runningcode changed the base branch from main to no/hybrid-sdk-api November 26, 2026 08:22
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit 431e551.

Main concerns: reach, public contract.

Rules that block low also fired:

  • R1: code was truncated, omitted or a reduced context was used: sentry/src/main/java/io/sentry/IScope.java, sentry/src/main/java/io/sentry/IScopes.java, sentry/src/main/java/io/sentry/ISentryExecutorService.java, sentry/src/main/java/io/sentry/ISpan.java, sentry/src/main/java/io/sentry/JsonObjectReader.java and 49 more
  • R4: a public API record changed: sentry/api/sentry.api

This label is a hint for reviewers, not an approval.

Add a source-retention @HybridSdkApi marker and apply it to the
Internal types and members, internal-package classes, and other
non-customer entry points that React Native, Flutter, .NET, Unity,
Unreal, Godot, KMP, and Capacitor call. A later Internal or v9
relocation pass can then tell hybrid-facing surface apart from pure
SDK plumbing.

Fixes JAVA-719

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@runningcode
runningcode force-pushed the no/java-719-mark-hybrid-sdk-api branch from 7238bb1 to 19260c7 Compare November 30, 2026 12:28
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 30, 2026
@sentry

sentry Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.66.0 (1) release

⚙️ sentry-android Build Distribution Settings

An audit of the Android code of the hybrid SDKs found internal API they
call that was not marked yet:

- ScopesAdapter's scope getters and IScopes.getScope. .NET binds the
  class, not the interface, so the IScopes markers don't cover it.
- Getters that pair with a marked setter or return a marked type:
  getReplayController, getContinuousProfiler, the connection status
  provider accessors, getDebugImagesLoader, and
  CompositePerformanceCollector.
- The Breadcrumb and User deserializers, IScope.withSession, the mask
  and unmask container setters, the SdkVersion constructor of
  SentryReplayOptions, the vendored Base64, and getOutboxPath, which
  Cordova writes envelopes to.
- All of ScreenshotRecorderConfig, since Flutter reads its properties.

LazyEvaluator loses its marker because no hybrid SDK uses it.

Refs JAVA-719

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sentry-junior sentry-junior Bot mentioned this pull request Dec 1, 2026
3 of 9 tasks
@runningcode
runningcode marked this pull request as ready for review December 2, 2026 08:12
@runningcode
runningcode requested review from a team and adinauer as code owners December 2, 2026 08:12
@runningcode
runningcode requested review from 0xadam-brown and markushi and removed request for a team December 2, 2026 08:12
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Dec 2, 2026
…structor

.NET is the only caller of this overload. It was added in #4808 so .NET
can deliver system event breadcrumbs on the main thread.

Refs JAVA-719

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mark the non-customer API that hybrid SDKs use

1 participant