[PR #301] [CLOSED] wave32_pixel_scan: use shared same_report_path and catch --out write OSError #353

Closed
opened 2026-11-26 20:17:36 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/301
Author: @Andretuta
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: old-pr/10033


📝 Commits (1)

  • 3ca5be8 wave32_pixel_scan: use shared same_report_path and catch --out write OSError

📊 Changes

2 files changed (+61 additions, -3 deletions)

View changed files

📝 tests/test_wave32_pixel_scan.py (+53 -0)
📝 tools/wave32_pixel_scan.py (+8 -3)

📄 Description

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.

🔄 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/301 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `old-pr/10033` --- ### 📝 Commits (1) - [`3ca5be8`](https://github.com/ubiquitarianism/leonida/commit/3ca5be83cdf87e414a3a7c1a60ad4da0edb5fcfc) wave32_pixel_scan: use shared same_report_path and catch --out write OSError ### 📊 Changes **2 files changed** (+61 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_wave32_pixel_scan.py` (+53 -0) 📝 `tools/wave32_pixel_scan.py` (+8 -3) </details> ### 📄 Description > 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:36 +01:00
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#353
No description provided.