Repository navigation
saves: verify every file in a batch after individual failures - #6889
Conversation
SirKingg
left a comment
There was a problem hiding this comment.
Blocking: a deeply nested block can still abort the batch.
On Windows / CPython 3.11.3, a synthetic JSAV with one entry pointing into the string value of a shallow JSON body reproduces this: use body {"s":" + 1500 [ + 0 + 1500 ] + "}, and set the entry offset to the start of those brackets and its size to 3001. parse_jsav accepts the shallow body, but json.loads(b) in verify raises RecursionError. verify nested.jsav valid.jsav exits 1 with a traceback and never reports the valid file, rather than reporting the bad input, continuing, and returning 2. Please handle the block decoder's recursion failure per input and add a batch regression.
Independent Windows validation: python -I tests\test_saves.py passed 65/66 (one POSIX permission-bits test skipped); synthetic CLI checks covered exit statuses 0/1/2, missing paths, a directory, a Windows sharing violation, a Unicode path, and both error-before-mismatch and mismatch-before-error. A parent negative control stopped after the malformed file. No game files or GPU were used. AI-assisted review.
|
Thanks @SirKingg. |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
tools/saves.py:verify() now catches RecursionError per block, re-raising it as a ValueError naming the block index. The verify branch of main() loops over all supplied files, catching ValueError/struct.error and OSError per file with a path-tagged ERROR: line, and returns 2 for any unreadable/malformed input, else 1 for a rebuild mismatch, else 0. docs/saves.md and tests/test_saves.py cover batch status precedence and a per-block decoder failure that no longer aborts later files.
Why merge
Batch verification of save fixtures now reports every file and preserves the worst status, so a single malformed input can no longer hide mismatches or successes in the files that follow — a concrete reliability win for executable/save round-trip analysis.
Verdict: Approve
Summary
Why mergeBatch verification of save fixtures now reports every file and preserves the worst status, so a single malformed input can no longer hide mismatches or successes in the files that follow — a concrete reliability win for executable/save round-trip analysis. Verdict: Approve |
Claimed in the coordination issue as: the
savesitem in this claim. Tracker group:BUILD-2416.What and why
A malformed input followed by a valid synthetic save exited 2 without reporting on the valid file on the parent. Handle read/parse errors per file in
verify, including the path in the diagnostic. Return 2 for any unreadable/malformed input, otherwise 1 for a rebuild mismatch, otherwise 0. The CLI regression mixes malformed, missing, valid-but-byte-different and byte-identical inputs, and checks that a later mismatch cannot hide an earlier error.Tested
Review fix on
f8e604f349: per-block JSON decoder recursion is now a per-file validation error. Linux/Python 3.12.13: 66 passed, 1 skipped. Native Windows re-review requested.1cc6e3c121. Patched head:a71b90ebf159b39fc3c40394061a737249b21ade. Linux x86-64, CPython 3.12.13; CPU only, GPU/driver not used.python3.12 -I tests/test_saves.py— 65 passed, 1 skipped (66 total).git diff --checkandpython3.12 -I scripts/check_no_game_data.py tools/saves.py tests/test_saves.py docs/saves.mdpassed.AI-assisted: yes.
Checklist