Turbo Modules crash time context #6227
3 issues
code-review: Found 3 issues (2 medium, 1 low)
Medium
Async TurboModule calls always recorded as `kind: 'sync'` in crash context - `packages/core/src/js/turbomodule/wrapTurboModule.ts:58-75`
Every method call pushes with kind: 'sync' (line 58), and when the result is thenable there is no mutation or re-push to change the stack frame's kind to 'async' — so async calls appear as kind: 'sync' in contexts.turbo_module for the entire duration of the async operation.
Also found at:
packages/core/etc/sentry-react-native.api.md:734
Sealed TurboModule proxies can be double-wrapped, causing duplicate tracker pushes per call - `packages/core/src/js/turbomodule/wrapTurboModule.ts:88-99`
When Object.defineProperty throws for a sealed proxy, WRAPPED_FLAG is never set, so the guard at line 39 (if (maybeWrapped[WRAPPED_FLAG])) always passes on subsequent calls to wrapTurboModule, re-wrapping already-wrapped methods and pushing the same call twice onto the tracker stack.
Also found at:
packages/core/etc/sentry-react-native.api.md:799
Low
No test verifies `turboModuleContextIntegration` inclusion/exclusion in `getDefaultIntegrations` - `packages/core/src/js/integrations/default.ts:175-178`
There is no test covering the new if (options.enableNative) branch — add a defaultTurboModuleContext.test.ts (following the pattern of defaultSpotlight.test.ts) that asserts the integration is included when enableNative: true and absent when enableNative: false.
⏱ 7m 47s · 899.2k in / 71.0k out · $2.56
Annotations
Check warning on line 75 in packages/core/src/js/turbomodule/wrapTurboModule.ts
sentry-warden / warden: code-review
Async TurboModule calls always recorded as `kind: 'sync'` in crash context
Every method call pushes with `kind: 'sync'` (line 58), and when the result is thenable there is no mutation or re-push to change the stack frame's `kind` to `'async'` — so async calls appear as `kind: 'sync'` in `contexts.turbo_module` for the entire duration of the async operation.
Check warning on line 734 in packages/core/etc/sentry-react-native.api.md
sentry-warden / warden: code-review
[EUK-DJP] Async TurboModule calls always recorded as `kind: 'sync'` in crash context (additional location)
Every method call pushes with `kind: 'sync'` (line 58), and when the result is thenable there is no mutation or re-push to change the stack frame's `kind` to `'async'` — so async calls appear as `kind: 'sync'` in `contexts.turbo_module` for the entire duration of the async operation.
Check warning on line 99 in packages/core/src/js/turbomodule/wrapTurboModule.ts
sentry-warden / warden: code-review
Sealed TurboModule proxies can be double-wrapped, causing duplicate tracker pushes per call
When `Object.defineProperty` throws for a sealed proxy, `WRAPPED_FLAG` is never set, so the guard at line 39 (`if (maybeWrapped[WRAPPED_FLAG])`) always passes on subsequent calls to `wrapTurboModule`, re-wrapping already-wrapped methods and pushing the same call twice onto the tracker stack.
Check warning on line 799 in packages/core/etc/sentry-react-native.api.md
sentry-warden / warden: code-review
[AF3-FXS] Sealed TurboModule proxies can be double-wrapped, causing duplicate tracker pushes per call (additional location)
When `Object.defineProperty` throws for a sealed proxy, `WRAPPED_FLAG` is never set, so the guard at line 39 (`if (maybeWrapped[WRAPPED_FLAG])`) always passes on subsequent calls to `wrapTurboModule`, re-wrapping already-wrapped methods and pushing the same call twice onto the tracker stack.