manifest_verifier: accept a flat entry named files #2403

Merged
bimo0o merged 1 commit from upstream-pr/2403 into main 2026-11-28 23:47:42 +00:00
bimo0o commented 2026-11-26 20:18:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bimo0o on 2026-11-26T20:18:01Z.


Claimed in the coordination issue as: VERIFY-FLAT-FILES

What and why

The verifier treated every top-level files key as a wrapper. Accept a flat entry named files when its value is a SHA-256 digest string or an object with an integer size and a SHA-256 string. Preserve wrapped manifests that list files named sha256 or size.

Tested

  • Both flat forms reproduced the bug on main (fac8b4b) and pass with the fix.
  • Manifest verifier on Windows, Python 3.12.3 and 3.14.0: 68 passed and 2 skipped on each.
  • Related path, game-data guard, and line-ending tests: 37 passed and 1 skipped.
  • Compileall, CLI help, changed-file game-data check, and git diff --check passed.
  • Full translator and runtime suites were not run.

GPUs tested: n/a. Synthetic fixtures only.

AI-assisted: yes (Codex).

Checklist

  • One topic.
  • No game data, keys or decryption.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5516608400 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2403). Originally posted by [bimo0o](https://github.com/bimo0o) on 2026-11-26T20:18:01Z. --- Claimed in the coordination issue as: [VERIFY-FLAT-FILES](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7202418131) ### What and why The verifier treated every top-level `files` key as a wrapper. Accept a flat entry named `files` when its value is a SHA-256 digest string or an object with an integer size and a SHA-256 string. Preserve wrapped manifests that list files named `sha256` or `size`. ### Tested - Both flat forms reproduced the bug on main (`fac8b4b`) and pass with the fix. - Manifest verifier on Windows, Python 3.12.3 and 3.14.0: 68 passed and 2 skipped on each. - Related path, game-data guard, and line-ending tests: 37 passed and 1 skipped. - Compileall, CLI help, changed-file game-data check, and `git diff --check` passed. - Full translator and runtime suites were not run. GPUs tested: n/a. Synthetic fixtures only. AI-assisted: yes (Codex). ### Checklist - [x] One topic. - [x] No game data, keys or decryption.
lixonik commented 2026-11-26 20:43:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T20:43:08Z.

Review: COMMENTED


On Windows 11 with Python 3.12.1, the manifest verifier suite had 68 passes and 2 skips. I ran the two new cases again with only the verifier loaded from the parent commit. Both flat forms raised ManifestError, while the wrapped manifest with entries named sha256 and size still passed.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6080301016 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2403#pullrequestreview-6080301016). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T20:43:08Z. **Review:** COMMENTED --- On Windows 11 with Python 3.12.1, the manifest verifier suite had 68 passes and 2 skips. I ran the two new cases again with only the verifier loaded from the parent commit. Both flat forms raised `ManifestError`, while the wrapped manifest with entries named `sha256` and `size` still passed. AI-assisted.
tiguan26 commented 2026-11-27 04:43:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-27T04:43:25Z.

Review: APPROVED


Approving 2b738d3ba.

A flat entry named files is taken as a file only when it looks like one (a 64-hex digest, or an object with an integer size and a string sha256). A real wrapper cannot look like that: its size member would be a file entry, not an integer, so a wrapped manifest that lists files called size or sha256 still reads as wrapped. The digest check now shares one compiled pattern.

Merged onto main d1dff7949 together with #2410, #2299, #2297, #2330 and #2286 (no conflicts), on Linux with Python 3.13. tests/test_manifest_verifier.py: 68 passed, 2 skipped (main: 66 passed). AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6083581746 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2403#pullrequestreview-6083581746). Originally posted by [tiguan26](https://github.com/tiguan26) on 2026-11-27T04:43:25Z. **Review:** APPROVED --- Approving 2b738d3ba. A flat entry named `files` is taken as a file only when it looks like one (a 64-hex digest, or an object with an integer `size` and a string `sha256`). A real wrapper cannot look like that: its `size` member would be a file entry, not an integer, so a wrapped manifest that lists files called `size` or `sha256` still reads as wrapped. The digest check now shares one compiled pattern. Merged onto `main` `d1dff7949` together with #2410, #2299, #2297, #2330 and #2286 (no conflicts), on Linux with Python 3.13. `tests/test_manifest_verifier.py`: 68 passed, 2 skipped (main: 66 passed). AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-28 10:23:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T10:23:46Z.


#2403 | head 2b738d3ba5 (merged cleanly with main 901b6c1bf) | python -I tests/test_manifest_verifier.py | red on main: FAILED (errors=2, skipped=4) (ManifestError: entry 'size' must be an object or digest string and ManifestError: 'files' must be a JSON object on flat manifests naming a file files) | green on PR+main: 70 tests OK (skipped=4) | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited load_manifest in tools/manifest_verifier.py (SHA256_HEX.fullmatch disambiguation for flat "files" digest strings and {"size": <int>, "sha256": <str>} entry objects while preserving wrapped {"files": ...} manifests whose entries are themselves named "sha256" or "size", with type(files_value.get("size")) is int rejecting bool). Also passed tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), tests/test_runner_calls_all_tests.py (3 OK), and scripts/check_no_game_data.py on the merged tree.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237868912 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2403#issuecomment-7237868912). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T10:23:46Z. --- #2403 | head 2b738d3ba5adbebcf2dc1f36cd5e685b356abab2 (merged cleanly with main 901b6c1bf) | `python -I tests/test_manifest_verifier.py` | red on main: `FAILED (errors=2, skipped=4)` (`ManifestError: entry 'size' must be an object or digest string` and `ManifestError: 'files' must be a JSON object` on flat manifests naming a file `files`) | green on PR+main: `70 tests OK (skipped=4)` | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `load_manifest` in `tools/manifest_verifier.py` (`SHA256_HEX.fullmatch` disambiguation for flat `"files"` digest strings and `{"size": <int>, "sha256": <str>}` entry objects while preserving wrapped `{"files": ...}` manifests whose entries are themselves named `"sha256"` or `"size"`, with `type(files_value.get("size")) is int` rejecting `bool`). Also passed `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), `tests/test_runner_calls_all_tests.py` (`3 OK`), and `scripts/check_no_game_data.py` on the merged tree.
TheGeogeo commented 2026-11-28 23:38:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T23:38:05Z.


Tested 2b738d3ba merged (no commit) with main aa918e5d9: Python 3.12.4, Windows 11 10.0.26300, CPU only. check_no_game_data.py is clean.

  • Green: tests/test_manifest_verifier.py, 78 tests pass (3 skipped).
  • Red: with tools/manifest_verifier.py back to main, test_flat_manifest_verifies_a_file_named_files errors twice ('files' must be a JSON object).

No blocker from my side.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247561454 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2403#issuecomment-7247561454). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-28T23:38:05Z. --- Tested `2b738d3ba` merged (no commit) with `main` `aa918e5d9`: Python 3.12.4, Windows 11 10.0.26300, CPU only. `check_no_game_data.py` is clean. - Green: `tests/test_manifest_verifier.py`, 78 tests pass (3 skipped). - Red: with `tools/manifest_verifier.py` back to `main`, `test_flat_manifest_verifies_a_file_named_files` errors twice (`'files' must be a JSON object`). No blocker from my side. AI-assisted (Claude Code).
MoonEyes commented 2026-11-28 23:47:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T23:47:44Z.


Merged after TheGeogeo's red/green check (check) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto main 717bd20df without conflict, and its test file(s) (tests/test_manifest_verifier.py) pass there. Earlier today the same tests failed on main without the PR (red/green) and a bundle with other open PRs showed no new failures. check_no_game_data.py is clean. Windows 11, Python 3.14; no GPU needed for these tests.

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247668395 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2403#issuecomment-7247668395). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T23:47:44Z. --- Merged after **TheGeogeo**'s red/green check ([check](https://github.com/ProjectLeonida/mandy/pull/2403#issuecomment-7247561454)) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto `main` 717bd20df without conflict, and its test file(s) (`tests/test_manifest_verifier.py`) pass there. Earlier today the same tests failed on `main` without the PR (red/green) and a bundle with other open PRs showed no new failures. `check_no_game_data.py` is clean. Windows 11, Python 3.14; no GPU needed for these tests. _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
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!2403
No description provided.