hashdict: report unreadable --extra files cleanly (HASHDICT-EXTRA-READ-ERROR) #1071
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1071"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.pyreads a regular file supplied through--extra, anOSErrorfrom opening or reading it escaped as a traceback. The tool already reports unreadable extra directories cleanly. This catches the file case, prints oneERRORline, exits 2, and leaves an existing--outunchanged. The regression uses a syntheticPermissionError; 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.PermissionErrorbefore 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
mainand merges cleanly.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.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).