tooling: report damaged inputs in the script state tools without a traceback #666
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/672"
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 R0Y00/Xbox2Windows. Originally posted by louisdibiasi on 2026-11-22T18:48:05Z.
Change
tools/script_state_probe.pyandtools/script_path_replay.pyraiseValueErrorfor a file that is not an RPF9 archive and for a--state/--record-withlabel that is not ASCII, andOSErrorfor a missing archive. The command lines did not catch them, so each ended in a traceback with exit status 1.sgd5_effects.py,texture_descriptors.pyandresource_root.pyreport the same errors as<archive>: <message>. This catchesOSErrorandValueErroraround the archive read and the label hash and reports them the same way. Only input handling is wrapped; the replay's own consistency checks keep their traceback.Independent problem, no linked issue.
Verification
Commit under test:
f429a11on58dfa51, Windows 11, Python 3.12.10.Base vs this branch (
python -B tools/<tool> <archive> ..., synthetic files):script_state_probe.py empty.binValueError: Expected an RPF9 archivetraceback, exit 1<path>\empty.bin: Expected an RPF9 archive, exit 1script_state_probe.py text.binscript_state_probe.py missing.binFileNotFoundErrortraceback<path>: [Errno 2] No such file or directory: ...script_state_probe.py hdr.bin --state caféUnicodeEncodeError: 'ascii' codec can't encode character '\xe9'traceback<path>: 'ascii' codec can't encode character '\xe9' ...script_path_replay.py empty.bin --host h.dll --record-with anchor pathValueErrortracebackscript_path_replay.py missing.bin ...FileNotFoundErrortracebackscript_path_replay.py hdr.bin ... --record-with caféUnicodeEncodeErrortracebackNew
CommandLineTestsintests/script_state_check.pyrun both tools on an empty file, a non-archive, a missing path and a non-ASCII label, and require exit 1, the file name in the message (for archive errors) and noTraceback.python -B tests/script_state_check.py->Ran 15 tests ... FAILED (failures=8)(every subtest).Ran 15 tests ... OK.python -B tests/script_path_check.py script_path_host.dll-> OK,python -B tests/script_dispatch_check.py script_path_host.dll-> OK.Evidence and follow-up
Synthetic bytes only, no archive from a game. The
--hostargument is never reached in the error cases, so the path tool is tested without the built DLL.Checklist
AI-assisted: I used Claude to find the bug and draft the change. I ran the reproductions and tests above myself.