Files
orca/src
SebastianandBrennan Benson 04e7f5c805 fix(cli): relativize absolute POSIX paths against UNC worktree roots in WSL (#11406)
* chore: ignore worktrees directory

* fix(cli): relativize absolute POSIX paths against UNC worktree roots in WSL

* fix(cli): prevent double-prefixing UNC paths in WSL path normalization

* fix(cli): gate the WSL path rewrite on a UNC worktree root

WSL_DISTRO_NAME is also set for a plain Linux CLI inside the distro, where
worktree roots are POSIX; prefixing there stranded every absolute path.
Rewrite only when the root really is a WSL UNC path, and cover the legacy
wsl$ alias, cross-distro paths, and the non-WSL case.

* test(cli): pin WSL_DISTRO_NAME absent for the whole file-path suite

Contributors run this suite inside WSL, where the inherited distro name
would flip the rewrite on for every POSIX-root case.

* fix(cli): never rewrite a Linux path that contains a backslash

Backslash is a legal Linux filename character but a separator once the
path reads as UNC, so `a\b.ts` relativized to `a/b.ts` — a different
file. Such a path has no UNC spelling; let it fail the match instead.

* test(cli): pin the WSL rewrite's negative space

Sibling-prefix roots, Linux-tail case sensitivity, and Windows
drive-letter workspaces all passed only by construction.

* test(cli): pin the distro-case fold from the CLI side

The negative-only case passed identically with the fold broken.

* fix(cli): name the WSL distro from the invocation cwd when the env is absent

WSL_DISTRO_NAME only reaches the CLI if interop forwards it across the
PowerShell bridge, which nothing in the launcher guarantees. ORCA_CLI_CWD
is set explicitly and its UNC form already names the distro.

* test(cli): match the launcher's real cwd spelling and fix an over-claim

wslpath -w emits a backslash UNC path; the fallback test now uses that
shape. The aliasing test's comment described a state the || guard makes
unreachable.

* refactor(cli): spell the WSL rewrite with the shared toWindowsWslPath helper

src/shared/wsl-paths.ts already owns "absolute Linux path in a known distro
-> its Windows form" and has five production callers; the handler hand-rolled
a fourth copy of the UNC template. Behavior is identical under the UNC-root
guard, and passing distro as a real argument makes the null check a compile
error rather than an untested branch.

* test(cli): drop a WSL case that pins the guard shape and kills no mutant

Deleting the distro null check left the case green — it asserts the same
passthrough as 'does not rewrite when the CLI is not running under WSL'. The
check is now enforced by the compiler instead.

* chore: keep WSL path fix scoped

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
2026-08-17 00:52:38 -07:00
..