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

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

Pull request successfully merged and closed

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

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

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)
Claimed in the coordination issue as: F16-WIDEN-PROBE-ATOMIC-JSON (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7170181036) ### 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)
MSedgeMC approved these changes 2026-11-25 18:56:34 +00:00
MSedgeMC left a comment

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.

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

#2004 | head c97e981f3661a5d1a64b29277ca53e75795924c8 | python3 -I tests/test_f16_widen_probe.py -v | red: 12 run, 1 failure, 1 error | green: 15 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.

#2004 | head `c97e981f3661a5d1a64b29277ca53e75795924c8` | `python3 -I tests/test_f16_widen_probe.py -v` | red: 12 run, 1 failure, 1 error | green: 15 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:16 +00:00

Merged, thank you @Ch1mpleo!

What it does: tools/f16_widen_probe: write --json report atomically (F16-WIDEN-PROBE-ATOMIC-JSON)

How it was checked: sodove tested this PR at head c97e981f3 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 (15 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/f16_widen_probe: write --json report atomically (F16-WIDEN-PROBE-ATOMIC-JSON) **How it was checked:** sodove tested this PR at head `c97e981f3` 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 (15 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.