mods: hash a mod.json name as hashdict.joaat does (OLD-10050) #1303

Closed
wetw0rks-c0ding wants to merge 1 commit from upstream-pr/1303 into main
wetw0rks-c0ding commented 2026-11-24 21:34:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wetw0rks-c0ding on 2026-11-24T21:34:26Z.


Claimed in the coordination issue as: OLD-10050

What and why

mods::joaat hashed UTF-8 bytes and lower-cased only ASCII, so a mod.json name containing non-ASCII Latin-1 characters got a different hash from tools/hashdict.py and archetype swaps silently missed their target. It now decodes UTF-8, lower-cases across Latin-1 code points and hashes the Latin-1 bytes with a ? fallback, matching hashdict.joaat.

Tested

  • cmake -S runtime -B runtime/build && cmake --build runtime/build --parallel 6 && ctest --test-dir runtime/build -R mods --output-on-failure -> ctest 1/1 passed
  • python -I scripts/check_no_game_data.py runtime/src/mods.h runtime/test/mods_test.cpp -> clean
  • Environment: Linux (CachyOS), CPU-only tests, no GPU required

AI-assisted: Yes. This work was done with OpenCode agents.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5480716539 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1303). Originally posted by [wetw0rks-c0ding](https://github.com/wetw0rks-c0ding) on 2026-11-24T21:34:26Z. --- Claimed in the coordination issue as: OLD-10050 ### What and why `mods::joaat` hashed UTF-8 bytes and lower-cased only ASCII, so a `mod.json` name containing non-ASCII Latin-1 characters got a different hash from `tools/hashdict.py` and archetype swaps silently missed their target. It now decodes UTF-8, lower-cases across Latin-1 code points and hashes the Latin-1 bytes with a `?` fallback, matching `hashdict.joaat`. ### Tested - `cmake -S runtime -B runtime/build && cmake --build runtime/build --parallel 6 && ctest --test-dir runtime/build -R mods --output-on-failure` -> ctest 1/1 passed - `python -I scripts/check_no_game_data.py runtime/src/mods.h runtime/test/mods_test.cpp` -> clean - Environment: Linux (CachyOS), CPU-only tests, no GPU required AI-assisted: Yes. This work was done with OpenCode agents.
PierreEbele commented 2026-11-25 14:56:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T14:56:53Z.


Reviewed ca898f0e6: ran tests/test_joaat_agreement.py (OK) and, via a Python port of the new joaat, checked all 12 static_assert constants against tools/hashdict.py (exact) and the algorithm over every Unicode code point (1,112,064 code points, 0 mismatches; the 60 fully-Latin-1 lowers are exactly the C++ branch set, U+0130 covered). Main's old hash disagrees on all 12 non-ASCII names, consistent with the PR. The C++ itself was not compiled here (no compiler on this arm64 host), so the g++13/clang claim rests on the author. AI-assisted review.

Recommendation: Merge

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7166064451 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1303#issuecomment-7166064451). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T14:56:53Z. --- Reviewed ca898f0e6: ran tests/test_joaat_agreement.py (OK) and, via a Python port of the new joaat, checked all 12 static_assert constants against tools/hashdict.py (exact) and the algorithm over every Unicode code point (1,112,064 code points, 0 mismatches; the 60 fully-Latin-1 lowers are exactly the C++ branch set, U+0130 covered). Main's old hash disagrees on all 12 non-ASCII names, consistent with the PR. The C++ itself was not compiled here (no compiler on this arm64 host), so the g++13/clang claim rests on the author. AI-assisted review. **Recommendation:** Merge
wavehs commented 2026-11-26 18:48:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-26T18:48:04Z.


This is the same change as #718 (abnalstlll-byte, opened 2026-11-24 12:51, ~8h43m earlier): the two diffs are byte-identical (only blob hashes differ), same runtime/src/mods.h + runtime/test/mods_test.cpp, and both claim OLD-10050. #718 also explicitly replaces draft #316.

I verified #718 on main f107ae044 (macOS, portable runtime subset): clean apply, mods_test builds, ctest -R '^mods$' passes. As a negative control, applying only its mods_test.cpp half against the unmodified mods.h fails to compile with 12 static_assert errors (Café, ÉLÉGIE, Crème Brûlée, the non-Latin-1 cases), so the test really pins the digest.

Nothing wrong with the content here; it is a duplicate reland. I would keep #718 (earlier, replaces the draft explicitly) and close this one; #316 can close once #718 lands.

AI-assisted (verification only).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7200865409 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1303#issuecomment-7200865409). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-26T18:48:04Z. --- This is the same change as **#718** (abnalstlll-byte, opened 2026-11-24 12:51, ~8h43m earlier): the two diffs are byte-identical (only blob hashes differ), same `runtime/src/mods.h` + `runtime/test/mods_test.cpp`, and both claim OLD-10050. #718 also explicitly replaces draft #316. I verified #718 on `main` `f107ae044` (macOS, portable runtime subset): clean apply, `mods_test` builds, `ctest -R '^mods$'` passes. As a negative control, applying only its `mods_test.cpp` half against the unmodified `mods.h` fails to compile with 12 `static_assert` errors (Café, ÉLÉGIE, Crème Brûlée, the non-Latin-1 cases), so the test really pins the digest. Nothing wrong with the content here; it is a duplicate reland. I would keep #718 (earlier, replaces the draft explicitly) and close this one; #316 can close once #718 lands. AI-assisted (verification only).
wetw0rks-c0ding commented 2026-11-27 17:24:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wetw0rks-c0ding on 2026-11-27T17:24:18Z.


Closing as an exact duplicate of #718, which was opened earlier and has an identical diff. Keeping #718 as the earlier submission.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7224367458 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1303#issuecomment-7224367458). Originally posted by [wetw0rks-c0ding](https://github.com/wetw0rks-c0ding) on 2026-11-27T17:24:18Z. --- Closing as an exact duplicate of #718, which was opened earlier and has an identical diff. Keeping #718 as the earlier submission.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1303
No description provided.