tools/ps_helper_probe: validate --json upfront and write atomically (PS-HELPER-PROBE-ATOMIC-JSON) #1997

Merged
leonida/mandy
Ch1mpleo merged 2 commits from fix/ps-helper-probe-atomic-json into main 2026-11-28 10:48:57 +00:00

Pull request successfully merged and closed

Ch1mpleo commented 2026-11-25 17:52:16 +00:00

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

What and why

Adds \ alidate_json_path\ and atomic \write_json_report\ (with \NamedTemporaryFile(..., newline="\n")\ +
eplace_retry\ and temp-file cleanup on failure) to \ ools/ps_helper_probe.py, validating --json\ upfront before \measure(), plus regression tests in \ ests/test_ps_helper_probe.py.

Tested

  • \python -m compileall -q tools/ps_helper_probe.py tests/test_ps_helper_probe.py\ — exit 0.
  • \python -I tests/test_ps_helper_probe.py\ — 12 tests (10 passed, 2 hardware tests skipped; Windows 11 x64, Python 3.14.7).
  • \python -I scripts/check_no_game_data.py tools/ps_helper_probe.py tests/test_ps_helper_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: PS-HELPER-PROBE-ATOMIC-JSON (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7170082835) ### What and why Adds \ alidate_json_path\ and atomic \write_json_report\ (with \NamedTemporaryFile(..., newline="\n")\ + \ eplace_retry\ and temp-file cleanup on failure) to \ ools/ps_helper_probe.py\, validating \--json\ upfront before \measure()\, plus regression tests in \ ests/test_ps_helper_probe.py\. ### Tested - \python -m compileall -q tools/ps_helper_probe.py tests/test_ps_helper_probe.py\ — exit 0. - \python -I tests/test_ps_helper_probe.py\ — 12 tests (10 passed, 2 hardware tests skipped; Windows 11 x64, Python 3.14.7). - \python -I scripts/check_no_game_data.py tools/ps_helper_probe.py tests/test_ps_helper_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 reviewed 2026-11-25 18:58:10 +00:00
MSedgeMC left a comment
No description provided.
Verified on the PR branch: both NEW tests pass individually (tests.test_ps_helper_probe.CliAndJsonTests.test_validate_json_path_and_upfront_refusal and .test_atomic_json_write_and_replace_failure_preserves_existing -> 1 test OK each). The upfront --json path validation and staging+os.replace write are sound. However the full branch suite is red: python3 -m unittest discover -s tests -p 'test_ps_helper_probe*.py' -> 12 tests, 1 failure in test_symlinked_json_updates_target_in_place (os.path.islink false). That test is NOT on current main (branch carries ~29 older commits); main's own 6 tests pass with 1 skip. Please rebase onto current main and confirm green before merge — I'm not approving a red branch.
Ch1mpleo commented 2026-11-25 19:37:17 +00:00

Thanks @MSedgeMC — \write_json_report\ now delegates directly to _write_json_atomic\ so symlinked --json\ targets are updated in place via \os.path.realpath. Re-verified: \python -I tests/test_ps_helper_probe.py\ (12 tests: 10 passed, 2 hardware tests skipped on Windows).

Thanks @MSedgeMC — \write_json_report\ now delegates directly to \_write_json_atomic\ so symlinked \--json\ targets are updated in place via \os.path.realpath\. Re-verified: \python -I tests/test_ps_helper_probe.py\ (12 tests: 10 passed, 2 hardware tests skipped on Windows).
sodove commented 2026-11-28 10:11:24 +00:00

#1997 | head d198dd508ecf9cb9e64ca6141d5fe5efc38272b8 | python3 -I tests/test_ps_helper_probe.py -v | red: 12 run, 2 errors, 1 skip | green: 11 passed, 1 skipped | Baseline exception → pass

The baseline raised errors in the new JSON-output tests. The optional live pixel-shader hardware-oracle case skipped on both sides in WSL. The reported pass covers the remaining checks.

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.

#1997 | head `d198dd508ecf9cb9e64ca6141d5fe5efc38272b8` | `python3 -I tests/test_ps_helper_probe.py -v` | red: 12 run, 2 errors, 1 skip | green: 11 passed, 1 skipped | **Baseline exception → pass** The baseline raised errors in the new JSON-output tests. The optional live pixel-shader hardware-oracle case skipped on both sides in WSL. The reported pass covers the remaining checks. 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:58 +00:00

Merged, thank you @Ch1mpleo!

What it does: tools/ps_helper_probe: validate --json upfront and write atomically (PS-HELPER-PROBE-ATOMIC-JSON)

How it was checked: sodove tested this PR at head d198dd508 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 (2 errors); with the PR, green (12 OK, 2 skips).

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/ps_helper_probe: validate --json upfront and write atomically (PS-HELPER-PROBE-ATOMIC-JSON) **How it was checked:** sodove tested this PR at head `d198dd508` 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 (2 errors); with the PR, green (12 OK, 2 skips). **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.