check_no_game_data: inspect legacy V7 tar archives #1899

Merged
XeNS1 merged 1 commit from upstream-pr/1899 into main 2026-11-28 08:04:00 +00:00
XeNS1 commented 2026-11-25 15:07:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by XeNS1 on 2026-11-25T15:07:43Z.


Claimed in the coordination issue as: CHECK-NO-GAME-DATA-V7-TAR
https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7166283601

Related: #1024 handles explicit-path validation in the same files; that separate behavior is unchanged here.

What and why

A valid V7 tar archive has no ustar marker. Saved under a harmless name such as .bin, it previously passed check_no_game_data.py without its members being inspected, even if a member started with a prohibited binary-format header.

Recognize legacy archives by validating their first 512-byte header through tarfile.TarInfo.frombuf. The existing ustar detection still identifies damaged modern tar archives as unchecked. Member inspection continues through the existing depth, expanded-byte and member-count budgets.

Add generated synthetic fixtures covering raw V7 tar, gzip/bzip2/xz compression, ZIP nesting, a clean first member followed by a synthetic DDS header, clean text-only archives, and non-archive controls. All binary fixture bytes are generated in temporary directories; no game files are included or needed.

Tested

Linux x86-64, Python 3.14.8, CPU only:

  • python3 -I tests/test_check_no_game_data.py: 15 tests passed.
  • python3 -I tests/test_no_game_data_workflow.py: 3 tests passed.
  • Regression proof: all five cases in the new V7 detection test fail against the unchanged scanner and pass with the fix.
  • tests/test_text_write_line_endings.py: 3 tests passed.
  • Full semantic suite: 489 files, 6,288 tests, zero failed files, 213 seconds with 2 workers. This was run before rebasing; the only subsequent upstream changes were runtime/CMakeLists.txt and runtime/test/d3d12_title_va_test.cpp, so the Python sources and semantic fixtures are identical.
  • compileall for make_game.py, tools, tests and the changed scanner; make_game.py --help; changed-file game-data scan; git diff --check: passed.
  • Known baseline failure: test_runner_calls_all_tests.py reports the uncalled test_feature_scan.py::test_out_named_like_the_optional_spirv_index. The same failure was reproduced on a separate clean upstream worktree. Neither file is changed here.

GPUs tested: n/a; CPU-only checks. No game installation was accessed.

AI-assisted: yes, OpenAI Codex.

Checklist

  • Rebased on current main without conflicts.
  • One topic.
  • No game data, keys, decryption or game-derived logs in the change or report.
  • No translator rule changed; contract-table update is not applicable.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5493943035 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1899). Originally posted by [XeNS1](https://github.com/XeNS1) on 2026-11-25T15:07:43Z. --- Claimed in the coordination issue as: CHECK-NO-GAME-DATA-V7-TAR https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7166283601 Related: #1024 handles explicit-path validation in the same files; that separate behavior is unchanged here. ### What and why A valid V7 tar archive has no `ustar` marker. Saved under a harmless name such as `.bin`, it previously passed `check_no_game_data.py` without its members being inspected, even if a member started with a prohibited binary-format header. Recognize legacy archives by validating their first 512-byte header through `tarfile.TarInfo.frombuf`. The existing `ustar` detection still identifies damaged modern tar archives as unchecked. Member inspection continues through the existing depth, expanded-byte and member-count budgets. Add generated synthetic fixtures covering raw V7 tar, gzip/bzip2/xz compression, ZIP nesting, a clean first member followed by a synthetic DDS header, clean text-only archives, and non-archive controls. All binary fixture bytes are generated in temporary directories; no game files are included or needed. ### Tested Linux x86-64, Python 3.14.8, CPU only: - `python3 -I tests/test_check_no_game_data.py`: 15 tests passed. - `python3 -I tests/test_no_game_data_workflow.py`: 3 tests passed. - Regression proof: all five cases in the new V7 detection test fail against the unchanged scanner and pass with the fix. - `tests/test_text_write_line_endings.py`: 3 tests passed. - Full semantic suite: 489 files, 6,288 tests, zero failed files, 213 seconds with 2 workers. This was run before rebasing; the only subsequent upstream changes were `runtime/CMakeLists.txt` and `runtime/test/d3d12_title_va_test.cpp`, so the Python sources and semantic fixtures are identical. - `compileall` for `make_game.py`, `tools`, `tests` and the changed scanner; `make_game.py --help`; changed-file game-data scan; `git diff --check`: passed. - Known baseline failure: `test_runner_calls_all_tests.py` reports the uncalled `test_feature_scan.py::test_out_named_like_the_optional_spirv_index`. The same failure was reproduced on a separate clean upstream worktree. Neither file is changed here. GPUs tested: n/a; CPU-only checks. No game installation was accessed. AI-assisted: yes, OpenAI Codex. ### Checklist - [x] Rebased on current `main` without conflicts. - [x] One topic. - [x] No game data, keys, decryption or game-derived logs in the change or report. - [x] No translator rule changed; contract-table update is not applicable.
DeadlyChirp commented 2026-11-25 15:32:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-25T15:32:08Z.


Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.

python -m pytest -q tests/test_check_no_game_data.py:

  • PR: 15 passed, 71 subtests passed. main: 11 passed, 66 subtests passed. The new tests pass on Windows.

(AI-assisted test run; output checked by hand.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7166993151 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1899#issuecomment-7166993151). Originally posted by [DeadlyChirp](https://github.com/DeadlyChirp) on 2026-11-25T15:32:08Z. --- Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main. `python -m pytest -q tests/test_check_no_game_data.py`: - PR: 15 passed, 71 subtests passed. main: 11 passed, 66 subtests passed. The new tests pass on Windows. (AI-assisted test run; output checked by hand.)
DadaCap commented 2026-11-28 08:04:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T08:04:03Z.


Merged into main (merge commit f7ea55c19), approved by DadaCap (maintainer). Thanks!

Checked before merging: Tested in our local release candidate (main + 41 PRs): translator suite 512 files / 6,442 tests clean, Python suite with no new failure versus main, and 360 s game runs on an RTX 5080 with no regression. The merge was pinned to the head commit that was tested (7dcca92ce).

AI-assisted (Claude Code), posted for DadaCap.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7236340530 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1899#issuecomment-7236340530). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T08:04:03Z. --- Merged into `main` (merge commit f7ea55c19), approved by DadaCap (maintainer). Thanks! Checked before merging: Tested in our local release candidate (main + 41 PRs): translator suite 512 files / 6,442 tests clean, Python suite with no new failure versus main, and 360 s game runs on an RTX 5080 with no regression. The merge was pinned to the head commit that was tested (7dcca92ce). _AI-assisted (Claude Code), posted for DadaCap._
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!1899
No description provided.