Repository navigation
feat(wsl): scope and path map for converting UNC Windows-drive projects (D1c-4a) - #33108
Conversation
820451d to
85eaf0a
Compare
71b61a9 to
fae28ea
Compare
85eaf0a to
26e4f21
Compare
fae28ea to
f5e6b51
Compare
26e4f21 to
102d859
Compare
f5e6b51 to
725f1d4
Compare
102d859 to
6920507
Compare
725f1d4 to
9b2f879
Compare
6920507 to
7105dc1
Compare
9b2f879 to
f82f8a8
Compare
7105dc1 to
acd9c2d
Compare
f82f8a8 to
37f8dd7
Compare
acd9c2d to
cc589b8
Compare
37f8dd7 to
73d6c57
Compare
cc589b8 to
727b8be
Compare
73d6c57 to
ed9113a
Compare
727b8be to
6b24e8c
Compare
ed9113a to
67da7de
Compare
6b24e8c to
9bc5b72
Compare
67da7de to
8b6579e
Compare
9bc5b72 to
e247268
Compare
8b6579e to
c465a8e
Compare
e247268 to
61534ac
Compare
c465a8e to
8796cff
Compare
61534ac to
6170884
Compare
8796cff to
a96c9e4
Compare
c553e78 to
f0f8f9e
Compare
e43376e to
f6a6990
Compare
f0f8f9e to
b19ac70
Compare
f6a6990 to
7388160
Compare
b19ac70 to
77aa4b2
Compare
7388160 to
cf08184
Compare
77aa4b2 to
462b073
Compare
cf08184 to
4912f85
Compare
462b073 to
47c5a07
Compare
4912f85 to
8c12faa
Compare
47c5a07 to
a683039
Compare
8c12faa to
5a931aa
Compare
[Low impact] The changes stay within WSL project selection and repo registration. The PR should not merge until the two existing mount-reading findings are fixed; both can let conversion select the wrong folder. FindingsSummaryAdds helpers that identify WSL UNC projects backed by Windows drives and map their paths and worktree IDs to Windows spelling.
|
| const mountInfo = result.timedOut || result.code !== 0 ? null : fence.readStdout(result.stdout) | ||
| return mountInfo === null ? null : parseWindowsDriveMountInfo(mountInfo) |
There was a problem hiding this comment.
Nested mounts select wrong folders
readWslDistroDriveMounts drops non-Windows mounts before the folder check chooses the innermost mount. If /home/me/app is bind-mounted at /mnt/c/shared, the parser skips that ext4 mount and leaves only /mnt/c → C:\. The check then accepts \\wsl.localhost\Ubuntu\mnt\c\shared as C:\shared, although they are different folders.
The conversion caller in PR #33135 trusts this result when rewriting saved paths. Folder projects have no Git check to stop the wrong conversion. Keep non-Windows mounts as entries with windowsRoot: null so they block the parent drive match, and test with parsed mountinfo rather than a hand-built mount list.
…tings Project settings show a Git row for a WSL-runtime project on a Windows drive (WSL hosts on). "Use Git for Windows" checks the project, shows any blocker in plain words, optionally sets core.autocrlf in the repo, and saves the returned runtime through the normal project update. Once converted the row says where Git and terminals run. Switching the distro keeps Git for Windows instead of silently dropping it. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…ts (D1c-4a) The mover refuses a project kept as a distro's UNC path into a Windows drive (\\wsl.localhost\<d>\mnt\c\x). D1c converts it in place to C:\x. This adds the pure part: which local repos and folder workspaces qualify (every stored path on the drive; not remote; not already a C:\ project here), the UNC → drive path map, and the worktree id each converted worktree gets (same repo id, drive path). Reuses the mover's list of a repo's stored paths. Nothing calls it yet. Co-Authored-By: Claude <noreply@anthropic.com>
…, not that it isn't a repo
The new message replaced "Not a valid git repository", which the renderer matches to offer adding the folder as a non-git project. With the WSL hosts gate closed the add fails with the usual text again. (cherry picked from commit a5a70dad7743f679fd764c3e17a3e27b71c9f28b)
… the distro mounts from that Windows drive - Two UNC spellings of one drive path (\\wsl$ vs \\wsl.localhost, \mnt\C vs \mnt\c) would both convert into two projects. Each accepted conversion now claims its drive path, so the next spelling is refused as a duplicate. Folder workspaces get the same duplicate check. - Any /mnt/<letter> read as a Windows drive. The scope now takes the distro's Windows-drive mounts (drvfs/9p from its mountinfo, parsed as the WSL-host drive guard does) and converts a path only when its mount is that same whole drive. A folder workspace has one path, so that check is its mixed-location check too. Co-Authored-By: Claude <noreply@anthropic.com>
… real /mnt/C directory never converts onto C:
a683039 to
ec56df4
Compare
5a931aa to
4c5a342
Compare
| timeoutMs: READ_TIMEOUT_MS, | ||
| maxOutputBytes: 1_048_576 | ||
| }) | ||
| const mountInfo = result.timedOut || result.code !== 0 ? null : fence.readStdout(result.stdout) |
There was a problem hiding this comment.
Incomplete mounts select wrong folders
If a distro's mount table exceeds the 1 MiB limit, runProcess keeps its beginning and sets outputTruncated. This code ignores that flag, and readStdout returns the captured text even when the closing marker is missing.
A parent drive mount can remain while a later nested mount is missing. Conversion then accepts a Windows folder that is not the UNC folder and rewrites saved paths to the wrong location. Return null when result.outputTruncated is true.
| const mountInfo = result.timedOut || result.code !== 0 ? null : fence.readStdout(result.stdout) | |
| const mountInfo = | |
| result.timedOut || result.code !== 0 || result.outputTruncated | |
| ? null | |
| : fence.readStdout(result.stdout) |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 19 seconds. View limit details
Finishing Touches: 💡 1
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 |
ELI5
Some projects are saved under a WSL network path that actually points at a Windows folder:
\\wsl.localhost\Ubuntu\mnt\c\src\appis the same folder asC:\src\app. The WSL move can't take these. They need to become plain Windows projects atC:\…instead. This PR adds the first piece: working out which projects qualify and what each saved path and workspace id becomes. Nothing changes yet.What Changed
New file
src/main/wsl/wsl-drive-unc-project-scope.ts:wslUncDrivePathToWindowsmaps\\wsl.localhost\<distro>\mnt\c\x(either UNC spelling or slash, any case inmnt\<drive>) toC:\x. Anything else returns null.collectWslDriveUncScopelists the local repos and folder workspaces of a distro that qualify. It refuses a repo with a reason when:C:\xis already a project here, so converting would make two rows for one folder.wslDriveUncWorktreeIdgives a converted worktree its new id: same repo id, drive path, and any folder-workspace suffix kept.New file
src/main/wsl/wsl-unc-access-denied.ts: when adding a\\wsl.localhost\…path fails because Windows refused to read it (EPERM or EACCES), the add says "Windows denied access to this WSL path" instead of "Not a valid git repository", which sent users looking in the wrong place. Only on Windows with the WSL hosts gate open; otherwise the usual message, which the renderer uses to offer adding the folder as a non-git project.The list of a repo's saved paths is the mover's own (
wslMoveRepoPaths, now exported), so the two scope rules can't drift apart.Why
Owner decision: Windows-drive projects that run under WSL become Windows projects with WSL terminals. For UNC-path projects the path itself changes, and a workspace id contains its path (
<repoId>::<path>). So the next PRs must re-key the saved session, chats and terminals. Pinning down the scope and the mapping first lets those PRs share one definition.Linked Issue
WSL re-write, step D1c (R36, R37). Stacked on #33097.
Visual Proof
N/A: no caller and no UI yet.
Testing
wsl-drive-unc-project-scope.test.ts: path map (spellings, case, drive root, other distros, in-distro paths), scope with every refusal reason, and worktree ids including the folder-workspace suffix.Review
Self-reviewed.
Agent skill upstream boundary
Notes
describeWslUncAccessDeniedreturns null unless it is Windows with the gate open, without listing the folder, so a failed add still says "Not a valid git repository" and the renderer still offers adding it as a folder (pinned inwsl-unc-access-denied.test.ts). The new scope module has no production importer yet, andwslMoveRepoPathsis a rename plus an export.Pure functions; nothing runs them yet.
Status
4c5a34243f4: rebased onto main64344142fa0, which has feat(wsl): run Git for Windows for a WSL project on a Windows drive (D1c-2) #33090 squash-merged (fix(wsl-host): tell users how to fix a distro Orca can't host (D1c-1) #33085 earlier) and fix(wsl-mover): hold an app update install while a moved project comes back #35357; feat(wsl): offer Git for Windows in a Windows-drive WSL project's settings (D1c-3) #33097 now targets main. Every commit is kept. CI: running on this head.\\wsl$vs\\wsl.localhost,/mnt/Cvs/mnt/ccompare equal); the others are refused as duplicates, for folder workspaces too. A path converts only when the distro's own mount table shows it is that Windows drive folder (main's drvfs/9p mountinfo parser); if the mounts can't be read, nothing converts.pnpm tc,pnpm run typecheck:ci, the PR's tests,check:code-quality:changed, the anti-slop oxlint, repo oxlint and ast-grep (including the no-real-time-sleep test rules) and the e2e typecheck ratchet all pass locally on this head, run one branch at a time.