rdna2spirv: do not cache a missing stage index #2194

Closed
whoalin1 wants to merge 0 commits from upstream-pr/2194 into main
whoalin1 commented 2026-11-26 04:46:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-26T04:46:58Z.


Depends on: #2154
Claimed in the coordination issue as SHADER-STAGE-CACHE-MISSING-INDEX (comment 7182872123).

What

qhukz13's #2154 review noted a remaining edge case: even with the stage cache keyed by carve root, a missing index.json is cached as that root's empty table for the rest of the process. If the index is created later, stage_of() keeps using the fallback stage until _STAGES is reset.

This follow-up caches only successful index reads. A missing file is probed again on the next lookup; a root whose index did load is still cached exactly as #2154 intends.

Test

Adds a synthetic missing-then-created regression case to tests/test_rdna2spirv_stage_cache.py.

  • python -I tests/test_rdna2spirv_stage_cache.py — 3 tests OK
  • python -I tests/test_bvh_shaders_stage.py — 13 tests OK
  • python -I tests/test_exe_shaders_stage.py — 11 tests OK
  • python -I tests/test_shader_library.py — 22 run, 21 passed + 1 skipped
  • python -m compileall -q tools/rdna2spirv.py tests/test_rdna2spirv_stage_cache.py — PASS

No game data.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5504162428 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2194). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-26T04:46:58Z. --- Depends on: #2154 Claimed in the coordination issue as `SHADER-STAGE-CACHE-MISSING-INDEX` (comment 7182872123). ## What qhukz13's #2154 review noted a remaining edge case: even with the stage cache keyed by carve root, a missing `index.json` is cached as that root's empty table for the rest of the process. If the index is created later, `stage_of()` keeps using the fallback stage until `_STAGES` is reset. This follow-up caches only successful index reads. A missing file is probed again on the next lookup; a root whose index did load is still cached exactly as #2154 intends. ## Test Adds a synthetic missing-then-created regression case to `tests/test_rdna2spirv_stage_cache.py`. - `python -I tests/test_rdna2spirv_stage_cache.py` — 3 tests OK - `python -I tests/test_bvh_shaders_stage.py` — 13 tests OK - `python -I tests/test_exe_shaders_stage.py` — 11 tests OK - `python -I tests/test_shader_library.py` — 22 run, 21 passed + 1 skipped - `python -m compileall -q tools/rdna2spirv.py tests/test_rdna2spirv_stage_cache.py` — PASS No game data. AI-assisted.
whoalin1 commented 2026-11-26 04:50:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-26T04:50:19Z.


Additional focused verification on the stacked head c5c367a2a: tests/test_rdna2spirv_stage_cache.py 3/3 OK; tests/test_bvh_shaders_stage.py 13/13 OK; tests/test_exe_shaders_stage.py 11/11 OK; tests/test_shader_library.py 22 run, 21 passed + 1 skipped. compileall PASS. No game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7182946990 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2194#issuecomment-7182946990). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-26T04:50:19Z. --- Additional focused verification on the stacked head c5c367a2a: tests/test_rdna2spirv_stage_cache.py 3/3 OK; tests/test_bvh_shaders_stage.py 13/13 OK; tests/test_exe_shaders_stage.py 11/11 OK; tests/test_shader_library.py 22 run, 21 passed + 1 skipped. compileall PASS. No game data.
real-rusher commented 2026-11-26 10:06:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by real-rusher on 2026-11-26T10:06:35Z.


Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_rdna2spirv_stage_cache.py: 3 tests OK. The same test file against main's tools/rdna2spirv.py: 2 failures, so it fails on main and passes with the fix. compileall clean.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7188919257 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2194#issuecomment-7188919257). Originally posted by [real-rusher](https://github.com/real-rusher) on 2026-11-26T10:06:35Z. --- Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_rdna2spirv_stage_cache.py: 3 tests OK. The same test file against main's tools/rdna2spirv.py: 2 failures, so it fails on main and passes with the fix. compileall clean. AI-assisted: yes (Claude Code)
Tauwni commented 2026-11-26 12:50:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T12:50:32Z.


Tested c5c367a2a on macOS 26.5.1 (Apple M3, Python 3.15). CPU only, synthetic fixtures.

  • tests/test_rdna2spirv_stage_cache.py: 3/3 pass, test_bvh_shaders_stage.py 13/13, test_exe_shaders_stage.py 11/11, and test_shader_library.py 22/22.
  • Control: with this PR's one-line change to tools/rdna2spirv.py reverted (back to #2154's head), test_a_missing_index_is_not_cached fails. With it, the test passes. So the new case does catch the cached miss.
  • The branch merges cleanly with main a73a57e13.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7192531712 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2194#issuecomment-7192531712). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T12:50:32Z. --- Tested `c5c367a2a` on macOS 26.5.1 (Apple M3, Python 3.15). CPU only, synthetic fixtures. - `tests/test_rdna2spirv_stage_cache.py`: 3/3 pass, `test_bvh_shaders_stage.py` 13/13, `test_exe_shaders_stage.py` 11/11, and `test_shader_library.py` 22/22. - Control: with this PR's one-line change to `tools/rdna2spirv.py` reverted (back to #2154's head), `test_a_missing_index_is_not_cached` fails. With it, the test passes. So the new case does catch the cached miss. - The branch merges cleanly with `main` `a73a57e13`. AI-assisted (Claude Code). No game data.
whoalin1 commented 2026-11-26 13:23:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-26T13:23:11Z.


Consolidated into #2154 without rewriting: #2154 was fast-forwarded to this PR's exact head c5c367a2a, so the missing-index fix and regression test are preserved there. Closing this stacked follow-up to reduce review noise.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7193277534 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2194#issuecomment-7193277534). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-26T13:23:11Z. --- Consolidated into #2154 without rewriting: #2154 was fast-forwarded to this PR's exact head `c5c367a2a`, so the missing-index fix and regression test are preserved there. Closing this stacked follow-up to reduce review noise.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!2194
No description provided.