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

Merged
IlyassRS3 merged 1 commit from upstream-pr/1584 into main 2026-11-28 10:56:00 +00:00
IlyassRS3 commented 2026-11-25 05:11:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-25T05:11:57Z.


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)

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5485575884 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1584). Originally posted by [IlyassRS3](https://github.com/IlyassRS3) on 2026-11-25T05:11:57Z. --- 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)
copilot-pull-request-reviewer[bot] commented 2026-11-25 05:12:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T05:12:15Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6052175477 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1584#pullrequestreview-6052175477). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-25T05:12:15Z. **Review:** COMMENTED --- 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.
MoonEyes commented 2026-11-28 10:55:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T10:55:56Z.


Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 19 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238215236 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1584#issuecomment-7238215236). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T10:55:56Z. --- Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18). Targeted batch of 19 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13. 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!1584
No description provided.