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

Merged
leonida/mandy
quietfold merged 1 commit from fix/world-drawable-lookup-validation into main 2026-11-28 10:56:00 +00:00

Pull request successfully merged and closed

quietfold commented 2026-11-25 05:11:57 +00:00

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)

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] reviewed 2026-11-25 05:12:15 +00:00
copilot-pull-request-reviewer[bot] left a comment
No description provided.
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

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)

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 description provided.