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

Manually merged
github merged 1 commit from gh-pr/1071/head into gh-pr/1071/base 2026-11-26 09:36:34 +00:00
Owner

@⁠j-weiner on GitHub · 2026-11-24 17:46 UTC · original
j-weiner:fix/hashdict-extra-read-error → main · +31 −2 · 2 files · 1 commits · merged 2026-11-24 23:21 UTC

Claimed in the coordination issue as: HASHDICT-EXTRA-READ-ERROR (#14)

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.
**@⁠j-weiner** on GitHub · 2026-11-24 17:46 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1071) `j-weiner:fix/hashdict-extra-read-error` → `main` · +31 −2 · 2 files · 1 commits · merged 2026-11-24 23:21 UTC Claimed in the coordination issue as: HASHDICT-EXTRA-READ-ERROR (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:36:32 +00:00
github manually merged commit 4c1eae0055 into gh-pr/1071/base 2026-11-26 09:36:34 +00:00
Author
Owner

@⁠KernelSmoker on GitHub · 2026-11-24 18:03 UTC · original · approved these changes

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.

**@⁠KernelSmoker** on GitHub · 2026-11-24 18:03 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1071#pullrequestreview-6044691799) · **approved these changes** 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.
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 23:21 UTC · original

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).

**@⁠QemmHD** on GitHub · 2026-11-24 23:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1071#issuecomment-7147314857) 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).
This discussion has been locked. Commenting is limited to contributors.
No description provided.