fix: include Windows directory junctions in project browser - #2798
fix: include Windows directory junctions in project browser#2798badcuban wants to merge 2 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
ApprovabilityVerdict: Approved Straightforward bug fix that makes directory symlinks and Windows junctions visible in the project browser. Changes are self-contained with proper error handling, a safeguard for problematic system junctions, and include a test. You can customize Macroscope's approvability policy. Learn more. |
cde0dbd to
8faa7ab
Compare
Dismissing prior approval to re-evaluate 8faa7ab
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ae46c95. Configure here.
| } | ||
| if (platform === "win32" && WINDOWS_LEGACY_PROFILE_JUNCTION_NAMES.has(dirent.name)) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
Legacy junction filter too broad
Low Severity
On Windows, the isDirectoryEntry function's check for WINDOWS_LEGACY_PROFILE_JUNCTION_NAMES applies too broadly. It filters out valid directory symlinks whose names match, even when they are outside the user profile, preventing these legitimate project folders from appearing in browse results.
Reviewed by Cursor Bugbot for commit ae46c95. Configure here.
| "SendTo", | ||
| "Start Menu", | ||
| "Templates", | ||
| ]); |
There was a problem hiding this comment.
Incomplete Windows junction denylist
Medium Severity
WINDOWS_LEGACY_PROFILE_JUNCTION_NAMES omits the standard profile junctions My Music, My Pictures, and My Videos, while including the same-class entry My Documents. After symlink/junction browsing is enabled, those missing names can pass stat and show up under the user profile as noisy dead-end folders that fail when opened.
Reviewed by Cursor Bugbot for commit ae46c95. Configure here.
| yield* writeTextFile(cwd, "target/index.ts", "export {};\n"); | ||
| yield* Effect.promise(() => | ||
| fsPromises.symlink(target, link, platform === "win32" ? "junction" : "dir"), | ||
| ); |
There was a problem hiding this comment.
Symlink regression test cannot run
Medium Severity
The new browse symlink regression test calls fsPromises.symlink, but this file only imports the fs promises module as NodeFSP. Setup throws before browse runs, so the only coverage for directory symlink/junction inclusion never executes.
Reviewed by Cursor Bugbot for commit ae46c95. Configure here.


Summary
Why
On Windows, OneDrive-backed known folders like Desktop, Documents, and Pictures can appear as reparse points. Node reports those entries as symbolic links from
fs.readdir(..., { withFileTypes: true }), so the project browser filtered them out when it only accepteddirent.isDirectory().This keeps the existing browser behavior, but follows symlink/junction entries with
fs.statand includes them when they resolve to directories.Testing
bun fmtbun lint(passes with existing warnings)bun typecheckbun run test -- WorkspaceEntries~/OneDrive/returnsAttachments,Desktop,Documents,Music,Pictures, andPublicNote
Low Risk
Scoped to workspace browse listing logic with graceful stat failures; no auth or data-path changes, only richer directory detection on disk.
Overview
Project folder browsing now treats symlink and junction entries as directories when they resolve to a folder, instead of dropping anything that
readdirreports only as a symbolic link.browse()inWorkspaceEntriesuses a newisDirectoryEntryhelper: real directories pass through unchanged; symlinks are followed withfs.statand included when the target is a directory (broken or file symlinks are skipped). On win32, a fixed set of legacy user-profile junction names is excluded so home-directory listings stay usable.Directory checks run async with concurrency 16 per listing. A regression test asserts symlinked directories appear when browsing a temp folder.
Reviewed by Cursor Bugbot for commit ae46c95. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Include Windows directory junctions in project browser
isDirectoryEntryhelper in WorkspaceEntries.ts that resolves symlinks viastat()and returns true if the target is a directory, false on error.browse()to replace thedirent.isDirectory()filter with asyncisDirectoryEntrychecks (concurrency: 16), so directory symlinks and junctions appear alongside real directories.WINDOWS_LEGACY_PROFILE_JUNCTION_NAMES) on win32 to avoid surfacing noise entries.browse()now returns symlinked directories that were previously omitted; broken symlinks and non-directory symlinks are silently skipped.Macroscope summarized ae46c95.