Skip to content

feat(tracing): Correlate deep links with the navigation they trigger#6264

Merged
alwx merged 5 commits into
mainfrom
alwx/features/deep-linking
Jun 11, 2026
Merged

feat(tracing): Correlate deep links with the navigation they trigger#6264
alwx merged 5 commits into
mainfrom
alwx/features/deep-linking

fix(tracing): Reject warm-open links that arrived before the dispatch

2758a72
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: code-review completed Jun 10, 2026 in 12m 41s

2 issues

code-review: Found 2 issues (2 low)

Low

`client.on('close')` clears the module-level deep-link listener, breaking tracking after Sentry re-init - `packages/core/src/js/tracing/reactnavigation.ts:350-353`

When the old client closes after a Sentry.init() re-initialization, the registered 'close' handler calls setPendingDeepLinkListener(undefined), wiping the new client's listener — silently disabling cold-start late-arrival attribution for any subsequent navigation. The deeplinkIntegration explicitly guards against this pattern (subscription?.remove() before re-subscribing), but the navigation integration does not.

Deep-link tests clear shared module state only in a trailing statement, risking cascade failures - `packages/core/test/tracing/reactnavigation.test.ts:313`

The new deep-link hand-off tests in reactnavigation.test.ts reset the module-level state in pendingDeepLink.ts (pending, listener, seqCounter) by calling clearPendingDeepLink() as the final statement of each test rather than in beforeEach/afterEach. The beforeEach hook (around line 121) clears Jest mocks and Sentry scopes but does not reset the pending deep-link module. In the normal success path this is harmless because consumePendingDeepLink always nulls pending on consumption, so each test self-cleans before its assertions. However, if an expect(...) throws before consumption completes, the trailing clearPendingDeepLink() is skipped (only the 'drops stale' test uses try/finally). A leaked, still-fresh pending value can then bleed into a later test — notably 'does not attach when no deep link is pending', which relies on the slot being empty — turning one genuine failure into confusing downstream failures. Consider moving clearPendingDeepLink() into beforeEach (alongside the existing scope clears) so cleanup is guaranteed regardless of test outcome. This is a test-hygiene improvement, not a production defect.


⏱ 11m 37s · 2.3M in / 85.4k out · $3.18