tools: guard malformed gfx_off and bool vertex_count in skinned GLB export #258

Merged
kotekompotek merged 1 commit from upstream-pr/258 into main 2026-11-28 18:51:57 +00:00
kotekompotek commented 2026-11-24 02:54:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kotekompotek on 2026-11-24T02:54:22Z.


Claimed in the coordination issue as: BUILD-1532 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140050149)

What and why

  • Rebased onto current main and squashed into one clean commit (691c178e2).
  • Reject bool vertex_count and malformed ("", bool, float, inf) gfx_off cleanly with SkinError in tools/skinned_glb.py, while preserving gfx_off=None / absent defaulting to 0.
  • Added regression tests (test_malformed_gfx_off_and_none_default, test_bool_vertex_count_is_rejected) in tests/test_skinned_glb.py.

Tested

  • python -I tests/test_skinned_glb.py (32 tests OK) on commit 691c178e2.
  • All 12 tests/test_docs_*.py (OK) on commit 691c178e2.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • 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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465194245 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/258). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-24T02:54:22Z. --- Claimed in the coordination issue as: BUILD-1532 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140050149) ### What and why - Rebased onto current `main` and squashed into one clean commit (`691c178e2`). - Reject `bool` `vertex_count` and malformed (`""`, `bool`, `float`, `inf`) `gfx_off` cleanly with `SkinError` in `tools/skinned_glb.py`, while preserving `gfx_off=None` / absent defaulting to `0`. - Added regression tests (`test_malformed_gfx_off_and_none_default`, `test_bool_vertex_count_is_rejected`) in `tests/test_skinned_glb.py`. ### Tested - `python -I tests/test_skinned_glb.py` (`32 tests OK`) on commit `691c178e2`. - All 12 `tests/test_docs_*.py` (`OK`) on commit `691c178e2`. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [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.
ubiquitarianism commented 2026-11-24 03:14:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ubiquitarianism on 2026-11-24T03:14:43Z.


Not merging yet. The malformed-gfx_off crash does reproduce (gfx_off: "abc" gives a ValueError traceback). Please:

  • add tests to tests/test_skinned_glb.py for a bad gfx_off and a bool vertex_count; the description mentions regression coverage, but the diff has none;
  • fix the title: the diff doesn't change skinning weights;
  • say whether rejecting "" and False for gfx_off is intended. Main accepted both as 0.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7120907435 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/258#issuecomment-7120907435). Originally posted by [ubiquitarianism](https://github.com/ubiquitarianism) on 2026-11-24T03:14:43Z. --- Not merging yet. The malformed-`gfx_off` crash does reproduce (`gfx_off: "abc"` gives a ValueError traceback). Please: - add tests to `tests/test_skinned_glb.py` for a bad `gfx_off` and a bool `vertex_count`; the description mentions regression coverage, but the diff has none; - fix the title: the diff doesn't change skinning weights; - say whether rejecting `""` and `False` for `gfx_off` is intended. Main accepted both as 0.
kotekompotek commented 2026-11-24 18:32:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kotekompotek on 2026-11-24T18:32:35Z.


@ubiquitarianism Updated in commit 691c178e2:

  • Added regression tests (test_malformed_gfx_off_and_none_default, test_bool_vertex_count_is_rejected) in tests/test_skinned_glb.py.
  • Rewrote commit and PR title to drop the inaccurate "skinning weights" reference.
  • Confirmed gfx_off=None/absent still defaults to 0, while malformed values ("", bool, float) for gfx_off and bool for vertex_count are rejected intentionally.

Verified: python -I tests/test_skinned_glb.py (32 tests OK) and all 12 tests/test_docs_*.py (OK).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7140790730 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/258#issuecomment-7140790730). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-24T18:32:35Z. --- @ubiquitarianism Updated in commit `691c178e2`: - Added regression tests (`test_malformed_gfx_off_and_none_default`, `test_bool_vertex_count_is_rejected`) in `tests/test_skinned_glb.py`. - Rewrote commit and PR title to drop the inaccurate "skinning weights" reference. - Confirmed `gfx_off=None`/absent still defaults to `0`, while malformed values (`""`, `bool`, `float`) for `gfx_off` and `bool` for `vertex_count` are rejected intentionally. Verified: `python -I tests/test_skinned_glb.py` (32 tests OK) and all 12 `tests/test_docs_*.py` (OK).
kotekompotek commented 2026-11-25 08:58:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kotekompotek on 2026-11-25T08:58:00Z.


Rebased on current ubi/main (3f81d46ac), no conflicts. The added tests pass locally on this base (python -I).

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7157699257 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/258#issuecomment-7157699257). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T08:58:00Z. --- Rebased on current ubi/main (3f81d46ac), no conflicts. The added tests pass locally on this base (python -I). AI-assisted: yes
MoonEyes commented 2026-11-28 18:51:53 +00:00 (Migrated from github.com)

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


Red/green: tests/test_skinned_glb.py fails on main (7 failures and 2 errors: ValueError on gfx_off='abc', OverflowError on inf, bool vertex_count accepted) and passes with the PR merged, on GitHub Actions Linux and natively on Windows.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main 7daa4a4a5 in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7244111266 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/258#issuecomment-7244111266). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T18:51:53Z. --- Red/green: tests/test_skinned_glb.py fails on main (7 failures and 2 errors: ValueError on gfx_off='abc', OverflowError on inf, bool vertex_count accepted) and passes with the PR merged, on GitHub Actions Linux and natively on Windows. Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main 7daa4a4a5 in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
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!258
No description provided.