Commit Graph

16 Commits

Author SHA1 Message Date
d4dcde4cc1 gamedata_graph: fix manifest/root summary invariants and --json path guards 2026-11-25 05:11:14 +01:00
755283da59 gamedata_graph: index sibling parentPath lookups and write JSON atomically 2026-11-24 15:01:34 +00:00
54ce888674 docs: point gamedata_graph at its --help usage line (#6551)
Squash-merged after diff review of PR #6551
2026-11-23 12:47:00 -06:00
c2d7dea381 gamedata_graph: keep scanning after an unsupported XML encoding (#6765)
Squash-merged after diff review of PR #6765 - gamedata_graph: keep scanning after an unsupported XML encoding
2026-11-23 10:05:27 -06:00
1ee2c46faa Protect game-data graph inputs from aliased report paths 2026-11-22 23:54:14 +01:00
9e141492d6 gamedata_graph: protect XML inputs found in directories 2026-11-22 18:00:21 +01:00
ec9b6cf22b tools: text reports are written with LF line ends on every platform (BUILD-468)
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.
2026-11-22 14:20:30 +00:00
d188c59670 gamedata_graph: refuse report paths that overwrite source documents or carved inputs 2026-11-22 17:49:58 +05:30
f698bf2206 tools: a path outside the console's code page no longer crashes a tool's output
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>
2026-11-22 11:27:00 +00:00
3118f9cbce gamedata_graph: a malformed carve index is one ERROR line, not a traceback
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.
2026-11-22 18:39:53 +08:00
6a2273c916 Merge pull request #1206 from Lucy 2026-11-22 03:37:49 -05:00
78193fb931 gamedata_graph: follow parentPath inheritance inside its own document
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>
2026-11-22 08:17:53 +00:00
83b285c612 gamedata_graph: report JSON write failures 2026-11-22 05:05:26 -03:00
380464f81b gamedata_graph.py: every <filename> is a graph target, as the module docstring says
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>
2026-11-22 07:53:11 +01:00
ad4f2b3017 gamedata_graph.py: handle deep include chains without recursion 2026-11-22 01:01:59 +01:00
b262056ac7 Tools: measure the common.rpf content-set graph
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.
2026-11-21 22:47:26 +00:00