mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:50:53 +01:00
[PR #1668] gen_gdk_runtime_classes: write --out atomically #1682
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#1682
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/1668
Author: @xel1uz
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/gen-gdk-runtime-classes-atomic-out📝 Commits (1)
f85de7dgen_gdk_runtime_classes: write --out atomically📊 Changes
2 files changed (+110 additions, -3 deletions)
View changed files
➕
tests/test_gen_gdk_runtime_classes.py(+85 -0)📝
tools/gen_gdk_runtime_classes.py(+25 -3)📄 Description
Item ID:
GEN-GDK-RUNTIME-CLASSES-ATOMIC-OUT(new item; the coordination issue #14 is at GitHub's 2,500-comment cap, so the claim lives here)Claimed as:
GEN-GDK-RUNTIME-CLASSES-ATOMIC-OUT- a failed--outwrite truncates an existing file and leaves a partial one behind. Reproduced on42537e7b.What and why
The generator opened its target with
open(a.out, "w")and thenjson.dumped into it, so the previous table was truncated the moment the file was opened; a short or failed write left partial JSON behind.The table is now written to a temp file in the destination directory and published with
os.replace; failures clean the temp file up and keep the previous table.Tested
pytest tests/test_gen_gdk_runtime_classes.py -qwith the tool at42537e7b: 1 failed, 2 passed.With this branch: 3 passed.
Repro with 128 synthetic classes, a 14-byte existing output and
ulimit -f 1: the original grew the file 14 -> 1024 bytes (partial JSON); with this patch it stayed 14 bytes and no temp file remained.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.