open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly
listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/,
make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source
with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention.
AI-assisted (Claude), on behalf of dev-ewann.
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").
tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main() caught only FileNotFoundError around the documents loaded through
gamedata_xml.load_documents, so every malformed carve index shape ends in
a traceback here: {} -> KeyError 'files', {"files": "oops"} -> TypeError,
malformed JSON -> JSONDecodeError, a row without 'off' -> KeyError 'off'.
Mirror the contract gamedata_xml.main() gained in #1282: RuntimeError is an
ERROR line, and (OSError, ValueError, KeyError, TypeError) gives
"ERROR: cannot read <where>: <reason>" with exit 2.
A parentPath of the form ../Tag[@attr='value'] is resolved against the
siblings of the element that carries it (exact match) and reported under
parent_path_inheritance: resolved, ambiguous and unresolved sites, chain
depths and cycles. Existing counts and edges are unchanged. On common.rpf
all 40 sites resolve, depth 1-4, no cycles. Synthetic tests cover chains,
both quote styles, case, a non-matching form, a duplicate key, a cycle and
a locator whose parent list lacks the key.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The docstring promises a target node for every <filename>, but
scan_document() only read <filename> inside a top-level or content-set
<fileList>, so a filename anywhere else (e.g. <group><filename>) was
dropped. Remaining filenames are now added as document-owned references
(owner "", like loadPath), each element counted once. The docstring line
for <loadPath> is corrected: only those in <includedChangesets> are read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add gamedata_graph.py, which rebuilds the XML payloads from a carve and measures document -> content-set -> target edges. Include ids are joined only on exact equality; missing ids stay dangling and common:/ is not normalized to $(common)/.
Add synthetic tests for includes, a cycle, reachability, prefix classification, unparsed payloads and output redaction. Add a measured docs page linked from the index.