wave32_pixel_scan: use shared same_report_path and catch --out write OSError #301

Closed
github-bot wants to merge 1 commit from gh-pr/301/head into gh-pr/301/base
Owner

@⁠Andretuta on GitHub · 2026-11-24 03:04 UTC · original
ubiquitarianism:old-pr/10033 → main · +61 −3 · 2 files · 1 commits · closed without merging

Carried over from old PR 10033 by EspadaHD in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10033, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
EspadaHD: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Claimed in the coordination issue as: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7117069018

What and why

tools/wave32_pixel_scan.py checked --out against scanned listings with a private os.path.exists(args.out) and any(os.path.samefile(args.out, p) ...) check instead of tools/report_paths.same_report_path (CONTRIBUTING.md), and wrote args.out in main() without catching OSError (unlike sibling tool tools/image_bvh_census.py), so an output write failure raised an uncaught traceback instead of printing an error line to stderr and returning exit code 2.

  • Use report_paths.same_report_path(args.out, p) to guard scanned listings.
  • Catch OSError when writing args.out, print ERROR: cannot write <path>: <reason> to stderr, and return 2.
  • Add unit tests in tests/test_wave32_pixel_scan.py covering same_report_path delegation and --out write OSError handling.

Tested

  • python -I tests/test_wave32_pixel_scan.py -v: 15/15 passed (OK)
  • python -m compileall -q tools/wave32_pixel_scan.py tests/test_wave32_pixel_scan.py: exit 0
  • python -I scripts/check_no_game_data.py tools/wave32_pixel_scan.py tests/test_wave32_pixel_scan.py: exit 0
  • Environment: Windows, CPU-only standard library tests, no game data, no GPU used.

AI-assisted: yes

Checklist

  • 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.
**@⁠Andretuta** on GitHub · 2026-11-24 03:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/301) `ubiquitarianism:old-pr/10033` → `main` · +61 −3 · 2 files · 1 commits · closed without merging > Carried over from **old PR 10033** by `EspadaHD` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10033`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `EspadaHD`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Claimed in the coordination issue as: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7117069018 ### What and why `tools/wave32_pixel_scan.py` checked `--out` against scanned listings with a private `os.path.exists(args.out) and any(os.path.samefile(args.out, p) ...)` check instead of `tools/report_paths.same_report_path` (CONTRIBUTING.md), and wrote `args.out` in `main()` without catching `OSError` (unlike sibling tool `tools/image_bvh_census.py`), so an output write failure raised an uncaught traceback instead of printing an error line to `stderr` and returning exit code 2. - Use `report_paths.same_report_path(args.out, p)` to guard scanned listings. - Catch `OSError` when writing `args.out`, print `ERROR: cannot write <path>: <reason>` to `stderr`, and return `2`. - Add unit tests in `tests/test_wave32_pixel_scan.py` covering `same_report_path` delegation and `--out` write `OSError` handling. ### Tested - `python -I tests/test_wave32_pixel_scan.py -v`: 15/15 passed (`OK`) - `python -m compileall -q tools/wave32_pixel_scan.py tests/test_wave32_pixel_scan.py`: exit 0 - `python -I scripts/check_no_game_data.py tools/wave32_pixel_scan.py tests/test_wave32_pixel_scan.py`: exit 0 - Environment: Windows, CPU-only standard library tests, no game data, no GPU used. AI-assisted: yes ### Checklist - [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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:52:33 +00:00
github-bot closed this pull request 2026-11-26 08:52:33 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-24 19:18 UTC · original

This carry-over of old upstream PR 10033 has been taken over in #898, so I'm closing this draft as #17 describes. The branch old-pr/10033 stays.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-24 19:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/301#issuecomment-7141910761) This carry-over of old upstream PR 10033 has been taken over in #898, so I'm closing this draft as #17 describes. The branch `old-pr/10033` stays. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.