world_drawable_lookup: validate hex keys, archetype u32 fields, window budget, and deep JSON (WORLD-DRAWABLE-LOOKUP-VALIDATION) #1584

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

@⁠IlyassRS3 on GitHub · 2026-11-25 05:11 UTC · original
IlyassRS3:fix/world-drawable-lookup-validation → main · +126 −10 · 2 files · 1 commits · open

Item: WORLD-DRAWABLE-LOOKUP-VALIDATION (unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touch tools/world_drawable_lookup.py).

Summary

  • Strictly parse placement key values as unsigned 64-bit hex strings ([0-9a-fA-F]+, < 2^64) so signed ("-1", "+1"), underscore-separated ("1_2"), 0x-prefixed, padded, or overflowing keys are counted as missing_or_invalid_key rather than entering wanted (where "-1" formatted as "-000000000000001").
  • Validate archetype row name, asset_name, and asset_type fields as optional unsigned 32-bit integers (type(v) is int), preventing Python's True == 1 collision from matching asset_type == 1 (.#ft) and avoiding raw TypeError: unhashable type on malformed rows.
  • Require type(budget) is int in export_window() so bool (True == 1), float (1.5), and non-numeric values raise ValueError instead of being accepted or raising TypeError.
  • Reject whitespace-only summary.archive strings, catch RecursionError in report_rows() and main(argv=None), enforce allow_nan=False on JSON output, and return exit code 0.

Verification

  • python3 -W error -I tests/test_world_drawable_lookup.py -v: 6/6 passed.
  • python3 -I tests/test_text_write_line_endings.py: 3/3 passed.
  • python3 -I scripts/check_no_game_data.py tools/world_drawable_lookup.py tests/test_world_drawable_lookup.py: passed.
  • python3 -m compileall -q tools/world_drawable_lookup.py tests/test_world_drawable_lookup.py: passed.
  • Mutation check (running the new test suite against unpatched main:tools/world_drawable_lookup.py): failures=7, errors=3 across all 4 new regression tests.

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

**@⁠IlyassRS3** on GitHub · 2026-11-25 05:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1584) `IlyassRS3:fix/world-drawable-lookup-validation` → `main` · +126 −10 · 2 files · 1 commits · open Item: `WORLD-DRAWABLE-LOOKUP-VALIDATION` (unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touch `tools/world_drawable_lookup.py`). ### Summary - Strictly parse placement `key` values as unsigned 64-bit hex strings (`[0-9a-fA-F]+`, `< 2^64`) so signed (`"-1"`, `"+1"`), underscore-separated (`"1_2"`), `0x`-prefixed, padded, or overflowing keys are counted as `missing_or_invalid_key` rather than entering `wanted` (where `"-1"` formatted as `"-000000000000001"`). - Validate archetype row `name`, `asset_name`, and `asset_type` fields as optional unsigned 32-bit integers (`type(v) is int`), preventing Python's `True == 1` collision from matching `asset_type == 1` (`.#ft`) and avoiding raw `TypeError: unhashable type` on malformed rows. - Require `type(budget) is int` in `export_window()` so `bool` (`True == 1`), `float` (`1.5`), and non-numeric values raise `ValueError` instead of being accepted or raising `TypeError`. - Reject whitespace-only `summary.archive` strings, catch `RecursionError` in `report_rows()` and `main(argv=None)`, enforce `allow_nan=False` on JSON output, and return exit code `0`. ### Verification - `python3 -W error -I tests/test_world_drawable_lookup.py -v`: 6/6 passed. - `python3 -I tests/test_text_write_line_endings.py`: 3/3 passed. - `python3 -I scripts/check_no_game_data.py tools/world_drawable_lookup.py tests/test_world_drawable_lookup.py`: passed. - `python3 -m compileall -q tools/world_drawable_lookup.py tests/test_world_drawable_lookup.py`: passed. - Mutation check (running the new test suite against unpatched `main:tools/world_drawable_lookup.py`): `failures=7, errors=3` across all 4 new regression tests. AI-assisted: yes GPUs tested: none (CPU-only Python tool; synthetic fixtures only, no game data)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:57:16 +00:00
Author
Owner

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

Merge

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