tools/script_qtable: add empty --json and atomic write regression tests (SCRIPT-QTABLE-ATOMIC-JSON) #2005

Merged
Ch1mpleo merged 2 commits from upstream-pr/2005 into main 2026-11-28 10:58:58 +00:00
Ch1mpleo commented 2026-11-25 17:57:18 +00:00 (Migrated from github.com)

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


Claimed in the coordination issue as: SCRIPT-QTABLE-ATOMIC-JSON (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7170215117)

What and why

Adds \ est_empty_json_rejected_and_atomic_write_preserves_existing\ to \ ests/test_script_qtable.py\ (and _write_json_atomic\ helper in \ ools/script_qtable.py) verifying empty --json\ refusal and atomic JSON write preservation on
eplace_retry\ failure.

Tested

  • \python -m compileall -q tools/script_qtable.py tests/test_script_qtable.py\ — exit 0.
  • \python -I tests/test_script_qtable.py\ — 15 tests (14 passed, 1 skipped; Windows 11 x64, Python 3.14.7).
  • \python -I scripts/check_no_game_data.py tools/script_qtable.py tests/test_script_qtable.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:5496450808 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2005). Originally posted by [Ch1mpleo](https://github.com/Ch1mpleo) on 2026-11-25T17:57:18Z. --- Claimed in the coordination issue as: SCRIPT-QTABLE-ATOMIC-JSON (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7170215117) ### What and why Adds \ est_empty_json_rejected_and_atomic_write_preserves_existing\ to \ ests/test_script_qtable.py\ (and \_write_json_atomic\ helper in \ ools/script_qtable.py\) verifying empty \--json\ refusal and atomic JSON write preservation on \ eplace_retry\ failure. ### Tested - \python -m compileall -q tools/script_qtable.py tests/test_script_qtable.py\ — exit 0. - \python -I tests/test_script_qtable.py\ — 15 tests (14 passed, 1 skipped; Windows 11 x64, Python 3.14.7). - \python -I scripts/check_no_game_data.py tools/script_qtable.py tests/test_script_qtable.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 18:56:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MSedgeMC on 2026-11-25T18:56:18Z.

Review: COMMENTED


Verified on the PR branch: the NEW test passes (python3 -m unittest tests.test_script_qtable.ScriptQtableTests.test_empty_json_rejected_and_atomic_write_preserves_existing -v -> 1 test OK), and the atomic-write change is the same sound staging+os.replace pattern used by the other probe tools. However the full branch suite is red: python3 -m unittest discover -s tests -p 'test_script_qtable*.py' -> 15 tests, 1 failure: test_symlinked_json_updates_target_in_place (os.path.islink(link_json) is False). That failing test is NOT on current main (it enters via older commits this branch carries, incl. merge of #1815), and main's own 10 tests pass. Please rebase onto current main and confirm the full suite is green before merge; I'm not approving a red branch.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6063267849 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2005#pullrequestreview-6063267849). Originally posted by [MSedgeMC](https://github.com/MSedgeMC) on 2026-11-25T18:56:18Z. **Review:** COMMENTED --- Verified on the PR branch: the NEW test passes (python3 -m unittest tests.test_script_qtable.ScriptQtableTests.test_empty_json_rejected_and_atomic_write_preserves_existing -v -> 1 test OK), and the atomic-write change is the same sound staging+os.replace pattern used by the other probe tools. However the full branch suite is red: python3 -m unittest discover -s tests -p 'test_script_qtable*.py' -> 15 tests, 1 failure: test_symlinked_json_updates_target_in_place (os.path.islink(link_json) is False). That failing test is NOT on current main (it enters via older commits this branch carries, incl. merge of #1815), and main's own 10 tests pass. Please rebase onto current main and confirm the full suite is green before merge; I'm not approving a red branch.
Ch1mpleo commented 2026-11-25 19:37:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Ch1mpleo on 2026-11-25T19:37:45Z.


Thanks @MSedgeMC — removed the duplicate _write_json_atomic\ that shadowed the symlink-preserving helper (\os.path.realpath\ + \published_mode). Re-verified: \python -I tests/test_script_qtable.py\ (15 tests: 14 passed, 1 symlink test skipped on Windows).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7172557342 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2005#issuecomment-7172557342). Originally posted by [Ch1mpleo](https://github.com/Ch1mpleo) on 2026-11-25T19:37:45Z. --- Thanks @MSedgeMC — removed the duplicate \_write_json_atomic\ that shadowed the symlink-preserving helper (\os.path.realpath\ + \published_mode\). Re-verified: \python -I tests/test_script_qtable.py\ (15 tests: 14 passed, 1 symlink test skipped on Windows).
sodove commented 2026-11-28 10:11:37 +00:00 (Migrated from github.com)

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


#2005 | head 34416c8c7de33c692df840519ff6e539a8e70e49 | python3 -I tests/test_script_qtable.py -v | red: 15 passed | green: 15 passed | Green on both trees

This PR adds regression coverage. The transplanted test already passed against the implementation on current 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:7237733758 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2005#issuecomment-7237733758). Originally posted by [sodove](https://github.com/sodove) on 2026-11-28T10:11:37Z. --- #2005 | head `34416c8c7de33c692df840519ff6e539a8e70e49` | `python3 -I tests/test_script_qtable.py -v` | red: 15 passed | green: 15 passed | **Green on both trees** This PR adds regression coverage. The transplanted test already passed against the implementation on current 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:59:00 +00:00 (Migrated from github.com)

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


Merged, thank you @Ch1mpleo! This PR (tools/script_qtable: add empty --json and atomic write regression tests (SCRIPT-QTABLE-ATOMIC-JSON)) was checked by zmasi or sodove and then by our own local run of its tests with main merged in, and it passed cleanly, so it went in with its reviewed batch.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238247560 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2005#issuecomment-7238247560). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T10:59:00Z. --- Merged, thank you @Ch1mpleo! This PR (tools/script_qtable: add empty --json and atomic write regression tests (SCRIPT-QTABLE-ATOMIC-JSON)) was checked by zmasi or sodove and then by our own local run of its tests with main merged in, and it passed cleanly, so it went in with its reviewed batch. 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!2005
No description provided.