fix(action-fusion): then_run skipped for Git Bash/MSYS/Cygwin/WSL drive paths on Windows - #35
Conversation
…ed guard `resolveToolPath()` handled `@`, `file://`, `~`, and `~/`, then went straight to `path.resolve()`. Pi's own `resolveToCwd()` does more on Windows: it converts Git Bash, MSYS, Cygwin, and WSL drive paths (`/c/...`, `/mnt/c/...`, `/cygdrive/c/...`) to native form and expands `~\`. A `then_run` call against such a path therefore mutated `C:\src\app.ts` while the queue and hash guard addressed a literal `\c\src\app.ts`, so the fused command was skipped with ENOENT. Same parity class as NVlabs#2 and NVlabs#7, different input class: the file-URL fix in NVlabs#4 and the Unicode-space work in NVlabs#7 do not cover shell drive paths. The conversion mirrors Pi 0.84.2's `normalizeWindowsShellPath()` and is a no-op off Windows, so POSIX targets like `/c/src/app.ts` keep their current meaning. Claude-Session: https://claude.ai/code/session_01Ax76YG2oRYYUvnYMdUdChk
gaoanze888
left a comment
There was a problem hiding this comment.
Compared the converter and tilde branch with Pi 0.84.2 path normalization; the pure Windows path semantics match, and the POSIX behavior remains unchanged. npm run check passes locally: 18 files / 142 tests, typecheck, and package dry-run. No blocking correctness issue found. This overlaps #9, so merge resolution must preserve the order Unicode normalization → @ stripping → Windows drive normalization → file URL/tilde/cwd resolution; a real Windows run would still be valuable.
|
Integration follow-up: I merged this exact head after #9 in a disposable tree that also included the currently approved #6, #8, #13, #14, #15, #17, #23, #26, #30, #31, #33, and #34. The expected conflict is limited to normalizeWindowsShellPath(normalizeToolPath(filePath))preserves the intended sequence: Unicode-space normalization → optional So this remains compatible with #9; it just needs that explicit single-file resolution if #9 lands first. This is still a macOS integration result, not a substitute for a native Windows run. |
Fixes #45
Summary
On Windows, a fused
edit/writewhose path comes from a Git Bash, MSYS, Cygwin, or WSL shell mutates one file while Action Fusion's queue and hash guard address another, sothen_runis skipped with ENOENT.resolveToolPath()handles@,file://,~, and~/, then callspath.resolve(). Pi'sresolveToCwd()does two more things on Windows, inutils/paths.js:So for
path: "/c/src/app.ts"the built-in mutation writesC:\src\app.ts, whileresolveToolPath()returns a literal\c\src\app.tsfor the queue slot and theassertUnchangedBeforeCommand()hash. The mutation succeeds, the guard reads a path that does not exist, and the model gets:This is the same parity class as #2 and #7, on a different input class — the file-URL fix in #4 and the Unicode-space work in #7 do not touch shell drive paths. Given #16, Windows users are running this.
Scope of the claim
I do not have a Windows machine, so this is reasoned from Pi 0.84.2's own resolver source rather than executed on Windows, and the tests below drive the platform branch with a stubbed
process.platform. Happy to hold this until someone can confirm on a real Windows runner — the upstream code path is quoted above so the divergence itself is checkable without one.Change
normalizeWindowsShellPath()mirrors Pi's function exactly, including the//-prefixed UNC and already-native (\-containing) exclusions, and the tilde branch accepts~\on Windows. Both are no-ops off Windows, so a POSIX user whose repository genuinely contains/c/src/app.tsis unaffected.docs/compatibility.mdgains a sentence in the Action Fusion section next to the existing file-URL note.Tests
Three added to
tests/action-fusion-paths.test.ts, using awithPlatform()helper that swapsprocess.platformaround one call and restores it:win32:/c/src/app.ts->C:\src\app.ts,/mnt/d/work/notes.md->D:\work\notes.md,/cygdrive/e/x/y->E:\x\y,/c->C:\, and/usr/local/bin/pi,//server/share/file.txt,C:\already\native.tsleft alone;linux:/c/src/app.tsunchanged, through both the helper andresolveToolPath();~\notes.txtexpands to the home directory underwin32and stays an ordinary relative filename underlinux.Red/green verified — with
src/reverted:With the fix, on the pinned Pi 0.84.2 (macOS):
https://claude.ai/code/session_01Ax76YG2oRYYUvnYMdUdChk