Skip to content

Upgrade Sentry React Native SDK to 8.32.0 and revert the TurboModuleContext workaround - #105398

Merged
mountiny merged 2 commits into
Expensify:mainfrom
arekm213:arekm213/upgrade-sentry-8.32
Nov 2, 2026
Merged

mountiny merged 2 commits into
Expensify:mainfrom
arekm213:arekm213/upgrade-sentry-8.32

Conversation

@arekm213

@arekm213 arekm213 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Upgrades @sentry/react-native from 8.27.0 to 8.32.0 and reverts the workaround from #103900, which disabled the TurboModuleContext integration.

Why the workaround can go: in 8.27.0, TurboModuleContext always wrapped RNSentry itself, in addition to any modules listed in its modules option. 8.32.0 fixes this upstream (getsentry/sentry-react-native#6921): RNSentry is no longer wrapped unless it is explicitly listed in the integration's modules. So the integration goes back into our default list.

Dependency changes:

  • @sentry/react-native 8.27.0 → 8.32.0
  • @sentry/core and @sentry/browser-utils (devDep) 10.75.0 → 10.76.2. 8.32.0 pins the JS SDK to exactly 10.76.2, so we bump these to keep a single copy of @sentry/core.
  • The lockfile only changes @sentry/* packages (plus @sentry/cli 3.8.1 and a dotenv relocation).
  • The four Sentry patches are renamed to the new versions. Their content is unchanged and they all apply cleanly. The patched code regions are identical between the old and new upstream versions; upstream only changed code around them.
  • ios/Podfile.lock: RNSentry 8.32.0, prebuilt checksum.

Removed _experiments.profilingOptions: 8.32.0 (getsentry/sentry-react-native#6916) auto-adds uiProfilingIntegration whenever _experiments.profilingOptions is set. That integration calls the native startProfiler for each root span. We start the native SDK ourselves in SentryNativeSDKManager without any profiling options (autoInitializeNativeSdk: false). On iOS, sentry-cocoa then sees options.profiling == nil, skips session sampling and starts the continuous profiler unconditionally, which means on every session regardless of profileSessionSampleRate. This only starts with 8.32.0; on main (8.27.0) nothing calls startProfiler, so the option has no effect there. Reproduced on an iOS simulator with 8.32.0: with profilingOptions kept, an io.sentry.SamplingProfiler thread runs; with it removed, as in this PR, it doesn't. Android is unaffected because sentry-java gates on profileSessionSampleRate.

The option did nothing before this upgrade. It only reached the native SDK through the JS-side native init, which we skip, and Sentry shows 0 iOS UI profiles over the last 14 days. Removing it therefore changes no data we collect today. A comment in setupSentry.ts explains why it must not be re-added on the JS side alone. Real UI profiling would need the options in the native init (App + Mobile-Expensify) and can be done as a follow-up if we want it.

Other upstream changes between 8.27 and 8.32 were reviewed and don't affect us:

  • maxTransactionDurationExceeded was removed. We don't use it.
  • Callback stripping is JS-only.
  • sideEffects: false only affects web tree-shaking.
  • Touch events, React Navigation and the native transport have only minor internal changes.

Fixed Issues

$ #103906
PROPOSAL: N/A

MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/14212

Tests

  1. Build and run the app on iOS and Android, sign in and navigate around (inbox, a report, settings).
  2. Verify that no errors appear in the JS console.
  3. In the dev Sentry debug menu, enable "Log Sentry to console" and verify transactions are logged with frames.* measurements and navigation transactions include TTID.
  4. Verify no transaction or scope contains a turbo_module context or tag for RNSentry.
  5. On web, click a button with data-sentry-label and verify the ui.click breadcrumb contains the label.
  • Verify that no errors appear in the JS console

Offline tests

N/A. Telemetry library upgrade, no change in offline behaviour.

QA Steps

  1. Use the app normally on all platforms (sign in, open reports, create an expense).
  2. Verify there are no crashes or new errors.
  3. In Sentry, open any http.client span for an /api request from this build and verify it still has the request-id attribute.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
screen-recording-4EB9FEDE-39A1-4AA2-AAB9-7E7D188D5B3F-1793611118128.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. ⚠️

@arekm213

Copy link
Copy Markdown
Contributor Author

@MelvinBot review

@MelvinBot

Copy link
Copy Markdown
Contributor

Review: no blocking issues

The upgrade looks correct. CI test (all 8 jobs), typecheck, and Storybook pass. ESLint is still pending.

Verified against the published 8.27.0 and 8.32.0 sources:

  • @sentry/react-native@8.32.0 pins @sentry/core, @sentry/browser, and @sentry/react to exactly 10.76.2, plus @sentry/cli 3.8.1. The lockfile changes match that and leave a single @sentry/core.
  • On 8.32.0, turboModuleContextIntegration wraps nothing unless you pass modules (and RNSentry only if listed). Removing the filter is safe.
  • 8.32.0 auto-adds uiProfilingIntegration when _experiments.profilingOptions is set. With lifecycle: 'trace' it calls native startProfiler. Native init in SentryNativeSDKManager.m:69-80 sets no profiling options, so removing the block is the right call.
  • No App code uses maxTransactionDurationExceeded, profilesSampleRate, or other removed options.

Suggestions (non-blocking):

  1. PR description: in 8.27.0 the integration did not wrap every TurboModule call. It always wrapped RNSentry, plus any listed modules. Other modules were wrapped only with enableLegacyNativeModules on the old architecture. The conclusion still holds.
  2. Comment wording at setupSentry.ts:91-94: "on every root span" overstates it. The integration starts one session when a root span starts and none is running, then stops 60s after the last root span ends. Consider "whenever a root span starts".
  3. HybridApp: per the bot warning, run an AdHoc build to confirm HybridApp picks up RNSentry 8.32.0 and the renamed patches.
  4. QA: 8.32.0 now respects enableHTTPTimings (fix(tracing): Respect enableHTTPTimings and stop leaking HTTP timing listeners getsentry/sentry-react-native#6912), so http.client span timings may change. QA step 3 already covers these spans.
Not verified
  • How sentry-cocoa behaves when startProfiler runs after a native init without profiling config. Your simulator repro covers this.
  • I didn't run the app. This is a code and dependency review only.

@arekm213

Copy link
Copy Markdown
Contributor Author

Answering to this

Thanks, both wording fixes applied
Here is the HybridApp companion PR https://github.com/Expensify/Mobile-Expensify/pull/14212
Related to enableHTTPTimings - there is no change for us, RN 0.86 reports resource timings, so XHR timings stay on, and our global fetch is nitroFetch, not expo/fetch

@arekm213

Copy link
Copy Markdown
Contributor Author

@MelvinBot review

@arekm213
arekm213 marked this pull request as ready for review October 30, 2026 10:25
@arekm213
arekm213 requested review from a team as code owners October 30, 2026 10:25
@melvin-bot
melvin-bot Bot requested review from shubham1206agra and removed request for a team October 30, 2026 10:25
@melvin-bot

melvin-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown

@shubham1206agra Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot requested review from heyjennahay and removed request for a team October 30, 2026 10:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-30T11:25:58.829216Z
We couldn’t complete this review. Comment @codex review to try again.
d112beb Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@MelvinBot

Copy link
Copy Markdown
Contributor

Re-review: no blocking issues

The only change since my last review is commit d112beb, which applies the comment wording fix. All CI checks pass except Check independent approval, which waits on a reviewer approval.

Re-verified against the upstream 8.27.0 and 8.32.0 sources:

  • TurboModuleContext: with no modules option, 8.32.0 wraps no native module (turboModuleContext.ts#L154-L170). It still adds a small spanStart/spanEnd listener per root span, which returns early because there are no counters. Returning to the default integrations is safe.
  • Profiling: on 8.27.0, _experiments.profilingOptions only reached NATIVE.initNativeSdk, which autoInitializeNativeSdk: false skips. Removing it changes nothing today. Neither ios/SentryNativeSDKManager.m nor SentryNativeSDKManager.kt sets profiling options. On iOS, sentry-cocoa skips session sampling when options.profiling is nil (SentrySDKInternal.m#L738-L770), so keeping the option on 8.32.0 would have profiled every session.
  • New comment: the wording at setupSentry.ts:91-94 now matches upstream behavior.
  • Dependencies: the 10.76.2 pins and @sentry/cli 3.8.1 match the lockfile.
Optional nit

The root devDependencies still pins @sentry/cli to 3.3.0, while the SDK uses its own nested 3.8.1. This was already the case before this PR, so it's out of scope here.


view run

@arekm213

Copy link
Copy Markdown
Contributor Author

@shubham1206agra its ready for review

@shubham1206agra

Copy link
Copy Markdown
Contributor

@arekm213 Please add video for atleast one platform

@arekm213

arekm213 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@shubham1206agra i added video from iOS native - there is no UI changes in this PR so what i recorded is simply running app and switching between main tabs to make sure nothing breaks

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

This looks good to me, thank you @arekm213

@mountiny

mountiny commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari

@mountiny
mountiny merged commit e8f8b9c into Expensify:main Nov 2, 2026
54 of 57 checks passed
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

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.

4 participants