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

Open
github-bot wants to merge 2 commits from github-bot/gh-1834 into main AGit
Owner

@⁠RK28A on GitHub · 2026-11-25 12:50 UTC · original
RK28A:mods-manager-camera-bom → main · +193 −13 · 3 files · 2 commits · open

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)
**@⁠RK28A** on GitHub · 2026-11-25 12:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1834) `RK28A:mods-manager-camera-bom` → `main` · +193 −13 · 3 files · 2 commits · open 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)
The manager checks a manifest with its own copy of the rules in
runtime/src/mods.h, and the copy had fallen behind in three places.

The "camera" section was not read at all. `list` said of mods/first_person,
which ships in this repository, "no archetype_swaps; this mod currently
changes nothing", and `check` passed a section the runtime skips the mod
for: an unknown view_mode, a first_person_value that is not a whole number
0-255, contexts that are not whole numbers.

A UTF-8 byte-order mark in front of mod.json was reported as invalid JSON,
although the runtime skips it and docs/modding.md says it is accepted.
Notepad's "UTF-8 with BOM" and Windows PowerShell 5.1's -Encoding utf8
write one. `enable`, `disable` and `install` failed on it too. A UTF-16
file is now named as the runtime names it.

"archetype_swaps": null passed as a mod without swaps; the runtime refuses
it.

`list` and `list --json` now show the camera a mod sets, and which mod's
camera wins when several enabled mods have one.
# Conflicts:
#	tests/test_leonida_mods.py
#	tools/leonida_mods.py
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:07:41 +00:00
Author
Owner

@⁠RK28A on GitHub · 2026-11-25 12:55 UTC · original

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

**@⁠RK28A** on GitHub · 2026-11-25 12:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1834#issuecomment-7163038433) I used an AI for code and text formatting and for help on the parts I could not get working
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/1834/head:github-bot/gh-1834'
git switch 'github-bot/gh-1834'

Merge

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