Skip to content

fix: Ensure root messenger has required function for error reporting#27794

Merged
FrederikBolding merged 1 commit into
mainfrom
fb/add-capture-exception-to-messenger
Mar 23, 2026
Merged

fix: Ensure root messenger has required function for error reporting#27794
FrederikBolding merged 1 commit into
mainfrom
fb/add-capture-exception-to-messenger

Conversation

@FrederikBolding
Copy link
Copy Markdown
Member

@FrederikBolding FrederikBolding commented Mar 23, 2026

Description

The root messenger on mobile does not currently have a captureException function passed. This means that any controllers relying on messenger.captureException to record unhandled errors are having their errors swallowed. This PR fixes it by passing in the Sentry captureException function.

Changelog

CHANGELOG entry: Fixed an issue where certain error reporting would not work


Note

Low Risk
Low risk: wires existing Sentry captureException into root Messenger/ExtendedMessenger construction; behavior change is limited to enabling error capture for controllers that opt into it.

Overview
Fixes missing error reporting on mobile by importing Sentry’s captureException and passing it into both getRootExtendedMessenger and getRootMessenger in app/core/Engine/types.ts.

This ensures controllers using messenger.captureException can forward unhandled errors to Sentry instead of silently swallowing them.

Written by Cursor Bugbot for commit 1617775. This will update automatically on new commits. Configure here.

@metamaskbot metamaskbot added team-core-platform Core Platform team INVALID-PR-TEMPLATE PR's body doesn't match template labels Mar 23, 2026
@FrederikBolding FrederikBolding marked this pull request as ready for review March 23, 2026 12:23
@FrederikBolding FrederikBolding requested a review from a team as a code owner March 23, 2026 12:23
@FrederikBolding FrederikBolding force-pushed the fb/add-capture-exception-to-messenger branch from 292442b to 1617775 Compare March 23, 2026 13:00
@github-actions github-actions Bot added the risk-medium Moderate testing recommended · Possible bug introduction risk label Mar 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeWalletPlatform, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeTrade, SmokeIdentity, SmokeMultiChainAPI, FlaskBuildTests
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:
The change in app/core/Engine/types.ts adds captureException from @sentry/react-native to both getRootExtendedMessenger() and getRootMessenger() factory functions. These are the root messenger constructors that underpin ALL controller communication in the app.

Why this is medium risk (not high):

  • The change is purely additive — it adds an error reporting callback to the messenger, not removing or modifying existing functionality
  • No controller initialization order changes
  • No state schema modifications
  • No messenger action/event list changes
  • captureException is a well-established Sentry API

Why broad testing is still warranted:

  • Both root messenger factories are foundational infrastructure — every controller's restricted messenger derives from these roots
  • If the captureException integration causes any unexpected behavior (e.g., Sentry SDK issues, unexpected exception swallowing, or performance impact), it would affect ALL controller communication
  • The root messenger is used across accounts, transactions, networks, snaps, identity, trading, and all other features
  • The change touches Phase 1/2 infrastructure (root messenger initialization)

Tags selected:

  • SmokeAccounts: Account management uses messenger-based controller communication
  • SmokeConfirmations: Transaction/signature flows depend on messenger infrastructure
  • SmokeWalletPlatform: Core wallet features use messenger throughout
  • SmokeNetworkAbstractions: Network management relies on messenger communication
  • SmokeNetworkExpansion: Multi-chain/Solana flows use messenger
  • SmokeTrade: Swap/bridge flows use messenger-based controllers
  • SmokeIdentity: Profile sync uses messenger infrastructure
  • SmokeMultiChainAPI: CAIP-25 session management uses messenger
  • FlaskBuildTests: Snaps use messenger for permissions and RPC calls

Tags NOT selected:

  • SmokeRamps: Fiat on/off-ramp is more isolated and lower risk for this infrastructure change
  • SmokeCard: Card integration is isolated enough
  • SmokePerps/SmokePredictions: These are feature-specific and the messenger change is unlikely to specifically break them beyond what SmokeTrade/SmokeWalletPlatform covers

Performance Test Selection:
The change adds captureException to the root messenger constructors. This is an error reporting callback that would only be invoked on exceptions (error paths), not on normal operation. There is no expected performance impact on normal app flows — the captureException function is not called during normal messenger operations, only when errors occur. No performance tests are needed.

View GitHub Actions results

@github-actions
Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
17 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud
Copy link
Copy Markdown

@FrederikBolding FrederikBolding added this pull request to the merge queue Mar 23, 2026
Merged via the queue into main with commit c70dee9 Mar 23, 2026
133 of 165 checks passed
@FrederikBolding FrederikBolding deleted the fb/add-capture-exception-to-messenger branch March 23, 2026 14:03
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 23, 2026
@metamaskbot metamaskbot added the release-7.72.0 Issue or pull request that will be included in release 7.72.0 label Mar 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template release-7.72.0 Issue or pull request that will be included in release 7.72.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-XS team-core-platform Core Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants