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

Closed
leonida/mandy
abnalstlll-byte 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.

abnalstlll-byte commented 2026-11-24 12:51:00 +00:00

### Summary
Restores old upstream PR 10050 (OLD-10050, replaces draft #316) with original author attribution (@Conrage) preserved.

gta6rt's mods::joaat previously hashed the UTF-8 bytes of a mod.json name and only lower-cased ASCII. Consequently, non-ASCII names in an archetype swap produced a hash that differed from tools/hashdict.py (enforced by tests/test_joaat_agreement.py), causing swaps to silently miss their target.

This change decodes the UTF-8, applies lowercase normalization across Latin-1 code points, and hashes the Latin-1 bytes with '?' fallback, aligning C++ constexpr mods::joaat with hashdict.joaat.

Verification

  • Added 12 compile-time static_asserts in runtime/test/mods_test.cpp covering accented Latin-1, ligatures, and CJK characters.
  • Clean-room check: python -I scripts/check_no_game_data.py clean (0 issues).
  • Zero external runtime dependencies.
  • AI-assisted (Claude Code).
### Summary Restores old upstream PR 10050 (OLD-10050, replaces draft #316) with original author attribution (@Conrage) preserved. `gta6rt`'s `mods::joaat` previously hashed the UTF-8 bytes of a `mod.json` name and only lower-cased ASCII. Consequently, non-ASCII names in an archetype swap produced a hash that differed from `tools/hashdict.py` (enforced by `tests/test_joaat_agreement.py`), causing swaps to silently miss their target. This change decodes the UTF-8, applies lowercase normalization across Latin-1 code points, and hashes the Latin-1 bytes with '?' fallback, aligning C++ `constexpr mods::joaat` with `hashdict.joaat`. ### Verification - Added 12 compile-time `static_assert`s in `runtime/test/mods_test.cpp` covering accented Latin-1, ligatures, and CJK characters. - Clean-room check: `python -I scripts/check_no_game_data.py` clean (0 issues). - Zero external runtime dependencies. - AI-assisted (Claude Code).
lixonik reviewed 2026-11-24 13:44:05 +00:00
lixonik left a comment
No description provided.
Independent Windows/MSVC run from full Git worktrees at `d6252ee8` and `51f31609`. The PR's stock `mods_test` passed 48 checks. A separate synthetic driver compared C++ `mods::joaat` with Python `tools/hashdict.py::joaat` over all 1,112,064 Unicode scalar values encoded individually as UTF-8 and 10,002 additional strings, including seeded mixed strings. The PR produced zero mismatches in both groups. The baseline produced 1,111,936 scalar mismatches and 9,792 additional-string mismatches. The differential check covers valid UTF-8. AI-assisted testing, synthetic strings only.
abnalstlll-byte commented 2026-11-25 21:54:58 +00:00

Rebased onto latest \main.
Verified \scripts/check_no_game_data.py\ (clean) on
untime/src/mods.h\ and
untime/test/mods_test.cpp, and \git diff --check.

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

Rebased onto latest \main\. Verified \scripts/check_no_game_data.py\ (clean) on \ untime/src/mods.h\ and \ untime/test/mods_test.cpp\, and \git diff --check\. AI-assisted (Claude Code, Claude Opus 5.5).
DadaCap commented 2026-11-28 10:34:01 +00:00

Thanks for the contribution! This PR was reviewed by the maintainers and is being closed as part of a large batch of closures.

Reason: superseded by main.

If this looks like a mistake, mention @DadaCap here at any time and it will be looked at again.

AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

Thanks for the contribution! This PR was reviewed by the maintainers and is being closed as part of a large batch of closures. Reason: superseded by main. If this looks like a mistake, mention @DadaCap here at any time and it will be looked at again. AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.
Sign in to join this conversation.
No description provided.