manifest_verifier: use unique cache staging files (VERIFY-CACHE-ATOMIC) #344

Open
github-bot wants to merge 2 commits from github-bot/gh-344 into main AGit
Owner

@⁠JiyouProt on GitHub · 2026-11-24 03:38 UTC · original
JiyouProt:codex/verify-cache-atomic → main · +127 −6 · 2 files · 2 commits · open

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.
**@⁠JiyouProt** on GitHub · 2026-11-24 03:38 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/344) `JiyouProt:codex/verify-cache-atomic` → `main` · +127 −6 · 2 files · 2 commits · open Claimed in the coordination issue as: [VERIFY-CACHE-ATOMIC](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:54:24 +00:00
Author
Owner

@⁠JiyouProt on GitHub · 2026-11-24 08:23 UTC · original

Updated in 6164357 to preserve POSIX publication permissions through the existing file_mode.published_mode helper. This avoids changing an existing readable cache to NamedTemporaryFile's private 0600 mode. New files get the directory/umask defaults; permission errors preserve the old cache and clean up staging. Windows behavior is unchanged.

Current verifier suite: 65 tests, 62 passed and 3 platform skips. Shared file_mode suite: 5 tests, 3 passed and 2 POSIX-only skips. New portable mode/failure regressions fail without the fix; the actual POSIX mode check is skipped on this Windows host. Compile and no-game-data checks pass.

SPIRV-Tools is now installed: the only two files that failed in the original full semantic run (test_sopc_validation and test_unary_f16_validation) pass on this branch, 11 + 5 tests. No translator changes. AI-assisted.

**@⁠JiyouProt** on GitHub · 2026-11-24 08:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/344#issuecomment-7126078937) Updated in 6164357 to preserve POSIX publication permissions through the existing file_mode.published_mode helper. This avoids changing an existing readable cache to NamedTemporaryFile's private 0600 mode. New files get the directory/umask defaults; permission errors preserve the old cache and clean up staging. Windows behavior is unchanged. Current verifier suite: 65 tests, 62 passed and 3 platform skips. Shared file_mode suite: 5 tests, 3 passed and 2 POSIX-only skips. New portable mode/failure regressions fail without the fix; the actual POSIX mode check is skipped on this Windows host. Compile and no-game-data checks pass. SPIRV-Tools is now installed: the only two files that failed in the original full semantic run (test_sopc_validation and test_unary_f16_validation) pass on this branch, 11 + 5 tests. No translator changes. AI-assisted.
Author
Owner

@⁠JiyouProt on GitHub · 2026-11-24 20:17 UTC · original

Rebased onto main 58be9cdf8 after #334 and #346 merged; new head ff426194a. The conflict was the shared imports: both file_mode.published_mode and report_paths.same_report_path are retained. The manifest/listed-input collision guards from main remain intact. The PR still changes only the cache writer and its synthetic regression tests.

Revalidated on Windows / Python 3.14.3: manifest verifier 76 tests (71 passed, 5 platform/permission skips); report paths 22 (20 passed, 2 skipped); file_mode 5 (3 passed, 2 POSIX skips); LF writers 3 passed; CI registration 15 passed. Compileall, changed-file no-game-data scan and git diff --check passed. The CI registration test initially could not launch Git Bash inside the local sandbox and passed when rerun outside it. No translator behavior changes; GPU not needed. AI-assisted with Codex.

**@⁠JiyouProt** on GitHub · 2026-11-24 20:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/344#issuecomment-7143324238) Rebased onto main 58be9cdf8 after #334 and #346 merged; new head ff426194a. The conflict was the shared imports: both file_mode.published_mode and report_paths.same_report_path are retained. The manifest/listed-input collision guards from main remain intact. The PR still changes only the cache writer and its synthetic regression tests. Revalidated on Windows / Python 3.14.3: manifest verifier 76 tests (71 passed, 5 platform/permission skips); report paths 22 (20 passed, 2 skipped); file_mode 5 (3 passed, 2 POSIX skips); LF writers 3 passed; CI registration 15 passed. Compileall, changed-file no-game-data scan and git diff --check passed. The CI registration test initially could not launch Git Bash inside the local sandbox and passed when rerun outside it. No translator behavior changes; GPU not needed. AI-assisted with Codex.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/344/head:github-bot/gh-344'
git switch 'github-bot/gh-344'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-344'
git switch 'github-bot/gh-344'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-344'
git switch 'github-bot/gh-344'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-344'
git switch 'main'
git merge --squash 'github-bot/gh-344'
git switch 'main'
git merge --ff-only 'github-bot/gh-344'
git switch 'main'
git merge 'github-bot/gh-344'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.