Skip to content

Refuse trailing-separator destination and normalize path spelling - #113

Merged
saworbit merged 3 commits into
mainfrom
batch/path-ux-fixes
Oct 29, 2026
Merged

saworbit merged 3 commits into
mainfrom
batch/path-ux-fixes

Conversation

@saworbit

Copy link
Copy Markdown
Owner

Two path-UX fixes to the single-file copy flow.

Changes

  • orbit copy and orbit plan now reject a destination that ends with a path separator. The raw input is inspected before Windows GetFullPathNameW drops the trailing character, so copy and plan behave the same way on both platforms. New error code: destination_has_trailing_separator, exit 3.
  • Windows human-mode error messages render paths with a consistent ordinary spelling. Reversible \\?\C:\ and \\?\UNC\ prefixes are stripped in display_path. JSON output is untouched so machine-readable paths stay unambiguous.

Tests

  • paths::tests::rejects_destination_with_trailing_separator covers both / and \ suffixes.
  • report::tests::display_path_strips_reversible_verbatim_prefix covers drive, UNC, non-reversible volume, and already-ordinary forms.
  • report::tests::trailing_separator_error_message_names_the_destination.
  • copy_integration::trailing_separator_destination_is_refused_without_creating_a_file.
  • copy_integration::error_messages_use_ordinary_path_spelling_on_windows.
  • Mutation checks: with the guard and the strip disabled, all four new tests fail; restoring the fix makes them pass.
  • Full cargo test is green locally.

Fixes #110
Fixes #111

…errors

Reject destinations that end with a path separator with exit code 3 and
code destination_has_trailing_separator. The raw input is inspected
before Windows GetFullPathNameW drops the trailing character, so copy
and plan behave the same way on both platforms.

Strip reversible \?\C:\ and \?\UNC\ prefixes in display_path on
Windows so human-mode errors use the same ordinary spelling regardless
of which arm produced them.

Fixes #110
Fixes #111
On Unix a backslash is a literal filename character, not a path separator,
so the Unix branch only exercises "/" suffixes while Windows still exercises
both "/" and "\\". The production check already behaves this way; only
the unit test iterated both separators unconditionally.
@saworbit
saworbit merged commit c3a94c6 into main Oct 29, 2026
4 checks passed
@saworbit
saworbit deleted the batch/path-ux-fixes branch October 29, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error messages render path with inconsistent \\?\ prefix orbit copy with trailing slash on destination silently creates a regular file

1 participant