[PR #274] [CLOSED] bvh_groups: use shared same_report_path and catch --json write OSError #325

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

📋 Pull Request Information

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

Base: main ← Head: old-pr/10006


📝 Commits (1)

  • 0dc1645 bvh_groups: use shared same_report_path and catch --json write OSError

📊 Changes

2 files changed (+37 additions, -2 deletions)

View changed files

📝 tests/test_bvh_groups.py (+30 -0)
📝 tools/bvh_groups.py (+7 -2)

📄 Description

Carried over from old PR 10006 by EspadaHD in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10006, 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-7116977803

What and why

tools/bvh_groups.py checked --json against the input archive with a private os.path.exists(...) and os.path.samefile(...) check instead of tools/report_paths.same_report_path (CONTRIBUTING.md), and called write_json_report() in main() without catching OSError (so passing a directory or unwritable path to --json raised an uncaught PermissionError / IsADirectoryError / FileNotFoundError traceback with exit code 1 instead of printing one bvh_groups: error line to stderr and returning exit code 2).

  • Use report_paths.same_report_path(a.json, a.archive) to guard the archive input.
  • Catch OSError around write_json_report() in main(), print bvh_groups: <error> to stderr, and return 2.
  • Add unit tests in tests/test_bvh_groups.py covering same_report_path delegation and --json write OSError handling.

Tested

  • python -I tests/test_bvh_groups.py -v: 16/16 passed (OK)
  • python -I tests/test_report_paths.py: 22 tests (21 passed, 1 skipped: OK (skipped=1))
  • python -m compileall -q tools/bvh_groups.py tests/test_bvh_groups.py: exit 0
  • python -I scripts/check_no_game_data.py tools/bvh_groups.py tests/test_bvh_groups.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/274 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `old-pr/10006` --- ### 📝 Commits (1) - [`0dc1645`](https://github.com/ubiquitarianism/leonida/commit/0dc1645400e1e39b7768d02411b0b200c583a606) bvh_groups: use shared same_report_path and catch --json write OSError ### 📊 Changes **2 files changed** (+37 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_bvh_groups.py` (+30 -0) 📝 `tools/bvh_groups.py` (+7 -2) </details> ### 📄 Description > Carried over from **old PR 10006** by `EspadaHD` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10006`, 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-7116977803 ### What and why `tools/bvh_groups.py` checked `--json` against the input archive with a private `os.path.exists(...) and os.path.samefile(...)` check instead of `tools/report_paths.same_report_path` (CONTRIBUTING.md), and called `write_json_report()` in `main()` without catching `OSError` (so passing a directory or unwritable path to `--json` raised an uncaught `PermissionError` / `IsADirectoryError` / `FileNotFoundError` traceback with exit code 1 instead of printing one `bvh_groups:` error line to `stderr` and returning exit code 2). - Use `report_paths.same_report_path(a.json, a.archive)` to guard the archive input. - Catch `OSError` around `write_json_report()` in `main()`, print `bvh_groups: <error>` to `stderr`, and return `2`. - Add unit tests in `tests/test_bvh_groups.py` covering `same_report_path` delegation and `--json` write `OSError` handling. ### Tested - `python -I tests/test_bvh_groups.py -v`: 16/16 passed (`OK`) - `python -I tests/test_report_paths.py`: 22 tests (`21` passed, `1` skipped: `OK (skipped=1)`) - `python -m compileall -q tools/bvh_groups.py tests/test_bvh_groups.py`: exit 0 - `python -I scripts/check_no_game_data.py tools/bvh_groups.py tests/test_bvh_groups.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:31 +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#325
No description provided.