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

Closed
leonida/mandy
wetw0rks-c0ding wants to merge 0 commits from restore/old-10050-mods-joaat-latin1 into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

wetw0rks-c0ding commented 2026-11-24 21:34:26 +00:00

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.

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

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

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

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

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

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

Closing as an exact duplicate of #718, which was opened earlier and has an identical diff. Keeping #718 as the earlier submission.
Sign in to join this conversation.
No description provided.