gamedata_reader: preserve empty polymorphic objects (GAMEDATA-EMPTY-TYPED-OBJECTS) #1850
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1850
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/gamedata-empty-typed-objects"
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?
Pull request successfully merged and closed
Claimed 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.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).