bvh_groups: validate scan bounds and --json upfront, use same_report_path, catch write OSError (BVH-GROUPS-GUARDS-AND-IO) #1599

Open
github-bot wants to merge 1 commit from github-bot/gh-1599 into main AGit
Owner

@⁠IlyassRS3 on GitHub · 2026-11-25 05:32 UTC · original
IlyassRS3:fix/bvh-groups-guards-and-io → main · +91 −7 · 2 files · 1 commits · open

Item: BVH-GROUPS-GUARDS-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/bvh_groups.py).

Summary

  • Validate start, limit, and max_inflate in scan() before the empty-archive fast path so out-of-range start on empty files, limit <= 0, max_inflate <= 0, and bool values raise ValueError (previously limit=0 scanned the whole archive and max_inflate=0/True crashed with struct.error in bvh_index.classify).
  • Validate archive and --json before scanning (reject empty/whitespace strings, directories, trailing separators, and missing parent directories) and use the shared report_paths.same_report_path() guard instead of raw os.path.samefile().
  • Catch OSError from write_json_report() in main() and publish --json before printing stdout (exiting with code 2 and one stderr line instead of a traceback), and enforce allow_nan=False in write_json_report().

Verification

  • python3 -W error -I tests/test_bvh_groups.py -v: 16/16 passed.
  • python3 -I tests/test_text_write_line_endings.py: 3/3 passed.
  • python3 -I scripts/check_no_game_data.py tools/bvh_groups.py tests/test_bvh_groups.py: passed.
  • python3 -m compileall -q tools/bvh_groups.py tests/test_bvh_groups.py: passed.
  • Mutation check (running tests/test_bvh_groups.py against unpatched main:tools/bvh_groups.py): failures=11, errors=3 across all new regression tests.

AI-assisted: yes
GPUs tested: none (CPU-only Python BVH descriptor tool; synthetic streams only, no game data)

**@⁠IlyassRS3** on GitHub · 2026-11-25 05:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1599) `IlyassRS3:fix/bvh-groups-guards-and-io` → `main` · +91 −7 · 2 files · 1 commits · open Item: `BVH-GROUPS-GUARDS-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/bvh_groups.py`). ### Summary - Validate `start`, `limit`, and `max_inflate` in `scan()` before the empty-archive fast path so out-of-range `start` on empty files, `limit <= 0`, `max_inflate <= 0`, and `bool` values raise `ValueError` (previously `limit=0` scanned the whole archive and `max_inflate=0`/`True` crashed with `struct.error` in `bvh_index.classify`). - Validate `archive` and `--json` before scanning (reject empty/whitespace strings, directories, trailing separators, and missing parent directories) and use the shared `report_paths.same_report_path()` guard instead of raw `os.path.samefile()`. - Catch `OSError` from `write_json_report()` in `main()` and publish `--json` before printing stdout (exiting with code 2 and one stderr line instead of a traceback), and enforce `allow_nan=False` in `write_json_report()`. ### Verification - `python3 -W error -I tests/test_bvh_groups.py -v`: 16/16 passed. - `python3 -I tests/test_text_write_line_endings.py`: 3/3 passed. - `python3 -I scripts/check_no_game_data.py tools/bvh_groups.py tests/test_bvh_groups.py`: passed. - `python3 -m compileall -q tools/bvh_groups.py tests/test_bvh_groups.py`: passed. - Mutation check (running `tests/test_bvh_groups.py` against unpatched `main:tools/bvh_groups.py`): `failures=11, errors=3` across all new regression tests. AI-assisted: yes GPUs tested: none (CPU-only Python BVH descriptor tool; synthetic streams only, no game data)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:57:43 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 05:32 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-25 05:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1599#pullrequestreview-6052331827) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1599/head:github-bot/gh-1599'
git switch 'github-bot/gh-1599'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1599'
git switch 'github-bot/gh-1599'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1599'
git switch 'github-bot/gh-1599'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1599'
git switch 'main'
git merge --squash 'github-bot/gh-1599'
git switch 'main'
git merge --ff-only 'github-bot/gh-1599'
git switch 'main'
git merge 'github-bot/gh-1599'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.