character_textures: fix None/zero/dict-param classification, unknown_slots count, and atomic I/O (CHARACTER-TEXTURES-CLASSIFICATION-AND-IO) #1553
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!1553
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/character-textures-classification-io"
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
What
Fix four classification/summary bugs and harden
--json/--csvI/O intools/character_textures.py:"None"(_texture_name):Noneentry),_first(...)returnedNoneand_texture_name(None)ranstr(None)->"None"instead of"-". Return"-"whenvalue is None.0discarded (classify_material):_first()explicitly preserves0andFalseas values, not gaps, but_first(material, MATERIAL_NAME_KEYS) or f"material[{index}]"discarded0and renamed it to"material[0]". Checkis not Nonebefore falling back.Texturesclobbered explicit lowercaseparam/slot/hash(texture_bindings):binding.setdefault("Param", slot)inserted"Param"(which precedes"param"/"slot"/"hash"inPARAM_KEYS) even when the entry dict already carried a lowercase slot key, overwriting the entry's own slot with the outer dict key. Only set"Param"when_first(binding, PARAM_KEYS) is None.summary["unknown_slots"]missed bindings without a validParam(build_report):b["role"].startswith("unknown 0x")skipped bindings with missing/malformedParam(role == "unknown"). Count both"unknown"and"unknown 0x...".--json/--csvvalidation & atomic writes (write_json,write_csv,main):--json/--csvpaths viaparser.error(...)instead of silently ignoring""or creating a whitespace-named file (" ").allow_nan=False, trailing"\n") and CSV (newline="") atomically through sibling temp files withfile_mode.published_modeandreplace_retry.replace, preserving existing files on failure.argv=Noneinmain(argv=None).Claimed in the coordination issue as
CHARACTER-TEXTURES-CLASSIFICATION-AND-IO— verified 0 open PRs and 0 prior claims; unable to post a comment on#14because GitHub disabled commenting once#14reached its 2,500-comment cap (and no successor"Coordinating who works on what"issue is open yet).Testing
python3 -I -W error tests/test_character_textures.py -v: 18/18 OK (including 3 new regression tests).python3 -I tests/test_text_write_line_endings.py: 3/3 OK.python3 -I scripts/check_no_game_data.py tools/character_textures.py tests/test_character_textures.py: clean.python3 -m compileall -q tools/character_textures.py tests/test_character_textures.py: clean.Mutation check against unpatched
main:tools/character_textures.py: all 3 new tests fail onmain(FAILED (failures=6, errors=1)).AI-assisted: yes
GPUs tested: none (CPU-only JSON/CSV texture classification tests on macOS; no GPU or game files needed)
Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 19 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)