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

Open
github-bot wants to merge 2 commits from github-bot/gh-1997 into main AGit
Owner

@⁠Ch1mpleo on GitHub · 2026-11-25 17:52 UTC · original
Ch1mpleo:fix/ps-helper-probe-atomic-json → main · +67 −4 · 2 files · 2 commits · open

Claimed in the coordination issue as: PS-HELPER-PROBE-ATOMIC-JSON (#1608)

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)
**@⁠Ch1mpleo** on GitHub · 2026-11-25 17:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1997) `Ch1mpleo:fix/ps-helper-probe-atomic-json` → `main` · +67 −4 · 2 files · 2 commits · open Claimed in the coordination issue as: PS-HELPER-PROBE-ATOMIC-JSON (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### 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)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:14:16 +00:00
Author
Owner

@⁠MSedgeMC on GitHub · 2026-11-25 18:58 UTC · original · reviewed

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.

**@⁠MSedgeMC** on GitHub · 2026-11-25 18:58 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1997#pullrequestreview-6063291483) · **reviewed** 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.
Author
Owner

@⁠Ch1mpleo on GitHub · 2026-11-25 19:37 UTC · original

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

**@⁠Ch1mpleo** on GitHub · 2026-11-25 19:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1997#issuecomment-7172547274) 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).
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/1997/head:github-bot/gh-1997'
git switch 'github-bot/gh-1997'

Merge

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