Skip to content

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

Merged
chargome merged 9 commits into
developfrom
cg/rr-sourcemaps-e2e-debugid-assert
Aug 4, 2026
Merged

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

Conversation

@chargome

@chargomechargome 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

chargomeand 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-actionsBot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser29.91 kB--
@sentry/browser - with treeshaking flags28.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 flags76.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/react31.73 kB--
@sentry/react (incl. Tracing)49.61 kB--
@sentry/vue34.98 kB--
@sentry/vue (incl. Tracing)49.34 kB--
@sentry/svelte29.94 kB--
CDN Bundle32.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 - uncompressed95.52 kB--
CDN Bundle (incl. Tracing) - uncompressed143.1 kB--
CDN Bundle (incl. Logs, Metrics) - uncompressed100.23 kB--
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed147.08 kB--
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed224.99 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed262.36 kB--
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed266.33 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed276.07 kB--
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed280.02 kB--
@sentry/nextjs (client)52.21 kB--
@sentry/sveltekit (client)47.81 kB--
@sentry/core/server80.01 kB--
@sentry/core/browser51.97 kB--
@sentry/node120.89 kB--
@sentry/node/import (ESM hook with diagnostics-channel injection)0 Baddedadded
@sentry/node - without tracing84.26 kB--
@sentry/aws-serverless92.94 kB--
@sentry/cloudflare (withSentry) - minified219.37 kB--
@sentry/cloudflare (withSentry)540.47 kB--

View base workflow run

chargomeand 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>
@chargomechargome self-assigned this Aug 3, 2026
@chargome

Copy link
Copy Markdown
MemberAuthor

bugbot run

@cursorcursorBot 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
Base automatically changed from cg/fix-rr-sourcemaps to developAugust 3, 2026 15:05
@chargome
chargome requested a review from a team as a code ownerAugust 3, 2026 15:05
@chargome
chargome requested review from s1gr1d and removed request for a teamAugust 3, 2026 15:05
chargomeand 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>
Comment on lines 19 to 23

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

l: I would just remove the comment, it's clear what this does from the function name imo

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This pr was targeting another branch that got merged, the diff here is misleading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lol

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

m: the title is test(react-router) and the description also only talks about the e2e app, are these changes included in this pr on purpose? if yes we should probably update the title/description

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

q: did we land on removing these in the major?

@chargome
chargome merged commit 071b0a7 into developAug 4, 2026
42 checks passed
@chargome
chargome deleted the cg/rr-sourcemaps-e2e-debugid-assert branch August 4, 2026 09:45
Sign up for freeto 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.

2 participants

@chargome@nicohrubec