hashdict: report unreadable --extra files cleanly (HASHDICT-EXTRA-READ-ERROR) #1071

Merged
j-weiner merged 1 commit from upstream-pr/1071 into main 2026-11-24 23:21:53 +00:00
j-weiner commented 2026-11-24 17:46:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by j-weiner on 2026-11-24T17:46:07Z.


Claimed in the coordination issue as: HASHDICT-EXTRA-READ-ERROR (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7139578822)

What and why

When hashdict.py reads a regular file supplied through --extra, an OSError from opening or reading it escaped as a traceback. The tool already reports unreadable extra directories cleanly. This catches the file case, prints one ERROR line, exits 2, and leaves an existing --out unchanged. The regression uses a synthetic PermissionError; no game files are needed.

Tested

  • python -I -B tests/test_hashdict.py — 42 passed, 1 skipped.
  • python -I -B tests/test_tool_startup.py — 2 passed.
  • python -I -B tests/test_text_write_line_endings.py — 3 passed.
  • python -m compileall -q tools/hashdict.py tests/test_hashdict.py — passed.
  • python -I scripts/check_no_game_data.py tools/hashdict.py tests/test_hashdict.py — passed.
  • python -I tools/hashdict.py --help — passed.
  • git diff --check — passed.
  • The new regression reproduced the uncaught PermissionError before the fix; it now verifies the one-line diagnostic, exit code 2, and preserved output.

GPUs tested: n/a (CPU-only synthetic tests).

AI-assisted: yes.

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys, or decryption.
  • New translator rule: not applicable.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5477369054 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1071). Originally posted by [j-weiner](https://github.com/j-weiner) on 2026-11-24T17:46:07Z. --- Claimed in the coordination issue as: HASHDICT-EXTRA-READ-ERROR (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7139578822) ### What and why When `hashdict.py` reads a regular file supplied through `--extra`, an `OSError` from opening or reading it escaped as a traceback. The tool already reports unreadable extra directories cleanly. This catches the file case, prints one `ERROR` line, exits 2, and leaves an existing `--out` unchanged. The regression uses a synthetic `PermissionError`; no game files are needed. ### Tested - `python -I -B tests/test_hashdict.py` — 42 passed, 1 skipped. - `python -I -B tests/test_tool_startup.py` — 2 passed. - `python -I -B tests/test_text_write_line_endings.py` — 3 passed. - `python -m compileall -q tools/hashdict.py tests/test_hashdict.py` — passed. - `python -I scripts/check_no_game_data.py tools/hashdict.py tests/test_hashdict.py` — passed. - `python -I tools/hashdict.py --help` — passed. - `git diff --check` — passed. - The new regression reproduced the uncaught `PermissionError` before the fix; it now verifies the one-line diagnostic, exit code 2, and preserved output. GPUs tested: n/a (CPU-only synthetic tests). AI-assisted: yes. ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys, or decryption. - [x] New translator rule: not applicable.
KernelSmoker commented 2026-11-24 18:03:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T18:03:47Z.

Review: APPROVED


The synthetic regression exercises the unreadable regular-file path, checks the one-line diagnostic and exit code 2, and confirms the existing output dictionary is preserved. The catch is limited to opening/reading the --extra file and returns before output serialization. On exact head 4c1eae0055, independent checks passed: hashdict 43/43, tool startup 2/2, line endings 3/3; --help, no-game-data, diff, and merge-tree checks also passed. CPU-only synthetic tests; no game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6044691799 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1071#pullrequestreview-6044691799). Originally posted by [KernelSmoker](https://github.com/KernelSmoker) on 2026-11-24T18:03:47Z. **Review:** APPROVED --- The synthetic regression exercises the unreadable regular-file path, checks the one-line diagnostic and exit code 2, and confirms the existing output dictionary is preserved. The catch is limited to opening/reading the --extra file and returns before output serialization. On exact head 4c1eae00557c3a2920b6480ceb3076f95dae1d92, independent checks passed: hashdict 43/43, tool startup 2/2, line endings 3/3; --help, no-game-data, diff, and merge-tree checks also passed. CPU-only synthetic tests; no game data.
QemmHD commented 2026-11-24 23:21:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-24T23:21:50Z.


Merging.

Why merged: HASHDICT-EXTRA-READ-ERROR: an unreadable --extra file gives one ERROR line and exit 2, and an existing --out file is left intact instead of being clobbered. KernelSmoker approved it.

Why it's good: test_hashdict: 42 passed, 1 skipped.

Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 0f98d193c. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests, ctest_registration) gives 578 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7147314857 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1071#issuecomment-7147314857). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-24T23:21:50Z. --- Merging. **Why merged:** HASHDICT-EXTRA-READ-ERROR: an unreadable --extra file gives one ERROR line and exit 2, and an existing --out file is left intact instead of being clobbered. KernelSmoker approved it. **Why it's good:** test_hashdict: 42 passed, 1 skipped. Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 0f98d193c. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests, ctest_registration) gives 578 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1071
No description provided.