mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:40:52 +01:00
[PR #1669] sandbox_scene: write --out atomically #1683
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#1683
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/1669
Author: @xel1uz
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/sandbox-scene-atomic-out📝 Commits (1)
24278bbsandbox_scene: write --out atomically📊 Changes
2 files changed (+103 additions, -4 deletions)
View changed files
📝
tests/test_sandbox_scene.py(+76 -0)📝
tools/sandbox_scene.py(+27 -4)📄 Description
Item ID:
SANDBOX-SCENE-ATOMIC-OUT(new item; the coordination issue #14 is at GitHub's 2,500-comment cap, so the claim lives here)Claimed as:
SANDBOX-SCENE-ATOMIC-OUT- a failed--outwrite truncates an existing file and leaves a partial one behind. Reproduced on42537e7b.What and why
The scene was written straight to the target with
open(args.out, "wb"), so an interrupted or failed write left a half-written binary and the previous baseline was lost.The scene is now written to a temp file in the destination directory and moved into place with
os.replace, which also keeps the target's existing permissions; a failure removes the temp file and leaves the previous output intact.Tested
pytest tests/test_sandbox_scene.py -qwith the tool at42537e7b: 1 failed, 14 passed, 5 subtests passed - the failure istest_failed_write_preserves_existing_output.With this branch: 15 passed, 5 subtests passed.
Repro with
ulimit -f 1: exit 2 and the file went 20 -> 1024 bytes on the original, versus 20 -> 20 bytes here with no temp file left. A successful run produces the same 2256 bytes (identical SHA-256) before and after.git diff --checkclean;python3 -I scripts/check_no_game_data.pyclean on the changed files.GPUs tested: n/a - CPU only, no Vulkan device involved.
AI-assisted: Yes.
Checklist
main(42537e7b) and merges cleanly.docs/design.md- not applicable, no translator change.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.