Commit Graph

27 Commits

Author SHA1 Message Date
48b2141a29 tests/test_hashdict: check directory entries instead of alias existence on folding volumes 2026-11-26 11:11:34 +01:00
1ca436c86d tools/hashdict: write --out atomically, use shared report_paths guard, and accept UTF-8 BOM in --lookup (HASHDICT-ATOMIC-JSON-AND-PATH-GUARD) 2026-11-25 20:36:32 +01:00
4c1eae0055 fix: report unreadable hashdict extra inputs (HASHDICT-EXTRA-READ-ERROR) 2026-11-24 12:44:53 -05:00
b2e409557d tests: the hashdict archive-selection fixture tells a full harvest from metadata-only
custom_pack held only a PSIN blob, which is harvested whether or not the archive is selected, so the
spaced-list case passed even if the second archive was dropped. An ordinary blob there now has to appear
for " common, custom_pack ,," and disappear for --archives "".

Suggested in review by @Sigtryggur-Mani-Gudmundsson.
2026-11-24 07:46:14 +05:30
15121735d9 hashdict: --archives ignores spaces and refuses an archive the carve does not have 2026-11-24 07:31:12 +05:30
28f86537a3 hashdict: harvest a carved stream with the streams that continue it (#6631)
Squash-merged after diff review of PR #6631
2026-11-23 11:11:22 -06:00
577b19cc55 hashdict: read a carve index.json saved with a UTF-8 BOM (EGEN-HASHDICT-INDEX-BOM) (#6871)
Squash-merged after diff review of PR #6871 - hashdict: read a carve index.json saved with a UTF-8 BOM (EGEN-HASHDICT-INDEX-BOM)
2026-11-23 09:48:43 -06:00
540aa64438 Merge pull request #4186 from Markas
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:12:07 -05:00
87d142cf69 hashdict: report unreadable --extra directories 2026-11-22 23:48:00 +00:00
128e0960a6 hashdict: report missing --extra inputs 2026-11-22 23:30:16 +00:00
0ee35fba67 hashdict: diagnose invalid carve index fields 2026-11-22 18:10:07 +01:00
962b6444b4 test(hashdict): reproduce --out overwriting harvested blob inputs 2026-11-22 20:06:25 +05:00
46d1ab3bf0 hashdict.py: harvest one archive's carve folder instead of writing an empty dictionary
A carve folder with its own index.json (<work>/carve/common, the folder the
gamedata_* tools take) matched no <carve>/<archive>/index.json, so the run
printed "0 strings -> 0 hashes" and exited 0. Treat such a folder as that one
archive; the --out-is-an-input check covers its index.json too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:00:17 +01:00
1e225e8550 Merge pull request #1589 from undeadhuman37 2026-11-22 07:38:24 -05:00
ea10e03898 hashdict.py: refuse an --out that names one of its inputs
The dictionary is written after the harvest, so `--out` naming an `--extra`
file or a carve folder's `index.json` replaced that input. Refuse it before
scanning with one ERROR line; os.path.samefile also catches a case-only
difference on Windows and macOS. Synthetic regression test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:29:13 +03:00
a8973abc24 hashdict.py: honor minimum lengths below three 2026-11-22 12:45:38 +01:00
9f95b08df9 hashdict: a string longer than 201 characters is not cut into fragments
The harvest pattern ended a match after 201 characters and the next match
started in the middle of the same run, so a truncated prefix and a fragment
were added as names and the path component across the cut was lost. The
whole run is matched now and split into its parts as before; a run or a
part longer than 201 characters is not added as a name, which keeps the
longest entry the dictionary could ever hold. Parts are found one at a time,
so a very long run does not build a list of all of them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 14:13:26 +07:00
bbbd6f907c Merge pull request #1042 from sanuk369 2026-11-22 01:38:00 -05:00
48ad23f026 hashdict: a non-object dictionary or a bad archive index is one ERROR line (#1034, #1043)
--lookup called .get on whatever the dictionary file held, so a JSON array ended in an AttributeError; the build
read each <carve>/<archive>/index.json with a bare json.load(f)["files"], so a malformed one aborted the run with a
traceback after earlier archives were processed. Both now print one ERROR line naming the file and exit 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:29:37 -05:00
186c93d64a test_hashdict: pin the Latin-1 joaat value instead of comparing a string with itself
"café" and "caf\xe9" are the same Python string, so the Latin-1 check
compared one value with itself and could never fail: with hashdict.joaat
encoding ASCII instead of Latin-1, all 20 tests still passed. It now pins
joaat("caf\xe9") to 0xEEFBF723, the Latin-1 one-at-a-time hash computed
independently; the ASCII mutation fails it (0x2C6DF1F2).
2026-11-22 11:39:13 +05:30
d9a76decd0 BUILD: create the hashdict --out parent directory before writing 2026-11-21 23:01:17 -06:00
51bb8734ab hashdict.py: bad carve folders, missing blobs and bad --lookup values are one line
A missing or non-folder carve ended in a traceback from os.listdir. A
carved .bin that an index.json lists but that is gone from disk stopped
the whole build with FileNotFoundError, so a long harvest wrote no
dictionary at all. --lookup died on a value that isn't hex, after
printing the values before it, and on a missing or broken dictionary.

The carve folder is now checked first (exit 2, one line). A listed blob
that can't be read is skipped, counted and named in one warning, and
the dictionary is still written from everything else. --lookup checks
every value before it prints anything (a usage error, exit 2) and
names a dictionary it can't read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:44:49 +01:00
202c58fd2d Merge pull request #405 from slopgobblercobbler 2026-11-21 19:14:01 -05:00
5b73750052 fix(tests): condition python -P flag on version >= 3.11 in test_hashdict 2026-11-22 00:41:10 +01:00
803b57d651 hashdict.py: require inputs for build and lookup 2026-11-22 00:23:40 +01:00
3fc2a44190 hashdict.py: make generated dictionaries reproducible 2026-11-21 22:44:11 +01:00
8eff3c4965 test(tools): add unit tests for hashdict joaat, harvesting, and lookup 2026-11-21 18:57:13 +01:00