Stop the module walk at the drive root on Windows (infinite loop) - #12
Conversation
The node_modules and imports walks terminated only when reaching
ctx.root (default "/"), which a drive-rooted windows path never
equals — dirname("D:/") returns "D:/" itself. Any resolution that
failed to resolve (missing package, unsatisfiable exports under
silent) therefore looped forever on windows. The walk now also stops
when a directory is its own parent, i.e. the file system root.
🦋 Changeset detectedLatest commit: cf39f9a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 35 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12 +/- ##
==========================================
+ Coverage 96.95% 97.01% +0.06%
==========================================
Files 1 1
Lines 394 402 +8
Branches 83 87 +4
==========================================
+ Hits 382 390 +8
Misses 11 11
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
The
node_modulesandimportswalks terminated only ondir !== ctx.root, withrootdefaulting to"/"— which a drive-rooted Windows path never equals, sincedirname("D:/")returns"D:/"itself. Any resolution that failed to resolve (missing package, or unsatisfiable exports undersilent) therefore looped forever on Windows. Both walks now also stop when a directory is its own parent, i.e. the file system root.Reproduced before the fix with
resolveSync("missing-pkg", { from: "C:\\project\\src\\index.js", silent: true, ... })— hard hang, killed by timeout; after the fix it returnsundefined. New tests cover the missing-module throw, thesilentvariant, and#importwalks from Windows paths without therootoption — the existing Windows tests all passedroot: "C:\\", which is why the loop was never hit in CI.Motivation and Context
This is what's hanging the Windows CI job in marko-js/vite (https://github.com/marko-js/vite/actions/runs/29170390485/job/86590525203) since
@marko/viteswitched its CJS detection to resolve-sync:isCJSModuleprobes bare ids withsilent: trueon every.jsresolve, and the first unresolvable id on a Windows runner spins forever.Checklist:
🤖 Generated with Claude Code
https://claude.ai/code/session_01KZUGLZL3YoBToFLSEv2Nys
Generated by Claude Code