[PR #346] [MERGED] manifest_verifier: protect listed files from cache writes (VERIFY-CACHE-INPUTS) #399

Closed
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/346
Author: @JiyouProt
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD

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


📝 Commits (1)

  • eb348cd manifest_verifier: refuse caches that alias listed inputs (VERIFY-CACHE-INPUTS)

📊 Changes

2 files changed (+62 additions, -0 deletions)

View changed files

📝 tests/test_manifest_verifier.py (+55 -0)
📝 tools/manifest_verifier.py (+7 -0)

📄 Description

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

What and why

With two listed files, passing one as --cache excludes it from the scan, reports it MISSING, then overwrites its original bytes with cache JSON when the other file passes. A missing listed file can likewise be created as cache JSON.

Check the cache destination against every manifest-listed input before scanning or hashing, using report_paths.same_report_path for normalized paths, case aliases and links. Refuse with ManifestError; the CLI exits 2 without a traceback and preserves the input bytes. An ordinary cache inside the target directory remains supported.

Six synthetic regression tests cover the CLI, alternate path spelling, case aliases, hard links, symlinks and a missing listed input. The four runnable negative controls fail on unchanged main. Independent of #334 (manifest collision) and #344 (temporary-file staging). Based on main d478a92.

Tested

Windows 11 build 26300, Python 3.14.3:

  • python -I tests/test_manifest_verifier.py: 63 tests, 59 passed, 4 platform/sandbox skips.
  • python -I tests/test_report_paths.py: 22 tests, 20 passed, 2 platform/sandbox skips.
  • The hard-link regression also passes under Python 3.11.9, where this sandbox permits hard links; the symlink test remains skipped.
  • python -m compileall -q make_game.py tools tests, changed-file check_no_game_data.py, and git diff --check: passed.
  • Shared translator-suite run on the same main base (translator and semantic-test trees unchanged by either cache fix): 463 files, 6,075 tests, 514 seconds; only test_sopc_validation and test_unary_f16_validation fail because spirv-as / spirv-val are unavailable.

GPUs tested: n/a (CPU-only input-preservation fix; synthetic bytes only).

AI-assisted: yes, Codex.

  • One topic, based on main.
  • 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/346 **Author:** [@JiyouProt](https://github.com/JiyouProt) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `codex/verify-cache-inputs` --- ### 📝 Commits (1) - [`eb348cd`](https://github.com/ubiquitarianism/leonida/commit/eb348cdd1f6b28653b71ed0e9b7d27d17dbcee40) manifest_verifier: refuse caches that alias listed inputs (VERIFY-CACHE-INPUTS) ### 📊 Changes **2 files changed** (+62 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_manifest_verifier.py` (+55 -0) 📝 `tools/manifest_verifier.py` (+7 -0) </details> ### 📄 Description Claimed in the coordination issue as: [VERIFY-CACHE-INPUTS](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7121173113) ### What and why With two listed files, passing one as `--cache` excludes it from the scan, reports it MISSING, then overwrites its original bytes with cache JSON when the other file passes. A missing listed file can likewise be created as cache JSON. Check the cache destination against every manifest-listed input before scanning or hashing, using `report_paths.same_report_path` for normalized paths, case aliases and links. Refuse with `ManifestError`; the CLI exits 2 without a traceback and preserves the input bytes. An ordinary cache inside the target directory remains supported. Six synthetic regression tests cover the CLI, alternate path spelling, case aliases, hard links, symlinks and a missing listed input. The four runnable negative controls fail on unchanged main. Independent of #334 (manifest collision) and #344 (temporary-file staging). Based on main d478a92. ### Tested Windows 11 build 26300, Python 3.14.3: - `python -I tests/test_manifest_verifier.py`: 63 tests, 59 passed, 4 platform/sandbox skips. - `python -I tests/test_report_paths.py`: 22 tests, 20 passed, 2 platform/sandbox skips. - The hard-link regression also passes under Python 3.11.9, where this sandbox permits hard links; the symlink test remains skipped. - `python -m compileall -q make_game.py tools tests`, changed-file `check_no_game_data.py`, and `git diff --check`: passed. - Shared translator-suite run on the same main base (translator and semantic-test trees unchanged by either cache fix): 463 files, 6,075 tests, 514 seconds; only `test_sopc_validation` and `test_unary_f16_validation` fail because `spirv-as` / `spirv-val` are unavailable. GPUs tested: n/a (CPU-only input-preservation fix; synthetic bytes only). AI-assisted: yes, Codex. - [x] One topic, based on main. - [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>
4ld0 2026-11-26 20:17:45 +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#399
No description provided.