Skip to content

test(react-router): Add e2e assertions for debug ID injection and source map upload - #22956

Open
chargome wants to merge 8 commits into
developfrom
cg/rr-sourcemaps-e2e-debugid-assert
Open

test(react-router): Add e2e assertions for debug ID injection and source map upload#22956
chargome wants to merge 8 commits into
developfrom
cg/rr-sourcemaps-e2e-debugid-assert

Conversation

@chargome

@chargome chargome commented Aug 3, 2026

Copy link
Copy Markdown
Member

This adds a build-time assertion app modelled on nextjs-sourcemaps, for react router. It asserts three things about the real build output:

  • exactly one debug ID per client chunk
  • source maps with non-empty mappings present in the uploaded artifact bundles
  • every shipped debug ID backed by an upload.

ref #22945

chargome and others added 4 commits August 3, 2026 13:10
…ugin

The bundler plugin deletes these files in a `finally` block in `writeBundle` that
runs regardless of `sourcemaps.disable`, so forwarding the option removed the maps
before `sentryOnBuildEnd` could inject debug IDs and upload them - the same end
symptom as the double-injection bug, reached from the other side.

Deletion still happens in `sentryOnBuildEnd`, driven by the same user option.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…rce map upload

The existing react-router e2e suites build real apps but never check how many debug
IDs each chunk carries, so they passed throughout both the double-injection bug in
#22929 and the premature source map deletion found while fixing it.

This app builds against a mock Sentry server and asserts on the build output: exactly
one debug ID per client chunk, source maps with real mappings present in the uploaded
artifact bundles, and every shipped debug ID backed by an upload. It deliberately routes
`sourcemaps` through `unstable_sentryVitePluginOptions`, the config shape that
triggered the original report.

Verified to fail on both bugs - two debug IDs per chunk for the first, no uploaded
chunks to cross-check for the second.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.91 kB - -
@sentry/browser - with treeshaking flags 28.12 kB - -
@sentry/browser (incl. Tracing) 47.36 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.36 kB - -
@sentry/browser (incl. Tracing, Profiling) 52.13 kB - -
@sentry/browser (incl. Tracing, Replay) 86.7 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.13 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 91.41 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 104.05 kB - -
@sentry/browser (incl. Feedback) 47.22 kB - -
@sentry/browser (incl. sendFeedback) 34.76 kB - -
@sentry/browser (incl. FeedbackAsync) 39.87 kB - -
@sentry/browser (incl. Metrics) 30.99 kB - -
@sentry/browser (incl. Logs) 31.22 kB - -
@sentry/browser (incl. Metrics & Logs) 31.9 kB - -
@sentry/react 31.73 kB - -
@sentry/react (incl. Tracing) 49.61 kB - -
@sentry/vue 34.98 kB - -
@sentry/vue (incl. Tracing) 49.34 kB - -
@sentry/svelte 29.94 kB - -
CDN Bundle 32.01 kB - -
CDN Bundle (incl. Tracing) 47.72 kB - -
CDN Bundle (incl. Logs, Metrics) 33.55 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.08 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 72.9 kB - -
CDN Bundle (incl. Tracing, Replay) 85.35 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.65 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.14 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.46 kB - -
CDN Bundle - uncompressed 95.52 kB - -
CDN Bundle (incl. Tracing) - uncompressed 143.1 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.23 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 147.08 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 224.99 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 262.36 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 266.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 276.07 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 280.02 kB - -
@sentry/nextjs (client) 52.21 kB - -
@sentry/sveltekit (client) 47.81 kB - -
@sentry/core/server 80.01 kB - -
@sentry/core/browser 51.97 kB - -
@sentry/node 120.89 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 84.26 kB - -
@sentry/aws-serverless 92.94 kB +0.01% +1 B 🔺
@sentry/cloudflare (withSentry) - minified 219.37 kB - -
@sentry/cloudflare (withSentry) 540.47 kB - -

View base workflow run

chargome and others added 2 commits August 3, 2026 14:53
The shared E2E job runs its "Install Playwright" step for every test application, so a
build-time-only app still needs the dependency present or the job exits 127 before
reaching the assertions. Matches what nextjs-sourcemaps does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… ts-node

The app is ESM (`type: module`, required by react-router), so `ts-node` needs `--esm`
and still fails with ERR_UNKNOWN_FILE_EXTENSION on CI. nextjs-sourcemaps gets away with
plain `ts-node` only because it is CommonJS.

tsx handles ESM TypeScript natively and is already the standard for running .ts scripts
elsewhere in dev-packages/e2e-tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chargome chargome self-assigned this Aug 3, 2026
@chargome

chargome commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 899454b. Configure here.

@chargome
chargome marked this pull request as ready for review August 3, 2026 14:15
@chargome
chargome requested review from Lms24 and nicohrubec August 3, 2026 14:15
Base automatically changed from cg/fix-rr-sourcemaps to develop August 3, 2026 15:05
@chargome
chargome requested a review from a team as a code owner August 3, 2026 15:05
@chargome
chargome requested review from s1gr1d and removed request for a team August 3, 2026 15:05
chargome and others added 2 commits August 3, 2026 17:45
…t one

`ids.length <= 1` also passed for chunks with zero debug IDs, and those chunks were then
skipped by the `ids.length > 0` guard so nothing downstream checked them. A regression
where injection silently missed some client chunks would have gone undetected, even though
unresolvable frames are the same user-visible outcome as injecting twice.

Verified both directions against a real build: stripping a chunk's snippet now fails with
"found 0", adding a second one fails with "found 2".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GHSA-qwww-vcr4-c8h2 (high, CSRF bypass in RSC mode) covers react-router >= 7.12.0 < 8.3.0
with no patched 7.x release, so dependency-review rejected the new app's manifest. Existing
apps still pin ^7.13.0 but are not re-checked, since dependency-review only inspects the diff.

Nothing in these assertions is version-specific - they check debug ID injection and upload,
which work the same on 8.x - so the app moves to 8.3.0 and drops the version from its name.
Verified on 8.3.0: all 6 chunks carry exactly one debug ID, and reintroducing the trailing
spread still fails the assertion with "found 2".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant