When writing dictionary JSON atomically in _write_json, apply published_mode
to the staged file and reset os.chmod to 0o600 before exiting TemporaryDirectory
if os.replace fails, ensuring cleanup does not fail with PermissionError on
Windows when replacing a read-only file.
agent: yes
AI-assisted: yes
audio_config hashed the lowercased UTF-8 bytes, and world_names encoded to UTF-8
before lower-casing the bytes, so both gave a different 32-bit hash for any
non-ASCII name than hashdict.py and awc_names.py, which hash the lowercased
latin-1 bytes that tests/test_hashdict.py pins. A title with an accent then
produced a stream id no AWC bank stores. Both copies now use the dictionary
form, and a cross-tool test holds every joaat copy in tools/ to it.
Resource tables can contain non-map names, which inflated the link totals even when the target map was absent. Build the name set and the report from the same map rows.
same_report_path was copied into ten tools, and each new "refuse an output that overwrites an input" change added
another copy or a variant. Four copies (anim_index, gamedata_index, gamedata_xml, navmesh_decode) also folded case and
accents on a case-insensitive macOS volume (through _path_key), the other six did not, so the same report pair was
refused by one tool and written by another.
tools/report_paths.py holds one version (the stricter one: realpath, normcase, case-folded NFD on a case-insensitive
volume, then os.path.samefile) and awc_manifest, gamedata_index, gamedata_xml, navmesh_index, rpf_probe, tile_probe
and world_names import it. The tools keep exposing the name same_report_path. On Windows and Linux nothing changes;
on macOS the five tools that lacked the case/accent step now refuse a case-only alias of a report that doesn't exist
yet, as the other five already did.
anim_index, navmesh_decode and world_lights_paths keep their copy for now because open pull requests edit them
(#2051, #2050, #2052, #2107); tests/test_report_paths.py fails if any other tool adds a copy.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SAjLH2L6R72dBvVaRG8hka
open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly
listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/,
make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source
with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention.
AI-assisted (Claude), on behalf of dev-ewann.
The resolve check used !r, which doubles backslashes on Windows, so
test_resolve_out_refuses_to_overwrite_an_input failed there (Linux CI
paths have none). Other errors in this file already print paths plainly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").
tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
add_xml() matched <filename> and <name> elements with regexes on the raw
text, so an escaped name was hashed as written ("A&B", not "A&B") and an
element inside an XML comment was added as a real name. Comments are now
removed first (CDATA and processing instructions are kept), and values are
unescaped with html.unescape, which never raises on a stray reference.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/world.md and docs/world_names.md said ~96% of archetypeName hashes stay
unresolved. That was a name-source limit of the two sampled windows: the
names are in levels.rpf, and rpf9_names.py already lists them. With its
name.#dr/name.#ft list as the dictionary, 99.85% of the 1,670,435 placement
entities resolve (99.94% with --max-inflate 256 MiB), every match verified by
the entity's 64-bit key.
- world_index.py --archetypes-out writes the aggregate archetype file that
world_names.py resolve --archetypes reads (entity count and 64-bit key per
hash); nothing in the repo produced it before. Entities of a resource that
needs a continuation stream are counted once.
- world_names.py build --rpf9-names reads rpf9_names.py index JSON.
- docs: whole-archive coverage table, the four commands that reproduce it,
and the corrected statements in world.md and docs/README.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured on Xbox 1.0.2.1:
- archetypeName, map name and parent are lower-cased joaat.
- per-archetype +0x20 and map +0x10 keys are MurmurHash3 x64 128 low 64 (seed 0).
- +0x08 is a per-entity id, not a per-archetype hash.
A 79,738-name local dictionary resolves 5,107/24,105 distinct
archetype hashes (8,263/203,799 entities) in two bounded windows,
all confirmed by the 64-bit key; one 32-bit-only candidate is
rejected. Map names resolve 5/23,535 and parents 1/2,089.
Adds tools/world_names.py, synthetic tests, world_names.md, and
map_name64 to world_index output.