gamedata_reader: preserve empty polymorphic objects (GAMEDATA-EMPTY-TYPED-OBJECTS) #1850
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1850
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1850/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@cheltyi on GitHub · 2026-11-25 13:06 UTC · original
cheltyi:fix/gamedata-empty-typed-objects→main· +70 −3 · 3 files · 1 commits · merged 2026-11-25 17:28 UTCClaimed in the coordination issue as: GAMEDATA-EMPTY-TYPED-OBJECTS (claim)
What and why
gamedata_readerturned an empty non-NULL typed XML object into an empty string and consumed itstypeattribute, losing the object's class. A hand-written<Item type="CEmpty"/>now becomes{"$type": "CEmpty"}. This preserves the documented polymorphic-object contract for default instances with no serialized fields.The change uses the existing object conversion after the explicit scalar, vector, array, reference and registered-handler paths. Synthetic regressions cover empty roots, list/map children, whitespace, extra attributes, dispatch precedence and streaming/tree parity. The documentation records the corrected convention and object count.
A whole-archive check of the user's local
common.rpf(size and SHA-256 match the Xbox 1.0.2.1 manifest) found 173 affected objects across 54 classes in 13 documents. Before/after comparison covers all 954 streams / 267 XML payloads: 259 well-formed documents and 8 malformed payloads in both runs; exactly 173 class restorations and zero other data changes. Polymorphic objects increase from 6,490 to 6,663. Only aggregate counts are reported; no game content is included.This is independent of #1557, which changes root filtering and output I/O. Both diffs apply together and the combined reader tests pass.
Tested
python -I tests/test_gamedata_reader.py: 25 passed. Against unpatchedmain, the new empty-object regressions fail (five failing subtests/assertions); compatibility checks still pass.test_gamedata_reader.py, 28 passed.python -m compileall -q make_game.py tools tests,python -I make_game.py --help,git diff --check, andpython -I scripts/check_no_game_data.py tools/gamedata_reader.py tests/test_gamedata_reader.py docs/gamedata.md: passed.python -I scripts/run_semantic_tests.py tests/semantic --jobs 16: 489 files, 6,288 tests, zero failed files (134 s).GPUs tested: n/a (CPU-only XML conversion; Linux x86-64, Python 3.14.9).
AI-assisted: yes (Codex).
Checklist
mainand merges cleanly.@madvillain91 on GitHub · 2026-11-25 13:31 UTC · original · reviewed
Independent Windows 11 26H2 (26300.9711) check at
6e85823daagainst main384abe5b0(PR base98c2f7777), using CPython 3.12.3 (python -I) and Git for Windows 2.56.0.windows.2. Passed test_gamedata_reader.py (25/25 in 1.833s) and test_text_write_line_endings.py (3/3 in 18.589s), with check_no_game_data.py and compileall clean. Verified empty/whitespace-only typed elements preserve {"$type": ...} across roots, lists, keyed maps, and streaming vs whole-tree conversion without affecting other leaf conventions or double-counting inside type handlers. LGTM.@aslan2142 on GitHub · 2026-11-25 17:29 UTC · original
Merged. Thank you, @cheltyi. Empty polymorphic objects keep their class now, and the docs counts are updated.
mainand pass here; the docs, line-ending and CI/ctest registration checks pass, and so does the game-data check.main6ade9f225+6e85823da: the semantic suite passes (490 files, 6,292 tests, 0 files failed);test_gamedata_readerpass; the 14 docs and writer tests pass;check_no_game_data.pyis clean on the 3 changed files.AI-assisted (Claude Code, Claude Opus 5.5).