fix(fs): absolute paths pass through Fs.path unprefixed on an unrestricted medium - #21
Conversation
…icted medium
Fs.path bolted "/" onto every path before cleaning. On an
unrestricted ("/"-rooted) medium that prefix was a no-op for POSIX
absolute paths ("//x" cleans to "/x") and corrupted Windows
drive-letter ones: filepath.Clean(`/C:\models\x`) is `\C:\models\x`,
a path no Win32 open resolves. Every List/Read walk over an absolute
path on Windows failed on it — go-inference's Discover yielded
nothing and model/pack printed the mangled path verbatim in CI
(dAppCore/go-inference run 31101973970):
CreateFile \C:\Users\RUNNER~1\...\pack-roundtrip-good-3323670468\src:
The filename, directory name, or volume label syntax is incorrect.
The unrestricted branch now cleans the path as it stands. The
sandboxed branch keeps its prefix — there it IS the contract
(absolute paths map under root). Relative-path handling is untouched.
PathIsAbs recognises the drive-letter form on every platform, so the
regression test pins the contract on POSIX runners too.
Co-Authored-By: Virgil <virgil@lethean.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe filesystem path handling now preserves absolute Windows drive-letter paths and normalises absolute POSIX paths for an unrestricted root. Tests cover both behaviours. ChangesFilesystem path handling
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Warning Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption. 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 |
The one-liner behind go-inference's windows CI red (Discover yielding nothing, model/pack's
\C:\Users\…mangle — run 31101973970, and likely a chunk of that lane's other 46 failing packages).Fs.pathprefixed"/"unconditionally before cleaning; harmless for POSIX absolute paths, fatal for drive-letter ones. The unrestricted ("/"-rooted) branch now cleans the path as given; the sandboxed branch keeps the prefix — there it is the sandbox contract.Receipts: full suite green (
GOWORK=off go test ./... -count=1→ ok), regression pinned inTestFs_Fs_path_Ugly—PathIsAbsknows theC:\form on every platform, so the pin holds on POSIX runners, not just windows.core/go is review-only by house rule — over to you.
🤖 Generated with Claude Code
Co-Authored-By: Virgil virgil@lethean.io
Summary by CodeRabbit