Skip to content

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

Open
JiyouProt wants to merge 2 commits into
ProjectLeonida:mainfrom
JiyouProt:codex/verify-cache-atomic
Open

JiyouProt wants to merge 2 commits into
ProjectLeonida:mainfrom
JiyouProt:codex/verify-cache-atomic

Conversation

@JiyouProt

@JiyouProt JiyouProt commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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.

QemmHD added a commit that referenced this pull request Nov 24, 2026
Merging.

**Why merged:** manifest_verifier refuses a --cache path that aliases the input manifest (another spelling, a hard link, a symlink or a case alias), which would otherwise overwrite the manifest: a real data-loss guard. Reviewed as good by Oliwettoo.

**Why it's good:** Its tests: 82 passed, 4 skipped. It merges cleanly together with #346, which touches the same tool; the cumulative run includes both. Note from Oliwettoo: this conflicts with #344, which will need a rebase.

Tested on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, alone on main (21625bc or 51f3160) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c24 (git merge-tree: 0 conflicts against current main). Repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests): 566 passed / 5 skipped / 0 failed on main and on main + batch. compileall OK. Full ctest: 302/304 on main and on main + batch (the same two pre-existing failures, d3d12_execute_indirect_validation and d3d12_depth_resolve, no new ones).

AI-assisted (Claude Code, Claude Opus 5.5).
@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 24, 2026
@JiyouProt
JiyouProt force-pushed the codex/verify-cache-atomic branch from 6164357 to ff42619 Compare November 24, 2026 20:17
@JiyouProt

Copy link
Copy Markdown
Contributor Author

Rebased onto main 58be9cd after #334 and #346 merged; new head ff42619. 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.

@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant