Repository navigation
find_hash_lookup: hash --hash names as latin-1, like hashdict (test_joaat_agreement fails on main) - #4753
find_hash_lookup: hash --hash names as latin-1, like hashdict (test_joaat_agreement fails on main)#4753tunczzz wants to merge 1 commit into
Conversation
tools/find_hash_lookup.py (3eb4410) carried its own joaat over the lower-cased UTF-8 bytes, so tests/test_joaat_agreement.py failed on main for every non-ASCII name (6 subtests): "é" is one latin-1 byte (0xE9), the rule tools/hashdict.py and the other copies are pinned to, and two UTF-8 bytes. Encode as hashdict does, list find_hash_lookup in the agreement test's EXPECTED copies, and add a unit test with the hand-computed hash of "caf" + 0xE9. Synthetic names only. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 5b4f86ede on Windows 11: pytest tests/test_find_hash_lookup.py tests/test_joaat_agreement.py -q -> 7 passed, 104 subtests passed; git diff --check clean.
--hash names are now hashed as latin-1 like hashdict, with a documented note, so the two tools agree on non-ASCII names; the JOAAT agreement test is updated for the case that failed on main. No blocking issue.
|
Tested 5b4f86e merged with main 98fa503 on Linux, Python 3.12.16: pass
|
|
Independent verification at head
Confirms the reported main-branch failure and the latin-1 fix. Overlap note vs #4752: not a competing fix — #4752 hardens No issues found. AI-assisted (Devin). |
|
Coordination overlap: #4773 makes the same |
|
Thanks @editrice. You're right: the claim for #4773 on #4683 came first. I missed it because I was still reading #4571 after the issue moved to #4683. Both PRs make the same one-line This PR also adds
Either is fine with me. I'll follow whichever the maintainer or @lines9686-rgb prefers, and I won't touch #4773. AI-assisted (Claude Code). |
|
Verified against current main: first reproduced the failure — tests/test_joaat_agreement.py on plain main gives FAILED with exactly the six find_hash_lookup mismatches on accented names (re-confirmed here) — and with this PR merged that test and test_find_hash_lookup.py (including the new chr(0xE9) pin) pass, with the fix line matching tools/hashdict.py rule for rule. Coordination note, verified on the diffs: open #4882 carries the identical encode-line change plus the same EXPECTED edit; this PR is earlier and additionally pins the behaviour with its own unit test and the modding.md note, so this is the one to land. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
|
Tested 5b4f86e on Windows 11, Python 3.14.6: Code read: |
|
Tested
The |
|
Tested
|
|
Tested on Windows, where Windows 11 Pro (26200), CPython 3.14.7,
#4882 makes the same AI-assisted (Claude Code); I read the diffs and ran the tests myself on the machine above. |
thiefyzheng
left a comment
There was a problem hiding this comment.
Code read + local run at 5b4f86ed (AI-assisted review, per AGENTS.md).
This is the most complete of the three open PRs for the same defect, and it verifies.
On unpatched 561b65a832, python -I tests/test_joaat_agreement.py is 6 failures, all find_hash_lookup, all non-ASCII names (café, ÉLÉGIE, Radio_LosSantos_Café, ...), each of the form 974630864 != 811395798. With this PR applied:
tests/test_joaat_agreement.py-> OK (6 failures gone)tests/test_find_hash_lookup.py-> OKpython -m compileall -q tools-> clean
The added test is the right shape: pinning b"caf" + 0xE9 as the expected bytes pins the contract (é is one byte, 0xE9, per docs/audio_config.md), instead of comparing one copy of joaat with another copy, which would pass whatever either one does.
Overlap, for the coordinator, not a problem with this PR: #4882 is the identical one-liner with no byte pin, and #5913 carries the same one-liner inside a larger unrelated change. This one is the one I would take; if a different one lands, the byte-pinned test here is worth keeping.
One question: encode("latin-1", "replace") maps any character above U+00FF to ? (0x3F), so two different non-Latin-1 names can collide, and a name containing a literal ? collides with them. That matches hashdict.joaat exactly, so the copies stay in agreement — but if that is not already written down anywhere, one sentence in docs/audio_config.md next to the latin-1 rule would record it.
|
Tested 5b4f86e on Linux (kernel 7.2), Python 3.14.8, CPU only: pass On Branch is 2,143 commits behind AI-assisted check (Claude Code); counts and pass/fail only, no game data. |
|
Independent check (Linux, Python 3.12.3, Node 24.13, CPU only, no game files): head
Fixes AI-assisted (Claude Code). |
tests/test_joaat_agreement.pyfails onmain(98fa503f) with 6 subtests.tools/find_hash_lookup.py, added in 3eb4410, has its ownjoaatover the UTF-8 bytes of the lower-cased name. The agreement test imports every stringjoaatintools/and compares it withtools/hashdict.py, which hashes latin-1 bytes ("é"is one byte,0xE9, not the pair0xC3 0xA9). So every name with a non-ASCII character hashed differently:café,Café,Señor,Crème Brûlée,ÉLÉGIE,Radio_LosSantos_Café.Claimed on #4571 (comment).
tools/find_hash_lookup.py:encode("latin-1", "replace"), ashashdict.joaatdoes. ASCII names (player_story000_00,cs_mandy) hash exactly as before.tests/test_joaat_agreement.py:find_hash_lookupadded toEXPECTED, so a rename can't quietly drop it from the comparison.tests/test_find_hash_lookup.py:joaat("Café")equals a hash computed by hand over63 61 66 E9.docs/modding.md: one line saying how a--hashname is hashed.Tested (WSL Ubuntu, Python venv, CPU only):
pytest tests/test_joaat_agreement.py tests/test_find_hash_lookup.py: 7 passed, 104 subtests. Withmain'stools/find_hash_lookup.pyand these tests: 7 failed.pytest tests --ignore=tests/semantic -n 2: 6987 passed, 157 skipped, 1 failed. The failure istest_rdna2_decode::test_parity_with_llvm_mc_on_shader_fixtures, which fails the same way on plainmain(claimed by MichaelL401 on Coordinating who works on what (24) (moved to #4683) #4571).No GPU needed. Runs on the PC with an RTX 5070 Ti, but nothing here touches it. Synthetic names only, no game files.
AI-assisted (Claude Code).
🤖 Generated with Claude Code