make_game: a saved translated index that names a shader not carved here is translated again (BUILD-SHADER-RESUME-IDENTITY) #1372

Open
github-bot wants to merge 1 commit from github-bot/gh-1372 into main AGit
Owner

@⁠Mykolas009 on GitHub · 2026-11-24 22:47 UTC · original
Mykolas009:build/shader-resume-identity → main · +95 −3 · 3 files · 1 commits · open

Claimed in the coordination issue as: BUILD-SHADER-RESUME-IDENTITY (claim, from sxnistxr's finding).

What and why

On a resumed shader stage, make_game.shaders kept a saved shaders/spirv/index.json that names other shaders than this work folder's, as long as it had the right number of entries: verify_translation_completeness compares only the counts. The build then reports the stage done while the shaders the runtime will ask for were never translated.

Reproduced on main with ShaderStageResumeTest's fixture: after one run, replace the index's only key with an unrelated name; the second run executes no step.

A shader keeps its carved file's stem through unpacking, disassembly and translation (fssm_unpack.py and shader_disasm.py keep the stem, rdna2spirv.py names each entry after its listing), so the stage now compares names:

  • translated_index_strangers(index, carved) returns the names in the translated index that are no carved shader of this folder (nothing when a file is missing, unreadable or malformed: other checks own those cases).
  • On resume, a stranger drops the index and its shard plan, and the translation runs again.
  • After a translation, a stranger fails the stage with the first such name.

tests/test_make_game_empty_translation.py: its fixture carved shader but translated shader_0; it now uses one name, as the real tools do.

Tested

Windows 11, Python 3.14.3, standard library only, no game files, no GPU:

  • python -I tests/test_shader_stage_resume.py: 50 tests, OK. The three new tests fail with make_game.py from main (2 failures, 1 error) and pass with this change.
  • python -I on every tests/test_make_game*.py, tests/test_*shaders_stage*.py and tests/test_text_write_line_endings.py: all OK.
  • python -I scripts/check_no_game_data.py on the three changed files: clean.

Not covered

  • The finding also mentions missing module files. An entry whose <name>.spv is gone is not detected here: the stage fixtures in six test files publish an index without modules, so that check needs them changed first and is left for a separate pull request.
  • No run against a real work folder (no game files here), so the corpus-sized cost of the check is not measured; it is two JSON reads.

GPUs tested: n/a

AI-assisted: yes (Claude Code, Claude Fable 5.2, wrote the change and the tests and ran them; I reviewed it)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • 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

**@⁠Mykolas009** on GitHub · 2026-11-24 22:47 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1372) `Mykolas009:build/shader-resume-identity` → `main` · +95 −3 · 3 files · 1 commits · open Claimed in the coordination issue as: BUILD-SHADER-RESUME-IDENTITY ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14), from sxnistxr's [finding](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)). ### What and why On a resumed shader stage, `make_game.shaders` kept a saved `shaders/spirv/index.json` that names other shaders than this work folder's, as long as it had the right number of entries: `verify_translation_completeness` compares only the counts. The build then reports the stage done while the shaders the runtime will ask for were never translated. Reproduced on `main` with `ShaderStageResumeTest`'s fixture: after one run, replace the index's only key with an unrelated name; the second run executes no step. A shader keeps its carved file's stem through unpacking, disassembly and translation (`fssm_unpack.py` and `shader_disasm.py` keep the stem, `rdna2spirv.py` names each entry after its listing), so the stage now compares names: - `translated_index_strangers(index, carved)` returns the names in the translated index that are no carved shader of this folder (nothing when a file is missing, unreadable or malformed: other checks own those cases). - On resume, a stranger drops the index and its shard plan, and the translation runs again. - After a translation, a stranger fails the stage with the first such name. `tests/test_make_game_empty_translation.py`: its fixture carved `shader` but translated `shader_0`; it now uses one name, as the real tools do. ### Tested Windows 11, Python 3.14.3, standard library only, no game files, no GPU: - `python -I tests/test_shader_stage_resume.py`: 50 tests, OK. The three new tests fail with `make_game.py` from `main` (2 failures, 1 error) and pass with this change. - `python -I` on every `tests/test_make_game*.py`, `tests/test_*shaders_stage*.py` and `tests/test_text_write_line_endings.py`: all OK. - `python -I scripts/check_no_game_data.py` on the three changed files: clean. **Not covered** - The finding also mentions missing module files. An entry whose `<name>.spv` is gone is not detected here: the stage fixtures in six test files publish an index without modules, so that check needs them changed first and is left for a separate pull request. - No run against a real work folder (no game files here), so the corpus-sized cost of the check is not measured; it is two JSON reads. GPUs tested: n/a AI-assisted: yes (Claude Code, Claude Fable 5.2, wrote the change and the tests and ran them; I reviewed it) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] 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](https://claude.com/claude-code)
verify_translation_completeness compares only the number of entries, so on a
resumed shader stage an index left by other inputs with as many entries as the
carve passed for this folder's finished translation and no step ran.

A shader keeps its carved file's stem through unpacking, disassembly and
translation, so the stage now compares the index's names with the carve's: on
resume a stranger drops the index and its shard plan and translates again, and
after a translation a stranger fails the stage.

The fixture in test_make_game_empty_translation.py named its carved shader
"shader" and its translated one "shader_0"; it now uses one name.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:49:12 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 15:11 UTC · original

Reviewed 318e76b: traced the naming chain the check relies on (carve file_name, fssm_unpack stem, disasm output_path, rdna2spirv index keys all equal splitext of the carved file name), and disassembly completion already forces listings to be carved stems, so the after-translate failure cannot fire on a clean pipeline. Ran: both touched test files pass (50 + 14 tests); the three new tests each fail on main as they must; 12 further make_game/shader-stage suites pass; a standalone probe reproduces both cases (main resumes a same-size stranger index with no step, and completes silently when translate publishes one; this branch retranslates with the stale shards.json dropped, and exits 1 with "not carved here"). check_no_game_data clean. No blocking findings, only a cosmetic wrap on line 156 of the new test.

AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 15:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1372#issuecomment-7166437888) Reviewed 318e76b: traced the naming chain the check relies on (carve `file_name`, fssm_unpack stem, disasm `output_path`, rdna2spirv index keys all equal `splitext` of the carved file name), and disassembly completion already forces listings to be carved stems, so the after-translate failure cannot fire on a clean pipeline. Ran: both touched test files pass (50 + 14 tests); the three new tests each fail on main as they must; 12 further make_game/shader-stage suites pass; a standalone probe reproduces both cases (main resumes a same-size stranger index with no step, and completes silently when translate publishes one; this branch retranslates with the stale shards.json dropped, and exits 1 with "not carved here"). check_no_game_data clean. No blocking findings, only a cosmetic wrap on line 156 of the new test. AI-assisted review. **Recommendation:** Merge
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1372/head:github-bot/gh-1372'
git switch 'github-bot/gh-1372'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1372'
git switch 'github-bot/gh-1372'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1372'
git switch 'github-bot/gh-1372'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1372'
git switch 'main'
git merge --squash 'github-bot/gh-1372'
git switch 'main'
git merge --ff-only 'github-bot/gh-1372'
git switch 'main'
git merge 'github-bot/gh-1372'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.