Uh oh!
There was an error while loading. Please reload this page.
fix(injection): keep Rollup debug IDs in upload prefix - #488
Open
jhssilva wants to merge 2 commits into
Open
Conversation
jhssilva
commented
Aug 14, 2026
ContributorAuthor
@codex review |
To use Codex here, create a Codex account and connect to github. |
jhssilvaforce-pushed
the
hugo.silva/rum-18038-rollup-debug-id
branch
from
August 14, 2026 13:35
817cc2d to
83a82fbCompareamortemousque
approved these changes
Aug 18, 2026
jhssilvaforce-pushed
the
hugo.silva/rum-18038-rollup-debug-id
branch
from
August 20, 2026 16:53
83a82fb to
53b65e8Compare…8-rollup-debug-id # Conflicts: # packages/plugins/error-tracking/src/sourcemaps/debugId.test.ts
buranmert
approved these changes
Aug 21, 2026
buranmert
left a comment
There was a problem hiding this comment.
disclaimer: i'm an outsider to rollup plugin. i approve as i don't see any obvious bug in this PR 👍
There was a problem hiding this comment.
Pull request overview
Friend, this PR addresses Rollup sourcemap uploads missing the entry bundle’s debug ID by ensuring the injected ddDebugId stays within a bounded prefix read (and survives later Rollup transforms).
Changes:
- Run the Rollup injection plugin’s
renderChunkhook withorder: 'post'so injections happen after normal transforms (e.g., Terser). - Serialize
ddDebugIdfirst in the RUM source-code-context snippet to keep it early in the emitted bundle. - Add/extend unit tests to assert debug ID ordering in the snippet and to cover the Rollup “late transform padding” scenario.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/plugins/rum/src/index.test.ts | Adds an ordering test for ddDebugId vs. other source code context metadata. |
| packages/plugins/rum/src/getSourceCodeContextSnippet.ts | Computes debugId up front and ensures ddDebugId is serialized first in the context object. |
| packages/plugins/injection/src/rollup.ts | Switches renderChunk to an ordered hook (order: 'post') so injection runs after other chunk transforms. |
| packages/plugins/error-tracking/src/sourcemaps/debugId.test.ts | Adds a Rollup-based regression test ensuring debug IDs remain within the bounded search prefix after later transforms. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+66
to
+70
| const code = value(); | ||
| expect(code.indexOf('"ddDebugId"')).toBeLessThan(code.indexOf('"service"')); | ||
| expect(code.indexOf('"ddDebugId"')).toBeLessThan(code.indexOf('"version"')); | ||
| }); |
Comment on lines
+141
to
+142
| const content = await readFile(outputPath); | ||
| expect(content.indexOf('ddDebugId')).toBeLessThan(DEBUG_ID_SEARCH_CHUNK_BYTES); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Fixes Rollup sourcemap uploads that can miss the entry bundle's debug ID when a later transform pushes the complete
ddDebugIdvalue outside Error Tracking's initial read.renderChunkinjection withorder: 'post', after normal transforms such as Terser.ddDebugIdfirst in the injected source-code context.Progressive debug-ID discovery is intentionally handled separately by the follow-up PR linked below, because it changes shared Error Tracking behavior for every bundler.
Related fixes:
Tracking issue: RUM-18038
Validation