fix: sandbox npm package store for devservers - #2988
Open
imanmalekian31 wants to merge 1 commit into
Open
imanmalekian31 wants to merge 1 commit into
imanmalekian31 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: faf2f6c5c0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
imanmalekian31
force-pushed
the
fix/js-run-devserver-sandbox-package-store
branch
from
August 25, 2026 13:10
faf2f6c to
cec17ae
Compare
jbedard
reviewed
Aug 25, 2026
jbedard
reviewed
Aug 25, 2026
jbedard
reviewed
Aug 25, 2026
jbedard
reviewed
Aug 25, 2026
jbedard
reviewed
Aug 25, 2026
jbedard
reviewed
Aug 25, 2026
imanmalekian31
force-pushed
the
fix/js-run-devserver-sandbox-package-store
branch
from
August 26, 2026 07:40
cec17ae to
d568a60
Compare
Add an opt-in package store mode that materializes npm packages inside the js_run_devserver sandbox. Rewrite and dereference node_modules symlinks as needed so realpath-sensitive bundlers such as Turbopack stay within the project root.
imanmalekian31
force-pushed
the
fix/js-run-devserver-sandbox-package-store
branch
from
September 1, 2026 04:38
d568a60 to
f9e280d
Compare
acozzette
approved these changes
Sep 1, 2026
Contributor
Author
|
Could you review my PR? @jbedard |
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.
Add an opt-in
package_store_mode = "sandbox"mode tojs_run_devserver.By default, npm package symlinks in the custom devserver sandbox point back to the Bazel execroot. Bundlers that canonicalize paths using native
realpath()and enforce a project-root boundary, such as Next.js with Turbopack, reject packages resolved outside the sandbox.The new mode materializes the npm package store inside the sandbox and rewrites or dereferences
node_modulessymlinks so their real paths remain within the sandbox root.Files are copied with
COPYFILE_FICLONE, which uses a copy-on-write filesystem clone when supported and falls back to a regular copy. Both strategies keep devserver writes isolated from Bazel outputs. The sandbox parent directory can be configured withJS_RUN_DEVSERVER_SANDBOX_DIR; placing it on the same filesystem as the execroot increases the chance that copy-on-write cloning is available.The existing behavior remains the default, so current users are unaffected unless they opt in.
Related: #2888
Changes are visible to end-users: yes
Suggested release notes
js_run_devservernow supportspackage_store_mode = "sandbox"for bundlers such as Turbopack that require resolved npm package paths to remain within the project root.Test plan
node_modulessymlink, including.binand package-internal links, escapes the sandbox;js_run_devserverend-to-end test to exercise incremental syncing withpackage_store_mode = "sandbox".