Repository navigation
fix: drop patchPnpmEnv so standalone+self-update works on Windows - #258
Conversation
`patchPnpmEnv` prepended `dest/node_modules/.bin` to PATH before
spawning `pnpm install` / `pnpm store prune`. On Windows in standalone
mode, `.bin/pnpm.cmd` is an npm-created shim that always points at the
BOOTSTRAP pnpm (currently 11.0.4) — the binary npm linked when it
installed `@pnpm/exe` into `node_modules`. The self-updated pnpm
written by `pnpm self-update` lives at `$PNPM_HOME/bin`, which is
separately added to PATH via `addPath()` in install-pnpm.
When the user requested a pnpm version different from the bootstrap
under `standalone: true` on Windows, patchPnpmEnv's `.bin` entry
shadowed the self-updated `$PNPM_HOME/bin` and the action's internal
`pnpm install` ran on the bootstrap. On a pnpm 11.0.x bootstrap this
broke any 11.1+ install flag (e.g. `--no-runtime`), reporting:
ERROR Unknown option: 'runtime'
POSIX standalone got lucky because `.bin` and `$PNPM_HOME` resolve to
the same directory there. Non-standalone never tripped on this since
the `.bin/pnpm` symlink for a regular `pnpm` package keeps working
across self-updates.
Removed `patchPnpmEnv` and the now-empty `src/utils/` module.
`spawnSync` now inherits `process.env`, whose PATH is already
correctly fronted by `$PNPM_HOME/bin` and `$PNPM_HOME` via the
`addPath` calls in install-pnpm.
Added `standalone_windows_self_update` to test.yaml as a regression
guard: standalone on Windows + target 11.1.0 + `run_install` with
`--no-runtime`. With the previous code, the install would have run
under the bootstrap (11.0.4) and errored on the unknown flag.
Originally found while building pnpm/setup (the new combined
pnpm + runtime action).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
📜 Recent review details🧰 Additional context used🧠 Learnings (1)📚 Learning: 2026-05-11T12:04:07.383ZApplied to files:
🔇 Additional comments (3)
📝 WalkthroughWalkthroughThe PR removes custom environment patching utilities and updates pnpm spawn calls across the action to rely on inherited process environment instead, addressing a PATH-shadow regression in Windows standalone scenarios. A new regression test validates the fix. ChangesEnvironment Patching Refactor
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Bumps [pnpm/action-setup](https://github.com/pnpm/action-setup) from 5.0.0 to 6.1.0. ## Release notes Sourced from pnpm/action-setup's releases. ### v6.1.0 ### What's Changed - feat: support pnpm v12 by `@zkochan` in pnpm/action-setup#288 Full Changelog: pnpm/action-setup@v6.0.10...v6.1.0 ### v6.0.10 ### What's Changed - docs(README): point users to the successor pnpm/setup action by `@BlackHole1` in pnpm/action-setup#282 - refactor: introduce restore keys for cache by `@SukkaW` in pnpm/action-setup#280 - ci: use pnpm 11 for `pr-check` by `@jamietanna` in pnpm/action-setup#284 - fix: update pnpm to v11.19.0 by `@jamietanna` in pnpm/action-setup#283 - docs: update README to include devEngines.packageManager by `@nemchik` in pnpm/action-setup#273 ### New Contributors - `@jamietanna` made their first contribution in pnpm/action-setup#284 - `@nemchik` made their first contribution in pnpm/action-setup#273 Full Changelog: pnpm/action-setup@v6...v6.0.10 ### v6.0.9 ### What's Changed - fix: update pnpm to v11.7.0 by `@zkochan` in pnpm/action-setup#267 Full Changelog: pnpm/action-setup@v6...v6.0.9 ### v6.0.8 ### What's Changed - docs(README): fix `cache_dependency_path` type by `@haines` in pnpm/action-setup#257 - fix: drop patchPnpmEnv so standalone+self-update works on Windows by `@zkochan` in pnpm/action-setup#258 - fix: update pnpm to 11.1.1 by `@mungodewar` in pnpm/action-setup#248 ### New Contributors - `@mungodewar` made their first contribution in pnpm/action-setup#248 Full Changelog: pnpm/action-setup@v6.0.7...v6.0.8 ### v6.0.7 ### What's Changed - fix: honor devEngines.packageManager.onFail=error (#252) by `@zkochan` in pnpm/action-setup#254 - fix: restore inputs from state in post by `@haines` in pnpm/action-setup#255 - fix: self-update bootstrap to packageManager-pinned version (#233) by `@zkochan` in pnpm/action-setup#256 ### New Contributors - `@haines` made their first contribution in pnpm/action-setup#255 Full Changelog: pnpm/action-setup@v6.0.6...v6.0.7 ... (truncated) ## Commits - `ea17c68` feat: support pnpm v12 (#288) - `0977fd9` docs: Update README to include devEngines.packageManager (#273) - `48261ac` fix: update pnpm to v11.19.0 (#283) - `75677f7` ci: use pnpm 11 for `pr-check` (#284) - `769ae71` refactor: introduce restore keys for cache (#280) - `6fed91f` docs(README): point users to the successor pnpm/setup action (#282) - `0ebf471` fix: update pnpm to v11.7.0 (#267) - `0e279bb` fix: update pnpm to 11.1.1 (#248) - `3e83581` fix: drop patchPnpmEnv so standalone+self-update works on Windows (#258) - `551b42e` docs(README): fix `cache_dependency_path` type (#257) - Additional commits viewable in compare view
Summary
src/utils/patchPnpmEnvprependsdest/node_modules/.bin(and.bin/bin) to PATH before spawningpnpm installandpnpm store prune. On Windows in standalone mode,node_modules/.bin/pnpm.cmdis an npm-created shim that points at the bootstrap pnpm (currently 11.0.4) — npm linked it there when it installed@pnpm/exefromnode_modules. The self-updated pnpm written bypnpm self-updatelives at$PNPM_HOME/bin, separately added to PATH viaaddPath()in install-pnpm.When the user requests a pnpm version different from the bootstrap under
standalone: trueon Windows,patchPnpmEnv's.binentry shadows the self-updated$PNPM_HOME/bin, so the action's internalpnpm installruns on the bootstrap. On a 11.0.x bootstrap this breaks any 11.1+ install flag — e.g.--no-runtime:POSIX standalone got lucky because
.binand$PNPM_HOMEresolve to the same directory there. Non-standalone never tripped on this since the.bin/pnpmsymlink for a regularpnpmpackage keeps working across self-updates.Fix
patchPnpmEnvand the now-emptysrc/utils/module.spawnSyncinpnpm-installandpnpm-store-prunenow inheritsprocess.env, whose PATH is already correctly fronted by$PNPM_HOME/binand$PNPM_HOMEviaaddPath()in install-pnpm.Regression test
Added
standalone_windows_self_updateto.github/workflows/test.yaml:runs-on: windows-lateststandalone: trueversion: 11.1.0(different from bootstrap 11.0.4)run_installwithargs: ['--no-runtime']With the previous code,
run_installwould have routed through the bootstrap and failed withUnknown option: 'runtime'. With the fix, install runs on the self-updated 11.1.0 and the flag is honored.Context
Originally found while building
pnpm/setup(the new combinedpnpm + JS runtimeaction that always runs standalone). The same bug existed in this repo but was latent because the existingstandalonetest job only runs on ubuntu, where.binand$PNPM_HOMEcollapse to the same directory.Test plan
Test ActionpassStandalone Windows self-update (PATH regression)job passespr-check / check-distpasses (committeddist/index.jsmatches source)Summary by CodeRabbit
Bug Fixes
Tests