Skip to content

check_no_game_data: --commits also checks files a pull request adds and deletes again - #6079

Closed
Jadiac5 wants to merge 2 commits into
ProjectLeonida:mainfrom
Jadiac5:fix/no-game-data-history
Closed

Jadiac5 wants to merge 2 commits into
ProjectLeonida:mainfrom
Jadiac5:fix/no-game-data-history

Conversation

@Jadiac5

@Jadiac5 Jadiac5 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Claim: #5934 (comment)

The No Game Data job checked only the pull request's last tree. A file added in one commit and deleted in a later one passed, but a merge commit keeps it in main's history.

  • check_no_game_data.py --commits BASE..HEAD checks every file version reachable from HEAD and not from BASE (git rev-list --objects), with the same magic-number rules as the tree check.
  • The workflow fetches history without blobs (fetch-depth: 0, filter: blob:none) and runs the new mode on HEAD^1..HEAD for pull requests. The checkout is the merge commit, so that range is what the merge would bring in.
  • One new test builds a throwaway repo with a renamed DDS (hand-written bytes) that is added, deleted and merged.

Tested on Windows 11, Python 3.12, CPU only (no GPU involved): python -I tests/test_check_no_game_data.py 9/9; the new test fails without the change. On this repository's real history the new mode reports 0 matches on the tip and on the last 50 commits of main.

Not done:

  • The workflow change has not run on GitHub yet; this pull request's own run is its first test. With the blob-less checkout, --commits fetches the file versions it lacks in one git fetch before reading them, instead of one fetch per version (20 versions: 20 lazy fetches before, 0 after, on a local partial clone).
  • Text formats (disassembly, SPIR-V assembly) that are added and deleted again are still caught only by the extension check on the last tree.
  • Direct pushes to main are not range-checked.

AI-assisted (Claude Code).

…t adds, so one deleted again in a later commit no longer passes
@leozinhoszg

Copy link
Copy Markdown
Contributor

Tested f89f750a on Windows 11 Pro (26200), CPython 3.14.7, git 2.55.0.windows.4, CPU only, no game files: pass with notes.

  • python -I tests/test_check_no_game_data.py 9/9, compileall and git diff --check clean. On synthetic repos --commits HEAD^1..HEAD also catches a DDS renamed to .txt, one added and deleted on a side branch merged into the PR, and one re-added after main deleted it. It passes a mode-only change and game data main added and deleted while the PR was open. No ${{ }} in any run: step, so no branch name or title reaches the shell. GitHub's refs/pull/6079/merge has two parents (base 561b65a8, head f89f750a), so HEAD^1 is the base.
  • Negative control: with main's scripts/check_no_game_data.py, test_commits_mode_finds_a_file_deleted_again fails (0 != 1). Main reads --commits as a path and skips it.
  1. With filter: blob:none, every file version that is not in the merge tree (deleted files, earlier versions of edited files) is fetched by its own git fetch. git rev-list --objects at scripts/check_no_game_data.py:249 triggers them one at a time. I copied the workflow's checkout against a local partial-clone server: 20 such versions gave 20 fetches and took 63 s, 100 gave 100 fetches and 267 s. Real open PRs with 16 to 28 commits have 30 to 150 such versions each (Runtime: ExecuteIndirect with multi-argument command signatures (root constants/descriptors, VB/IB views per record) on VK_EXT_device_generated_commands #2077: 147, Runtime tests: run the M5 mesh gate on 32-wide GPUs through --wave64-emulate (depends on #3777) #4236: 133, Runtime: ExecuteIndirect with DISPATCH_MESH signatures and the M5 mesh gate (translated mesh shader) #3777: 120). I couldn't time a fetch on a GitHub runner, but this grows with commit count and could hit the 5-minute timeout-minutes. Fetching them in one go first solved it here: 0 lazy fetches, 8.6 s for the 20-version case:
    git rev-list --objects --missing=print HEAD^1..HEAD | sed -n 's/^?//p' \
      | git -c fetch.negotiationAlgorithm=noop fetch -q --no-tags --no-write-fetch-head --filter=blob:none --stdin origin
    Put it in the workflow step before the check, or in commit_blobs when a ? line shows up.
  2. Optional: commit_blobs already has each blob's path, so the workflow's extension list could run on those paths too. An added-then-deleted text x.spvasm passes now (exit 0) even though rev-list prints its name.

AI-assisted.

@Jadiac5

Jadiac5 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. Note 1 confirmed: with a local partial-clone server (blob:none, 20 file versions added and deleted again) --commits HEAD^1..HEAD started 20 lazy fetches.

Fixed in 333de04c, in commit_blobs instead of the workflow, so a local run on a partial clone gets it too and no bash is needed. It first runs git rev-list --objects --missing=print. If some versions are missing, it fetches all of them from origin with one git fetch --stdin (your command, without sed), then lists the objects again. Without missing objects nothing changes.

  • Same 20-version repo: 0 lazy fetches now, and the result is the same.
  • New test: a blob:none clone of a local repo with 3 deleted DDS versions. It checks that all 3 are found and that git starts no lazy fetch. It fails before the fix and passes after.
  • tests/test_check_no_game_data.py: 10 tests, OK, was 9.
  • Not timed on a GitHub runner.
  • Note 2 (extension list on the history paths) is not done in this PR.
  • Tested on Windows 11, Python 3.12, git 2.52.

AI-assisted (Claude Code).

@haayden

haayden commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Code review of 333de04c (CPU only)

No blocking findings.

  • commit_blobs gets its list from rev-list --objects --missing=print, and that call doesn't trigger lazy fetches. It sends every ?<oid> in one fetch --stdin, then lists again. Paths come back through cat-file --batch-check ... %(rest), so a path containing spaces stays whole. rev-list --objects already cuts a path at a newline, so the printable() on the label is only a second guard.
  • Each blob is spooled to a TemporaryFile before classify_open. The archive and seek paths therefore behave the same as in the tree check, and a large blob is never held in memory.
  • Ran python -I tests/test_check_no_game_data.py on Windows 11, CPython 3.14.4, Git 2.54.0.windows.1. At head, 10/10 pass. With scripts/check_no_game_data.py from f89f750a (before the one-fetch change), only test_commits_mode_fetches_the_missing_versions_of_a_partial_clone_at_once fails, so that test pins the new fetch. I also ran --commits HEAD~30..HEAD on this branch in a full clone: exit 0, about 7 s.

Two non-blocking notes:

  • A bad range gives a traceback with exit 1. I ran --commits nosuchref..HEAD and got CalledProcessError ... exit status 128. Because of capture_output=True, git's own message is swallowed, and exit 1 is also what the script uses for "game data found". CI still fails safe, but catching CalledProcessError in main, printing e.stderr, and returning 2 (the usage exit code) would keep the two cases apart.
  • fetch-depth: 0 + filter: blob:none now applies to the push and workflow_dispatch runs too, and those never run the --commits step. That's a full commit and tree history fetch for nothing, cheap with blob:none but not free. You could keep fetch-depth: 1 for non-PR events with fetch-depth: ${{ github.event_name == 'pull_request' && '0' || '1' }}, or leave it as is.

AI-assisted (Claude Code). No game files.

@mralanbourne

Copy link
Copy Markdown

Second check, CPU, Linux (no game files). Run by an agent (Hermes) on mralanbourne's machine; AI-assisted.

Tested 333de04c5 on CachyOS Linux (kernel 7.3.5), CPython 3.14.10, CPU only: pass. check_no_game_data: --commits also checks files a pull request adds and deletes again.

On this head, from a worktree: tests/test_check_no_game_data.py: OK (10 tests). Not a code review; the author's reasoning was not re-derived.

@OlaiFG7

OlaiFG7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Reviewed 333de04, code read (CPU), AI-assisted: the workflow change uses pull_request, adds no secrets, has no ${{ }} in a run: step and keeps persist-credentials: false; I see no injection or permission problem. Ran python -I tests/test_check_no_game_data.py: pass (10); with the script reverted to main the two new commits-mode tests fail. Note: an invalid range such as nosuchref..HEAD ends in a traceback with exit 1, which is also the "game data found" status (it fails safe; already noted). #8958 also edits check() in this script, so one of the two will need a rebase. LGTM.

@rideinstead

Copy link
Copy Markdown

✅ Automated security review: CLEAN (commit 333de04c)

  • No findings.

Scope: static analysis of added diff lines only; no code was executed. Please review findings manually.

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.

7 participants