Repository navigation
0.142.0: the doctor names what it could not read; a file nested too deep is skipped - #41
Merged
Merged
Conversation
…eep is skipped The doctor said nothing about a file the folder reader skipped. With one element file cut off mid-write it reported the other elements as the whole world and listed every link to the unread one as a link to an element that is not there. Report.unread (and unread in --json, after written) now lists each such file with why, the prose report prints the list before any finding, and any entry makes the exit code 1. A second file of one id and a directory that is no type's are listed too; a dot-prefixed file is not. A value nested thousands deep made json.loads raise RecursionError, which no reader caught: on an element file or a world.json the doctor and pack stopped with a traceback. _outside_json.loads turns that into a ValueError in plain words, and gives an integer of more than 4,300 digits a reason of its own in place of Python's advice about an interpreter setting. The folder reader, the archive reader, the Kanka and LegendKeeper doors and lint's world.json read parse through it. A test reads the package's syntax trees and fails on a json.loads that is neither that reader nor named. Not changed: python -m onlyworlds.lint reads element files through the schema distribution's own checker, which still stops on such a file. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The first version of this change relied on json.loads raising RecursionError for a value nested 100,000 deep. Python 3.14 on Linux reads that value whole, so the same file was skipped on Windows and read on Linux, and the depth was left to whatever walked the value next. _outside_json.loads now refuses nesting past MAX_DEPTH (200) itself, after the parse, with a loop that keeps its own stack; a RecursionError from the parser reads as the same refusal. A test holds the line at 200 and 201 for arrays and for objects, so each interpreter in CI shows it parses that deep and refuses one more. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch was previously deployed
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.
The doctor said nothing about a file the folder reader skipped. With one
element file cut off mid-write it reported the other elements as the
whole world and listed every link to the unread one as a link to an
element that is not there. Report.unread (and unread in --json, after
written) now lists each such file with why, the prose report prints the
list before any finding, and any entry makes the exit code 1. A second
file of one id and a directory that is no type's are listed too; a
dot-prefixed file is not.
A value nested thousands deep made json.loads raise RecursionError,
which no reader caught: on an element file or a world.json the doctor
and pack stopped with a traceback. _outside_json.loads turns that into a
ValueError in plain words, and gives an integer of more than 4,300
digits a reason of its own in place of Python's advice about an
interpreter setting. The folder reader, the archive reader, the Kanka
and LegendKeeper doors and lint's world.json read parse through it. A
test reads the package's syntax trees and fails on a json.loads that is
neither that reader nor named.
Not changed: python -m onlyworlds.lint reads element files through the
schema distribution's own checker, which still stops on such a file.
Watched failing: four faults planted one at a time (the doctor not filling the list, the deep case let through, no reason of its own for a long number, the folder reader back on json.loads) each turned the new tests red.
Second commit: Python 3.14 on Linux parses a value nested 100,000 deep with no error, so the depth is refused by one number (200) on every platform, after the parse; a test holds the line at 200 and 201.
🤖 Generated with Claude Code