mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:20:53 +01:00
[PR #1811] tools: add atomic I/O, input-overwrite protection and CLI tests for gen_bcpack_runtime_tables.py #1824
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#1824
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/1811
Author: @kirigayakazima
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/gen-bcpack-tables-safety📝 Commits (1)
8dfb5cdtools: add atomic I/O, input-overwrite protection and CLI tests for gen_bcpack_runtime_tables.py📊 Changes
2 files changed (+250 additions, -18 deletions)
View changed files
➕
tests/test_gen_bcpack_runtime_tables.py(+150 -0)📝
tools/gen_bcpack_runtime_tables.py(+100 -18)📄 Description
Claimed in the coordination issue as: GEN-BCPACK-TABLES-ATOMIC-IO-AND-CLI-TESTS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162264899)
What and why
generate) and binary (write_profile) outputs intools/gen_bcpack_runtime_tables.pythrough_atomic_write()(tempfile.mkstempbesideos.path.realpath(output), parent directory creation, explicitnewline="\n"for text,os.fsync,published_mode, andreplace_retry) so write failures never truncate existing files._validate_output_path) to reject empty/whitespace paths, trailing separators, existing directories, and non-directory parent components cleanly before writing.--profile JSON OUTwhenOUTaliases the source JSON (orbc6h.json/bc7.jsonin a source directory) viasame_report_path.main(argv=None)to reject combining positional output with--profile, catch(OSError, ValueError, KeyError, TypeError, RecursionError)with exit2instead of tracebacks, and broaden the stdoutreconfigureguard to(AttributeError, ValueError, OSError).tests/test_gen_bcpack_runtime_tables.py.Tested
python -I tests/test_gen_bcpack_runtime_tables.py -v->Ran 6 tests in 0.629s,OK(verified in a detachedupstream/mainworktree that all new tests fail before the fix:FAILED (failures=8)).python -I tests/test_ci_registration.py->Ran 16 tests in 4.413s,OK.python -I tests/test_text_write_line_endings.py->Ran 3 tests in 12.495s,OK.python -I scripts/check_no_game_data.py tools/gen_bcpack_runtime_tables.py tests/test_gen_bcpack_runtime_tables.py-> exit0.python -I -m compileall -q tools/gen_bcpack_runtime_tables.py tests/test_gen_bcpack_runtime_tables.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.