mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:50:51 +01:00
[PR #1852] [MERGED] tools/int_hw_probe: write --json atomically and reject trailing-separator paths #1864
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#1864
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/1852
Author: @kirigayakazima
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:fix/int-hw-probe-safety📝 Commits (1)
71c8683tools/int_hw_probe: write --json atomically and reject trailing-separator paths📊 Changes
2 files changed (+86 additions, -7 deletions)
View changed files
📝
tests/test_int_hw_probe.py(+53 -1)📝
tools/int_hw_probe.py(+33 -6)📄 Description
Claimed in the coordination issue as: INT-HW-PROBE-ATOMIC-JSON-AND-PATH-SAFETY (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163274170)
What and why
os.sep/os.altsep) intools/int_hw_probe.py's_validate_json_out()beforeos.path.abspath()strips them, so directory-like--jsonpaths fail upfront with exit2.--jsonoutput atomically in_write_json_atomic()(tempfile.mkstempbesideos.path.realpath(path), explicitnewline="\n", trailing\n,os.fsync,published_mode, andreplace_retry.replace), preserving any existing file and cleaning up staging files on write/replace failure.tests/test_int_hw_probe.py.Tested
python -I tests/test_int_hw_probe.py -v->Ran 13 tests in 2.008s,OK.upstream/main(98c2f777) baseline worktree with updatedtests/test_int_hw_probe.py->Ran 13 tests in 2.450s,FAILED (failures=3, errors=1).python -I tests/test_ci_registration.py->Ran 16 tests in 6.463s,OK.python -I tests/test_text_write_line_endings.py->Ran 3 tests in 14.893s,OK.python -I scripts/check_no_game_data.py tools/int_hw_probe.py tests/test_int_hw_probe.py,python -I -m compileall -q tools/int_hw_probe.py tests/test_int_hw_probe.py, andgit diff --check-> exit0.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.