Commit Graph

13 Commits

Author SHA1 Message Date
00a0a68f59 Merge pull request #1816 from Tayar 2026-11-22 09:48:24 -05:00
85f6c01bb7 save_keys: reject negative compose counts 2026-11-22 11:24:51 -03:00
ec9b6cf22b tools: text reports are written with LF line ends on every platform (BUILD-468)
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.
2026-11-22 14:20:30 +00:00
f698bf2206 tools: a path outside the console's code page no longer crashes a tool's output
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>
2026-11-22 11:27:00 +00:00
b2d7c367b0 Merge pull request #1387 from undeadhuman37 2026-11-22 06:08:09 -05:00
de0366d619 save_keys: resolve refuses an --out that is one of its inputs
`resolve --out names.txt --dict names.txt` replaced the user's local
dictionary with the JSON report (exit 0, no warning); a save, a file found
in an input folder, or a hard link to either was replaced the same way.
An --out in a missing folder ended in a FileNotFoundError traceback after
the whole resolve (and --compose) had run.

resolve now checks --out before reading anything: it refuses a path that
is the same file (os.path.samefile) as any input file or --dict path, and
a missing folder, each as one error line with exit 1. A write that still
fails is reported the same way. input_files() lists the files iter_inputs
reads, so the check and the reader agree on folder inputs.

Tests: tests/test_save_keys.py 19/19 (2 new, synthetic names and saves);
the new cases fail on main (5 subtest failures). No game files, no GPU.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:51:14 +03:00
82575ab46e save_keys: harvest a long identifier whole instead of cutting it after 81 characters
IDENT had its length bound inside the pattern ({1,80}), so a longer run of identifier characters was cut after 81
and the search went on in what was left: one 89-character name became an 81-character prefix and a tail that
nobody wrote, and the real name was never hashed against the save keys. The pattern now takes the whole run, and
a run past 255 characters (an encoded blob, not a name) is left out whole. hashdict.py already reads names this
way.

tests/test_save_keys.py: four tests, all fail on the old code. Synthetic inputs only.
2026-11-22 10:05:21 +00:00
1d649a8bde Merge pull request #872 from ray3242
# Conflicts:
#	tools/save_keys.py
2026-11-21 23:15:54 -05:00
145672a28d BUILD: name the offending file in save_keys JSAV warnings 2026-11-21 22:02:44 -06:00
e74d7f54c3 save_keys: directory scans read .jsav and .asav saves (#844)
iter_inputs only took .json, .bin and extensionless files from a folder, so collect and resolve silently skipped
the JSAV/ASAV saves they document as their input. Extensions now match case-insensitively.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:55:41 -05:00
28b3191eeb BUILD: include .jsav files in save_keys directory scans 2026-11-21 21:53:32 -06:00
3895b9d86b BUILD: skip a malformed JSAV table with a warning instead of a traceback 2026-11-21 20:49:52 -06:00
df696e4c3b saves: key hashes are case-sensitive joaat; add tools/save_keys.py
The $0x... keys in JSAV blocks and ASAV settings are the case-sensitive joaat
(seed 0, no lower-casing) of engine/script names, the same rule as the member
hashes in docs/world_names.md. Found from structure: the group keys hash names
derived from the clear-text JSON wrappers.

tools/save_keys.py collects the distinct keys from saves or extract folders and
resolves them against strings harvested from any local files (raw bytes and
zlib streams), reporting per hash family how many keys resolve and how many
are expected by chance; --compose N adds one/two-word names. On the sample set
278 of 1,059 keys resolve with joaat over the game's own data archives; every
other family stays at chance level. Only counts are documented; names stay local.

Synthetic tests only (tests/test_save_keys.py).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:21:17 +00:00