tools/buffer_store_probe: write --json report atomically (BUFFER-STORE-PROBE-ATOMIC-JSON) #1998

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

@⁠Ch1mpleo on GitHub · 2026-11-25 17:53 UTC · original
Ch1mpleo:fix/buffer-store-probe-atomic-json → main · +30 −2 · 2 files · 1 commits · open

Claimed in the coordination issue as: BUFFER-STORE-PROBE-ATOMIC-JSON (#1608)

What and why

Updates \ ools/buffer_store_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. Adds a regression test in \ ests/test_buffer_store_probe.py.

Tested

  • \python -m compileall -q tools/buffer_store_probe.py tests/test_buffer_store_probe.py\ — exit 0.
  • \python -I tests/test_buffer_store_probe.py\ — 10 tests, OK (Windows 11 x64, Python 3.14.7).
  • \python -I scripts/check_no_game_data.py tools/buffer_store_probe.py tests/test_buffer_store_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:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1998) `Ch1mpleo:fix/buffer-store-probe-atomic-json` → `main` · +30 −2 · 2 files · 1 commits · open Claimed in the coordination issue as: BUFFER-STORE-PROBE-ATOMIC-JSON (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why Updates \ ools/buffer_store_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. Adds a regression test in \ ests/test_buffer_store_probe.py\. ### Tested - \python -m compileall -q tools/buffer_store_probe.py tests/test_buffer_store_probe.py\ — exit 0. - \python -I tests/test_buffer_store_probe.py\ — 10 tests, OK (Windows 11 x64, Python 3.14.7). - \python -I scripts/check_no_game_data.py tools/buffer_store_probe.py tests/test_buffer_store_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:17 +00:00
Author
Owner

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

Verified on the PR branch: python3 -m unittest discover -s tests -p 'test_buffer_store_probe*.py' -> 10 tests OK, including the new atomic-write/replace-failure preservation test and the retargeted disk-full OSError test. write_json_report now stages through NamedTemporaryFile and os.replace, so a failure leaves any previous report untouched. Advisory: branch carries ~29 older commits not on current main; rebase before merge for clean history.

**@⁠MSedgeMC** on GitHub · 2026-11-25 19:10 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1998#pullrequestreview-6063455616) · **approved these changes** Verified on the PR branch: python3 -m unittest discover -s tests -p 'test_buffer_store_probe*.py' -> 10 tests OK, including the new atomic-write/replace-failure preservation test and the retargeted disk-full OSError test. write_json_report now stages through NamedTemporaryFile and os.replace, so a failure leaves any previous report untouched. Advisory: branch carries ~29 older commits not on current main; rebase before merge for clean history.
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/1998/head:github-bot/gh-1998'
git switch 'github-bot/gh-1998'

Merge

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