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

Closed
narekshaghoyandev wants to merge 1 commit from upstream-pr/885 into main
narekshaghoyandev commented 2026-11-24 14:55:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by narekshaghoyandev on 2026-11-24T14:55:32Z.


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://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135149126)
AI-assisted: yes (Gemini)

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5474566929 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/885). Originally posted by [narekshaghoyandev](https://github.com/narekshaghoyandev) on 2026-11-24T14:55:32Z. --- 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://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135149126) AI-assisted: yes (Gemini)
PierreEbele commented 2026-11-25 01:15:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T01:15:03Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7149357005 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/885#issuecomment-7149357005). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T01:15:03Z. --- 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
MoonEyes commented 2026-11-28 18:02:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T18:02:07Z.


Hi @narekshaghoyandev, thanks for this pull request. It currently conflicts with main (conflicting file(s): tools/glb_skinning.py), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7243477806 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/885#issuecomment-7243477806). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T18:02:07Z. --- Hi @narekshaghoyandev, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `tools/glb_skinning.py`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 11:52:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:52:43Z.

Review: CHANGES_REQUESTED


Reviewed against current main: bounding bufferView-less zero accessors and atomic JSON writes in tools/glb_skinning.py look good, but this branch conflicts with main in tools/glb_skinning.py and has failing CI. Please rebase onto current main so CI runs cleanly.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130707659 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/885#pullrequestreview-6130707659). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:52:43Z. **Review:** CHANGES_REQUESTED --- Reviewed against current `main`: bounding bufferView-less zero accessors and atomic JSON writes in `tools/glb_skinning.py` look good, but this branch conflicts with `main` in `tools/glb_skinning.py` and has failing CI. Please rebase onto current `main` so CI runs cleanly. *(AI-assisted review.)*
MoonEyes commented 2026-12-02 11:39:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T11:39:46Z.


Closing: this pull request no longer applies to current main (merge conflict in tools/glb_skinning.py), and open pull requests that have fallen out of step with main are being closed so the list stays workable. If you still want this change, rebase it on current main and reopen it (or open a new pull request); it will be looked at again.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7344232031 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/885#issuecomment-7344232031). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T11:39:46Z. --- Closing: this pull request no longer applies to current `main` (merge conflict in `tools/glb_skinning.py`), and open pull requests that have fallen out of step with `main` are being closed so the list stays workable. If you still want this change, rebase it on current `main` and reopen it (or open a new pull request); it will be looked at again. AI-assisted (Claude Code).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!885
No description provided.