Skip to content

No game data: refuse hash-named shader disassembly listings (.s / .asm) in both checks - #9000

Closed
Crxckyi wants to merge 1 commit into
ProjectLeonida:mainfrom
Crxckyi:nogamedata-disasm-names
Closed

Crxckyi wants to merge 1 commit into
ProjectLeonida:mainfrom
Crxckyi:nogamedata-disasm-names

Conversation

@Crxckyi

@Crxckyi Crxckyi commented Nov 23, 2026

Copy link
Copy Markdown

Claimed in the coordination issue as: #8868 (comment)

Depends on: none. Other open check_no_game_data PRs (#8090, #6396, #6079, #8231 and the magic-number ones) edit main(), tracked_files() or the magic table. This PR adds a name check inside check() and a pattern in the workflow step, so any conflict is local and small.

What and why

A committed shader disassembly listing passed both no-game-data checks:

  • .github/workflows/no-game-data.yml's extension regex has no .s or .asm.
  • scripts/check_no_game_data.py reads magics. Its docstring said text formats like disassembly "stay with the extension check", which wasn't true for these.

tools/shader_disasm.py:43 writes a listing under its shader's name with .s. Hundreds of hand-written .s/.asm fixtures are tracked (402 under tests/semantic/fixtures, runtime/test/shaders, ...), so refusing the extensions outright isn't possible, and a copied listing looked like one more fixture. Shader disassembly is on AGENTS.md's no-game-data list.

This PR refuses a .s/.asm file whose name starts with 16 or more hex digits, case-insensitive. The name either ends there or continues with a suffix after ., ~ or _: tools/shader_carve.py names duplicates ~N, and tools/fspx_unpack.py adds _NN. Pattern: (^|/)[0-9a-f]{16,}([._~][^/]*)?\.(s|asm)$. No tracked fixture matches; the longest leading hex run in a fixture name is 3 characters.

  • Workflow step: the old extension regex and the listing pattern are combined in one grep -ziE over git ls-files -z, so quoted names and plain names are handled alike, as before.
  • check_no_game_data.py: a LISTING pattern with the same expression and listing_name(), used in check() as classify_file(path) or listing_name(path). The report says shader disassembly listing (hash-named). The docstring is corrected. main() is unchanged.

Tests:

  • tests/test_no_game_data_workflow.py::test_a_hash_named_listing_is_caught runs the real workflow step.
    • Refused: 9f3a1c2b4d5e6f70.s, an upper-case .asm, the .vs.s, ~1.s and _01.asm suffixes, and a nested path.
    • Accepted: v_add_f32.s, cs_exec_const.asm, deadbeef.s and 0123456789abcdef.txt.
  • tests/test_check_no_game_data.py has two new tests: paths given as arguments (refused and accepted, including abc_0123456789abcdef.s), and default mode in a throwaway git repo.
  • The three new tests fail on main and pass with this change.

The "16+ hex digits" rule is based on how the repo's own tools name their outputs (shader_disasm, shader_carve, fspx_unpack). It doesn't look at any package data, so a listing renamed by hand still passes. That is the same limit as the existing extension check.

Tested

Windows 11, CPython 3.13.14, Git for Windows bash, CPU only (no GPU or driver involved), on main 867d922f0:

  • python -I tests/test_check_no_game_data.py, python -I tests/test_no_game_data_workflow.py (it runs bash and git itself), python -I tests/test_ci_registration.py: OK.
  • python -I scripts/check_no_game_data.py from the repository root: exit 0, so no tracked fixture is refused.
  • python -m compileall -q scripts tests, git diff --check: pass.

AI-assisted: yes

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

…m) in both checks

Neither check caught a committed listing such as shader_disasm.py's
<hash>.s: the workflow's extension list has no .s/.asm, and
check_no_game_data.py reads magics while its docstring said text formats
"stay with the extension check". Hundreds of hand-written .s/.asm fixtures
are tracked, so the extensions can't be refused outright; a name that
starts with 16+ hex characters (optionally followed by a ., ~ or _ suffix,
as shader_carve and fspx_unpack name duplicates) is refused instead. No
tracked fixture matches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 9016f984f138a3d0113bb574133a9c32b81da818)

@LAKSHYA-cmd-tech LAKSHYA-cmd-tech left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3155fef on Windows 11 CPU (CPython 3.12.10, clean-room synthetic fixtures only, zero game data): pass.

Test Suite Execution

  • python -I tests/test_check_no_game_data.py: 10/10 passed (6.78s).
    • Verifies est_hash_named_listings_are_caught_and_fixtures_pass: rejects 16+ hex digit disassembly listings (9f3a1c2b4d5e6f70.s, 9F3A1C2B4D5E6F70A1.asm, �123456789abcdef.vs.s, �123456789abcdef~1.s, edcba9876543210_01.asm) with shader disassembly listing (hash-named) while accepting readable hand-written synthetic fixtures (�_add_f32.s, cs_exec_const.asm, deadbeef.s, etc.).
    • Verifies est_default_mode_catches_a_tracked_hash_named_listing: default mode in a tracked git repository flags hash-named listings upon invocation.
  • python -I tests/test_no_game_data_workflow.py: 4/4 passed (1.19s).
    • Confirms GitHub Actions workflow step git ls-files -z | grep -ziE "|" catches hash-named listings identically.
  • Repository-wide execution: python -I scripts/check_no_game_data.py across entire repository exits 0 cleanly (no hand-written test fixtures false-flagged).

Negative Control

Reverted scripts/check_no_game_data.py to origin/main (867d922) while running CheckNoGameData.test_hash_named_listings_are_caught_and_fixtures_pass:

  • Failed with AssertionError: 0 != 1, confirming unpatched check permitted hash-named disassembly listings to pass undetected.
  • Restoring 3155fef cleanly restored expected rejection and exit code 1.

Clean-Room & Repository Hygiene

  • python -I scripts/check_no_game_data.py: clean (0 violations).
  • git diff --check origin/main: clean (0 formatting or whitespace issues).
  • python -m compileall -q: clean.

LGTM!

@KarloZ7715

KarloZ7715 commented Nov 23, 2026 •

Copy link
Copy Markdown

Tested 3155fef on Windows, Python 3.13.17, CPU only: pass (no game files).

  • python -I tests/test_check_no_game_data.py -v → 10 tests OK
  • python -I tests/test_no_game_data_workflow.py -v → 4 tests OK
  • Code read: workflow regex and scripts/check_no_game_data.py LISTING pattern match consistently and keep hand-written fixture names passing.

AI-assisted.

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.

4 participants