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

Closed
abnalstlll-byte wants to merge 1 commit from upstream-pr/718 into main
abnalstlll-byte commented 2026-11-24 12:51:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T12:51:00Z.


### 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).
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5472485238 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/718). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T12:51:00Z. --- ### 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 commented 2026-11-24 13:44:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-24T13:44:05Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6040276296 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/718#pullrequestreview-6040276296). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-24T13:44:05Z. **Review:** COMMENTED --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T21:54:58Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7175702500 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/718#issuecomment-7175702500). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-25T21:54:58Z. --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T10:34:01Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237979799 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/718#issuecomment-7237979799). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T10:34:01Z. --- 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.

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!718
No description provided.