manifest_verifier: refuse cache aliases of the input manifest (VERIFY-CACHE-COLLISION) #334

Merged
JiyouProt merged 1 commit from upstream-pr/334 into main 2026-11-24 13:37:01 +00:00
JiyouProt commented 2026-11-24 03:14:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by JiyouProt on 2026-11-24T03:14:26Z.


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

What and why

Passing the same file to --manifest and --cache replaces the input manifest with cache JSON after reporting successful verification. Reject this configuration before hashing or writing, using report_paths.same_report_path so alternate path spellings, case aliases and links are also checked. The CLI exits 2 and preserves the original bytes.

Adds five synthetic regression tests. On the unchanged base, four fail and the symlink case is skipped on this Windows host. Based on main 84347bb; GitHub reports no merge conflicts.

Tested

Windows, Python 3.14.3:

  • python -I tests/test_manifest_verifier.py: 62 tests, 58 passed, 4 skipped.
  • python -I tests/test_report_paths.py: 22 tests, 20 passed, 2 skipped. The sandbox prevents hard/symbolic link creation; the other verifier skips are platform-specific.
  • Both suites also pass with Python 3.11.9: 80 passed, 4 skipped overall, including the new hard-link regression.
  • python -m compileall -q make_game.py tools tests, python -I make_game.py --help, scripts/check_no_game_data.py on both changed files, and git diff --check: passed.
  • python -I scripts/run_semantic_tests.py tests/semantic --jobs 8: completed in 501 s, 463 files and 6,075 tests run; 2 files failed (test_sopc_validation, test_unary_f16_validation) because spirv-as / spirv-val are unavailable. These translator files are unchanged by this PR.

GPUs tested: n/a. No game files used.

AI-assisted: yes, Codex.

Checklist

  • Based on main 84347bb and merges cleanly at submission.
  • One topic.
  • No game data, keys or decryption, including in fixtures and reports.
  • No new translator rule; contract table changes are not applicable.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465399622 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/334). Originally posted by [JiyouProt](https://github.com/JiyouProt) on 2026-11-24T03:14:26Z. --- Claimed in the coordination issue as: [VERIFY-CACHE-COLLISION](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7120714712) ### What and why Passing the same file to `--manifest` and `--cache` replaces the input manifest with cache JSON after reporting successful verification. Reject this configuration before hashing or writing, using `report_paths.same_report_path` so alternate path spellings, case aliases and links are also checked. The CLI exits 2 and preserves the original bytes. Adds five synthetic regression tests. On the unchanged base, four fail and the symlink case is skipped on this Windows host. Based on main 84347bb; GitHub reports no merge conflicts. ### Tested Windows, Python 3.14.3: - `python -I tests/test_manifest_verifier.py`: 62 tests, 58 passed, 4 skipped. - `python -I tests/test_report_paths.py`: 22 tests, 20 passed, 2 skipped. The sandbox prevents hard/symbolic link creation; the other verifier skips are platform-specific. - Both suites also pass with Python 3.11.9: 80 passed, 4 skipped overall, including the new hard-link regression. - `python -m compileall -q make_game.py tools tests`, `python -I make_game.py --help`, `scripts/check_no_game_data.py` on both changed files, and `git diff --check`: passed. - `python -I scripts/run_semantic_tests.py tests/semantic --jobs 8`: completed in 501 s, 463 files and 6,075 tests run; 2 files failed (`test_sopc_validation`, `test_unary_f16_validation`) because `spirv-as` / `spirv-val` are unavailable. These translator files are unchanged by this PR. GPUs tested: n/a. No game files used. AI-assisted: yes, Codex. ### Checklist - [x] Based on main 84347bb and merges cleanly at submission. - [x] One topic. - [x] No game data, keys or decryption, including in fixtures and reports. - [x] No new translator rule; contract table changes are not applicable.
Oliwettoo commented 2026-11-24 10:26:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Oliwettoo on 2026-11-24T10:26:08Z.


Looks good. This prevents real data loss: --cache pointing at the manifest (another spelling, hard link, symlink or case alias) would otherwise overwrite the input with the cache. It reuses same_report_path as CONTRIBUTING asks, and the CLI turns the ManifestError into exit 2. test_manifest_verifier.py and test_report_paths.py pass with the PR on current main. Merge note: this conflicts with #344 (git merge-tree), but not with #346, so whichever of #334/#344 lands second needs a rebase. Ship. AI-assisted review.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7128777152 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/334#issuecomment-7128777152). Originally posted by [Oliwettoo](https://github.com/Oliwettoo) on 2026-11-24T10:26:08Z. --- Looks good. This prevents real data loss: `--cache` pointing at the manifest (another spelling, hard link, symlink or case alias) would otherwise overwrite the input with the cache. It reuses `same_report_path` as CONTRIBUTING asks, and the CLI turns the `ManifestError` into exit 2. `test_manifest_verifier.py` and `test_report_paths.py` pass with the PR on current `main`. Merge note: this conflicts with #344 (`git merge-tree`), but not with #346, so whichever of #334/#344 lands second needs a rebase. Ship. AI-assisted review.
QemmHD commented 2026-11-24 13:36:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-24T13:36:59Z.


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 (21625bca8 or 51f316092) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c242f (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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7133085724 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/334#issuecomment-7133085724). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-24T13:36:59Z. --- 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 (21625bca8 or 51f316092) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c242f (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).
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!334
No description provided.