Skip to content

Improve source map symbolication#1392

Closed
dannyhw wants to merge 2 commits into
mainfrom
dannyhw/source-map-symbolication-fixes
Closed

Improve source map symbolication#1392
dannyhw wants to merge 2 commits into
mainfrom
dannyhw/source-map-symbolication-fixes

Conversation

@dannyhw

@dannyhw dannyhw commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

WIP based on patches received for resolving errors to editor paths etc, still needs extensive testing

Summary

  • improve /open-stack-frame handling by resolving macOS editor commands earlier and mapping feature-app source paths when possible
  • make symbolication tolerant of bundle and hot-update frames, skip known React runtime frames, and use source map contents for code frames when available
  • allow the Rspack dev server to fetch remote source maps from bundle URLs or Module Federation remote config when the local compiler cannot provide one

Validation

  • node_modules/.bin/biome check --write packages/dev-server/src/plugins/devtools/devtoolsPlugin.ts packages/dev-server/src/plugins/symbolicate/Symbolicator.ts packages/dev-server/src/plugins/symbolicate/sybmolicatePlugin.ts packages/repack/src/commands/rspack/start.ts
  • packages/dev-server/node_modules/.bin/tsc --noEmit -p packages/dev-server/tsconfig.json
  • packages/repack/node_modules/.bin/tsc --noEmit -p packages/repack/tsconfig.json
  • git diff --check

Note: the local pre-commit hook attempted to run pnpm through the bundled runtime and stopped before checks with a non-interactive modules purge prompt, so the commit was created after running the relevant checks directly.

@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
repack-website Ready Ready Preview, Comment Jul 2, 2026 12:01pm

Request Review

@changeset-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 799d911

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment thread packages/dev-server/src/plugins/devtools/devtoolsPlugin.ts Fixed
Comment thread packages/repack/src/commands/rspack/start.ts Fixed
Comment thread packages/dev-server/src/plugins/devtools/devtoolsPlugin.ts Fixed

@dannyhw dannyhw left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

codex review: Posting the main review findings inline. I also did not find targeted tests for the changed symbolicator, open-stack-frame, or Rspack remote source-map fallback behavior, so the current passing checks do not exercise the highest-risk paths.

private getSourceContent(frame: StackFrame): string | undefined {
for (const consumer of Object.values(this.sourceMapConsumerCache)) {
try {
const source = consumer.sourceContentFor(frame.file, true);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

codex review: getSourceContent searches every cached source map and returns the first map with frame.file, but processFrame has already discarded which generated bundle/source map produced that frame. In multi-bundle or federated stacks, duplicate logical names like [projectRoot]/src/App.tsx are plausible, so this can render a code frame from the wrong host/remote. Please carry the source-map key/consumer through processFrame and query that exact consumer for sourcesContent.

fileUrl: frame.file,
error: (error as Error).message,
});
processedFrames.push({

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

codex review: This failed-symbolication fallback keeps the raw bundle frame visible with collapse: false. getCodeFrame later tries this raw URL first and returns after the first getSource failure, so one missing map can still suppress a later frame that did symbolicate correctly. Either collapse or skip failed raw frames for code-frame selection, or make getCodeFrame continue to the next frame after a source read miss.

const filename = url.split(/[?#]/)[0].split('/').pop() ?? '';

return (
filename.match(/\.([^.]+)\.chunk\.bundle(?:\.map)?$/)?.[1] ??

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

codex review: This regex does not match Re.Pack's standard [name].chunk.bundle filenames such as remote.chunk.bundle because it requires a dot before the captured name. The container regex also misses the MF v1 default <name>.container.bundle. When direct URL fetch is unavailable, remoteName becomes undefined and the fallback probes all remotes, which can pick a source map from the wrong remote. Please handle the default filename shapes before falling back to all remotes.

}
}

private shouldSkipSourceMap(frame: InputStackFrame): boolean {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

codex review: This skips purely by generated methodName before resolving the source. A user/app frame named beginWork, dispatchSetState, etc. would be collapsed and never symbolicated. The skip should be tied to source/package context, or applied only after the frame is known to come from React internals.

@dannyhw

dannyhw commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

I want to revisit this, I'm not confident we're solving the right thing

@dannyhw dannyhw closed this Jul 6, 2026
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.

2 participants