Repository navigation
make_game: a translated index that cannot be removed fails the stage with its message, not a traceback - #6740
Conversation
…with its message, not a traceback After rdna2spirv.py --merge, translate() drops an index it cannot open or parse, or one that is empty, with a bare os.remove(). On Windows the lock that stops the open (an antivirus scan, the search indexer) usually stops the remove too, so the stage ended in a PermissionError traceback and the user never saw why it failed. drop_index() removes the index and, when that fails, returns a sentence for the failure message that names the file and asks for it to be deleted before the next run: a leftover index could otherwise be taken as a finished translation. The failed-shard branch, which already logged its failed remove, now uses it too. The OSError reasons in these messages and in require_translated_shaders() and pipeline_names() are the strerror, not str(error), which named the path a second time through repr() (every Windows backslash doubled). Tests: four mocked cases in tests/test_make_game_empty_translation.py; three end in a PermissionError traceback and one fails without this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent CPU review at Code inspection:
Checks run on Linux CPU:
Looks good to merge. |
devnull34
left a comment
There was a problem hiding this comment.
Reviewed and verified at head 43c1d88:
- Fix verified:
- drop_index() replaces bare os.remove(index) calls and catches OSError (e.g. Windows file locking by antivirus / indexing), appending clean instructions to delete the file rather than raising an unhandled PermissionError traceback.
- Replaces str(error) with error.strerror so Windows backslashes are not doubled via
epr().
- Test execution: python -m unittest tests/test_make_game_empty_translation.py passed all 13 tests (including all 4 locked index tests: unopenable, unparsable, empty, and stale index).
- Diff & formatting: git diff --check 1cc6e3c..HEAD clean.
No game data used.
AI-assisted verification.
shayderrr
left a comment
There was a problem hiding this comment.
Summary
make_game.py adds drop_index(), which removes a stale index.json and returns a one-sentence failure hint instead of raising. On Windows an antivirus/indexer lock that blocks reading the index usually blocks removal too, so a raw PermissionError traceback hid the cause. Messages use e.strerror rather than str(e), which doubled Windows backslashes through repr(). Applied in translate() and index/pipeline read failures; tests simulate a locked index across unopenable, unparsable, empty and stale cases.
Why merge
Turns opaque tracebacks into an actionable message naming the file once and telling the user to delete it before rerunning the shaders stage.
Verdict: Approve
Summary
Why mergeTurns opaque tracebacks into an actionable message naming the file once and telling the user to delete it before rerunning the shaders stage. Verdict: Approve |
Claimed in #6603: #6603 (comment)
What
After
rdna2spirv.py --merge,translate()drops anindex.jsonit cannot open or parse, or one that is empty, with a bareos.remove(index)(make_game.py:1489and:1493on1cc6e3c12). On Windows the lock that stops the open (an antivirus scan or the search indexer holding the file) usually stops the remove too. The shaders stage then ends in aPermissionErrortraceback, and the user never seesrdna2spirv.py --merge wrote an unreadable ....drop_index()removes the index. If the remove fails, it returns a sentence for the stage's failure message instead of raising. That sentence names the file and asks the user to delete it before the next run, because a leftover index could be taken as a finished translation. The failed-shard branch at:1474-1479used to log its own failed remove; it now usesdrop_index()too, so that warning moves into the failure message.OSErrorreasons in these messages, and inrequire_translated_shaders()(:1920) andpipeline_names()(:2066), are now thestrerror. Before, they werestr(error), which named the path a second time throughrepr()with every Windows backslash doubled. This follows the same convention as tools: print a refused or unreadable path as typed, not through repr() (5 tests fail on Windows) #5927.Before (Windows, a locked
index.json):After:
Tests
Four mocked cases in
tests/test_make_game_empty_translation.py. Each one patchesos.removeandopento raisePermissionErrorfor the index:Without the change, three of them end in a
PermissionErrortraceback and the fourth fails.On Windows 11 (26200) with Python 3.13, all 22
tests/test_make_game*.pyfiles pass, and so dopython -m compileall -q make_game.pyandpython -I make_game.py --help. No game files and no GPU are involved; the shard processes andrdna2spirv.pyare mocked.AI-assisted (Claude Code).
🤖 Generated with Claude Code