[PR #22] [MERGED] leonida_mods: hash names as the pinned latin-1 joaat does #77

Closed
opened 2026-11-26 20:16:43 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/22
Author: @wavehs
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: mods-joaat-latin1


📝 Commits (1)

  • 0c7beb7 leonida_mods: hash names as the pinned latin-1 joaat does

📊 Changes

1 file changed (+7 additions, -4 deletions)

View changed files

📝 tools/leonida_mods.py (+7 -4)

📄 Description

Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository has no such issue yet. No open pull request touches tools/leonida_mods.py.

Depends on: none.

What and why

tests/test_joaat_agreement.py imports every def joaat( in tools/ and compares it with tools/hashdict.py, the dictionary the rest of the pipeline is pinned to. leonida_mods.joaat is the one copy that disagrees, on every name with a non-ASCII character:

FAILED (failures=6)
AssertionError: 2425794034 != 4009490211 : leonida_mods hashes 'café' differently from hashdict.joaat

It encoded the name to UTF-8 and ASCII-lowercased the bytes; the rule is name.lower().encode("latin-1", "replace") (tools/hashdict.py:44, and what audio_config/world_names/awc_names do since 0a8c08a56). The consequence in the tool: parse_model_id (the only caller, for from_name/to_name in a swap) returns an id no package entry has when a manifest spells a name with an accent, and nothing reports it.

The copy now follows the pinned rule, including ? for characters outside latin-1. ASCII names are unchanged: the two pinned expectations in tests/test_leonida_mods.py (player_story000_00 = 0xE472B687, cs_mandy = 0xD7C0CDFF) still pass.

Tested

main@9ec34cdff, macOS 15 arm64 (Apple M3 Pro), CPython 3.15.2, CPU only, no game files:

tree tests/test_joaat_agreement.py tests/test_leonida_mods.py
main@9ec34cdff FAILED (failures=6) OK
this commit Ran 2 tests ... OK OK

python -I tools/leonida_mods.py --help still works (exit 0). Not run: Windows, any GPU test, the translator suite.

AI-assisted: yes.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: no translator change.)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/22 **Author:** [@wavehs](https://github.com/wavehs) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `mods-joaat-latin1` --- ### 📝 Commits (1) - [`0c7beb7`](https://github.com/ubiquitarianism/leonida/commit/0c7beb7e57ab6cdffd6c93a60ba97f8bada533dc) leonida_mods: hash names as the pinned latin-1 joaat does ### 📊 Changes **1 file changed** (+7 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `tools/leonida_mods.py` (+7 -4) </details> ### 📄 Description Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository has no such issue yet. No open pull request touches `tools/leonida_mods.py`. Depends on: none. ### What and why `tests/test_joaat_agreement.py` imports every `def joaat(` in `tools/` and compares it with `tools/hashdict.py`, the dictionary the rest of the pipeline is pinned to. `leonida_mods.joaat` is the one copy that disagrees, on every name with a non-ASCII character: ``` FAILED (failures=6) AssertionError: 2425794034 != 4009490211 : leonida_mods hashes 'café' differently from hashdict.joaat ``` It encoded the name to UTF-8 and ASCII-lowercased the bytes; the rule is `name.lower().encode("latin-1", "replace")` (`tools/hashdict.py:44`, and what `audio_config`/`world_names`/`awc_names` do since `0a8c08a56`). The consequence in the tool: `parse_model_id` (the only caller, for `from_name`/`to_name` in a swap) returns an id no package entry has when a manifest spells a name with an accent, and nothing reports it. The copy now follows the pinned rule, including `?` for characters outside latin-1. ASCII names are unchanged: the two pinned expectations in `tests/test_leonida_mods.py` (`player_story000_00` = `0xE472B687`, `cs_mandy` = `0xD7C0CDFF`) still pass. ### Tested `main@9ec34cdff`, macOS 15 arm64 (Apple M3 Pro), CPython 3.15.2, CPU only, no game files: | tree | `tests/test_joaat_agreement.py` | `tests/test_leonida_mods.py` | |---|---|---| | `main@9ec34cdff` | `FAILED (failures=6)` | OK | | this commit | `Ran 2 tests ... OK` | OK | `python -I tools/leonida_mods.py --help` still works (exit 0). Not run: Windows, any GPU test, the translator suite. AI-assisted: yes. ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (Not applicable: no translator change.) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:16:43 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#77
No description provided.