diff --git a/scripts/__tests__/provision-worktree-self-heal.test.mjs b/scripts/__tests__/provision-worktree-self-heal.test.mjs index bbe44698d1..c74c480b49 100644 --- a/scripts/__tests__/provision-worktree-self-heal.test.mjs +++ b/scripts/__tests__/provision-worktree-self-heal.test.mjs @@ -492,3 +492,35 @@ test("runtime provisioning does not trust a truncated verified manifest", () => 1, ); }); + +/** + * pnpm 9.15.4 calls the deprecated url.parse() once per `pnpm install` + * (see toNerfDart in the pnpm bundle), which Node 24 reports as DEP0169. + * Each `pnpm install` call site must silence that one warning code, and must + * append the flag to any NODE_OPTIONS value the environment already set + * instead of overwriting it. + */ +test("every pnpm install call site silences DEP0169 without overwriting NODE_OPTIONS", () => { + const disableWarningFlag = "--disable-warning=DEP0169"; + const appendsToExistingNodeOptions = /NODE_OPTIONS="\$\{NODE_OPTIONS:-\} --disable-warning=DEP0169"/; + + const provisionSource = fs.readFileSync(script, "utf8"); + const repairCallSites = provisionSource.match(/env -u NODE_ENV CI=true NODE_OPTIONS="\$repair_node_options" "\$\{repair_cmd\[@\]\}"/g) ?? []; + assert.equal(repairCallSites.length, 2, "expected the repair pnpm install to carry the flag at both call sites (locked and unlocked)"); + assert.match(provisionSource, /local repair_node_options="\$\{NODE_OPTIONS:-\} --disable-warning=DEP0169"/); + assert.match(provisionSource, appendsToExistingNodeOptions); + assert.match(provisionSource, /NODE_OPTIONS="\$\{NODE_OPTIONS:-\} --disable-warning=DEP0169" pnpm install --prod=false "\$@"/); + + const runtimeSource = fs.readFileSync(runtimeScript, "utf8"); + const runtimeRepairCallSites = runtimeSource.match(/env -u NODE_ENV CI=true NODE_OPTIONS="\$repair_node_options" "\$\{repair_cmd\[@\]\}"/g) ?? []; + assert.equal(runtimeRepairCallSites.length, 2, "expected the repair pnpm install to carry the flag at both call sites (locked and unlocked)"); + assert.match(runtimeSource, /local repair_node_options="\$\{NODE_OPTIONS:-\} --disable-warning=DEP0169"/); + + // No other warning code is suppressed anywhere in either script. + for (const source of [provisionSource, runtimeSource]) { + const disableWarningMatches = source.match(/--disable-warning=[^\s"]+/g) ?? []; + for (const match of disableWarningMatches) { + assert.equal(match, disableWarningFlag); + } + } +}); diff --git a/scripts/provision-worktree-runtime.sh b/scripts/provision-worktree-runtime.sh index a6d925918a..9303645481 100755 --- a/scripts/provision-worktree-runtime.sh +++ b/scripts/provision-worktree-runtime.sh @@ -106,6 +106,10 @@ repair_base_workspace_install() { [[ -f "$base_cwd/package.json" && -f "$base_cwd/pnpm-lock.yaml" ]] || return 1 echo "Base workspace CLI at $base_cli_entry_path failed its health check (typically dangling pnpm symlinks after a partial install); repairing with pnpm install in $base_cwd." >&2 local repair_cmd=(pnpm install --prod=false --force --frozen-lockfile --config.confirmModulesPurge=false) + # pnpm 9.15.4 calls the deprecated url.parse() in toNerfDart on every + # install. Node 24 reports that call as DEP0169. Remove this flag when the + # pinned pnpm no longer calls url.parse() in that path. + local repair_node_options="${NODE_OPTIONS:-} --disable-warning=DEP0169" local repair_lock_dir="" if command -v git >/dev/null 2>&1; then repair_lock_dir="$(git -C "$base_cwd" rev-parse --absolute-git-dir 2>/dev/null || true)" @@ -122,11 +126,11 @@ repair_base_workspace_install() { echo "Base workspace CLI became healthy while waiting for the repair lock; skipping reinstall." >&2 exit 0 fi - env -u NODE_ENV CI=true "${repair_cmd[@]}" >&2 || exit 1 + env -u NODE_ENV CI=true NODE_OPTIONS="$repair_node_options" "${repair_cmd[@]}" >&2 || exit 1 base_cli_healthy ) else - (cd "$base_cwd" && env -u NODE_ENV CI=true "${repair_cmd[@]}" >&2 && base_cli_healthy) + (cd "$base_cwd" && env -u NODE_ENV CI=true NODE_OPTIONS="$repair_node_options" "${repair_cmd[@]}" >&2 && base_cli_healthy) fi } diff --git a/scripts/provision-worktree.sh b/scripts/provision-worktree.sh index d25f6a6672..1f41b03082 100644 --- a/scripts/provision-worktree.sh +++ b/scripts/provision-worktree.sh @@ -91,6 +91,10 @@ repair_base_workspace_install() { # otherwise skip the dangling symlinks; --frozen-lockfile keeps the repair # from mutating the shared base workspace's lockfile. local repair_cmd=(pnpm install --prod=false --force --frozen-lockfile --config.confirmModulesPurge=false) + # pnpm 9.15.4 calls the deprecated url.parse() in toNerfDart on every + # install. Node 24 reports that call as DEP0169. Remove this flag when the + # pinned pnpm no longer calls url.parse() in that path. + local repair_node_options="${NODE_OPTIONS:-} --disable-warning=DEP0169" # Resolve the real git dir so locking also covers base workspaces that are # linked worktrees, where "$base_cwd/.git" is a file rather than a directory. local repair_lock_dir="" @@ -113,11 +117,11 @@ repair_base_workspace_install() { echo "Base workspace CLI became healthy while waiting for the repair lock; skipping reinstall." >&2 exit 0 fi - env -u NODE_ENV CI=true "${repair_cmd[@]}" >&2 || exit 1 + env -u NODE_ENV CI=true NODE_OPTIONS="$repair_node_options" "${repair_cmd[@]}" >&2 || exit 1 base_cli_healthy ) else - (cd "$base_cwd" && env -u NODE_ENV CI=true "${repair_cmd[@]}" >&2 && base_cli_healthy) + (cd "$base_cwd" && env -u NODE_ENV CI=true NODE_OPTIONS="$repair_node_options" "${repair_cmd[@]}" >&2 && base_cli_healthy) fi } @@ -770,7 +774,10 @@ if [[ -f "$worktree_cwd/package.json" && -f "$worktree_cwd/pnpm-lock.yaml" ]]; t if ( cd "$worktree_cwd" - pnpm install --prod=false "$@" + # pnpm 9.15.4 calls the deprecated url.parse() in toNerfDart on every + # install. Node 24 reports that call as DEP0169. Remove this flag + # when the pinned pnpm no longer calls url.parse() in that path. + NODE_OPTIONS="${NODE_OPTIONS:-} --disable-warning=DEP0169" pnpm install --prod=false "$@" ) >"$stdout_path" 2>"$stderr_path"; then cat "$stdout_path" cat "$stderr_path" >&2