Repository navigation
Description
Summary
When the destination argument to orbit copy or orbit plan ends in a trailing path separator (e.g. out/ or out\), Orbit silently normalizes it away and creates a regular file at that path. A trailing separator is a well-established user signal (POSIX, rsync, cp) that the destination is intended to be a directory, so this is surprising given the "exact target path" contract.
Repro
Windows, orbit 0.1.0-alpha.0 on branch codex/single-file-copy (commit 2abf672).
$vibe = 'C:\tmp\vibe'
Remove-Item -Recurse -Force $vibe -ErrorAction SilentlyContinue
New-Item -ItemType Directory $vibe | Out-Null
"hello" | Set-Content -Encoding ascii "$vibe\src.txt"
orbit.exe copy "$vibe\src.txt" "$vibe\new_dir\"Observed output:
Copied \\?\C:\tmp\vibe\src.txt -> \\?\C:\tmp\vibe\new_dir (7 bytes, hash verified)
A regular file new_dir (no trailing separator) is created, with no warning or acknowledgement that the trailing separator was dropped.
plan behaves the same way:
orbit.exe plan "$vibe\src.txt" "$vibe\plan_slash\" --json{"schema_version":1,"event":"plan_entry","data":{...,"destination":{"encoding":"utf8","value":"\\\\?\\C:\\tmp\\vibe\\plan_slash"},...,"kind":"file","disposition":"copy","reason":"destination does not exist",...}}The planned entry's destination has the trailing separator removed and kind is file.
Expected
One of the following, in order of strictness:
- Refuse when the destination argument ends with a trailing path separator — a trailing separator is a directory signal and
copyonly accepts a single-file destination today. Exit 3 with a clear message would match the existing design that rejects ambiguous destinations. - Preserve the user's input verbatim and refuse if the resulting path refers to anything other than an exact non-existent target.
Silent normalization to a file is the behavior most likely to surprise users coming from cp, rsync, or shell conventions.
Notes
- On Windows this falls out of
std::path::absolute→GetFullPathNameW, which strips trailing separators from ordinary paths. On Linux the trailing separator is retained in thePath, so the behavior may differ between platforms today. - Caught during fundamentals/vibe testing of the copy flow.
Activity
saworbit commentedon Oct 28, 2026
Fixed in d9eb186 on PR #113.
resolve_endpointsnow rejects a destination that ends with/or\on the raw input, before WindowsGetFullPathNameWcan drop it. New error codedestination_has_trailing_separator, exit 3. Covered by apathsunit test and acopyintegration test. CHANGELOG updated.