mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:55:52 +01:00
[PR #1817] [MERGED] tools: make gamedata_sps1.py --json writes atomic, validate paths and avoid duplicate index read #1829
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#1829
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/1817
Author: @kirigayakazima
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:fix/gamedata-sps1-atomic-json📝 Commits (1)
def89c3tools: make gamedata_sps1.py --json writes atomic, validate paths and avoid duplicate index read📊 Changes
2 files changed (+176 additions, -6 deletions)
View changed files
➕
tests/test_gamedata_sps1_atomic.py(+131 -0)📝
tools/gamedata_sps1.py(+45 -6)📄 Description
Claimed in the coordination issue as: GAMEDATA-SPS1-ATOMIC-JSON-AND-PATH-SAFETY (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162409595)
What and why
tools/gamedata_sps1.py--jsonreports atomically via_write_json_atomic()(tempfile.mkstempbesideos.path.realpath(path), explicitnewline="\n", trailing\n,os.fsync,published_mode, andreplace_retry), preserving any existing file and cleaning up staging files on write/replace failure.--jsonpaths upfront viaap.error(...)(exit2).rowsinread_payloads(target, rows=None)so directory CLI runs reuse the already-parsedindex.jsonrows instead of reading and parsingindex.jsontwice.tests/test_gamedata_sps1_atomic.py(leavingtests/test_gamedata_sps1.pyuntouched).Tested
python -I tests/test_gamedata_sps1.py -v->Ran 7 tests in 0.884s,OK.python -I tests/test_gamedata_sps1_atomic.py -v->Ran 5 tests in 0.048s,OK(verified in a detachedupstream/mainworktree that the new regression suite fails before the fix:FAILED (failures=7)).python -I tests/test_ci_registration.py->Ran 16 tests in 4.722s,OK.python -I tests/test_text_write_line_endings.py->Ran 3 tests in 12.631s,OK.python -I scripts/check_no_game_data.py tools/gamedata_sps1.py tests/test_gamedata_sps1_atomic.py-> exit0.python -I -m compileall -q tools/gamedata_sps1.py tests/test_gamedata_sps1_atomic.pyandgit diff --check-> clean.GPUs tested: n/a (CPU/stdlib Python tests on Windows 11 x64)
AI-assisted: yes
Checklist
needs rebase).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.