[PR #25] [MERGED] OLD-7845: hashdict --archives ignores spaces and refuses unknown archive names #79

Closed
opened 2026-11-26 20:16:43 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/25
Author: @ItsMrDubey
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: hashdict-archives-names


📝 Commits (2)

  • 1512173 hashdict: --archives ignores spaces and refuses an archive the carve does not have
  • b2e4095 tests: the hashdict archive-selection fixture tells a full harvest from metadata-only

📊 Changes

2 files changed (+59 additions, -2 deletions)

View changed files

📝 tests/test_hashdict.py (+46 -0)
📝 tools/hashdict.py (+13 -2)

📄 Description

Claimed in the coordination issue as: OLD-7845 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7119646964)

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/25 **Author:** [@ItsMrDubey](https://github.com/ItsMrDubey) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `hashdict-archives-names` --- ### 📝 Commits (2) - [`1512173`](https://github.com/ubiquitarianism/leonida/commit/15121735d93310a32ee01c3272d7a363e7fe472c) hashdict: --archives ignores spaces and refuses an archive the carve does not have - [`b2e4095`](https://github.com/ubiquitarianism/leonida/commit/b2e409557dfab268c6e112031f50a2d1300c23fb) tests: the hashdict archive-selection fixture tells a full harvest from metadata-only ### 📊 Changes **2 files changed** (+59 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_hashdict.py` (+46 -0) 📝 `tools/hashdict.py` (+13 -2) </details> ### 📄 Description Claimed in the coordination issue as: OLD-7845 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7119646964) ### 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:16:43 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#79
No description provided.