Repository navigation
find_hash_lookup: hash a name over the lower-cased Latin-1 bytes, as the other joaat copies do - #6254
evilclanker9000 wants to merge 2 commits into
Conversation
… bytes The tool hashed the lower-cased name's UTF-8 bytes, so a name with a non-ASCII character got a hash no name table in the game or in this pipeline holds. Every other copy of joaat in tools/ (hashdict, awc_names, audio_config, ...) hashes the lower-cased Latin-1 bytes, which is the rule tests/test_hashdict.py pins.
…his pins The test imported find_hash_lookup's joaat but never listed the module, so a rename of that copy would have left it testing one copy less; the docstring now names the third copy that was on the UTF-8 form and turned this suite red.
|
Tested 9ea16de on Windows, CPython 3.14.7, CPU only: pass for the name hash change.
AI-assisted. |
|
Tested 9ea16de merged onto main
#4753 and #4882 make the same It merges cleanly together with #7092 #6049 #7120 #6513 #7242 #7209 #7214 #6957 #7309 #4771 #7029 #7094 #7129 #6508 #7152 #7174 #7032 onto main; with all of them applied, the only standalone test still red on Windows is No GPU or game files needed. AI-assisted (Claude Code); I read the diff before running it. |
|
Independent check (Linux, Python 3.12.3, Node 24.13, CPU only, no game files): head
Fixes AI-assisted (Claude Code). |
|
Tested
#4753, #4882 and #7820 make the same encoding change and also turn this file green; #4753 additionally adds a direct unit test. Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) before posting; claimed in #8047. |
tools/find_hash_lookup.py'sjoaat()hashed the lower-cased name's UTF-8 bytes. Every other copy of joaat intools/(hashdict, awc_names, audio_config, world_names, mission_tables, tex_headers, ...) hashes the lower-cased Latin-1 bytes, which is the ruletests/test_hashdict.pypins; a non-ASCII character is one byte there and two in UTF-8, sofind_hash_lookup.py --hash cafélooked for a hash no name table holds.tests/test_joaat_agreement.pyimports everyjoaat/joaat32copy intools/and so reports the stale copy: the file was red onmain.The fix is the encoding line plus its docstring. Nothing else in the tool changes:
parse_hash()still passes ASCII names (where both encodings agree) and0x...values through unchanged.The second commit lists
find_hash_lookupin the test'sEXPECTEDmodules, so a rename of that copy can no longer leave the test quietly comparing one copy less, and the docstring names the third copy that was on the UTF-8 form.Test
Before (upstream/main,
561b65a83):After:
The other tests this touches stay green:
Synthetic names only, no game data. No GPU needed.
Notes
find_hash_lookupfrom the test:docs/modding.mdpromises the name is hashed "as the game does", and the module stays standard-library-only with its own copy, which is the pattern the test is built for.tools/find_hash_lookup.pyand its cross-tool test only; the--json/--outguards in that tool are a separate open pull request.AI-assisted.