Repository navigation
bink_play: clean up failed cache writes (BINK-CACHE-CLEANUP) - #568
Conversation
|
Reviewed on Windows 11 x64 ( Verdict: Looks good overall (one small Windows FD-cleanup gap noted below) — wrapping Checks run locally
Windows edge-case probes
AI-assisted: yes |
|
Thanks for the Windows fd-ownership edge case. It is now covered by the open follow-up #840 from @trigger337 (head d6cee3e), so I have not duplicated that work. I checked its changes and merged it locally with main 58be9cd and our still-open --no-cache PR #566: clean merge, 16/16 bink_play tests and 3/3 cache-write tests pass on Windows / Python 3.14.3. Synthetic fixtures only; no game data or GPU. #840 still needs maintainer review/merge. AI-assisted with Codex. |
Claimed in the coordination issue as: BINK-CACHE-CLEANUP
What and why
A failed write or final replacement leaves
bink_names.*.partin the persistent cache directory. Repeated failures accumulate incomplete files even though the previous cache is still usable.Clean up the unique staging path in a finally block after the file handle is closed, including on interruption. Successful publication still uses the existing atomic replacement. Only the current writer's temporary file is removed.
Three synthetic regressions cover a write error, replacement errors/interruption, and an outer save failing after an overlapping inner save successfully publishes. They verify the old or newly published cache survives and an unrelated .part neighbor stays untouched. All three fail against the original source.
This is independent of #566 (uncached lookup storage). The production patch applies cleanly on that head; the new tests live in a separate file so the test additions do not collide.
Tested
Windows 11 build 26300.9974, Python 3.14.3, based on main 1c93c86.
python -I tests/test_bink_play_cache_write.py: 3 passed.python -I tests/test_bink_play.py: 10 passed.python -I tests/test_text_write_line_endings.py: 3 passed.git diff --check: passed.GPUs tested: n/a — standard-library tests with synthetic names only, no game data, codec or GPU needed.
AI-assisted: yes, Codex.