Repository navigation
fix(installer): accept well-formed Windows PATHEXT entries such as Python .PY and .PYW - #1983
Conversation
…thon .PY and .PYW Any well-formed extension resolves in its PATHEXT place; only a verified .cmd npm shim with an .exe Node is ever accepted, so an unlisted extension found first still fails closed. Closes #1978.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe Windows command resolver now accepts any unique PATHEXT extension matching ChangesWindows PATHEXT Resolution
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change broadens support for well-formed PATHEXT entries. No actionable merge risk is established here; proceed with normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #1978
Summary
pathext (pnpm-discovery)wheneverPATHEXTcontained an extension outside a fixed list, for example Python's.PYand.PYW, even thoughcmd.exeresolves the existing pnpm fine..CPL(5ed499ade). Extending the list again would only wait for the next runtime (.RB,.PL, …), so this fixes the class instead.findWindowsCommandnow accepts any well-formed extension (^\.[a-z0-9]+$) and still resolves in the inherited PATH-then-PATHEXT order. It still rejects duplicate, empty and malformed entries.Why this keeps the guard safe
The list never decided what runs; it only decided which
PATHEXTvalues we model. What runs is still gated after resolution:.cmdnpm shim whose exact content is proven, or the bootstrap fails closed withUnknown pnpm wrapper; refusing replacement;.exe;So a
pnpm.pyfound before the genuinepnpm.cmdis resolved first and refused; it is never executed. This is the same rule the code comment already stated for.cpl.Changes
scripts/installer-windows.mjstests/installer-windows-bootstrap.test.ts.CPL); an earlierpnpm.pyfails closed and is never run; duplicates/empty/malformed still rejected; the step-name test uses a still-invalid PATHEXTTest plan
main: the two new tests fail withUnknown Windows PATHEXT semantics, the exact error from the issue.node --experimental-strip-types --test tests/installer-windows-bootstrap.test.ts→ 36 pass, 0 fail, 15 skipped (native-Windows lanes).tests/installer-probes.test.tsandtests/installer-runner.test.ts→ 89/89.tests/*.test.tslocally: the same 92 failures with and without this change, all from a worktree withoutnode_modules; CI runs the complete suite.ensureWindowsPnpminterface.Summary by CodeRabbit
PATHEXTextensions matching the supported format, including Python extensions, while rejecting empty, malformed, or duplicate entries..cmdor.exe, discovery continues to fail closed without downloading or executing it.