[PR #344] manifest_verifier: use unique cache staging files (VERIFY-CACHE-ATOMIC) #396

Open
opened 2026-11-26 20:17:45 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/344
Author: @JiyouProt
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: codex/verify-cache-atomic


📝 Commits (2)

  • ec2ff81 manifest_verifier: isolate each cache save in a unique temp file (VERIFY-CACHE-ATOMIC)
  • ff42619 manifest_verifier: preserve published cache permissions

📊 Changes

2 files changed (+127 additions, -6 deletions)

View changed files

📝 tests/test_manifest_verifier.py (+112 -0)
📝 tools/manifest_verifier.py (+15 -6)

📄 Description

Claimed in the coordination issue as: VERIFY-CACHE-ATOMIC

What and why

The verification cache writer uses the fixed cache_path + ".tmp" staging name. An existing neighbor is truncated and removed, including when it is the manifest; overlapping saves also share the same file.

Use an exclusive, unique temporary file beside the cache, close it before replacement on Windows, and clean up only that save's file on failure. Serialization or replacement failures preserve the old cache. Reuse file_mode.published_mode to preserve publication permissions rather than changing a readable cache to private mode. Existing manifest/input collision guards remain intact.

Synthetic regressions cover an unrelated .tmp neighbor, a manifest at that path, serialization/replacement failures, deterministically interleaved saves, and permission handling. The original five staging regressions fail without this fix. Only the cache writer and its tests change.

Depends on: none. #334 and #346 are already merged; their collision guards are preserved.

Tested

Latest compatibility check, 26 November 2026: Windows 11 build 26300, Python 3.11.9. PR head ff426194a8c9ca5bcb986b2f55ff31d4d5d1cfdf merged locally with current main 8ff7bc5b23f02d017ab9c33ddc8a043da6e9fc08, without conflicts. No remote history rewrite.

  • python -I tests/test_manifest_verifier.py: 76 tests, 71 passed, 5 skips.
  • python -I tests/test_report_paths.py: 24 tests, 23 passed, 1 skip.
  • python -I tests/test_file_mode.py: 5 tests, 3 passed, 2 POSIX skips.
  • python -I tests/test_text_write_line_endings.py: 3 passed.
  • python -I tests/test_ci_registration.py: 16 passed. Git Bash cannot start in the local sandbox; the same test passed outside it.
  • python -m compileall -q make_game.py tools tests, changed-file check_no_game_data.py, and changed-file git diff --check: passed. Two trailing blank lines introduced by main in unrelated semantic fixtures are outside this diff.

GPUs tested: n/a (CPU-only cache fix; synthetic data only).

Limits: Windows validation does not cover POSIX permission behavior. The full translator/runtime suites were not rerun for this compatibility check; neither component changes. Earlier validation details remain in the comments. Upstream CI's functional jobs passed, but the aggregate run was cancelled; this is not a fully green CI claim.

AI-assisted: OpenAI Codex (GPT-6; exact model variant unavailable), implementation, tests and review. Publication and PR maintenance authorized by the user.

  • One topic; merges into current main without conflicts.
  • No game data, keys or decryption.
  • No translator 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/344 **Author:** [@JiyouProt](https://github.com/JiyouProt) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `codex/verify-cache-atomic` --- ### 📝 Commits (2) - [`ec2ff81`](https://github.com/ubiquitarianism/leonida/commit/ec2ff813ec4752bf136973ad985f71f4edffed48) manifest_verifier: isolate each cache save in a unique temp file (VERIFY-CACHE-ATOMIC) - [`ff42619`](https://github.com/ubiquitarianism/leonida/commit/ff426194a8c9ca5bcb986b2f55ff31d4d5d1cfdf) manifest_verifier: preserve published cache permissions ### 📊 Changes **2 files changed** (+127 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_manifest_verifier.py` (+112 -0) 📝 `tools/manifest_verifier.py` (+15 -6) </details> ### 📄 Description Claimed in the coordination issue as: [VERIFY-CACHE-ATOMIC](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7121115599) ### What and why The verification cache writer uses the fixed `cache_path + ".tmp"` staging name. An existing neighbor is truncated and removed, including when it is the manifest; overlapping saves also share the same file. Use an exclusive, unique temporary file beside the cache, close it before replacement on Windows, and clean up only that save's file on failure. Serialization or replacement failures preserve the old cache. Reuse `file_mode.published_mode` to preserve publication permissions rather than changing a readable cache to private mode. Existing manifest/input collision guards remain intact. Synthetic regressions cover an unrelated `.tmp` neighbor, a manifest at that path, serialization/replacement failures, deterministically interleaved saves, and permission handling. The original five staging regressions fail without this fix. Only the cache writer and its tests change. Depends on: none. #334 and #346 are already merged; their collision guards are preserved. ### Tested Latest compatibility check, 26 November 2026: Windows 11 build 26300, Python 3.11.9. PR head `ff426194a8c9ca5bcb986b2f55ff31d4d5d1cfdf` merged locally with current main `8ff7bc5b23f02d017ab9c33ddc8a043da6e9fc08`, without conflicts. No remote history rewrite. - `python -I tests/test_manifest_verifier.py`: 76 tests, 71 passed, 5 skips. - `python -I tests/test_report_paths.py`: 24 tests, 23 passed, 1 skip. - `python -I tests/test_file_mode.py`: 5 tests, 3 passed, 2 POSIX skips. - `python -I tests/test_text_write_line_endings.py`: 3 passed. - `python -I tests/test_ci_registration.py`: 16 passed. Git Bash cannot start in the local sandbox; the same test passed outside it. - `python -m compileall -q make_game.py tools tests`, changed-file `check_no_game_data.py`, and changed-file `git diff --check`: passed. Two trailing blank lines introduced by main in unrelated semantic fixtures are outside this diff. GPUs tested: n/a (CPU-only cache fix; synthetic data only). Limits: Windows validation does not cover POSIX permission behavior. The full translator/runtime suites were not rerun for this compatibility check; neither component changes. Earlier validation details remain in the comments. Upstream CI's functional jobs passed, but the aggregate run was cancelled; this is not a fully green CI claim. AI-assisted: OpenAI Codex (GPT-6; exact model variant unavailable), implementation, tests and review. Publication and PR maintenance authorized by the user. - [x] One topic; merges into current main without conflicts. - [x] No game data, keys or decryption. - [x] No translator rule changed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#396
No description provided.