Skip to content

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

Draft
runningcode wants to merge 1 commit into
no/hybrid-sdk-apifrom
no/java-719-mark-hybrid-sdk-api
Draft

runningcode wants to merge 1 commit 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

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>
@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

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit 7238bb1.

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/JsonObjectReader.java, sentry/src/main/java/io/sentry/JsonUnknown.java, sentry/src/main/java/io/sentry/NoOpLogger.java, sentry/src/main/java/io/sentry/PerformanceCollectionData.java, sentry/src/main/java/io/sentry/PropagationContext.java and 43 more
  • R4: a public API record changed: sentry/api/sentry.api

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

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