character_census: pass model dict in model_row, dedup mesh issues, trim paths, atomic writes (CHARACTER-CENSUS-ROW-AND-ATOMIC-IO) #1543

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

@⁠IlyassRS3 on GitHub · 2026-11-25 04:01 UTC · original
IlyassRS3:fix/character-census-row-and-atomic-io → main · +115 −14 · 2 files · 1 commits · open

What changed

  • Pass input model instead of output row in model_row() (tools/character_census.py:model_row, _bones): model_row() previously passed the blank output row dictionary to _kind(), _bones(), and _skin_8(), causing top-level IsFragment, HasBoneBindings, skin_8, and skin_influences keys in a model.json to be silently ignored. _bones() also avoids duplicating its model/manifest check when row is model.
  • Deduplicate repeated mesh issues (tools/character_census.py:model_row): _mesh_count() runs up to three times (vertices, triangles, indices) over the same meshes list, previously repeating identical "mesh N is not an object" and "mesh N index count is not a non-negative integer" issues on a single row.
  • Trim and validate string manifest paths (tools/character_census.py:_entry_path): strip surrounding whitespace from string/dict path entries and return None for blank strings ("" / " ") so blank entries are reported cleanly instead of resolved as filesystem paths.
  • Atomic CSV and JSON report writes (tools/character_census.py:write_csv, write_json, main): stage reports through sibling temp files with explicit newline=, preserve permissions via file_mode.published_mode, publish with replace_retry.replace, enforce allow_nan=False on JSON output, clean up temp files on error, and catch ValueError alongside OSError in main().
  • Tests (tests/test_character_census.py): added 4 synthetic regression tests covering every fix above.

Claimed in the coordination issue as:

CHARACTER-CENSUS-ROW-AND-ATOMIC-IO (#14 reached GitHub's 2,500-comment cap with no successor coordination issue open yet; checked #14 and open PRs — 0 claims and 0 open PRs touch tools/character_census.py)

How it was tested

  • python3 -I -W error tests/test_character_census.py: 27/27 passed (0 warnings).
  • python3 -I tests/test_text_write_line_endings.py: 3/3 passed.
  • python3 -I scripts/check_no_game_data.py tools/character_census.py tests/test_character_census.py: passed.
  • python3 -m compileall -q tools/character_census.py tests/test_character_census.py: passed.
  • Mutation check against unpatched main:tools/character_census.py: all 4 new tests fail (FAILED (failures=3, errors=1)), all 23 baseline tests pass.

Metadata

  • AI-assisted: yes
  • GPUs tested: none (CPU-only synthetic JSON/CSV/CLI unit tests on macOS arm64; no game files used)
**@⁠IlyassRS3** on GitHub · 2026-11-25 04:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1543) `IlyassRS3:fix/character-census-row-and-atomic-io` → `main` · +115 −14 · 2 files · 1 commits · open ## What changed - **Pass input `model` instead of output `row` in `model_row()` (`tools/character_census.py:model_row`, `_bones`)**: `model_row()` previously passed the blank output `row` dictionary to `_kind()`, `_bones()`, and `_skin_8()`, causing top-level `IsFragment`, `HasBoneBindings`, `skin_8`, and `skin_influences` keys in a `model.json` to be silently ignored. `_bones()` also avoids duplicating its `model`/`manifest` check when `row is model`. - **Deduplicate repeated mesh issues (`tools/character_census.py:model_row`)**: `_mesh_count()` runs up to three times (vertices, triangles, indices) over the same `meshes` list, previously repeating identical `"mesh N is not an object"` and `"mesh N index count is not a non-negative integer"` issues on a single row. - **Trim and validate string manifest paths (`tools/character_census.py:_entry_path`)**: strip surrounding whitespace from string/dict path entries and return `None` for blank strings (`""` / `" "`) so blank entries are reported cleanly instead of resolved as filesystem paths. - **Atomic CSV and JSON report writes (`tools/character_census.py:write_csv`, `write_json`, `main`)**: stage reports through sibling temp files with explicit `newline=`, preserve permissions via `file_mode.published_mode`, publish with `replace_retry.replace`, enforce `allow_nan=False` on JSON output, clean up temp files on error, and catch `ValueError` alongside `OSError` in `main()`. - **Tests (`tests/test_character_census.py`)**: added 4 synthetic regression tests covering every fix above. ## Claimed in the coordination issue as: `CHARACTER-CENSUS-ROW-AND-ATOMIC-IO` (#14 reached GitHub's 2,500-comment cap with no successor coordination issue open yet; checked #14 and open PRs — 0 claims and 0 open PRs touch `tools/character_census.py`) ## How it was tested - `python3 -I -W error tests/test_character_census.py`: 27/27 passed (0 warnings). - `python3 -I tests/test_text_write_line_endings.py`: 3/3 passed. - `python3 -I scripts/check_no_game_data.py tools/character_census.py tests/test_character_census.py`: passed. - `python3 -m compileall -q tools/character_census.py tests/test_character_census.py`: passed. - Mutation check against unpatched `main:tools/character_census.py`: all 4 new tests fail (`FAILED (failures=3, errors=1)`), all 23 baseline tests pass. ## Metadata - AI-assisted: yes - GPUs tested: none (CPU-only synthetic JSON/CSV/CLI unit tests on macOS arm64; no game files used)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:55:59 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 04:01 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 04:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1543#pullrequestreview-6051677034) · **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/1543/head:github-bot/gh-1543'
git switch 'github-bot/gh-1543'

Merge

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