bvh_groups: use shared same_report_path and catch --json write OSError #274

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

@⁠Andretuta on GitHub · 2026-11-24 02:57 UTC · original
ubiquitarianism:old-pr/10006 → main · +37 −2 · 2 files · 1 commits · closed without merging

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.
**@⁠Andretuta** on GitHub · 2026-11-24 02:57 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/274) `ubiquitarianism:old-pr/10006` → `main` · +37 −2 · 2 files · 1 commits · closed without merging > 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:51:34 +00:00
github-bot closed this pull request 2026-11-26 08:51:34 +00:00
Author
Owner

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

This carry-over of old upstream PR 10006 has been taken over in #931, so I'm closing this draft as #17 describes. The branch old-pr/10006 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/274#issuecomment-7141902991) This carry-over of old upstream PR 10006 has been taken over in #931, so I'm closing this draft as #17 describes. The branch `old-pr/10006` 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.