leonida_mods: read mod.json as the runtime does, camera section and byte-order mark included (MODS-MANIFEST-RUNTIME-RULES) #1834

Merged
leonida/mandy
RK28A merged 2 commits from mods-manager-camera-bom into main 2026-11-28 20:15:35 +00:00

Pull request successfully merged and closed

RK28A commented 2026-11-25 12:50:45 +00:00

Claimed in the coordination issue as: MODS-MANIFEST-RUNTIME-RULES

What and why

The mod manager checks mod.json with its own copy of the rules in runtime/src/mods.h and that copy was behind. It did not read the camera section so list said that mods/first_person changes nothing and check passed camera values the runtime refuses. It refused a mod.json that starts with a UTF-8 byte-order mark although the runtime and docs/modding.md accept it. It also accepted "archetype_swaps": null which the runtime refuses.

The manager now applies the same checks as parse_mod and list shows the camera each mod sets.

Tested

python -I tests/test_leonida_mods.py passes with 13 tests and 5 of them fail without the change. I compared the manager with parse_mod built from runtime/src/mods.h on 30,015 generated manifests. 17,256 decisions differed before and none after. Linux and Python 3.13.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)
Claimed in the coordination issue as: MODS-MANIFEST-RUNTIME-RULES ### What and why The mod manager checks `mod.json` with its own copy of the rules in `runtime/src/mods.h` and that copy was behind. It did not read the `camera` section so `list` said that `mods/first_person` changes nothing and `check` passed camera values the runtime refuses. It refused a `mod.json` that starts with a UTF-8 byte-order mark although the runtime and `docs/modding.md` accept it. It also accepted `"archetype_swaps": null` which the runtime refuses. The manager now applies the same checks as `parse_mod` and `list` shows the camera each mod sets. ### Tested `python -I tests/test_leonida_mods.py` passes with 13 tests and 5 of them fail without the change. I compared the manager with `parse_mod` built from `runtime/src/mods.h` on 30,015 generated manifests. 17,256 decisions differed before and none after. Linux and Python 3.13. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change)
RK28A commented 2026-11-25 12:55:12 +00:00

I used an AI for code and text formatting and for help on the parts I could not get working

I used an AI for code and text formatting and for help on the parts I could not get working
zmasi commented 2026-11-28 12:04:45 +00:00

#1834 | head 4895e63a99a19f94d38b3a52b43feb852a5560cb (merged cleanly with main d48a957bb) | python -I tests/test_leonida_mods.py | red on main: FAILED (failures=3, errors=2) (AttributeError: 'ModInfo' object has no attribute 'camera', UTF-8 BOM rejection, and "archetype_swaps": null acceptance) | green on PR+main: 15 tests OK | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited Camera, whole_number, parse_camera, validate_manifest, manifest_text, print_report, and report_json in tools/leonida_mods.py and docs/modding.md (matching runtime/src/mods.h rules for camera.view_mode, first_person_value 0..255, contexts 0..4294967295, null archetype_swaps, UTF-8 BOM stripping, explicit UTF-16 diagnostics, and camera override reporting in list/check/--json). Also verified tests/test_docs_encoding.py (1 OK), tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), and scripts/check_no_game_data.py.

#1834 | head 4895e63a99a19f94d38b3a52b43feb852a5560cb (merged cleanly with main d48a957bb) | `python -I tests/test_leonida_mods.py` | red on main: `FAILED (failures=3, errors=2)` (`AttributeError: 'ModInfo' object has no attribute 'camera'`, UTF-8 BOM rejection, and `"archetype_swaps": null` acceptance) | green on PR+main: `15 tests OK` | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `Camera`, `whole_number`, `parse_camera`, `validate_manifest`, `manifest_text`, `print_report`, and `report_json` in `tools/leonida_mods.py` and `docs/modding.md` (matching `runtime/src/mods.h` rules for `camera.view_mode`, `first_person_value` `0..255`, `contexts` `0..4294967295`, null `archetype_swaps`, UTF-8 BOM stripping, explicit UTF-16 diagnostics, and camera override reporting in `list`/`check`/`--json`). Also verified `tests/test_docs_encoding.py` (`1 OK`), `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), and `scripts/check_no_game_data.py`.
MoonEyes commented 2026-11-28 20:15:32 +00:00

Red/green: On main test_leonida_mods.py has 3 failures and 2 errors (no camera section in ModInfo, UTF-8 BOM manifests rejected), and with the PR all 15 tests pass on Windows 11 at OreoFR's (RTX 4070).
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.

Red/green: On main test_leonida_mods.py has 3 failures and 2 errors (no camera section in ModInfo, UTF-8 BOM manifests rejected), and with the PR all 15 tests pass on Windows 11 at OreoFR's (RTX 4070). Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.
OreoFR commented 2026-11-28 21:54:44 +00:00

Verified by OreoFR

  • Base: main 3408969a7 + PR head 4895e63a9
  • Test: python -I tests/test_leonida_mods.py
  • Red on main: 3 FAIL + 2 ERROR (AttributeError ModInfo.camera): the missing camera section itself
  • Green with the PR: 15 OK
  • Verdict: READY (docs/modding.md and tools/leonida_mods.py shared with #1835: merge one, then rebase the other)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

**Verified by OreoFR** - Base: main `3408969a7` + PR head `4895e63a9` - Test: `python -I tests/test_leonida_mods.py` - Red on main: 3 FAIL + 2 ERROR (AttributeError ModInfo.camera): the missing camera section itself - Green with the PR: 15 OK - Verdict: READY (docs/modding.md and tools/leonida_mods.py shared with #1835: merge one, then rebase the other) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No description provided.