Fail loudly on sibling filename collisions - #123
Merged
Conversation
getAGoodFileName() serves as both the on-disk filename and the identity in the *_order arrays, but nothing checked it was unique among siblings. Two siblings collapsing to the same name (a shared GUID inside a container, or nicknames differing only in stripped punctuation) caused the second to silently overwrite the first. Add a checkFilenameCollisions helper and invoke it where siblings sharing a directory are enumerated: root objects in Printer.PrintObjectStates, and contained objects plus states in parseFromJSON. A collision now returns a clear error naming the offending filename and the GUIDs involved. Fixes #107 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
argonui
force-pushed
the
fix/filename-collision-error
branch
from
August 4, 2026 02:25
a4ddb60 to
00ec93c
Compare
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.
Summary
getAGoodFileName()returns<sanitized nickname>.<guid>, used both as the on-disk filename and as the object's identity in the*_orderarrays, with no uniqueness check. Two siblings that collapse to the same name — a shared GUID inside a container, or nicknames differing only in stripped punctuation — caused the secondWriteObjto silently overwrite the first.The maintainer chose to fail loudly on collision rather than disambiguate.
Changes
checkFilenameCollisions([]*objConfig)which returns an error naming the colliding filename and the two GUIDs involved.Printer.PrintObjectStates— root objects (top-levelobjects/directory).parseFromJSON— contained objects and states together, since both are written into the same subdirectory.TestPrintObjectStatesCollision(shared GUID and stripped-punctuation cases) andTestContainedObjectCollision.go build ./...,go vet ./..., andgo test ./...all pass; no existing fixtures collide.Fixes #107