wave64_graphics_scan: harden --out guards, OSError privacy, atomic JSON, and tie-breaking (WAVE64-GRAPHICS-SCAN-CLI-AND-IO) #1582

Merged
IlyassRS3 merged 1 commit from upstream-pr/1582 into main 2026-11-28 10:55:00 +00:00
IlyassRS3 commented 2026-11-25 05:05:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-25T05:05:35Z.


Item: WAVE64-GRAPHICS-SCAN-CLI-AND-IO (unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touch tools/wave64_graphics_scan.py).

Summary

  • Reject empty or whitespace-only --out values instead of silently skipping --out "" or creating a whitespace-named file for --out " ", and validate the resolved symlink target's parent directory before scanning.
  • Catch OSError when enumerating/reading shader listings or writing --out and exit cleanly with code 2, stripping scanned shader filenames from error details so names stay inside the work folder.
  • Publish --out JSON atomically via file_mode.published_mode + replace_retry.replace with allow_nan=False and a trailing \n before printing stdout, preserving any existing report on write failure and leaving non-regular targets (e.g. /dev/null) intact.
  • Break equal-count ties alphabetically ((-count, op)) in occurrences and mask_word_source for deterministic JSON and console output.

Verification

  • python3 -W error -I tests/test_wave64_graphics_scan.py -v: 24/24 passed.
  • python3 -I tests/test_text_write_line_endings.py: 3/3 passed.
  • python3 -I scripts/check_no_game_data.py tools/wave64_graphics_scan.py tests/test_wave64_graphics_scan.py: passed.
  • python3 -m compileall -q tools/wave64_graphics_scan.py tests/test_wave64_graphics_scan.py: passed.
  • Mutation check (running the new test suite against unpatched main:tools/wave64_graphics_scan.py): failures=5, errors=3 across all new assertions.

AI-assisted: yes
GPUs tested: none (CPU-only Python tool; synthetic fixtures only, no game data)

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5485518391 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1582). Originally posted by [IlyassRS3](https://github.com/IlyassRS3) on 2026-11-25T05:05:35Z. --- Item: `WAVE64-GRAPHICS-SCAN-CLI-AND-IO` (unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touch `tools/wave64_graphics_scan.py`). ### Summary - Reject empty or whitespace-only `--out` values instead of silently skipping `--out ""` or creating a whitespace-named file for `--out " "`, and validate the resolved symlink target's parent directory before scanning. - Catch `OSError` when enumerating/reading shader listings or writing `--out` and exit cleanly with code 2, stripping scanned shader filenames from error details so names stay inside the work folder. - Publish `--out` JSON atomically via `file_mode.published_mode` + `replace_retry.replace` with `allow_nan=False` and a trailing `\n` before printing stdout, preserving any existing report on write failure and leaving non-regular targets (e.g. `/dev/null`) intact. - Break equal-count ties alphabetically (`(-count, op)`) in `occurrences` and `mask_word_source` for deterministic JSON and console output. ### Verification - `python3 -W error -I tests/test_wave64_graphics_scan.py -v`: 24/24 passed. - `python3 -I tests/test_text_write_line_endings.py`: 3/3 passed. - `python3 -I scripts/check_no_game_data.py tools/wave64_graphics_scan.py tests/test_wave64_graphics_scan.py`: passed. - `python3 -m compileall -q tools/wave64_graphics_scan.py tests/test_wave64_graphics_scan.py`: passed. - Mutation check (running the new test suite against unpatched `main:tools/wave64_graphics_scan.py`): `failures=5, errors=3` across all new assertions. AI-assisted: yes GPUs tested: none (CPU-only Python tool; synthetic fixtures only, no game data)
copilot-pull-request-reviewer[bot] commented 2026-11-25 05:05:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T05:05:43Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6052129215 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1582#pullrequestreview-6052129215). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-25T05:05:43Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
GeorgiyDemo commented 2026-11-25 05:20:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-25T05:20:07Z.


Tested 7817a454a on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main c7e82e26e (Python tool; no GPU):

  • pytest 9.2.0 on tests/test_wave64_graphics_scan.py: 24 passed, 2 subtests passed at this head.
  • The same file on main: 8 failed, 18 passed — the --out guards, atomic write and the unreadable-listing/name-leak handling are not there.
  • Not run: the scan against real shader listings; only the synthetic tests.

AI-assisted; synthetic fixtures only, no game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7153671424 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1582#issuecomment-7153671424). Originally posted by [GeorgiyDemo](https://github.com/GeorgiyDemo) on 2026-11-25T05:20:07Z. --- Tested `7817a454a` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `c7e82e26e` (Python tool; no GPU): - pytest 9.2.0 on `tests/test_wave64_graphics_scan.py`: **24 passed, 2 subtests passed** at this head. - The same file on `main`: **8 failed**, 18 passed — the `--out` guards, atomic write and the unreadable-listing/name-leak handling are not there. - Not run: the scan against real shader listings; only the synthetic tests. AI-assisted; synthetic fixtures only, no game data.
sodove commented 2026-11-28 10:44:35 +00:00 (Migrated from github.com)

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


#1582 | head 7817a454aec547f40d3bbb9723b20c0766cf9db8 | python3 -I tests/test_wave64_graphics_scan.py -v | red: 24 run, 5 failures, 3 errors | green: 24 passed | Red → green

The CLI tests exercised output-path validation, failed writes and atomic publication of the scan report.

Base 3bd936ecd98995bca3e1da83d5e28d2343001aef was merged into the recorded PR head for the second run. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Counts include unittest subtest events where applicable. AI-assisted with OpenAI Codex. Batch claim.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238092811 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1582#issuecomment-7238092811). Originally posted by [sodove](https://github.com/sodove) on 2026-11-28T10:44:35Z. --- #1582 | head `7817a454aec547f40d3bbb9723b20c0766cf9db8` | `python3 -I tests/test_wave64_graphics_scan.py -v` | red: 24 run, 5 failures, 3 errors | green: 24 passed | **Red → green** The CLI tests exercised output-path validation, failed writes and atomic publication of the scan report. Base `3bd936ecd98995bca3e1da83d5e28d2343001aef` was merged into the recorded PR head for the second run. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Counts include unittest subtest events where applicable. AI-assisted with OpenAI Codex. [Batch claim](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7237873883).
MoonEyes commented 2026-11-28 10:54:57 +00:00 (Migrated from github.com)

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


Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 19 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238204520 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1582#issuecomment-7238204520). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T10:54:57Z. --- Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18). Targeted batch of 19 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13. AI-assisted (Claude Code, Claude Opus 5.5)
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!1582
No description provided.