[PR #1071] [MERGED] hashdict: report unreadable --extra files cleanly (HASHDICT-EXTRA-READ-ERROR) #1105

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1071
Author: @j-weiner
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @QemmHD

Base: main ← Head: fix/hashdict-extra-read-error


📝 Commits (1)

  • 4c1eae0 fix: report unreadable hashdict extra inputs (HASHDICT-EXTRA-READ-ERROR)

📊 Changes

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

View changed files

📝 tests/test_hashdict.py (+25 -0)
📝 tools/hashdict.py (+6 -2)

📄 Description

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.

🔄 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/1071 **Author:** [@j-weiner](https://github.com/j-weiner) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `fix/hashdict-extra-read-error` --- ### 📝 Commits (1) - [`4c1eae0`](https://github.com/ubiquitarianism/leonida/commit/4c1eae00557c3a2920b6480ceb3076f95dae1d92) fix: report unreadable hashdict extra inputs (HASHDICT-EXTRA-READ-ERROR) ### 📊 Changes **2 files changed** (+31 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_hashdict.py` (+25 -0) 📝 `tools/hashdict.py` (+6 -2) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:20:06 +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#1105
No description provided.