mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:50:52 +01:00
[PR #1566] page_index: handle mixed None/int versions, guard scan_rpf limit/listdir errors, and write JSON/CSV atomically (PAGE-INDEX-SUMMARY-AND-ATOMIC-IO) #1590
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#1590
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/1566
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/page-index-summary-and-atomic-io📝 Commits (1)
83f4e8apage_index: handle mixed None/int versions, guard scan_rpf limit and listdir errors, and write JSON/CSV atomically📊 Changes
2 files changed (+120 additions, -7 deletions)
View changed files
📝
tests/test_page_index.py(+75 -0)📝
tools/page_index.py(+45 -7)📄 Description
Item ID:
PAGE-INDEX-SUMMARY-AND-ATOMIC-IO(new item; coordination issue #14 is at GitHub's 2,500-comment cap with no open successor at PR time — confirmed 0 open PRs touchtools/page_index.py)Summary
TypeErrorinsummarise()on mixedNoneandintversions:sorted({p["version"] for p in pages})crashed whenever pages contained bothNoneand integer versions; count in one pass withCounterand sort with(v is None, 0 if v is None else v).limitinscan_rpf(): previouslylimit=0was falsy and scanned the whole archive, and negativelimitsilently scanned nothing; nowlimit is not None and limit < 1raisesValueError("limit must be at least 1")matching the CLI validator.OSErroronos.listdir(a.source)during overwrite checking inmain(): an unreadable carve directory with an existing output file previously raised an uncaughtPermissionErrortraceback instead of exiting 2 cleanly.NamedTemporaryFile+file_mode.published_mode+replace_retry.replace, enforceallow_nan=Falseand trailing LF\non JSON, and clean up temporary files on failure so existing outputs are never truncated.Testing
python3 -W error -I tests/test_page_index.py -v: 25/25 passedpython3 -W error -I tests/test_text_write_line_endings.py -v: 3/3 passedpython3 -I scripts/check_no_game_data.py tools/page_index.py tests/test_page_index.py: passedpython3 -m compileall -q make_game.py tools tests: passedmain:tools/page_index.py: all 4 new tests fail (FAILED (failures=3, errors=2)).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.