Skip to content

fix(core): Hide dataCollection option until supported in React Native#6345

Merged
antonis merged 4 commits into
mainfrom
fix/hide-datacollection-option
Jun 25, 2026
Merged

fix(core): Hide dataCollection option until supported in React Native#6345
antonis merged 4 commits into
mainfrom
fix/hide-datacollection-option

Conversation

@antonis

@antonis antonis commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Omits the dataCollection option from the public RN options types (ReactNativeOptions / ReactNativeClientOptions) by adding it to the existing Omit<…> on the inherited @sentry/core Options/ClientOptions.

dataCollection was introduced upstream in @sentry/core v10 as the granular replacement for the (now deprecated) sendDefaultPii, and it is inherited into the RN options type surface automatically with the JS SDK bump to 10.60.0. However, it is not wired up in React Native:

  • The native SDKs (iOS/Android) only read sendDefaultPii across the bridge; they do not understand dataCollection.
  • RN-specific JS gates also read raw sendDefaultPii and ignore core's resolved data-collection settings — e.g. infer_ip metadata and addAutoIpAddressToSession (client.ts), and the URL/route-param gating in reactnavigation.ts, expoRouter.ts, and deeplink.ts.

So a user who set dataCollection would get a silent partial no-op: native and the RN JS gates would not honor it. Hiding it keeps the option surface honest until full support lands. Users should continue to use sendDefaultPii.

💡 Motivation and Context

Spotted while reviewing the JS SDK bump to 10.60.0. The bump auto-exposes dataCollection in the RN types even though no layer honors it, which would be a silent footgun. This is the low-risk interim move; full dataCollection support (native + the RN JS gates) is tracked separately and the option will be re-exposed there.

💚 How did you test it?

  • yarn build:sdk passes
  • yarn api-report regenerated — only change is the Omit on ReactNativeOptions

📝 Checklist

  • I added tests to verify 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.
  • All tests passing
  • No breaking changes

🔮 Next steps

  • Re-expose dataCollection once the native SDKs and the RN-specific sendDefaultPii gates support it.

antonis and others added 2 commits June 25, 2026 10:03
The dataCollection option is exposed by @sentry/core but is not yet
honored by the native SDKs (iOS/Android) nor by the RN-specific
sendDefaultPii gates (IP inference, deep links, navigation params), so
setting it would silently have no effect. Omit it from the public
options types until full support lands; users should use sendDefaultPii.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • fix(core): Hide dataCollection option until supported in React Native by antonis in #6345
  • feat(core): Capture Expo Router ErrorBoundary errors by alwx in #6318
  • chore(deps): update Cocoa SDK to v9.19.0 by github-actions in #6343
  • chore(deps): update Android SDK to v8.45.0 by github-actions in #6344
  • fix(core): Align SENTRY_ENVIRONMENT/RELEASE/DIST in JS bundled options with native SDKs by antonis in #6330
  • chore(deps): update JavaScript SDK to v10.60.0 by github-actions in #6332
  • chore(core): Bump react-native and metro devDependencies to 0.86.0 by antonis in #6316
  • chore: Bump macOS sample to react-native-macos 0.81.7 by antonis in #6315
  • chore(e2e): Bump react-native devDependency to 0.86.0 by antonis in #6313
  • fix(core): Forward user geo as an object so the native scope keeps it by antonis in #6309
  • fix(ios): Remove manual geo handling, use sentry-cocoa native support by antonis in #6289
  • fix(deps): bump js-yaml from ^4.1.1 to ^4.2.0 by antonis in #6298
  • fix: update React Native repo URL to new GitHub org by antonis in #6290
  • chore(deps): update JavaScript SDK to v10.59.0 by github-actions in #6321
  • chore(deps): bump concurrent-ruby from 1.3.6 to 1.3.7 in /samples/react-native-macos by dependabot in #6327
  • chore(deps): bump undici from 6.24.1 to 6.27.0 by dependabot in #6328
  • chore(deps): bump actions/checkout from 6.0.3 to 7.0.0 by dependabot in #6324
  • fix(ios): [RN 0.87] remove unused React/RCTTextView.h import by cortinico in #6322
  • chore(deps): bump actions/setup-java from 5.2.0 to 5.3.0 by dependabot in #6326
  • chore(deps): bump ruby/setup-ruby from 1.313.0 to 1.314.0 by dependabot in #6325
  • chore(deps): update Android SDK to v8.44.1 by github-actions in #6323

🤖 This preview updates automatically when you update the PR.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor
Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request

Generated by 🚫 dangerJS against 6073585

@alwx alwx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, let's ship it!

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* @see ReactNativeFrontend for more information.
*/

// `dataCollection` is omitted until the option is fully supported in React Native. It is exposed by

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The dataCollection option is hidden from TypeScript but can still be passed at runtime. It is ignored by React Native specific logic, which still uses sendDefaultPii, leading to silent misconfiguration.
Severity: MEDIUM

Suggested Fix

To fully prevent usage, the dataCollection property should be explicitly destructured and removed from the options object at runtime in wrapper.ts before the remaining options are passed to initNativeSdk. This ensures it is not passed to the core SDK or native layers, preventing the partial, confusing behavior.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/core/src/js/options.ts#L515

Potential issue: Hiding the `dataCollection` option from TypeScript types using `Omit`
is a compile-time-only change. At runtime, users can still provide this option. The
option is passed to the core SDK but is ignored by React Native-specific data-gating
logic (e.g., for IP addresses, deep links), which continues to read the `sendDefaultPii`
option. This discrepancy can lead to silent failures where a user's data privacy
settings in `dataCollection` are not respected by the React Native layer, causing
unintended data to be sent if `sendDefaultPii` is also configured.

Did we get this right? 👍 / 👎 to inform future reviews.

@antonis antonis merged commit c79c2ae into main Jun 25, 2026
59 of 65 checks passed
@antonis antonis deleted the fix/hide-datacollection-option branch June 25, 2026 10:14
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