mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:50:52 +01:00
[PR #1850] [MERGED] gamedata_reader: preserve empty polymorphic objects (GAMEDATA-EMPTY-TYPED-OBJECTS) #1862
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1862
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1850
Author: @cheltyi
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:fix/gamedata-empty-typed-objects📝 Commits (1)
6e85823gamedata_reader: preserve empty polymorphic objects📊 Changes
3 files changed (+70 additions, -3 deletions)
View changed files
📝
docs/gamedata.md(+5 -2)📝
tests/test_gamedata_reader.py(+61 -0)📝
tools/gamedata_reader.py(+4 -1)📄 Description
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.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.