feat(tracing): Wrap Expo Router push, replace, navigate, back, dismiss in addition to prefetch#6221
3 issues
find-bugs: Found 3 issues (3 low)
Low
Stale pending navigation value can contaminate app-restart and initial-setup spans - `packages/core/src/js/tracing/pendingExpoRouterNavigation.ts:22`
The module-level pending singleton has no expiry, so a value set by a router call that never produces a __unsafe_action__ event (e.g. navigation attempted before the container is registered) will be consumed and applied as navigation.method by the next startIdleNavigationSpan invocation regardless of whether it is a normal dispatch, an initial setup call, or an isAppRestart=true call.
Test asserts router is 'unchanged' but push method is now silently wrapped - `packages/core/test/tracing/expoRouter.test.ts:54-57`
The test at line 51 passes { push: jest.fn() } (no prefetch) and asserts expect(wrapped).toBe(router), but wrapExpoRouter now replaces router.push with a wrapped version — the assertion only validates object identity, not method identity, so the test stays green while the described invariant is violated.
Test 'returns the router unchanged if prefetch method does not exist' no longer holds: push is silently wrapped
The test asserts wrapped === router (trivially true), but after this PR router.push is replaced by a wrapper function and router.__sentryWrapped is added — the router is mutated. The test's assertion gives false confidence that no wrapping occurs when prefetch is absent.
⏱ 25m 9s · 2.1M in / 194.5k out · $5.53