[PR #568] [MERGED] bink_play: clean up failed cache writes (BINK-CACHE-CLEANUP) #612

Closed
opened 2026-11-26 20:18:28 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/568
Author: @JiyouProt
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: codex/bink-cache-cleanup


📝 Commits (1)

  • 09867f4 bink_play: remove cache staging files after failed publication (BINK-CACHE-CLEANUP)

📊 Changes

2 files changed (+97 additions, -7 deletions)

View changed files

➕ tests/test_bink_play_cache_write.py (+87 -0)
📝 tools/bink_play.py (+10 -7)

📄 Description

Claimed in the coordination issue as: BINK-CACHE-CLEANUP

What and why

A failed write or final replacement leaves bink_names.*.part in 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 1c93c86970.

  • python -I tests/test_bink_play_cache_write.py: 3 passed.
  • Existing python -I tests/test_bink_play.py: 10 passed.
  • python -I tests/test_text_write_line_endings.py: 3 passed.
  • Integration with #566: 14 lookup tests + 3 cache-publication tests passed; no conflicting hunks.
  • compileall, changed-file no-game-data scan and git diff --check: passed.
  • Shared translator-suite run on the same main base (translator, semantic tests and runner unchanged by either cache fix): 465 files, 6,107 tests, 0 files failed in 515 s with 8 jobs and SPIRV-Tools available.

GPUs tested: n/a — standard-library tests with synthetic names only, no game data, codec or GPU needed.

AI-assisted: yes, Codex.

  • One topic, based on current main at task start and merges cleanly.
  • No game data, keys or decryption.
  • No translation rule changed.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/568 **Author:** [@JiyouProt](https://github.com/JiyouProt) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `codex/bink-cache-cleanup` --- ### 📝 Commits (1) - [`09867f4`](https://github.com/ubiquitarianism/leonida/commit/09867f4939ca43f535a3cda0bd43af045a7a60c9) bink_play: remove cache staging files after failed publication (BINK-CACHE-CLEANUP) ### 📊 Changes **2 files changed** (+97 additions, -7 deletions) <details> <summary>View changed files</summary> ➕ `tests/test_bink_play_cache_write.py` (+87 -0) 📝 `tools/bink_play.py` (+10 -7) </details> ### 📄 Description Claimed in the coordination issue as: [BINK-CACHE-CLEANUP](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7126204344) ### What and why A failed write or final replacement leaves `bink_names.*.part` in 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 1c93c8697078c3ccbd6f374caf5bb3ab0b6bc8e4. - `python -I tests/test_bink_play_cache_write.py`: 3 passed. - Existing `python -I tests/test_bink_play.py`: 10 passed. - `python -I tests/test_text_write_line_endings.py`: 3 passed. - Integration with #566: 14 lookup tests + 3 cache-publication tests passed; no conflicting hunks. - compileall, changed-file no-game-data scan and `git diff --check`: passed. - Shared translator-suite run on the same main base (translator, semantic tests and runner unchanged by either cache fix): **465 files, 6,107 tests, 0 files failed** in 515 s with 8 jobs and SPIRV-Tools available. GPUs tested: n/a — standard-library tests with synthetic names only, no game data, codec or GPU needed. AI-assisted: yes, Codex. - [x] One topic, based on current main at task start and merges cleanly. - [x] No game data, keys or decryption. - [x] No translation rule changed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:28 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#612
No description provided.