Copy real files when patching the bundled Undici proxy tree - #276
Open
francescovidaich964 wants to merge 1 commit into
Open
Copy real files when patching the bundled Undici proxy tree#276francescovidaich964 wants to merge 1 commit into
francescovidaich964 wants to merge 1 commit into
Conversation
On Windows, every `feynman` invocation failed with `EPERM: operation not permitted, symlink` once an optional package was installed, including `feynman --version`. Recovery required removing the package, enabling Developer Mode, or running an elevated shell. `safePackagePath` resolves to `node_modules/undici`, which the bundled workspace exposes through a link created by `linkBundledPackage`. Because `cpSync` defaults to `dereference: false`, it recreated that link at the temporary path, and creating a symlink on Windows requires `SeCreateSymbolicLinkPrivilege`, which a standard non-elevated process does not hold unless Developer Mode is enabled. Pass `dereference: true` so the real files are copied instead. This follows existing precedent in the repo: `scripts/verify-stale-pi-upgrade.mjs` already passes `dereference: true`, and `linkBundledPackage` already prefers junctions on win32 because they require no privilege. Add a regression test whose fixture reaches undici through a link. It asserts the patched tree is not a symlink, so it fails before this change on every platform rather than only on Windows. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
@francescovidaich964 is attempting to deploy a commit to the Advait Paliwal's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
Fixes #275. On Windows,
cpSyncatscripts/lib/pi-undici-proxy-patch.mjs:173recreates theundicisymlink (created bylinkBundledPackage) instead of copying real files, because it defaults todereference: false. Creating adirsymlink requiresSeCreateSymbolicLinkPrivilege, which a non-elevated user does not hold — so every command fails withEPERMonce any optional package is installed.This change passes
dereference: true, matching the precedent already in the repo atscripts/verify-stale-pi-upgrade.mjs:460.Changes
scripts/lib/pi-undici-proxy-patch.mjs— adddereference: trueto thecpSynccall, with an explanatory comment.tests/pi-undici-proxy-patch.test.ts— regression test asserting the patched undici tree contains real files (not a symlink).Test coverage note
The regression test asserts
isSymbolicLink() === false, which fails on Linux too (the unfixed code recreates the symlink there as well), so the existing ubuntu CI run catches regressions — no Windows-only test needed.Verification
npm run typecheck— passnpm run build— passmain; the failing set on this branch is identical (2 additional failures were confirmed flaky)CI status
npm testworkflow has not run on this PR yet: fork workflow runs await maintainer approval. Once approved, the ubuntu run is the one that exercises the new regression test.Notes
This PR was prepared with AI assistance; the contributor verified the diff against the current source before opening.