SHADER-INDEX-RECOVERY: rebuild damaged translation indexes from shards #494
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/494"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-24T06:21:36Z.
Claimed in the coordination issue as: SHADER-INDEX-RECOVERY
What and why
A truncated or malformed
shaders/spirv/index.jsoncould let the shaders stage report success while the pipeline stage later rejected the same file and asked for another full translation. This treats a readable but malformed index as recoverable from the already completed shards, keeps a UTF-8 BOM index reusable, and still rejects a genuine empty merge. It also halves jobs correctly when shaders and assets overlap during free-space preflight.Carried from the source patch in Sigtryggur-Mani-Gudmundsson's graphics-runtime-patches collection:
github.com/Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches@33ab48d3ea/README.md (recovering-a-damaged-shader-index)No game data, keys, or decryption are included.
Tested
python -I tests/test_make_game_argparse.py— 38 tests OKpython -I tests/test_make_game_empty_translation.py— 20 tests OKpython -I tests/test_make_game_preflight.py— 98 tests OK, 1 skippedpython -I tests/test_make_game_translator_flags.py— 33 tests OKpython -I tests/test_shader_stage_resume.py— 46 tests OKpython -I tests/test_docs_links.py— 16 tests OKpython -I tests/test_docs_cli_flags.py— 4 tests OKpython -I tests/test_ci_registration.py— 15 tests OKpython -m compileall -q make_game.py tools tests— OKgit diff --checkcleanThe source report rebuilt a truncated merged index from two synthetic pixel shards with matching original bytes. I reproduced the regression locally with the new tests; no game files were involved.
GPUs tested: n/a (CPU-only pipeline/tooling change)
AI-assisted: yes
Checklist
mainand merges cleanly.Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-24T21:53:33Z.
Reviewed 43f73d7: ran the five touched test files in a no-network sandbox on the PR and on main (all OK on the PR, including the real two-shard re-merge under SPIRV-Tools), plus adjacent tests and
compileall. Reproduced the fix with a synthetic work folder: on current main a truncatedspirv/index.jsonstill passesshader_outputs_reusable(), skips translation, leaves the index damaged, and fails innative_pso_hashes(withpipelinesalso refusing it; silent"shaders: done"only occurs on the PR's base or with a newernative_hashes.txt), whereas with the PR the stage rebuilds it from the completed shards (merge only,"keeping 2 of 2 shards") and restores it byte-identically. Two items: the branch conflicts with current main intests/test_make_game_translator_flags.pyandtests/test_shader_stage_resume.py, and after merging main's newnative_pso_hashesstep (tools/native_pso_hashes.py:48) readsspirv/index.jsonwith strictutf-8, so the PR's owntest_utf8_bom_index_remains_reusablefails on the merged tree. Please rebase and switch that reader toutf-8-sigtoo. AI-assisted review.Recommendation: Fix first
Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-24T23:42:45Z.
Rebased on current main; resolved newer shader-stage/native-PSO integration conflicts and made native_pso_hashes accept UTF-8 BOM indexes. Verified: 442 make_game tests, 47 shader-stage resume tests, 10 native-PSO tests, no-game-data and security checks clean.
Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T00:07:28Z.
Follow-up on
8a5be5ce: both items from the previous review are fixed. The branch merges cleanly into current main, andtools/native_pso_hashes.py:48now readsspirv/index.jsonasutf-8-sig. In a no-network sandbox (Linux, with SPIRV-Tools) on the PR merged with main, these all pass:test_make_game_empty_translation20/20 (includingtest_utf8_bom_index_remains_reusableand the real two-shard re-merge),test_native_pso_hashes10/10,test_make_game_preflight98,test_make_game_argparse38,test_make_game_translator_flags33 andtest_shader_stage_resume47. The last two are no longer touched by the PR and still pass.check_no_game_datais clean. With the PR'stest_make_game_empty_translation.pydropped onto current main, 6 failures and 3 errors show up, so the tests do cover the change. AI-assisted review.Recommendation: Merge
Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T07:21:09Z.
Thanks for this! Rebuilding a damaged
spirv/index.jsonfrom the finished shards, and reading it BOM-tolerant, closes a nasty resume failure.During maintainer testing (local, 2026-11-28) (head
8a5be5ce7, merged on mainb1619e0a3/6dfca6428, Windows 11, Python tests via pytest/unittest) we found:translation_plan()callstranslator_digest(), which #452 removes. Once both land this is a NameError, and git may not flag it as a conflict.To get this merged:
translation_sources_digest()instead.AI-assisted (Claude Code), posted for DadaCap (maintainer).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T10:56:23Z.
Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 23 PRs (their tests, the tests importing the changed modules, the docs tests) on main
3ca0707: no new failure, Linux / Python 3.13.AI-assisted (Claude Code, Claude Opus 5.5)