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

Merged
Ch1mpleo merged 1 commit from upstream-pr/1998 into main 2026-11-28 10:48:23 +00:00
Ch1mpleo commented 2026-11-25 17:53:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Ch1mpleo on 2026-11-25T17:53:26Z.


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)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5496392099 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1998). Originally posted by [Ch1mpleo](https://github.com/Ch1mpleo) on 2026-11-25T17:53:26Z. --- 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 commented 2026-11-25 19:10:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MSedgeMC on 2026-11-25T19:10:31Z.

Review: APPROVED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6063455616 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1998#pullrequestreview-6063455616). Originally posted by [MSedgeMC](https://github.com/MSedgeMC) on 2026-11-25T19:10:31Z. **Review:** APPROVED --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T10:11:28Z.


#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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237731730 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1998#issuecomment-7237731730). Originally posted by [sodove](https://github.com/sodove) on 2026-11-28T10:11:28Z. --- #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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T10:48:25Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238134439 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1998#issuecomment-7238134439). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T10:48:25Z. --- 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 reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1998
No description provided.