leonida_mods: trim model ID whitespace (MODS-PARSE-MODEL-WHITESPACE) #852

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

@⁠KernelSmoker on GitHub · 2026-11-24 14:33 UTC · original
KernelSmoker:kernelsmoker/mods-parse-model-whitespace → main · +13 −0 · 2 files · 1 commits · open

Claimed in the coordination issue as: MODS-PARSE-MODEL-WHITESPACE — #14

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.
  • Synthetic names and manifests only; no game files used.

GPUs tested: n/a (CPU-only parser tests)

AI-assisted: yes

**@⁠KernelSmoker** on GitHub · 2026-11-24 14:33 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/852) `KernelSmoker:kernelsmoker/mods-parse-model-whitespace` → `main` · +13 −0 · 2 files · 1 commits · open Claimed in the coordination issue as: MODS-PARSE-MODEL-WHITESPACE — https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 ### 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. - Synthetic names and manifests only; no game files used. GPUs tested: n/a (CPU-only parser tests) AI-assisted: yes
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:24:33 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:38 UTC · original · approved these changes

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.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 14:38 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/852#pullrequestreview-6041254750) · **approved these changes** 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.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:39 UTC · original · approved these changes

Clean-Room Audit & Verification — PR #852 (MODS-PARSE-MODEL-WHITESPACE)

Thank you @⁠KernelSmoker for picking up and addressing our finding so quickly!

Technical Verification

  1. Whitespace Trimming:
    • parse_model_id now strips leading/trailing whitespace before inspecting whether the string is a hex literal or archetype name.
    • Guarded empty string check ensures parse_model_id(" \t\n ") raises ValueError("empty model name") cleanly.
  2. Test Suite Coverage:
    • Added unit test cases to tests/test_leonida_mods.py covering padded names (" player_story000_00 \t" -> 0xE472B687, "\n0xD7C0CDFF " -> 0xD7C0CDFF), whitespace-only ValueError verification, and manifest validation with padded names in archetype_swaps.
    • Verified locally with Python: python -I -m unittest tests/test_leonida_mods.py — PASS.
  3. Clean-Room Compliance:
    • 0 game data, synthetic test fixtures only, 100% standard library compliance.

Verdict: APPROVED

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 14:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/852#pullrequestreview-6041273889) · **approved these changes** ### Clean-Room Audit & Verification — PR #852 (`MODS-PARSE-MODEL-WHITESPACE`) Thank you @⁠KernelSmoker for picking up and addressing our finding so quickly! #### Technical Verification 1. **Whitespace Trimming**: - `parse_model_id` now strips leading/trailing whitespace before inspecting whether the string is a hex literal or archetype name. - Guarded empty string check ensures `parse_model_id(" \t\n ")` raises `ValueError("empty model name")` cleanly. 2. **Test Suite Coverage**: - Added unit test cases to `tests/test_leonida_mods.py` covering padded names (`" player_story000_00 \t"` -> `0xE472B687`, `"\n0xD7C0CDFF "` -> `0xD7C0CDFF`), whitespace-only ValueError verification, and manifest validation with padded names in `archetype_swaps`. - Verified locally with Python: `python -I -m unittest tests/test_leonida_mods.py` — **PASS**. 3. **Clean-Room Compliance**: - 0 game data, synthetic test fixtures only, 100% standard library compliance. **Verdict: APPROVED**
Author
Owner

@⁠tiguan26 on GitHub · 2026-11-25 03:56 UTC · original · approved these changes

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).

**@⁠tiguan26** on GitHub · 2026-11-25 03:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/852#pullrequestreview-6051646469) · **approved these changes** 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).
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/852/head:github-bot/gh-852'
git switch 'github-bot/gh-852'

Merge

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