Conversation
robhogan
added this pull request to stack #2016
October 3, 2026 22:02
robhogan
requested review from
huntie and
motiz88
and
a balanced review from Copilot
October 3, 2026 22:09
robhogan
marked this pull request as ready for review
October 3, 2026 22:10
*Recreating #1710 / [D104259454](https://www.internalfb.com/diff/D104259454) (@motiz88) for GH first without a diff attachment* The `getCodeFrame` helper in the symbolicate handler resolves stack frame file paths against `projectRoot` only. When source maps use `SourcePathsMode.ServerUrl`, the `file` field may be a server-relative URL pathname (e.g. `/src/App.js`) or a virtual-prefix path (e.g. `/[metro-watchFolders]/0/foo.js`). These resolve incorrectly against `projectRoot`. Here, we check `path.isAbsolute(file)` first (for `SourcePathsMode.Absolute` source maps), then try `filePathOfUrlDecodedPathname` (for virtual-prefix paths), and fall back to the original `path.resolve(projectRoot, file)`. Changelog: Internal Test plan: See [D104259454](https://www.internalfb.com/diff/D104259454)
There was a problem hiding this comment.
Copilot review overview
馃煛 Changes recommended
Encoded paths remain unresolved, and the regression test bypasses the production sourcePaths=url-server flow.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Updates symbolication code-frame resolution for virtual Metro source paths.
Changes:
- Resolves virtual-prefixed and relative source paths.
- Adds symbolication code-frame tests.
| File | Description |
|---|---|
packages/鈥媘etro/鈥媠rc/鈥婼erver.js |
Adds virtual-path resolution for code frames. |
packages/鈥媘etro/鈥媠rc/鈥婼erver/鈥媉_tests__/鈥婼erver-test.js |
Tests virtual and relative paths. |
馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const fileAbsolute = path.resolve(this._config.projectRoot, file ?? ''); | ||
| const fileAbsolute = | ||
| file != null | ||
| ? (this._routeMap.filePathOfUrlDecodedPathname(file) ?? |
Comment on lines
+1496
to
+1498
| jest | ||
| .spyOn(server, '_explodedSourceMapForBundleOptions') | ||
| .mockResolvedValue([ |
This branch has not been deployed
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.

Recreating #1710 / D104259454 (@motiz88) for GH first without a diff attachment
The
getCodeFramehelper in the symbolicate handler resolves stack frame file paths againstprojectRootonly. When source maps useSourcePathsMode.ServerUrl, thefilefield may be a server-relative URL pathname (e.g./src/App.js) or a virtual-prefix path (e.g./[metro-watchFolders]/0/foo.js). These resolve incorrectly againstprojectRoot.Here, we check
path.isAbsolute(file)first (forSourcePathsMode.Absolutesource maps), then tryfilePathOfUrlDecodedPathname(for virtual-prefix paths), and fall back to the originalpath.resolve(projectRoot, file).Changelog: Internal
Test plan:
See D104259454