tools/f16_widen_probe: write --json report atomically (F16-WIDEN-PROBE-ATOMIC-JSON) #2004

Open
github-bot wants to merge 1 commit from github-bot/gh-2004 into main AGit
Owner

@⁠Ch1mpleo on GitHub · 2026-11-25 17:56 UTC · original
Ch1mpleo:fix/f16-widen-probe-atomic-json → main · +35 −2 · 2 files · 1 commits · open

Claimed in the coordination issue as: F16-WIDEN-PROBE-ATOMIC-JSON (#1608)

What and why

Updates \ ools/f16_widen_probe.py::write_json_report\ to write via a sibling \ empfile.NamedTemporaryFile(..., encoding="utf-8", newline="\n")\ and \os.replace\ (with temp-file cleanup on failure), so an existing report is never truncated on error. Updates the OSError test and adds an atomic-replace regression test in \ ests/test_f16_widen_probe.py.

Tested

  • \python -m compileall -q tools/f16_widen_probe.py tests/test_f16_widen_probe.py\ — exit 0.
  • \python -I tests/test_f16_widen_probe.py\ — 12 tests, OK (Windows 11 x64, Python 3.14.7).
  • \python -I scripts/check_no_game_data.py tools/f16_widen_probe.py tests/test_f16_widen_probe.py\ — exit 0.

GPUs tested: n/a (CPU-only Python tool & unit tests)

AI-assisted: yes

Checklist

  • Based on current \main\ and merges cleanly (a conflicting pull request is labeled
    eeds rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of \docs/design.md, with how it was confirmed. (n/a — no translator change)
**@⁠Ch1mpleo** on GitHub · 2026-11-25 17:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2004) `Ch1mpleo:fix/f16-widen-probe-atomic-json` → `main` · +35 −2 · 2 files · 1 commits · open Claimed in the coordination issue as: F16-WIDEN-PROBE-ATOMIC-JSON (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why Updates \ ools/f16_widen_probe.py::write_json_report\ to write via a sibling \ empfile.NamedTemporaryFile(..., encoding="utf-8", newline="\n")\ and \os.replace\ (with temp-file cleanup on failure), so an existing report is never truncated on error. Updates the OSError test and adds an atomic-replace regression test in \ ests/test_f16_widen_probe.py\. ### Tested - \python -m compileall -q tools/f16_widen_probe.py tests/test_f16_widen_probe.py\ — exit 0. - \python -I tests/test_f16_widen_probe.py\ — 12 tests, OK (Windows 11 x64, Python 3.14.7). - \python -I scripts/check_no_game_data.py tools/f16_widen_probe.py tests/test_f16_widen_probe.py\ — exit 0. GPUs tested: n/a (CPU-only Python tool & unit tests) AI-assisted: yes ### Checklist - [x] Based on current \main\ and merges cleanly (a conflicting pull request is labeled \ eeds rebase\). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of \docs/design.md\, with how it was confirmed. (n/a — no translator change)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:14:29 +00:00
Author
Owner

@⁠MSedgeMC on GitHub · 2026-11-25 18:56 UTC · original · approved these changes

Verified on the PR branch: python3 -m unittest discover -s tests -p 'test_f16_widen*.py' -> 12 tests OK, including the new atomic-write / replace-failure preservation test. write_json_report now stages via NamedTemporaryFile in the target directory and os.replace, with cleanup on failure; a failed replace leaves the existing report intact. This fixes the real disk-full truncation issue. Advisory: this branch carries ~29 commits not on current main (older merges), so a rebase before merge will keep history clean — but the branch is green as-is.

**@⁠MSedgeMC** on GitHub · 2026-11-25 18:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2004#pullrequestreview-6063271106) · **approved these changes** Verified on the PR branch: python3 -m unittest discover -s tests -p 'test_f16_widen*.py' -> 12 tests OK, including the new atomic-write / replace-failure preservation test. write_json_report now stages via NamedTemporaryFile in the target directory and os.replace, with cleanup on failure; a failed replace leaves the existing report intact. This fixes the real disk-full truncation issue. Advisory: this branch carries ~29 commits not on current main (older merges), so a rebase before merge will keep history clean — but the branch is green as-is.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2004/head:github-bot/gh-2004'
git switch 'github-bot/gh-2004'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2004'
git switch 'github-bot/gh-2004'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2004'
git switch 'github-bot/gh-2004'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2004'
git switch 'main'
git merge --squash 'github-bot/gh-2004'
git switch 'main'
git merge --ff-only 'github-bot/gh-2004'
git switch 'main'
git merge 'github-bot/gh-2004'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.