Skip to content

Report inputs that share an output name, and reject --output equal to --input [patch] - #138

Merged
matt-edmondson merged 2 commits into
mainfrom
claude/iconhelper-120-output-collisions
Oct 8, 2026
Merged

matt-edmondson merged 2 commits into
mainfrom
claude/iconhelper-120-output-collisions

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #120

What changed

  • Inputs sharing a base name. ProcessDirectory now remembers which output names it has written during a run. If a later input maps to a name that is already taken, for example save.bmp after save.png, that input is reported as failed with a message naming the earlier input, and it is not written. The first input's output is kept, the written count matches the files on disk, and the run exits 2.
  • --output equal to --input. Arguments.Validate rejects an output directory that resolves to the input directory, trailing separator included, so the run exits 1 before any source icon is overwritten.
  • Arguments.PathComparison makes both checks case-insensitive on Windows and macOS and case-sensitive elsewhere, to match the default file systems.
  • Docs. The collision was listed in the README and in CLAUDE.md's "Known Rough Edges" as a limitation. The README now describes the new behaviour, and the CLAUDE.md entry moves to "Fixed Bugs Worth Knowing About".

Tests

  • ProcessDirectoryTests.InputsSharingABaseNameDoNotOverwriteEachOther: save.png + save.bmp gives 1 written, 1 failed, one file on disk, and exit code 2.
  • ArgumentsTests.ValidateRejectsAnOutputThatIsTheInputDirectory: setting --output to the input path with a trailing separator is rejected.

With the fix reverted, both new tests fail. With the fix in place, every test passes except the 8 OutputMatchesTheGoldMaster cases, which fail locally because the Git LFS fixtures are pointer stubs in this checkout. CLAUDE.md documents that case, and it is unrelated to this change. dotnet build --no-incremental -warnaserror is clean.

This branch is independent of #137, which touches the same loop for #119. Whichever of the two merges second may need a small rebase.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WyG38ppCkkDDCmkSnea826


Generated by Claude Code

… --input [patch]

Every output is <base name>.png, so save.png and save.bmp wrote the same file:
the later one won while the summary counted both. ProcessDirectory now
remembers the names it has written in a run and counts a collision as a
failed file. Validate rejects an output directory that is the input
directory, which used to replace the source icons with their masks and exit 0.

Fixes #120

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WyG38ppCkkDDCmkSnea826
Comment thread IconHelper.Test/ProcessDirectoryTests.cs Fixed
Comment thread IconHelper.Test/ProcessDirectoryTests.cs Fixed
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit dee94a7 into main Oct 8, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the claude/iconhelper-120-output-collisions branch October 8, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants