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

Merged
leonida/mandy
Ch1mpleo merged 1 commit from fix/buffer-store-probe-atomic-json into main 2026-11-28 10:48:23 +00:00

Pull request successfully merged and closed

Ch1mpleo commented 2026-11-25 17:53:26 +00:00

Claimed in the coordination issue as: BUFFER-STORE-PROBE-ATOMIC-JSON (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7170105485)

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)
Claimed in the coordination issue as: BUFFER-STORE-PROBE-ATOMIC-JSON (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7170105485) ### 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)
MSedgeMC approved these changes 2026-11-25 19:10:31 +00:00
MSedgeMC left a comment

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.

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.
sodove commented 2026-11-28 10:11:28 +00:00

#1998 | head cac1f1fe993052690f9f9e0439622162a23ca8d2 | python3 -I tests/test_buffer_store_probe.py -v | red: 10 run, 1 failure, 1 error | green: 13 passed | Red → green

The atomic-write and output-error cases failed on main. The merged test file also picked up additional tests from main.

Pinned main 33db04a7010e81c40a7a6a15624525aa0c4a3a58, merged into this PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.

#1998 | head `cac1f1fe993052690f9f9e0439622162a23ca8d2` | `python3 -I tests/test_buffer_store_probe.py -v` | red: 10 run, 1 failure, 1 error | green: 13 passed | **Red → green** The atomic-write and output-error cases failed on main. The merged test file also picked up additional tests from main. Pinned main `33db04a7010e81c40a7a6a15624525aa0c4a3a58`, merged into this PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. [Batch claim](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7237628300).
DadaCap commented 2026-11-28 10:48:25 +00:00

Merged, thank you @Ch1mpleo!

What it does: tools/buffer_store_probe: write --json report atomically (BUFFER-STORE-PROBE-ATOMIC-JSON)

How it was checked: sodove tested this PR at head cac1f1fe9 on main 33db04a70: the PR's own test fails on main and passes with this PR merged in (his result is linked from the batch summary in #1608). We then re-ran the same test locally on Windows 11 and got the same verdict: on main, red (1 failure, 1 error); with the PR, green (13 OK).

CI: the red jobs on this PR fail the same way on main, or on the older main it was built on (the cs_dpp_cmp.asm translator fixture, since fixed on main, and the Windows runner's Visual Studio setup), so none comes from this change.

Merged one by one with 20 other PRs of the same reviewed batch, pinned to the tested head.

AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

Merged, thank you @Ch1mpleo! **What it does:** tools/buffer_store_probe: write --json report atomically (BUFFER-STORE-PROBE-ATOMIC-JSON) **How it was checked:** sodove tested this PR at head `cac1f1fe9` on main `33db04a70`: the PR's own test fails on main and passes with this PR merged in (his result is linked from the batch summary in #1608). We then re-ran the same test locally on Windows 11 and got the same verdict: on main, red (1 failure, 1 error); with the PR, green (13 OK). **CI:** the red jobs on this PR fail the same way on main, or on the older main it was built on (the `cs_dpp_cmp.asm` translator fixture, since fixed on main, and the Windows runner's Visual Studio setup), so none comes from this change. Merged one by one with 20 other PRs of the same reviewed batch, pinned to the tested head. AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.
Sign in to join this conversation.
No description provided.