OLD-7648: glb_skinning: bound bufferView-less zero accessors and write JSON reports atomically #885

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

@⁠narekshaghoyandev on GitHub · 2026-11-24 14:55 UTC · original
narekshaghoyandev:ubiq-glb-skinning-zero-accessor-and-atomic-write → main · +78 −8 · 2 files · 1 commits · open

Reopening my original upstream PR #7648 (previously verified on Linux and macOS M1 by @slint6614-dev and @azterixx), cleanly rebased onto main:

  1. Bound zero-initialized accessors without bufferView (_Reader.read): Rejects bufferView-less accessors with count > MAX_ZERO_ACCESSOR_COUNT (1_000_000) as GlbSkinError instead of attempting unbounded list allocation (OOM), and reuses a single immutable zero tuple per accessor ([(zero,) * components] * count).
  2. Atomic JSON report writes & --json directory guard (write_json, main): Writes --json reports via tempfile.mkstemp + file_mode.published_mode + replace_retry.replace (preserving permissions and leaving any existing report intact on write/replace failure, with read-only-safe temp cleanup), and refuses --json <directory> before reading the GLB with exit code 2.

Verification

  • python3 -I tests/test_glb_skinning.py -v: 28/28 pass (both new tests fail/error against main).
  • python3 -I scripts/check_no_game_data.py tools/glb_skinning.py tests/test_glb_skinning.py: clean.
  • python3 -m compileall -q tools/glb_skinning.py tests/test_glb_skinning.py: clean.

Claimed in the coordination issue as: OLD-7648 (#14)
AI-assisted: yes (Gemini)

**@⁠narekshaghoyandev** on GitHub · 2026-11-24 14:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/885) `narekshaghoyandev:ubiq-glb-skinning-zero-accessor-and-atomic-write` → `main` · +78 −8 · 2 files · 1 commits · open Reopening my original upstream PR #7648 (previously verified on Linux and macOS M1 by `@slint6614-dev` and `@azterixx`), cleanly rebased onto `main`: 1. **Bound zero-initialized accessors without `bufferView` (`_Reader.read`)**: Rejects `bufferView`-less accessors with `count > MAX_ZERO_ACCESSOR_COUNT` (`1_000_000`) as `GlbSkinError` instead of attempting unbounded list allocation (`OOM`), and reuses a single immutable zero tuple per accessor (`[(zero,) * components] * count`). 2. **Atomic JSON report writes & `--json` directory guard (`write_json`, `main`)**: Writes `--json` reports via `tempfile.mkstemp` + `file_mode.published_mode` + `replace_retry.replace` (preserving permissions and leaving any existing report intact on write/replace failure, with read-only-safe temp cleanup), and refuses `--json <directory>` before reading the GLB with exit code 2. ### Verification - `python3 -I tests/test_glb_skinning.py -v`: 28/28 pass (both new tests fail/error against `main`). - `python3 -I scripts/check_no_game_data.py tools/glb_skinning.py tests/test_glb_skinning.py`: clean. - `python3 -m compileall -q tools/glb_skinning.py tests/test_glb_skinning.py`: clean. Claimed in the coordination issue as: OLD-7648 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) AI-assisted: yes (Gemini)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:26:22 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 01:15 UTC · original

Reviewed 372bac6. I read the diff and ran tests/test_glb_skinning.py in a Linux sandbox: 28 tests OK on the PR. With the PR's test file on a main worktree, the new tests fail (1 failure, 1 error), as they should. check_no_game_data.py passes on both changed files.

What the diff does:

  • A bufferView-less accessor is capped at 1,000,000 rows.
  • Its rows become one shared immutable tuple, which is safe because tuples can't be mutated.
  • write_json goes through mkstemp + published_mode + replace_retry. On failure it cleans up the temp file and leaves the old report untouched.
  • A directory passed to --json is refused before the GLB is parsed.

No findings. One behaviour change worth knowing: --json given a symlink now replaces the link with a regular file instead of writing through it. The repo's other staged writers already behave this way.

AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 01:15 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/885#issuecomment-7149357005) Reviewed 372bac6. I read the diff and ran `tests/test_glb_skinning.py` in a Linux sandbox: 28 tests OK on the PR. With the PR's test file on a main worktree, the new tests fail (1 failure, 1 error), as they should. `check_no_game_data.py` passes on both changed files. What the diff does: - A bufferView-less accessor is capped at 1,000,000 rows. - Its rows become one shared immutable tuple, which is safe because tuples can't be mutated. - `write_json` goes through `mkstemp` + `published_mode` + `replace_retry`. On failure it cleans up the temp file and leaves the old report untouched. - A directory passed to `--json` is refused before the GLB is parsed. No findings. One behaviour change worth knowing: `--json` given a symlink now replaces the link with a regular file instead of writing through it. The repo's other staged writers already behave this way. AI-assisted review. **Recommendation:** Merge
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/885/head:github-bot/gh-885'
git switch 'github-bot/gh-885'

Merge

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