tools: handle corrupt XBCH zlib, case-insensitive extensions and index errors in pal_stages.py #1807
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!1807
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1807/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?
@kirigayakazima on GitHub · 2026-11-25 12:21 UTC · original
kirigayakazima:fix/pal-stages-safety→main· +61 −5 · 2 files · 1 commits · merged 2026-11-25 17:29 UTCClaimed in the coordination issue as: PAL-STAGES-ZLIB-ERROR-AND-CASE-EXTENSIONS (#1608)
What and why
zlib.errorintools/pal_stages.py'sblob_rows()so a DXBC container with a corruptXBCHzlib stream is recorded as an error row instead of aborting the entire directory run with an unhandled traceback..fssmand.dxbcextensions case-insensitively infiles_of()and deduplicate bare FSSM vs container stems withos.path.normcase.fssm_header.stage_index()inmain()againstRecursionErroron malformed/deeply nestedindex.json.tests/test_pal_stages.py.Tested
python -I tests/test_pal_stages.py -v->Ran 21 tests in 0.391s,OK(verified in a detachedupstream/mainworktree that all three new tests fail before the fix:FAILED (failures=1, errors=2)).python -I tests/test_ci_registration.py->Ran 16 tests in 4.462s,OK.python -I tests/test_text_write_line_endings.py->Ran 3 tests in 12.612s,OK.python -I scripts/check_no_game_data.py tools/pal_stages.py tests/test_pal_stages.py-> exit0.python -I -m compileall -q tools/pal_stages.py tests/test_pal_stages.pyandgit diff --check-> clean.GPUs tested: n/a (CPU/stdlib Python tests on Windows 11 x64)
AI-assisted: yes
Checklist
needs rebase).@madvillain91 on GitHub · 2026-11-25 12:58 UTC · original · reviewed
Independent Windows 11 26H2 (26300.9711) check at
abe47df11against main98c2f7777(PR base0d80bc5df), using CPython 3.12.3 (python -I) and Git for Windows 2.56.0.windows.2. All 40 tests passed across test_pal_stages.py (21/21 in 0.589s), test_ci_registration.py (16/16 in 7.577s), and test_text_write_line_endings.py (3/3 in 16.880s), with check_no_game_data.py and compileall clean. Verified Windows os.path.normcase stem deduplication for mixed-case .FSSM/.DXBC extensions, graceful zlib.error row reporting on corrupt XBCH payloads, and RecursionError handling around fssm_header.stage_index(). LGTM.@DeadlyChirp on GitHub · 2026-11-25 15:52 UTC · original
Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.
python -m pytest -q tests/test_pal_stages.py:(AI-assisted test run; output checked by hand.)
@MSedgeMC on GitHub · 2026-11-25 17:24 UTC · original · approved these changes
Verified on the PR branch: python3 -m unittest tests.test_pal_stages -v -> 21 tests OK, including new cases for corrupt XBCH zlib producing an error row instead of crashing, case-insensitive extension handling, and deduplication. The tool now reports bad payloads as data rather than aborting the whole scan. Python-only, no game data.
@aslan2142 on GitHub · 2026-11-25 17:29 UTC · original
Merged. Thank you, @kirigayakazima. A corrupt XBCH stream no longer aborts the whole directory run, and extensions match case-insensitively.
mainand pass here; the docs, line-ending and CI/ctest registration checks pass, and so does the game-data check.mainaeec1ddc6+abe47df11: the semantic suite passes (490 files, 6,292 tests, 0 files failed);test_pal_stagespass; the 14 docs and writer tests pass;check_no_game_data.pyis clean on the 2 changed files.AI-assisted (Claude Code, Claude Opus 5.5).