leonida_mods: trim model ID whitespace (MODS-PARSE-MODEL-WHITESPACE) #852
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!852
Loading…
Reference in a new issue
No description provided.
Delete branch "kernelsmoker/mods-parse-model-whitespace"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claimed in the coordination issue as: MODS-PARSE-MODEL-WHITESPACE — https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7134562317
What and why
Trim surrounding whitespace before parsing or hashing a textual model ID in a mod manifest. This makes accidental spaces/tabs/newlines resolve to the intended model ID instead of silently hashing a different name. Whitespace-only values remain invalid. Hex IDs also accept surrounding whitespace.
Tested
python3 -I tests/test_leonida_mods.py -v: 10/10 passed.python3 -I -m py_compile tools/leonida_mods.py tests/test_leonida_mods.py: passed.git diff --check: passed.GPUs tested: n/a (CPU-only parser tests)
AI-assisted: yes
Audited and verified. Trimming surrounding whitespace in parse_model_id handles leading/trailing whitespace in manifest model names and hexadecimal IDs while properly rejecting whitespace-only inputs with ValueError('empty model name'). Unit tests in ests/test_leonida_mods.py pass cleanly. Approved.
Clean-Room Audit & Verification — PR #852 (
MODS-PARSE-MODEL-WHITESPACE)Thank you @KernelSmoker for picking up and addressing our finding so quickly!
Technical Verification
parse_model_idnow strips leading/trailing whitespace before inspecting whether the string is a hex literal or archetype name.parse_model_id(" \t\n ")raisesValueError("empty model name")cleanly.tests/test_leonida_mods.pycovering padded names (" player_story000_00 \t"->0xE472B687,"\n0xD7C0CDFF "->0xD7C0CDFF), whitespace-only ValueError verification, and manifest validation with padded names inarchetype_swaps.python -I -m unittest tests/test_leonida_mods.py— PASS.Verdict: APPROVED
Approving. Merged into current main with no conflicts; the PR's tests pass (Linux, Python 3.13). A model id is stripped before use and an all-whitespace one is refused as empty.
AI-assisted (Claude).
Red/green: tests/test_leonida_mods.py 2 failed on main, 12 passed with the PR.
Targeted batch of 30 PRs (their tests, the tests importing the changed modules, the docs tests, the translator suite) on main a997a3c: no new failure, Windows 11 / Python.
AI-assisted (Claude Code, Claude Opus 5.5)
Verified by OreoFR
4a54aedcb+ PR head43b445ca3python -I tests/test_leonida_mods.pyAI-assisted (Claude Code, Claude Opus 5.5).