Skip to content

refactor: apply chdir from the node bootstrap, not the launcher - #2994

Merged
acozzette merged 6 commits into
mainfrom
chdir
Aug 28, 2026
Merged

refactor: apply chdir from the node bootstrap, not the launcher#2994
acozzette merged 6 commits into
mainfrom
chdir

Conversation

@acozzette

@acozzette acozzette commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

This is one of the more complex behaviors remaining in the bash launcher, so let's move it into the node bootstrap in preparation for adopting hermetic_launcher.

bootstrap.cjs now cds into JS_BINARY__CHDIR before deleting that variable. Deleting it prevents child processes or worker threads from attempting to cd to that same directory a second time.

This necessitated updating js_run_devserver to pass the normalized chdir value via the devserver's JSON config instead of through JS_BINARY__CHDIR.


Changes are visible to end-users: no

Test plan

  • Covered by existing test cases
  • New test cases added

This is one of the more complex behaviors remaining in the bash launcher, so
let's move it into the node bootstrap in preparation for adopting
hermetic_launcher.

bootstrap.cjs now cds into `JS_BINARY__CHDIR` before deleting that variable.
Deleting it prevents child processes or worker threads from attempting to cd to
that same directory a second time.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@acozzette
acozzette marked this pull request as ready for review August 28, 2026 04:28
@acozzette
acozzette requested a review from jbedard August 28, 2026 04:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7872f7ae71

ℹ️ 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".

Comment thread js/private/node-bootstrap/bootstrap.cjs
Comment thread js/private/js_run_devserver.bzl
Comment thread js/private/node-bootstrap/bootstrap.cjs
Comment thread js/private/node-bootstrap/bootstrap.cjs
Comment thread js/private/node-bootstrap/bootstrap.cjs Outdated
Comment thread js/private/node-bootstrap/bootstrap.cjs
Comment thread js/private/test/chdir/BUILD.bazel
Comment thread js/private/node-bootstrap/bootstrap.cjs Outdated
@acozzette
acozzette merged commit c3c809d into main Aug 28, 2026
186 checks passed
@acozzette
acozzette deleted the chdir branch August 28, 2026 22:40
acozzette added a commit that referenced this pull request Sep 3, 2026
The JS launcher was ported from a branch based on #2984, so the bash
launcher changes that landed after it were missing:

- #2995 dropped the `JS_BINARY__BINDIR` fallback in
  `resolve_execroot_bin_path`. `BAZEL_BINDIR` is already required by then,
  so the fallback only masked a misconfiguration.

- #2991 made `NODE_DISABLE_COMPILE_CACHE=1` unconditional, leaving
  `bootstrap.cjs` to re-enable the cache when `NODE_COMPILE_CACHE` is set.
  The two forms agree on every combination the tests cover, but the
  conditional is the behavior #2991 deliberately replaced.

The other two changes in that window were already reflected: #2994 moved
chdir into `bootstrap.cjs` and #2984 moved coverage report generation into
a node exit listener, and the JS launcher does neither.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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