page_index: handle mixed None/int versions, guard scan_rpf limit/listdir errors, and write JSON/CSV atomically (PAGE-INDEX-SUMMARY-AND-ATOMIC-IO) #1566
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!1566
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/page-index-summary-and-atomic-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
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)).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)