fix(error-tracking): search debug IDs progressively - #489
Open
jhssilva wants to merge 1 commit into
Open
Conversation
jhssilva
marked this pull request as ready for review
August 14, 2026 13:56
jhssilva
requested review from
buranmert and
ksun154
and removed request for
a team
August 14, 2026 13:56
There was a problem hiding this comment.
Pull request overview
This PR updates the Error Tracking sourcemap pipeline to extract injected ddDebugId values by scanning built JavaScript artifacts progressively (in fixed-size chunks with overlap) instead of only inspecting the initial prefix, improving reliability across bundlers/transforms that may move the injected snippet later in the file.
Changes:
- Replaces prefix-only reads with a progressive 1 KiB chunk scan that stops early on match and retains a small overlap for boundary-split literals.
- Exposes the chunk size constant and adds unit tests covering early stop, later-in-file IDs, split-across-chunks IDs, scan-to-EOF, and unreadable files.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/plugins/error-tracking/src/sourcemaps/debugId.ts |
Implements progressive chunked scanning with overlap to find ddDebugId without reading entire bundles in the common case. |
packages/plugins/error-tracking/src/sourcemaps/debugId.test.ts |
Adds coverage for the progressive read behavior and related edge cases. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+41
to
+53
| test('Should stop reading after finding the debug ID in the first chunk', async () => { | ||
| const literal = `ddDebugId:"${debugId}"`; | ||
| const read = jest.fn(async (buffer: Buffer) => { | ||
| buffer.write(literal); | ||
| return { bytesRead: literal.length, buffer }; | ||
| }); | ||
| const close = jest.fn(async () => undefined); | ||
| jest.spyOn(fsp, 'open').mockResolvedValue({ read, close } as never); | ||
|
|
||
| await expect(extractDebugId('first-chunk.min.js')).resolves.toBe(debugId); | ||
| expect(read).toHaveBeenCalledTimes(1); | ||
| expect(close).toHaveBeenCalledTimes(1); | ||
| }); |
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 free
to 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?
Searches built JavaScript artifacts progressively for their injected
ddDebugIdinstead of stopping after the first 1 KiB.This is intentionally separate from the bundler-specific fixes:
Tracking issue: RUM-18038
Validation
Exact PR package matrix:
The Rollup result uses PR #489 without PR #488, confirming progressive discovery finds the entry debug ID beyond the initial 1 KiB.
The locally stacked PR #487 + PR #489 esbuild package extracted 7/7 debug IDs and observed both runtime-loaded IDs, confirming compatibility once artifact readiness is present.
All five exact PR packages also passed static production builds, deterministic rebuild checks, and browser entry/lazy registration. Staging RUM search returned zero indexed events for all generated targets during the retry window, despite successful browser intake, so this run could not revalidate downstream deobfuscation.