Repository navigation
world_archetypes: refuse --out equal to the input, one error line for a bad --out - #3330
Merged
Merged
Conversation
Contributor
|
Verified on
One note from a sibling tool, since this is the same class as my #2930: |
This was referenced Nov 22, 2026
tomgamer22
approved these changes
Nov 22, 2026
tomgamer22
left a comment
Contributor
There was a problem hiding this comment.
The checks now run before the scan and use the shared report_paths.same_report_path (realpath + normcase, falling back to samefile), so other spellings of the input's path are refused too. Both new tests fail on the merge base and pass here. AI-assisted review (Claude Code).
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.
What broke
tools/world_archetypes.pywith--outequal to the input file (world_archetypes.py x.bin --out x.bin) ran the scan, then opened the input for writing: the 3000-byte input became a 293-byte JSON report.--outunder a regular file, or naming a folder, raisedFileExistsError/IsADirectoryErrortracebacks, again only after the whole scan.Fix
The report path is checked right after argument parsing, before the scan:
same_report_pathagainst the input, a folder as--out, andmakedirsfailures each give oneworld_archetypes.py: error: ...line and exit 2. The final write is also guarded.Tested
python -I tests/test_world_archetypes.py: 15 tests OK, Python 3.12.16, Linux (WSL2).tools/world_archetypes.pyreverted to upstream/main, the two new tests fail (input truncated; traceback).Claim: #3232
AI-assisted.