mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:05:53 +01:00
[PR #2258] gamedata_blobs: fix unshipped count, index type checks, and atomic JSON #2263
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#2263
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/2258
Author: @kirigayakazima
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/gamedata-blobs-safety📝 Commits (1)
d1545dfgamedata_blobs: fix unshipped count, index type checks, and atomic JSON📊 Changes
2 files changed (+196 additions, -13 deletions)
View changed files
📝
tests/test_gamedata_blobs.py(+143 -0)📝
tools/gamedata_blobs.py(+53 -13)📄 Description
Claimed in the coordination issue as: GAMEDATA-BLOBS-UNSHIPPED-OVERLAP-INDEX-TYPES-AND-ATOMIC-JSON (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7189816855)
What and why
unshippedoverlap double-subtraction incross_reference_sgd5()(tools/gamedata_blobs.py) so preload-list entries present in bothdb0anddb1are counted accurately viasum(1 for s in stems if s not in db0_set and s not in db1_set)instead ofp["entries"] - len(in_db0) - len(in_db1).check_carve_index()to convertUnicodeDecodeErrorandRecursionErrorfromjson.load()into single-lineValueErrordiagnostics and requiretype(row.get("off")) is intandtype(row.get("stored")) is int(non-bool,>= 0).index.jsonacrossmain()andread_payloads(..., _checked_index=is_dir), reject trailing/or\--jsondirectory paths incheck_report_path()and non-file--shadersupfront beforeread_payloads(), and catchRecursionErrorcleanly inmain().--jsonoutput atomically via_write_json_atomic()(staging next toos.path.realpath(out_path), trailing LF\n,os.fsync(), preserving permissions withpublished_mode(), publishing viareplace_retry.replace(), and unlinking.blobs-*.tmpfiles on failure).GamedataBlobsSafetyTeststotests/test_gamedata_blobs.py(without overlapping#1269's lines) covering overlapunshipped,bool/negative/strindex types,RecursionError, singleindex.jsonparse, early CLI validation, and atomic JSON write/failure rollback.Tested
python -I tests/test_gamedata_blobs.py -v->Ran 14 tests in 1.178s(OK).upstream/maina73a57e1with updatedtests/test_gamedata_blobs.pycopied into detached worktree):Ran 14 tests in 1.119s(FAILED (failures=10)).python -I tests/test_ci_registration.py(Ran 16 tests in 5.560s,OK),python -I tests/test_text_write_line_endings.py(Ran 3 tests in 13.499s,OK),python -I scripts/check_no_game_data.py(exit 0),python -I -m compileall -q tools/gamedata_blobs.py tests/test_gamedata_blobs.py(exit 0),git diff --check(exit 0).GPUs tested: n/a (synthetic carve/RPF/SGD5 fixtures and atomic JSON output tests)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.