OLD-7845: hashdict --archives ignores spaces and refuses unknown archive names #25

Manually merged
github merged 2 commits from gh-pr/25/head into gh-pr/25/base 2026-11-26 08:41:08 +00:00
Owner

@⁠ItsMrDubey on GitHub · 2026-11-24 02:01 UTC · original
ItsMrDubey:hashdict-archives-names → main · +59 −2 · 2 files · 2 commits · merged 2026-11-24 02:26 UTC

Claimed in the coordination issue as: OLD-7845 (#14)

What and why

Fixes old #7845: full = set(a.archives.split(",")) kept the spaces and never checked the names, so --archives "common, data" selected only common (" data" matched nothing) and a typo such as --archives comon harvested no archive fully, both with exit 0 and no message.

Now each entry is stripped and empty entries are dropped. When --archives is given explicitly, a name that matches none of the archives in the carve (subfolders with an index.json, or the one archive when <carve dir> is itself an archive folder) is a usage error via ap.error (exit 2, usage line, like the tool's other usage errors), naming the unknown archive(s) and the archives that are there. It is checked before any harvesting, so an existing --out is left untouched.

The default list is not checked: it names five archives and a partial carve (or a one-archive folder such as <work>/carve/common) legitimately lacks most of them, so refusing them would break the documented default invocation. To tell the two apart, --archives now defaults to None and the default list lives in DEFAULT_ARCHIVES (shown in --help). An explicit --archives "" still means "no archive fully, PSIN/RBF0 blobs only" and is not an error.

Tested

Windows 11, Python 3.11.9, no GPU needed.

  • Before (origin/main), hand-built carve with common and data: --archives "common, data" -> exit 0, only the common name in the dictionary; --archives comon -> exit 0, empty dictionary.
  • After: --archives "common, dta" -> exit 2, hashdict.py: error: --archives: dta not found in <carve> (archives there: common).
  • python -I tests/test_hashdict.py -> Ran 42 tests, OK (the new test_archives_list_ignores_spaces_and_empty_entries and test_archive_named_but_not_carved_is_a_usage_error fail on origin/main; test_default_archives_absent_from_a_partial_carve_are_not_an_error pins the default-list behaviour).
  • python -I tests/test_audio_config.py (imports hashdict) -> Ran 22 tests, OK.
  • python -I scripts/check_no_game_data.py tools/hashdict.py tests/test_hashdict.py -> exit 0.

AI-assisted: yes

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • n/a: no translator rule
**@⁠ItsMrDubey** on GitHub · 2026-11-24 02:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/25) `ItsMrDubey:hashdict-archives-names` → `main` · +59 −2 · 2 files · 2 commits · merged 2026-11-24 02:26 UTC Claimed in the coordination issue as: OLD-7845 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why Fixes old #7845: `full = set(a.archives.split(","))` kept the spaces and never checked the names, so `--archives "common, data"` selected only `common` (" data" matched nothing) and a typo such as `--archives comon` harvested no archive fully, both with exit 0 and no message. Now each entry is stripped and empty entries are dropped. When `--archives` is given explicitly, a name that matches none of the archives in the carve (subfolders with an `index.json`, or the one archive when `<carve dir>` is itself an archive folder) is a usage error via `ap.error` (exit 2, usage line, like the tool's other usage errors), naming the unknown archive(s) and the archives that are there. It is checked before any harvesting, so an existing `--out` is left untouched. The default list is not checked: it names five archives and a partial carve (or a one-archive folder such as `<work>/carve/common`) legitimately lacks most of them, so refusing them would break the documented default invocation. To tell the two apart, `--archives` now defaults to `None` and the default list lives in `DEFAULT_ARCHIVES` (shown in `--help`). An explicit `--archives ""` still means "no archive fully, PSIN/RBF0 blobs only" and is not an error. ### Tested Windows 11, Python 3.11.9, no GPU needed. - Before (origin/main), hand-built carve with `common` and `data`: `--archives "common, data"` -> exit 0, only the `common` name in the dictionary; `--archives comon` -> exit 0, empty dictionary. - After: `--archives "common, dta"` -> exit 2, `hashdict.py: error: --archives: dta not found in <carve> (archives there: common)`. - `python -I tests/test_hashdict.py` -> Ran 42 tests, OK (the new `test_archives_list_ignores_spaces_and_empty_entries` and `test_archive_named_but_not_carved_is_a_usage_error` fail on origin/main; `test_default_archives_absent_from_a_partial_carve_are_not_an_error` pins the default-list behaviour). - `python -I tests/test_audio_config.py` (imports hashdict) -> Ran 22 tests, OK. - `python -I scripts/check_no_game_data.py tools/hashdict.py tests/test_hashdict.py` -> exit 0. AI-assisted: yes ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] n/a: no translator rule
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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:41:07 +00:00
github manually merged commit b2e409557d into gh-pr/25/base 2026-11-26 08:41:08 +00:00
Author
Owner

@⁠Sigtryggur-Mani-Gudmundsson on GitHub · 2026-11-24 02:12 UTC · original

All 42 hashdict tests passed on Linux with 1512173. Before the fix I reproduced the silent omission and the successful exit for a misspelled archive.

One fixture improvement: custom_pack contains only a PSIN token, which also gets harvested if the second archive is skipped. I added an ordinary blob there and checked that its token appears for the spaced list and disappears for --archives "". This caught a deliberately dropped second selection. The second commit in the source mailbox contains the five added lines.

**@⁠Sigtryggur-Mani-Gudmundsson** on GitHub · 2026-11-24 02:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/25#issuecomment-7119862379) All 42 hashdict tests passed on Linux with 1512173. Before the fix I reproduced the silent omission and the successful exit for a misspelled archive. One fixture improvement: `custom_pack` contains only a PSIN token, which also gets harvested if the second archive is skipped. I added an ordinary blob there and checked that its token appears for the spaced list and disappears for `--archives ""`. This caught a deliberately dropped second selection. The second commit in the [source mailbox](https://github.com/Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches/blob/d66f783cc2ef4723515c44bd91298466fbacda53/archive-selection.mbox) contains the five added lines.
Author
Owner

@⁠ItsMrDubey on GitHub · 2026-11-24 02:16 UTC · original

Thanks, good catch: with only a PSIN blob in custom_pack, the spaced-list case could not tell a selected archive from a skipped one. Added as b2e4095 (same five lines, credited in the message).

Checked both ways on Windows 11 / Python 3.11.9: python -I tests/test_hashdict.py -> 42 tests OK, and with the tool changed to keep only the first selected archive, test_archives_list_ignores_spaces_and_empty_entries now fails where it used to pass.

**@⁠ItsMrDubey** on GitHub · 2026-11-24 02:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/25#issuecomment-7119947790) Thanks, good catch: with only a PSIN blob in `custom_pack`, the spaced-list case could not tell a selected archive from a skipped one. Added as b2e4095 (same five lines, credited in the message). Checked both ways on Windows 11 / Python 3.11.9: `python -I tests/test_hashdict.py` -> 42 tests OK, and with the tool changed to keep only the first selected archive, `test_archives_list_ignores_spaces_and_empty_entries` now fails where it used to pass.
This discussion has been locked. Commenting is limited to contributors.
No description provided.