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

Open
opened 2026-11-26 20:21:08 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1372
Author: @Mykolas009
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: build/shader-resume-identity


📝 Commits (1)

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

📊 Changes

3 files changed (+95 additions, -3 deletions)

View changed files

📝 make_game.py (+36 -0)
📝 tests/test_make_game_empty_translation.py (+3 -3)
📝 tests/test_shader_stage_resume.py (+56 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1372 **Author:** [@Mykolas009](https://github.com/Mykolas009) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `build/shader-resume-identity` --- ### 📝 Commits (1) - [`318e76b`](https://github.com/ubiquitarianism/leonida/commit/318e76bcf09a9723a4fec04f2a2d0886a8d6e491) make_game: a saved translated index that names a shader not carved here is translated again (BUILD-SHADER-RESUME-IDENTITY) ### 📊 Changes **3 files changed** (+95 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `make_game.py` (+36 -0) 📝 `tests/test_make_game_empty_translation.py` (+3 -3) 📝 `tests/test_shader_stage_resume.py` (+56 -0) </details> ### 📄 Description Claimed in the coordination issue as: BUILD-SHADER-RESUME-IDENTITY ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146036301), from sxnistxr's [finding](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7145787151)). ### 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1402
No description provided.