feat(tracing): Add breadcrumbs for dispatched React Navigation events #6218
4 issues
Low
Default fallback 'NAVIGATE' is misleading when action type is unknown - `packages/core/src/js/tracing/reactnavigation.ts:357-360`
When actionType is undefined (e.g. a malformed or unexpected event cast from unknown), the breadcrumb message says Dispatched NAVIGATE and implies a NAVIGATE action, but since action_type is omitted from data in that case, the message is inconsistent and could mislead debugging. Consider using 'UNKNOWN' as the fallback instead.
'does not create dispatch breadcrumb for app restart' test exercises no dispatch code path - `packages/core/test/tracing/reactnavigation.test.ts:1801-1827`
The test calls mockNavigation.finishAppStartNavigation(), which only fires listeners['state'] โ it never triggers listeners['__unsafe_action__']. Since the dispatch breadcrumb lives in startIdleNavigationSpan (bound to __unsafe_action__), the test never invokes that function at all and passes trivially, leaving the actual isAppRestart = true guard untested.
Breadcrumb message falsely reports 'NAVIGATE' when action type is unknown - `packages/core/src/js/tracing/reactnavigation.ts:357-365`
When actionType is undefined, the message says Dispatched NAVIGATE but the data object omits action_type, so the message contradicts the structured data and misattributes the dispatch type.
App-restart dispatch breadcrumb test passes trivially without exercising the guard - `packages/core/test/tracing/reactnavigation.test.ts:1800-1826`
The new test 'does not create dispatch breadcrumb for app restart' (reactnavigation.test.ts:1800โ1826) calls mockNavigation.finishAppStartNavigation(), which only fires the state listener and never the __unsafe_action__ listener. Since the navigation.dispatch breadcrumb is emitted exclusively inside startIdleNavigationSpan (reactnavigation.ts:353) โ which is wired to the __unsafe_action__ listener โ the breadcrumb code path is never reached in this test. The assertion expect(dispatchCall).toBeUndefined() therefore passes regardless of whether the !isAppRestart guard exists, so the real app-restart suppression path (invoked via getAppRegistryIntegration โ onRunApplication โ startIdleNavigationSpan(undefined, true)) remains unverified.
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| security-review | 0 | 3.7s | $0.04 |
| code-review | 2 | 1m 37s | $0.37 |
| find-bugs | 2 | 7m 27s | $1.29 |
| gha-security-review | 0 | 1m 17s | $0.03 |
โฑ 10m 25s ยท 839.5k in / 44.7k out ยท $1.73