mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:45:53 +01:00
[PR #1567] ptr_truncation_census: guard output paths/overwrites, handle scan/listing OSError, and write JSON atomically (PTR-TRUNCATION-CENSUS-GUARDS-AND-IO) #1591
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#1591
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/1567
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/ptr-truncation-census-guards-and-io📝 Commits (1)
9dcc3e7ptr_truncation_census: guard output overwrites/paths, catch OSError in scan_one/listings, and write JSON atomically📊 Changes
2 files changed (+163 additions, -10 deletions)
View changed files
📝
tests/test_ptr_truncation_census.py(+86 -0)📝
tools/ptr_truncation_census.py(+77 -10)📄 Description
Item ID:
PTR-TRUNCATION-CENSUS-GUARDS-AND-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/ptr_truncation_census.py)Summary
--jsonand--index-outbefore scanning: reject empty/whitespace paths (previously""was silently ignored and" "created a literal" "file in cwd), existing directories, missing parent directories, and any output path that aliasessrc, a scanned.slisting,<root>/index.json,<root>/<name>.dxbc, or adjacentnative_paths(.fssm/.code/.json).--jsonand--index-outatomically: stage viaNamedTemporaryFile+file_mode.published_mode+replace_retry.replace, enforceallow_nan=Falseand trailing LF\n, and clean up temp files on failure so existing outputs are never truncated.OSErrorcleanly inscan_one()andmain(): record unreadable listings ascannot read listing: <ExcType>(never leaking the filename or path into aggregate counts) instead of aborting the pool, and exit 2 cleanly whenlistings(src)raisesOSError.summarise()["not_reached"]: sort by(-count, error)instead of insertion-order-dependentCounter.most_common().Testing
python3 -W error -I tests/test_ptr_truncation_census.py -v: 16/16 passedpython3 -W error -I tests/test_text_write_line_endings.py -v: 3/3 passedpython3 -I scripts/check_no_game_data.py tools/ptr_truncation_census.py tests/test_ptr_truncation_census.py: passedpython3 -m compileall -q make_game.py tools tests: passedmain:tools/ptr_truncation_census.py: all 5 new/updated tests fail (FAILED (failures=19, errors=2)).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.