mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:05:54 +01:00
[PR #316] mods: hash a mod.json name as hashdict.joaat does (lower-cased Latin-1, not UTF-8 bytes) #368
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#368
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/316
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/10050📝 Commits (1)
3bf9490mods: hash a mod.json name as hashdict.joaat does (lower-cased Latin-1, not UTF-8 bytes)📊 Changes
2 files changed (+63 additions, -5 deletions)
View changed files
📝
runtime/src/mods.h(+48 -5)📝
runtime/test/mods_test.cpp(+15 -0)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Claimed in the coordination issue as: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7117095716
What and why
runtime/src/mods.h'sjoaat()hashed the UTF-8 bytes of a mod.json name and lower-cased only ASCII. Every other copy of joaat is pinned totools/hashdict.py(s.lower().encode("latin-1", "replace"), enforced bytests/test_joaat_agreement.py), so a non-ASCII name in an archetype swap ("from": "Café") got a hash nothing else in the pipeline produces and the swap silently matched no model.#10002left this open ("leonida_mods hashes UTF-8 bytes like runtime/src/mods.h, so both sides change together");#9902changestools/leonida_mods.py, this changes the runtime so gta6rt and the mod manager agree again.joaat()now decodes the UTF-8, applies Python'sstr.lower()for every code point whose lower case lands in Latin-1 (A-Z, U+00C0-U+00DE but U+00D7, plus U+0178, U+1E9E, U+212A, U+212B and U+0130 -> "i" + an unencodable dot; the list was checked againststr.lower()over all of Unicode), and hashes the Latin-1 byte,?for anything else, ashashdict.joaatdoes. Malformed UTF-8 hashes as?per bad byte. ASCII names hash exactly as before (the existing model-id asserts are unchanged). Stillconstexpr.Tested
mods_testgets 12static_asserts whose values come fromhashdict.joaat(accented Latin-1, ×, Ÿ, ẞ, Kelvin/Angstrom signs, İ, CJK). On main 12 of them fail to compile; with this changemods_test: 48 checks, 0 failureswith g++ 13 and clang (-std=c++20 -Wall -Wextra -Wconversion -Wsign-conversion, no warnings from mods.h), Linux x86-64. No GPU involved. Not built with MSVC here.AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. (n/a, no translator change)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.