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

Open
opened 2026-11-26 20:21:49 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1582
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/wave64-graphics-scan-cli-and-io


📝 Commits (1)

  • 7817a45 wave64_graphics_scan: harden --out guards, OSError privacy, atomic JSON, and tie-breaking

📊 Changes

2 files changed (+171 additions, -8 deletions)

View changed files

📝 tests/test_wave64_graphics_scan.py (+105 -0)
📝 tools/wave64_graphics_scan.py (+66 -8)

📄 Description

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)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1582 **Author:** [@IlyassRS3](https://github.com/IlyassRS3) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/wave64-graphics-scan-cli-and-io` --- ### 📝 Commits (1) - [`7817a45`](https://github.com/ubiquitarianism/leonida/commit/7817a454aec547f40d3bbb9723b20c0766cf9db8) wave64_graphics_scan: harden --out guards, OSError privacy, atomic JSON, and tie-breaking ### 📊 Changes **2 files changed** (+171 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_wave64_graphics_scan.py` (+105 -0) 📝 `tools/wave64_graphics_scan.py` (+66 -8) </details> ### 📄 Description 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1602
No description provided.