leonida_mods: trim model ID whitespace (MODS-PARSE-MODEL-WHITESPACE) #852
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/852"
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?
Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T14:33:47Z.
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
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:38:25Z.
Review: APPROVED
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.
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:39:22Z.
Review: 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
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-25T03:56:59Z.
Review: 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).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T13:05:46Z.
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)
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:44:48Z.
Verified by OreoFR
4a54aedcb+ PR head43b445ca3python -I tests/test_leonida_mods.pyAI-assisted (Claude Code, Claude Opus 5.5).