fix(windows): tolerate unreachable UNC permission paths#586
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR improves Windows external path resolution by classifying Bun-on-Windows ChangesWindows UNC lstat error handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues
Possibly related PRs
Suggested labels
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)
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 |
There was a problem hiding this comment.
Code Review
This pull request introduces a fix for handling unreachable UNC components on Windows, specifically addressing cases where Bun reports an EUNKNOWN error during path resolution. It adds a helper function isMissingPermissionPath to identify these scenarios and includes a new test case to verify the behavior. Feedback suggests expanding the error check to include the realpath syscall and ensuring path normalization for canonicalization.
Summary
Tolerate unreachable Windows UNC components while resolving external-directory permission metadata.
Why
PR #582 tightened Windows UNC normalization so UNC inputs now reach the permission resolver more consistently. That exposed a pre-existing gap in
resolveWindowsForPermission(): Bun on Windows can report an unreachable UNC intermediate component asEUNKNOWNfromlstat, while the resolver only treatedENOENTandENOTDIRas missing-path fallback cases.For permission metadata, an unreachable UNC component should behave like a not-yet-existing path under the UNC share. The resolver should still produce canonical permission metadata instead of throwing before the permission request can be built. This is a follow-up for the gap exposed by PR #582, not a broad revert of the Windows path canonicalization work.
Related Issue
Refs PR #582. This does not close issue #497; it is a follow-up fix for the Windows advisory regression exposed after #582 merged.
Human Review Status
Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.
Review Focus
resolveWindowsForPermission()now treats only UNClstatEUNKNOWNerrors as missing-path fallbacks.ENOENT/ENOTDIRbehavior is unchanged.EUNKNOWNpath without requiring a live unreachable UNC host on macOS.Risk Notes
Windows-only path/permission behavior. The change is intentionally narrow: only
lstatEUNKNOWNon UNC candidates is folded into the existing missing-path fallback. macOS/Linux behavior is not touched. The Windows advisory workflow must be green before merge.How To Verify
Screenshots or Recordings
None. No visible UI changes.
Checklist
dev, and my PR title and commit messages use Conventional Commits in EnglishSummary by CodeRabbit
Bug Fixes
Tests