shaders: reject and retry truncated disassembly listings and name failing shaders (SHADERS-DISASM-TRUNCATED-CHECK) #2553

Closed
kirigayakazima wants to merge 4 commits from upstream-pr/2553 into main
kirigayakazima commented 2026-11-28 02:03:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-28T02:03:58Z.


SHADERS-DISASM-TRUNCATED-CHECK. Claim. Fixes #2539.

In #2539, an llvm-mc run left a .s disassembly listing truncated mid-line before s_endpgm, yet tools/shader_disasm.py still published it, --skip-existing and make_game.py (disassembly_listings) accepted any non-empty file, and tools/rdna2spirv.py only printed failure counts without naming which shaders hit branch without encoding or other refusal reasons.

This removes the root causes rather than adding a manual workaround:

  • tools/shader_stage_manifest.py: add shared listing_is_complete() and fast tail-checking listing_file_is_complete() (requiring trailing newline, a complete non-comment ending s_endpgm, and a closed ; encoding: [...] when encoding comments are present, while ignoring optional trailing ; --- llvm-mc messages --- footers).
  • tools/shader_disasm.py: retry truncated llvm-mc disassemblies (up to 3 total attempts) before refusing to publish partial .s files (FAILED guarded by FAILED_LOCK), and reject incomplete existing .s listings under --skip-existing.
  • make_game.py: have disassembly_listings() validate completeness via listing_file_is_complete() so truncated listings invalidate reuse and get repaired automatically on --skip-existing.
  • tools/rdna2spirv.py: record up to 5 failing shader stems per failure/refusal reason (Unsupported, translator errors, INVALID:) and print them alongside counts in the shard/run summary.
  • tests/: add 6 targeted regression tests across test_shader_disasm.py, test_shader_stage_resume.py, and test_rdna2spirv_cli.py, and update the 7 test suites whose placeholder .s fixtures wrote plain text instead of a valid s_endpgm listing.

Verification on Windows 11 (RTX 4070 Laptop host; stdlib/synthetic tests only, no game files or GPU execution tested):

  • python -I tests/test_shader_disasm.py: 35 tests OK
  • python -I tests/test_shader_stage_resume.py: 48 tests OK
  • python -I tests/test_rdna2spirv_cli.py: 37 tests OK (1 skipped without SPIRV-Tools)
  • python -I tests/test_make_game_dry_run.py: 24 tests OK
  • python -I tests/test_make_game_empty_translation.py: 14 tests OK
  • python -I tests/test_make_game_resume.py: 14 tests OK
  • python -I tests/test_make_game_translator_flags.py: 34 tests OK
  • python -I tests/test_text_write_line_endings.py: 3 tests OK
  • python -I tests/test_make_game_preflight.py: 108/109 passed (test_preflight_charges_space_only_when_shaders_need_to_be_rebuilt passed; only pre-existing repo-rename failure test_ensure_submodule_names_the_clone_command_the_readme_gives failed on 1a441d336)
  • python -m compileall -q, python -I make_game.py --help, and python -I scripts/check_no_game_data.py over all 12 modified files passed.

AI-assisted: Antigravity (Gemini).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5535637244 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-28T02:03:58Z. --- SHADERS-DISASM-TRUNCATED-CHECK. [Claim](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7231982927). Fixes #2539. In #2539, an `llvm-mc` run left a `.s` disassembly listing truncated mid-line before `s_endpgm`, yet `tools/shader_disasm.py` still published it, `--skip-existing` and `make_game.py` (`disassembly_listings`) accepted any non-empty file, and `tools/rdna2spirv.py` only printed failure counts without naming which shaders hit `branch without encoding` or other refusal reasons. This removes the root causes rather than adding a manual workaround: - `tools/shader_stage_manifest.py`: add shared `listing_is_complete()` and fast tail-checking `listing_file_is_complete()` (requiring trailing newline, a complete non-comment ending `s_endpgm`, and a closed `; encoding: [...]` when encoding comments are present, while ignoring optional trailing `; --- llvm-mc messages ---` footers). - `tools/shader_disasm.py`: retry truncated `llvm-mc` disassemblies (up to 3 total attempts) before refusing to publish partial `.s` files (`FAILED` guarded by `FAILED_LOCK`), and reject incomplete existing `.s` listings under `--skip-existing`. - `make_game.py`: have `disassembly_listings()` validate completeness via `listing_file_is_complete()` so truncated listings invalidate reuse and get repaired automatically on `--skip-existing`. - `tools/rdna2spirv.py`: record up to 5 failing shader stems per failure/refusal reason (`Unsupported`, translator errors, `INVALID:`) and print them alongside counts in the shard/run summary. - `tests/`: add 6 targeted regression tests across `test_shader_disasm.py`, `test_shader_stage_resume.py`, and `test_rdna2spirv_cli.py`, and update the 7 test suites whose placeholder `.s` fixtures wrote plain text instead of a valid `s_endpgm` listing. Verification on Windows 11 (RTX 4070 Laptop host; stdlib/synthetic tests only, no game files or GPU execution tested): - `python -I tests/test_shader_disasm.py`: 35 tests OK - `python -I tests/test_shader_stage_resume.py`: 48 tests OK - `python -I tests/test_rdna2spirv_cli.py`: 37 tests OK (1 skipped without SPIRV-Tools) - `python -I tests/test_make_game_dry_run.py`: 24 tests OK - `python -I tests/test_make_game_empty_translation.py`: 14 tests OK - `python -I tests/test_make_game_resume.py`: 14 tests OK - `python -I tests/test_make_game_translator_flags.py`: 34 tests OK - `python -I tests/test_text_write_line_endings.py`: 3 tests OK - `python -I tests/test_make_game_preflight.py`: 108/109 passed (`test_preflight_charges_space_only_when_shaders_need_to_be_rebuilt` passed; only pre-existing repo-rename failure `test_ensure_submodule_names_the_clone_command_the_readme_gives` failed on `1a441d336`) - `python -m compileall -q`, `python -I make_game.py --help`, and `python -I scripts/check_no_game_data.py` over all 12 modified files passed. AI-assisted: Antigravity (Gemini).
zmasi commented 2026-11-28 03:13:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T03:13:34Z.


#2553 | head aee75f002e (merged cleanly with main 02f71ccfe) | python -I tests/test_rdna2spirv_cli.py && python -I tests/test_shader_disasm.py && python -I tests/test_shader_stage_resume.py | red on main: rdna2spirv_cli FAILED (failures=1, skipped=2) in 37 tests; shader_disasm FAILED (failures=3, errors=1 importing new listing_is_complete) in 35 tests; shader_stage_resume FAILED (failures=1) in 48 tests | green on PR+main: rdna2spirv_cli 37 tests OK (skipped=2); shader_disasm 35 tests OK; shader_stage_resume 48 tests OK | Windows 11, Python 3.12.10 | AI-assisted: yes

Diff reviewed across all 12 touched files (FAILED_LOCK guards concurrent failure recording, tail check handles trailing ; --- llvm-mc messages --- footers, and --skip-existing repairs truncated .s files). Also verified on merged PR+main: test_make_game_dry_run.py (24/24 OK), test_make_game_empty_translation.py (14/14 OK), test_make_game_resume.py (14/14 OK), test_make_game_translator_flags.py (34/34 OK), test_make_game_preflight.py (same single pre-existing clone-URL failure as plain main, 108/109 pass, skipped=2), test_runner_calls_all_tests.py (3/3 OK), test_text_write_line_endings.py (3/3 OK), compileall, git diff --check, and scripts/check_no_game_data.py (clean).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232898389 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#issuecomment-7232898389). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T03:13:34Z. --- #2553 | head aee75f002ef33fc9daeb526348da19e1e128b3ac (merged cleanly with main 02f71ccfe) | `python -I tests/test_rdna2spirv_cli.py && python -I tests/test_shader_disasm.py && python -I tests/test_shader_stage_resume.py` | red on main: rdna2spirv_cli FAILED (failures=1, skipped=2) in 37 tests; shader_disasm FAILED (failures=3, errors=1 importing new `listing_is_complete`) in 35 tests; shader_stage_resume FAILED (failures=1) in 48 tests | green on PR+main: rdna2spirv_cli 37 tests OK (skipped=2); shader_disasm 35 tests OK; shader_stage_resume 48 tests OK | Windows 11, Python 3.12.10 | AI-assisted: yes Diff reviewed across all 12 touched files (`FAILED_LOCK` guards concurrent failure recording, tail check handles trailing `; --- llvm-mc messages ---` footers, and `--skip-existing` repairs truncated `.s` files). Also verified on merged `PR+main`: `test_make_game_dry_run.py` (24/24 OK), `test_make_game_empty_translation.py` (14/14 OK), `test_make_game_resume.py` (14/14 OK), `test_make_game_translator_flags.py` (34/34 OK), `test_make_game_preflight.py` (same single pre-existing clone-URL failure as plain `main`, 108/109 pass, skipped=2), `test_runner_calls_all_tests.py` (3/3 OK), `test_text_write_line_endings.py` (3/3 OK), `compileall`, `git diff --check`, and `scripts/check_no_game_data.py` (clean).
lixonik commented 2026-11-28 09:20:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T09:20:42Z.

Review: APPROVED


Reviewed the diff and tested merged onto main (493867366).

The shared listing_is_complete / listing_file_is_complete tail check, TRUNCATED_RETRY_ATTEMPTS retry loop with FAILED_LOCK, --skip-existing repair path, and per-reason failing-shader stem summaries in tools/rdna2spirv.py cleanly address #2539.

Tests run

  • python -m unittest across test_shader_disasm.py, test_shader_stage_resume.py, test_rdna2spirv_cli.py, test_make_game_dry_run.py, test_make_game_empty_translation.py, test_make_game_resume.py, and test_make_game_translator_flags.py: 205 passed (1 skipped, 0 failures).

AI-assisted (Antigravity, Gemini).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6096941190 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#pullrequestreview-6096941190). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-28T09:20:42Z. **Review:** APPROVED --- Reviewed the diff and tested merged onto `main` (`493867366`). The shared `listing_is_complete` / `listing_file_is_complete` tail check, `TRUNCATED_RETRY_ATTEMPTS` retry loop with `FAILED_LOCK`, `--skip-existing` repair path, and per-reason failing-shader stem summaries in `tools/rdna2spirv.py` cleanly address #2539. ### Tests run - `python -m unittest` across `test_shader_disasm.py`, `test_shader_stage_resume.py`, `test_rdna2spirv_cli.py`, `test_make_game_dry_run.py`, `test_make_game_empty_translation.py`, `test_make_game_resume.py`, and `test_make_game_translator_flags.py`: **205 passed** (1 skipped, 0 failures). AI-assisted (Antigravity, Gemini).
TheGeogeo commented 2026-11-28 23:37:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T23:37:57Z.


Re-checked on main c8bf0e7b6 (head aee75f002 unchanged): Python 3.12.4, Windows 11 10.0.26300, CPU only. check_no_game_data.py is clean. I ran only the tests, not the shader stage.

  • Green: 7 of the 8 touched test files pass on the merge: test_shader_disasm.py (38), test_rdna2spirv_cli.py (37), test_shader_stage_resume.py (48), test_make_game_dry_run.py, test_make_game_empty_translation.py, test_make_game_resume.py and test_make_game_translator_flags.py. test_make_game_preflight.py: not run here (it starts bash).
  • Red: with make_game.py, tools/rdna2spirv.py, tools/shader_disasm.py and tools/shader_stage_manifest.py back to main, the same three files fail as before:
    • test_rdna2spirv_cli.py: branch without encoding (ps_branch_no_enc) is not reported.
    • test_shader_disasm.py: 3 failures and 1 error ('reused': 1).
    • test_shader_stage_resume.py: test_finished_disassembly_repairs_a_truncated_listing fails.
  • On plain main, the 7 files pass. The PR adds 6 tests (34 to 38, 36 to 37, 47 to 48).

No blocker from my side. AI-assisted (Claude Code).


Tested aee75f002 merged (no commit) with main aa918e5d9: Python 3.12.4, Windows 11 10.0.26300, CPU only. check_no_game_data.py is clean.

I ran only the tests, not the shader stage.

  • Green: the 8 touched test files pass, except test_make_game_preflight.py. Its one failure, test_ensure_submodule_names_the_clone_command_the_readme_gives, fails the same way on plain main, so it is unrelated.
  • Red: with make_game.py, tools/rdna2spirv.py, tools/shader_disasm.py and tools/shader_stage_manifest.py back to main, three files fail:
    • test_rdna2spirv_cli.py: branch without encoding (ps_branch_no_enc) is not reported.
    • test_shader_disasm.py: 3 failures and 1 error ('reused': 1).
    • test_shader_stage_resume.py: 1 failure.

No blocker from my side.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247560036 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#issuecomment-7247560036). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-28T23:37:57Z. --- Re-checked on `main` `c8bf0e7b6` (head `aee75f002` unchanged): Python 3.12.4, Windows 11 10.0.26300, CPU only. `check_no_game_data.py` is clean. I ran only the tests, not the shader stage. - Green: 7 of the 8 touched test files pass on the merge: `test_shader_disasm.py` (38), `test_rdna2spirv_cli.py` (37), `test_shader_stage_resume.py` (48), `test_make_game_dry_run.py`, `test_make_game_empty_translation.py`, `test_make_game_resume.py` and `test_make_game_translator_flags.py`. `test_make_game_preflight.py`: not run here (it starts bash). - Red: with `make_game.py`, `tools/rdna2spirv.py`, `tools/shader_disasm.py` and `tools/shader_stage_manifest.py` back to `main`, the same three files fail as before: - `test_rdna2spirv_cli.py`: `branch without encoding (ps_branch_no_enc)` is not reported. - `test_shader_disasm.py`: 3 failures and 1 error (`'reused': 1`). - `test_shader_stage_resume.py`: `test_finished_disassembly_repairs_a_truncated_listing` fails. - On plain `main`, the 7 files pass. The PR adds 6 tests (34 to 38, 36 to 37, 47 to 48). No blocker from my side. AI-assisted (Claude Code). --- Tested `aee75f002` merged (no commit) with `main` `aa918e5d9`: Python 3.12.4, Windows 11 10.0.26300, CPU only. `check_no_game_data.py` is clean. I ran only the tests, not the shader stage. - Green: the 8 touched test files pass, except `test_make_game_preflight.py`. Its one failure, `test_ensure_submodule_names_the_clone_command_the_readme_gives`, fails the same way on plain `main`, so it is unrelated. - Red: with `make_game.py`, `tools/rdna2spirv.py`, `tools/shader_disasm.py` and `tools/shader_stage_manifest.py` back to `main`, three files fail: - `test_rdna2spirv_cli.py`: `branch without encoding (ps_branch_no_enc)` is not reported. - `test_shader_disasm.py`: 3 failures and 1 error (`'reused': 1`). - `test_shader_stage_resume.py`: 1 failure. No blocker from my side. AI-assisted (Claude Code).
timbot103 commented 2026-11-29 01:06:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T01:06:12Z.

Review: COMMENTED


Static audit of aee75f002 against 48bae6cad, with line numbers on the patched base. Request changes.

  • tools/shader_stage_manifest.py:33 accepts a truncated prefix ending at an earlier s_endpgm in a multi-program range. The prefix is published and reusable. Verify coverage of the selected byte range.
  • tools/shader_disasm.py:345 rejects a complete Python decode when a trailing literal consumes the marker bytes. Validate completeness independently of program-end detection.
  • make_game.py:1236 hides unexpected truncated listings from the resume inventory, while translation still scans them. Check observed stems before choosing which expected files to repair.
  • tools/shader_disasm.py:338 skips retry for LLVM truncation in auto. In default mode an empty response also stops an incomplete sequence before its final attempt. Apply the same bounded policy to LLVM in both modes.
  • tools/shader_disasm.py:357 can abort a repair on a transient Windows sharing violation. Reuse replace_retry and keep the original error if temp cleanup also fails.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6100840025 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#pullrequestreview-6100840025). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-29T01:06:12Z. **Review:** COMMENTED --- Static audit of `aee75f002` against `48bae6cad`, with line numbers on the patched base. Request changes. - `tools/shader_stage_manifest.py:33` accepts a truncated prefix ending at an earlier `s_endpgm` in a multi-program range. The prefix is published and reusable. Verify coverage of the selected byte range. - `tools/shader_disasm.py:345` rejects a complete Python decode when a trailing literal consumes the marker bytes. Validate completeness independently of program-end detection. - `make_game.py:1236` hides unexpected truncated listings from the resume inventory, while translation still scans them. Check observed stems before choosing which expected files to repair. - `tools/shader_disasm.py:338` skips retry for LLVM truncation in `auto`. In default mode an empty response also stops an incomplete sequence before its final attempt. Apply the same bounded policy to LLVM in both modes. - `tools/shader_disasm.py:357` can abort a repair on a transient Windows sharing violation. Reuse `replace_retry` and keep the original error if temp cleanup also fails. AI-assisted.
lixonik commented 2026-11-29 02:48:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T02:48:51Z.


Retested aee75f002ef33fc9daeb526348da19e1e128b3ac merged with main c8bf0e7b65 on Windows 10/CPython 3.12.1. The 38 stock disassembler tests passed. Two new synthetic probes confirm the later review findings:

  • I passed one() a hand-built 16-byte range containing two nop; endpgm programs and stubbed the decoder to return only the first 8 bytes' listing. The result was clean, it was published on the first attempt, and listing_file_is_complete() accepted it for reuse.
  • With a stub that would return a full listing on attempt 3, an incomplete first response followed by an empty response stopped explicit LLVM mode after attempt 2. Auto mode stopped after the first incomplete response. Neither published a file. The configured retry count was 3.

The first probe checks coverage of the selected byte range. The second checks the retry policy with a transient failure. They use no game files.

AI-assisted. Codex (GPT-6).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249663348 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#issuecomment-7249663348). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-29T02:48:51Z. --- Retested `aee75f002ef33fc9daeb526348da19e1e128b3ac` merged with `main` `c8bf0e7b65` on Windows 10/CPython 3.12.1. The 38 stock disassembler tests passed. Two new synthetic probes confirm the later review findings: - I passed `one()` a hand-built 16-byte range containing two `nop; endpgm` programs and stubbed the decoder to return only the first 8 bytes' listing. The result was `clean`, it was published on the first attempt, and `listing_file_is_complete()` accepted it for reuse. - With a stub that would return a full listing on attempt 3, an incomplete first response followed by an empty response stopped explicit LLVM mode after attempt 2. Auto mode stopped after the first incomplete response. Neither published a file. The configured retry count was 3. The first probe checks coverage of the selected byte range. The second checks the retry policy with a transient failure. They use no game files. AI-assisted. Codex (GPT-6).
fiestorra commented 2026-11-29 17:22:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-29T17:22:59Z.


Verification of this one on current main, since it is 1780 commits behind and nobody has said whether it still applies.

I cherry-picked its single commit onto origin/main 4364a4fa6:

12 files changed, 238 insertions(+), 22 deletions(-), no conflicts
python3 -m pytest tests/test_make_game_dry_run.py tests/test_make_game_empty_translation.py \
    tests/test_make_game_preflight.py tests/test_make_game_resume.py \
    tests/test_make_game_translator_flags.py tests/test_rdna2spirv_cli.py \
    tests/test_shader_disasm.py tests/test_shader_stage_resume.py -q
-> 327 passed, 1 skipped, 119 subtests passed in 55.44s

So the change applies to today's tree and the tests written for it hold, including make_game.py and tools/rdna2spirv.py, which main has moved on since the
branch was cut. It still wants a rebase before merging - 1780 commits is a lot of drift in the diff a reviewer would see - but the content itself is not stale.

Not verified: any behaviour that needs the game. Everything above is the standard-library side, which is what these eight files cover.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259646559 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#issuecomment-7259646559). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-29T17:22:59Z. --- Verification of this one on current `main`, since it is 1780 commits behind and nobody has said whether it still applies. I cherry-picked its single commit onto `origin/main` `4364a4fa6`: ``` 12 files changed, 238 insertions(+), 22 deletions(-), no conflicts python3 -m pytest tests/test_make_game_dry_run.py tests/test_make_game_empty_translation.py \ tests/test_make_game_preflight.py tests/test_make_game_resume.py \ tests/test_make_game_translator_flags.py tests/test_rdna2spirv_cli.py \ tests/test_shader_disasm.py tests/test_shader_stage_resume.py -q -> 327 passed, 1 skipped, 119 subtests passed in 55.44s ``` So the change applies to today's tree and the tests written for it hold, including `make_game.py` and `tools/rdna2spirv.py`, which `main` has moved on since the branch was cut. It still wants a rebase before merging - 1780 commits is a lot of drift in the diff a reviewer would see - but the content itself is not stale. Not verified: any behaviour that needs the game. Everything above is the standard-library side, which is what these eight files cover. Written with an AI assistant.
KelboLive commented 2026-11-30 16:28:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T16:28:09Z.


Independent check on Windows (not the author), at aee75f002.

Green:

  • tests/test_shader_disasm.py: 35 passed
  • tests/test_make_game_resume.py: 14 passed
  • tests/test_shader_stage_resume.py: 48 passed
  • tests/test_make_game_empty_translation.py: 14 passed

One failure, and it is a stale base, not this PR's logic:

  • tests/test_make_game_preflight.py: 109 passed, 1 failed — the test still expects git clone --recursive https://github.com/ubiquitarianism/leonida, while the branch's README (and current main) say https://github.com/ProjectLeonida/mandy.
  • Current main b17b22d33 has the updated expectation and passes 110 tests, OK.
    So merging/rebase on current main should clear it; the branch is based on f9f3ec4c6, where the expectation had not yet been renamed.

Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10.

AI-assisted: yes (opencode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7284718011 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#issuecomment-7284718011). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T16:28:09Z. --- Independent check on Windows (not the author), at `aee75f002`. Green: - `tests/test_shader_disasm.py`: 35 passed - `tests/test_make_game_resume.py`: 14 passed - `tests/test_shader_stage_resume.py`: 48 passed - `tests/test_make_game_empty_translation.py`: 14 passed One failure, and it is a **stale base**, not this PR's logic: - `tests/test_make_game_preflight.py`: 109 passed, 1 failed — the test still expects `git clone --recursive https://github.com/ubiquitarianism/leonida`, while the branch's README (and current `main`) say `https://github.com/ProjectLeonida/mandy`. - Current `main` `b17b22d33` has the updated expectation and passes **110 tests, OK**. So merging/rebase on current `main` should clear it; the branch is based on `f9f3ec4c6`, where the expectation had not yet been renamed. Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10. AI-assisted: yes (opencode).
kirigayakazima commented 2026-12-01 11:26:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-12-01T11:26:16Z.


Merged upstream/main (3ee508b46) at efe1a42ea (no rebase, no force-push) and addressed all five review findings at 594469b99:

  1. Selected byte-range coverage (tools/shader_stage_manifest.py, tools/shader_disasm.py): listing_is_complete now parses ; code 0x..<end>, ..., N invalid words (or uses explicit expected_bytes and invalid_words) and verifies sum(encoded_instruction_bytes) + invalid_words * 4 == expected_bytes across all instructions in the code section. A truncated prefix ending on an earlier s_endpgm in a multi-program range is rejected during both one() and listing_file_is_complete().
  2. Trailing literal consuming s_endpgm (tools/shader_stage_manifest.py): Because completeness now validates full byte coverage independently of a trailing s_endpgm mnemonic line when the byte range is known, a complete Python-backend decode whose final instruction consumes 0xbf810000 as a literal is accepted and reused.
  3. Unexpected truncated .s files during resume (make_game.py): Added _disassembly_inventory(dxbc) returning (observed, complete) stems. disassembly_status now validates observed <= active and observed <= expected <= active before reusing or preserving files, and shaders() verifies observed == listings after shader_disasm.py, so unexpected truncated .s files cannot be hidden while translate() still scans the folder.
  4. Consistent bounded retries in llvm-mc and auto modes (tools/shader_disasm.py): one() now runs the same bounded TRUNCATED_RETRY_ATTEMPTS loop for both llvm-mc and auto when the initial response is non-empty, and keeps retrying through intermediate empty responses up to the final attempt.
  5. Retry sharing violations & preserve original error (tools/shader_disasm.py): Publication now uses replace_retry (tools/replace_retry.py), and temp .tmp cleanup uses replaced tracking with a try/except OSError: pass unlink so transient Windows sharing violations retry and cleanup errors cannot mask the original exception.

Thanks @timbot103 for the thorough static audit, @lixonik for both synthetic probes (both cases now have dedicated regression tests in tests/test_shader_disasm.py), and @fiestorra / @KelboLive for checking against main (merging main also resolves the stale clone-URL test in tests/test_make_game_preflight.py).

Verification (Windows 11, Python 3.12, no game data)

  • python -I tests/test_shader_disasm.py: 44 tests OK
  • python -I tests/test_shader_stage_resume.py: 49 tests OK (including TranslationSourcesTest)
  • python -I tests/test_rdna2spirv_cli.py: 37 tests OK (skipped=1)
  • python -I tests/test_make_game_dry_run.py: 25 tests OK
  • python -I tests/test_make_game_empty_translation.py: 20 tests OK (skipped=1)
  • python -I tests/test_make_game_resume.py: 14 tests OK
  • python -I tests/test_make_game_translator_flags.py: 42 tests OK
  • python -I tests/test_make_game_preflight.py: 110 tests OK (skipped=1)
  • python -I tests/test_text_write_line_endings.py: 3 tests OK
  • python -I scripts/check_no_game_data.py & git diff --check upstream/main...HEAD: clean (exit 0)

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7309642012 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#issuecomment-7309642012). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-12-01T11:26:16Z. --- Merged `upstream/main` (`3ee508b46`) at `efe1a42ea` (no rebase, no force-push) and addressed all five review findings at `594469b99`: 1. **Selected byte-range coverage (`tools/shader_stage_manifest.py`, `tools/shader_disasm.py`)**: `listing_is_complete` now parses `; code 0x..<end>, ..., N invalid words` (or uses explicit `expected_bytes` and `invalid_words`) and verifies `sum(encoded_instruction_bytes) + invalid_words * 4 == expected_bytes` across all instructions in the code section. A truncated prefix ending on an earlier `s_endpgm` in a multi-program range is rejected during both `one()` and `listing_file_is_complete()`. 2. **Trailing literal consuming `s_endpgm` (`tools/shader_stage_manifest.py`)**: Because completeness now validates full byte coverage independently of a trailing `s_endpgm` mnemonic line when the byte range is known, a complete Python-backend decode whose final instruction consumes `0xbf810000` as a literal is accepted and reused. 3. **Unexpected truncated `.s` files during resume (`make_game.py`)**: Added `_disassembly_inventory(dxbc)` returning `(observed, complete)` stems. `disassembly_status` now validates `observed <= active` and `observed <= expected <= active` before reusing or preserving files, and `shaders()` verifies `observed == listings` after `shader_disasm.py`, so unexpected truncated `.s` files cannot be hidden while `translate()` still scans the folder. 4. **Consistent bounded retries in `llvm-mc` and `auto` modes (`tools/shader_disasm.py`)**: `one()` now runs the same bounded `TRUNCATED_RETRY_ATTEMPTS` loop for both `llvm-mc` and `auto` when the initial response is non-empty, and keeps retrying through intermediate empty responses up to the final attempt. 5. **Retry sharing violations & preserve original error (`tools/shader_disasm.py`)**: Publication now uses `replace_retry` (`tools/replace_retry.py`), and temp `.tmp` cleanup uses `replaced` tracking with a `try/except OSError: pass` unlink so transient Windows sharing violations retry and cleanup errors cannot mask the original exception. Thanks @timbot103 for the thorough static audit, @lixonik for both synthetic probes (both cases now have dedicated regression tests in `tests/test_shader_disasm.py`), and @fiestorra / @KelboLive for checking against `main` (merging `main` also resolves the stale clone-URL test in `tests/test_make_game_preflight.py`). ### Verification (Windows 11, Python 3.12, no game data) - `python -I tests/test_shader_disasm.py`: **44 tests OK** - `python -I tests/test_shader_stage_resume.py`: **49 tests OK** (including `TranslationSourcesTest`) - `python -I tests/test_rdna2spirv_cli.py`: **37 tests OK** (`skipped=1`) - `python -I tests/test_make_game_dry_run.py`: **25 tests OK** - `python -I tests/test_make_game_empty_translation.py`: **20 tests OK** (`skipped=1`) - `python -I tests/test_make_game_resume.py`: **14 tests OK** - `python -I tests/test_make_game_translator_flags.py`: **42 tests OK** - `python -I tests/test_make_game_preflight.py`: **110 tests OK** (`skipped=1`) - `python -I tests/test_text_write_line_endings.py`: **3 tests OK** - `python -I scripts/check_no_game_data.py` & `git diff --check upstream/main...HEAD`: clean (exit 0) AI-assisted.
aslan2142 commented 2026-12-01 11:33:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:33:23Z.

Review: CHANGES_REQUESTED


Reviewed against current main: the shared shader_stage_manifest.listing_file_is_complete design and retry logic look cleaner than duplicating checks, but this branch currently has merge conflicts against main, failing CI, and competes with #2646 for the same #2539 truncated-disassembly and named-refusal issue. Please rebase onto main so CI runs cleanly and a maintainer can select between #2553 and #2646.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130383825 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#pullrequestreview-6130383825). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:33:23Z. **Review:** CHANGES_REQUESTED --- Reviewed against current `main`: the shared `shader_stage_manifest.listing_file_is_complete` design and retry logic look cleaner than duplicating checks, but this branch currently has merge conflicts against `main`, failing CI, and competes with `#2646` for the same `#2539` truncated-disassembly and named-refusal issue. Please rebase onto `main` so CI runs cleanly and a maintainer can select between `#2553` and `#2646`. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 11:52:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:52:04Z.

Review: CHANGES_REQUESTED


Keeping #2553 over closed duplicate #2646 for #2539 (SHADERS-DISASM-TRUNCATED-CHECK).

Your latest update (594469b99) cleanly addresses all five findings from @timbot103 and @lixonik (full byte-range coverage, trailing-literal s_endpgm, observed vs. complete _disassembly_inventory, consistent bounded retries in llvm-mc and auto modes, and replace_retry) while keeping completeness validation centralized in tools/shader_stage_manifest.py without special-casing test strings in production code.

Holding from merge for now because CI/linux-python-and-viewer is currently red on 594469b99 (and CI/check / Runtime/windows are still pending). Please check that failure and ping once all required CI checks are green!

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130696532 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#pullrequestreview-6130696532). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:52:04Z. **Review:** CHANGES_REQUESTED --- Keeping **#2553** over closed duplicate **#2646** for `#2539` (`SHADERS-DISASM-TRUNCATED-CHECK`). Your latest update (`594469b99`) cleanly addresses all five findings from `@timbot103` and `@lixonik` (full byte-range coverage, trailing-literal `s_endpgm`, observed vs. complete `_disassembly_inventory`, consistent bounded retries in `llvm-mc` and `auto` modes, and `replace_retry`) while keeping completeness validation centralized in `tools/shader_stage_manifest.py` without special-casing test strings in production code. Holding from merge for now because `CI/linux-python-and-viewer` is currently red on `594469b99` (and `CI/check` / `Runtime/windows` are still pending). Please check that failure and ping once all required CI checks are green! *(AI-assisted review.)*
kirigayakazima commented 2026-12-01 12:44:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-12-01T12:44:13Z.


Updated the fake_mc.py test stubs in tests/test_bvh_shaders_stage.py and tests/test_exe_shaders_stage.py (494a4384f7) to echo encoded instruction bytes (; encoding: [...]) per input dword instead of bare \ts_endpgm, so shader_disasm.py's byte-range coverage check accepts them cleanly.

Verified locally (Windows 11, Python 3.14, no game data):

  • python -m unittest tests.test_bvh_shaders_stage: 13 OK
  • python -m unittest tests.test_exe_shaders_stage: 11 OK
  • python -m unittest tests.test_fspx_shaders_stage: 24 OK
  • python -m unittest tests.test_library_shaders_stage: 17 OK (1 skipped)
  • python -m unittest tests.test_shader_disasm: 44 OK
  • python -m unittest tests.test_text_write_line_endings: 3 OK
  • python -I scripts/check_no_game_data.py and git diff --check: clean

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7311571991 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#issuecomment-7311571991). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-12-01T12:44:13Z. --- Updated the `fake_mc.py` test stubs in `tests/test_bvh_shaders_stage.py` and `tests/test_exe_shaders_stage.py` (494a4384f7) to echo encoded instruction bytes (`; encoding: [...]`) per input dword instead of bare `\ts_endpgm`, so `shader_disasm.py`'s byte-range coverage check accepts them cleanly. Verified locally (Windows 11, Python 3.14, no game data): - `python -m unittest tests.test_bvh_shaders_stage`: 13 OK - `python -m unittest tests.test_exe_shaders_stage`: 11 OK - `python -m unittest tests.test_fspx_shaders_stage`: 24 OK - `python -m unittest tests.test_library_shaders_stage`: 17 OK (1 skipped) - `python -m unittest tests.test_shader_disasm`: 44 OK - `python -m unittest tests.test_text_write_line_endings`: 3 OK - `python -I scripts/check_no_game_data.py` and `git diff --check`: clean AI-assisted: yes
merzleckeier commented 2026-12-01 12:57:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T12:57:20Z.


Real LLVM resume check for a truncated two-stage listing at 494a4384f + c95183fd8, using LLVM 23.1.5 on Linux. I preseeded a synthetic listing whose header declared 16 bytes but contained only the first two encoded instructions. With --backend llvm-mc --skip-existing, main reported reused and left two instructions. The PR reported clean and rewrote all four. I also ran ten affected Python suites against that tree. 364 tests passed and two skipped.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7311890555 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#issuecomment-7311890555). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T12:57:20Z. --- Real LLVM resume check for a truncated two-stage listing at `494a4384f` + `c95183fd8`, using LLVM 23.1.5 on Linux. I preseeded a synthetic listing whose header declared 16 bytes but contained only the first two encoded instructions. With `--backend llvm-mc --skip-existing`, main reported `reused` and left two instructions. The PR reported `clean` and rewrote all four. I also ran ten affected Python suites against that tree. 364 tests passed and two skipped. AI-assisted with OpenAI Codex.
merzleckeier commented 2026-12-01 15:21:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T15:21:16Z.


I tested a local resolution of the publication-path conflict between 494a4384 and main 88a9f133e. The conflict is in tools/shader_disasm.py, after the temporary listing has been written. The local merge keeps main’s destination mode calculation and writable-temp cleanup, and retains the PR’s replace_retry. Best-effort cleanup preserves the original replacement exception if the temporary file cannot be removed.

Ten affected suites passed with this resolution: 263 tests and 153 subtests passed, with one skip. This includes the existing mode-restoration-on-failure and transient replacement retry checks, along with truncated-listing repair and the affected stage suites. The merge resolution here is a local test, and the published branch still has the conflict. MEASURED on Linux using synthetic fixtures. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7315769484 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#issuecomment-7315769484). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T15:21:16Z. --- I tested a local resolution of the publication-path conflict between 494a4384 and main 88a9f133e. The conflict is in tools/shader_disasm.py, after the temporary listing has been written. The local merge keeps main’s destination mode calculation and writable-temp cleanup, and retains the PR’s replace_retry. Best-effort cleanup preserves the original replacement exception if the temporary file cannot be removed. Ten affected suites passed with this resolution: 263 tests and 153 subtests passed, with one skip. This includes the existing mode-restoration-on-failure and transient replacement retry checks, along with truncated-listing repair and the affected stage suites. The merge resolution here is a local test, and the published branch still has the conflict. MEASURED on Linux using synthetic fixtures. AI-assisted (Codex).
aslan2142 commented 2026-12-01 17:26:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:26:13Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319295976 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2553#issuecomment-7319295976). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:26:13Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

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!2553
No description provided.