Retry esbuild tree removals with backoff for transient EPERM - #282
Open
francescovidaich964 wants to merge 1 commit into
Open
Retry esbuild tree removals with backoff for transient EPERM#282francescovidaich964 wants to merge 1 commit into
francescovidaich964 wants to merge 1 commit into
Conversation
replacePortableTree removals race antivirus handles on a freshly written esbuild binary on Windows. Use removeTemporaryTree, which retries EPERM and other removal codes with exponential backoff, instead of a bare rmSync without force.
|
@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 #281. On Windows,
rmSyncatscripts/lib/pi-esbuild-package-patch.mjs:485races Defender's handle on a freshly written 11.6 MBesbuild.exe, throwing intermittentEPERMduringnpm test/prepack. The repo already solved this inscripts/lib/temporary-tree-cleanup.mjs(removeTemporaryTree, which retriesEPERMand other removal codes with exponential backoff); this call site just never used it.Changes
scripts/lib/pi-esbuild-package-patch.mjs— replace the barermSync(dir, { recursive: true })withremoveTemporaryTree(dir)(addsforce: trueplus bounded retries with exponential backoff).Test note
No new call-site test: the helper is already tested in
tests/temporary-tree-cleanup.test.ts(injects a failingremoveto simulateEPERM). Asserting retry behavior at this call site would require wideningpatchPiEsbuildPackageTree's API purely for testability — happy to add that plumbing if preferred.Verification
npm run typecheck— passtests/pi-esbuild-package-patch.test.ts) passes in full for the covered behavior; the full file on Windows has 5 failures, all pre-existing non-elevated symlinkEPERMat fixture setup (identical on cleanmain)main; this change adds noneCI status
npm testworkflow has not run on this PR yet: fork workflow runs await maintainer approval.Notes
This PR was prepared with AI assistance; the contributor verified the diff against the current source before opening.