Skip to content

Skip paths the path type rejects instead of aborting the scan - #173

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/140-unrepresentable-paths
Oct 7, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/140-unrepresentable-paths

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #140

What changed

  • FileScanner.ScanForFiles catches the ArgumentException from As<AbsoluteFilePath>() for each enumerated path, prints Skipped <path>: <reason>, and carries on. This matches how FileHasher handles a file it cannot read. A file name with <, > or |, or a path over 256 characters, no longer stops every verb on that root.
  • BaseVerb<T>.Run checks that the root itself converts before it calls IsScannableDirectory. A root that cannot be represented now prints one line, Cannot scan <path>: <reason>, and exits 1 instead of throwing a stack trace.

The upstream relaxation of the limits stays with ktsu-dev/Semantics#330, as the triage comment says.

Tests

  • ScanSkipsAFileWhoseNameThePathTypeRejects and ScanSkipsAFileWhosePathIsTooLongForThePathType: the scan returns the two representable duplicates and skips the rest.
  • EveryVerbSkipsAnUnrepresentableFileAndReportsTheRest: Scan, DryRun, Stats and Deduplicate each exit 0, name the skipped file, and still handle the duplicate pair next to it.
  • ScanOfAnUnrepresentableRootReportsItInOneLine: a root named left|right exits 1 with a one-line message.
  • On a file system that refuses the name (for example < or | on Windows), the staging helper marks the test inconclusive.

With the two production files reverted, all four new tests fail. With the fix, the full suite passes locally on Linux: 83 passed, 3 skipped. The 3 skips already existed; they need a non-root user.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EMKbHPuiquQwvUr7NBWPvL


Generated by Claude Code

ktsu.Semantics.Paths rejects '<', '>', '|' and paths over 256 characters,
all of which Unix file systems accept. One such file anywhere in the tree
threw out of FileScanner.ScanForFiles and took every verb down with it.
The scan now names and skips the file, as the hasher does for a file it
cannot read, and a root that cannot be represented fails in one line with
exit code 1.

Fixes #140

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EMKbHPuiquQwvUr7NBWPvL
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 31369cf into main Oct 7, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the fix/140-unrepresentable-paths branch October 7, 2026 05:33
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.

Every verb crashes with "Cannot convert ... to AbsoluteFilePath" if any file in the tree has <, > or | in its name or a path over 256 characters

2 participants