Skip generated icons by file name, not by full path - #117
Merged
Merged
Conversation
Directory.GetFiles hands back full paths, so testing the whole string for ".new.png" let a directory anywhere above the input decide that every file below it was already generated. An input path containing that substring in a parent folder -- a user name, a date stamp, a project name -- processed nothing and still exited 0. The documented contract, in README.md and CLAUDE.md alike, has always been about file names: "Files whose names contain .new.png are skipped". The check now matches that. Fixes #116 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012betVHk3gFcj5RYkEe4vrm
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #116
The defect
Directory.GetFilesreturns full paths, andIconHelper.cs:119tested the whole string:So a directory anywhere above the input could decide that every file below it had already been generated. The contract has never been about paths —
README.md:265andCLAUDE.md:107both say names: "Files whose names contain.new.pngare skipped".The failure is the worst shape a batch tool can have: total, silent, and reported as success. Nothing is written, nothing is logged per file, and the process exits 0.
The change
Ordinal, not theOrdinalIgnoreCasethe issue suggests.string.Contains(string)is already ordinal, soOrdinalis what the code does today made explicit, and the fix stays confined to the reported defect. Case-insensitivity would be a second, independent behaviour change:.new.pngis not a marker the tool ever writes — nothing in the codebase produces it, it is purely a user-facing convention thatREADME.mddocuments — so the tool's own output settles nothing about whetherAlready.New.PNGshould be skipped. On Linux those are distinct files. That call is worth its own issue rather than riding along in a path-versus-name fix.Tests
Two, because the obvious over-correction here is to stop matching on names as well:
SkipsOnTheFileNameRatherThanTheContainingPathicons.new.png.dir/in, both expected to be writtenSkipsOnTheFileNameEvenBelowAMatchingPathThe second matters because the first passes if the skip is simply deleted. Together they pin the check to exactly the name.
Proved failing without the fix. Reverting only
IconHelper/IconHelper.csand keeping both tests takes the suite from 8 failures to 10 — the two new ones, and nothing else moves:Verification
dotnet build IconHelper.sln -c Release— succeeded, 0 warnings, 0 errors (this repo runs analyzers as errors)dotnet test IconHelper.sln -c Release— 75 total, 67 passed, 8 failedAbout those 8 failures
They are all
GoldMasterTests.OutputMatchesTheGoldMaster, and they are not caused by this change — unmodifiedmaingives 73 total, 65 passed, the same 8 failed.The cause is this container, not the repository: the gold master fixtures under
IconHelper.Test/GoldMaster/Input/are Git LFS objects,git-lfsis not installed here, and a shallow clone therefore leaves them as pointer files.filereports them as ASCII text beginningversion https://git-lfs.github.com/spec/v1. ImageSharp cannot decode a pointer file,ProcessDirectorycounts it as a failure, and every case trips itsAssert.AreEqual(1, result.Written)guard.Nothing in this change touches decoding or the gold master path, and CI, which materializes LFS content, should see all 75 green. Flagging it rather than leaving it to be rediscovered: any agent working this repository in a container without
git-lfswill see these 8 failures and should not read them as a regression.🤖 Generated with Claude Code
https://claude.ai/code/session_012betVHk3gFcj5RYkEe4vrm
Generated by Claude Code