Repository navigation
tools: stream game-data XML events by root and type (ASSET-139) - #2278
kacper-serewis wants to merge 1 commit into
Conversation
Add a stdlib event reader, synthetic dispatch and memory tests, and aggregate common.rpf validation documentation. AI-assisted. No game data included.
|
Independent review & local CPU verification (AI-assisted) on Windows 11 x64 / Python 3.14.8 against commit Tests run locally:
Code & diff review (
No issues found; looks ready to merge from a CPU/code-read perspective. |
|
Independent check of
|
|
AI-assisted code read (Claude), not run. Looks correct. One small diagnostic issue. The dispatch precedence, provisional-event contract, DTD refusal and callback-error passthrough ( Nit: errors from the chunk iterator are reported as malformed XML. The |
|
Closing as a duplicate: the streaming game-data XML reader (ASSET-139) landed on main via #2238. Thanks! |
|
Ran this on
One failure: jbot1324's nit reproduces: chunks from a closed stream give AI-assisted (Claude Code). |
Claimed as ASSET-139: #2078 (comment)
Publication requested by the coordinator after reconciling the overlap with #2238: #2078 (comment). This PR is offered for that comparison; it does not depend on #2238, #1995 or #2268.
What and why
Add a stdlib streaming event API for game-data XML.
read_xmlaccepts byte chunks and dispatches start/text/end events by document root and each element's owntype, with root/default fallbacks. It preserves values without schema conversion guesses and retains open-element metadata rather than a tree. Attributes are read-only snapshots. Tail text belongs to the parent; text chunks can split arbitrarily.DTD declarations are refused. Malformed/unsupported XML raises a sanitized error; consumer exceptions propagate unchanged. Callbacks are explicitly provisional until parsing completes, so consumers must discard partial state after an error. The CLI reads local XML files and emits aggregate counts only. Documentation describes the API, memory/depth limits and archive-grouping integration; runtime consumers and RTTI mapping remain future work.
Tested
Windows 11 Pro 10.0.26200, Python 3.13.15. CPU-only; no GPU required or exercised (host RTX 5070, driver 32.0.16.1656).
python -I tests/test_gamedata_reader.py: 11 passed, including dispatch precedence, mixed content, single-byte UTF-8/UTF-16 chunking, namespaces, malformed input, unsupported encodings, DTD refusal, callback exceptions, partial delivery and memory across 20,000 siblings.test_gamedata_index.py(19),test_gamedata_xml.py(6),test_docs_links.py(5),test_text_write_line_endings.py(2): all passed.python -m compileall -q make_game.py tools testsandgit diff --check: passed.gamedata_xml.scan_xml. Accepted documents contain 428,611 elements, 7,181 typed elements, 111 distinct roots, maximum depth 17. Counts include the complete recovered XML corpus, not a sample. Game data and per-document reports remain local.Checklist