shader_carve: exclude the length byte from shader names (SHADER-CARVE-NAME-LENGTH) #1361

Closed
x2Tweek wants to merge 1 commit from upstream-pr/1361 into main
x2Tweek commented 2026-11-24 22:31:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by x2Tweek on 2026-11-24T22:31:17Z.


Claimed in the coordination issue as: SHADER-CARVE-NAME-LENGTH (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146324024)

What and why

A printable name-length byte can be captured as the first letter of a shader name. Interpret the length after matching the candidate header so both the Python and optional native scanners use the same name handling. Check for a length field immediately before the match to preserve a real first character that happens to have the same value as the matched name length.

The correction changes some output filenames and translation-index keys. Existing work folders need the shaders stage again. Run python -I make_game.py --stages shaders with your usual game and work-folder options. A missing or stale carve-source digest tells that stage to recarve, unpack, disassemble and translate.

Tested

  • python -I tests/test_shader_carve.py, python -I tests/test_shader_stage_resume.py, python -I tests/test_shader_stage_manifest.py, python -I tests/test_shader_library.py, and python -I tests/test_text_write_line_endings.py.
  • Built the optional scanner with cargo build --release --offline --manifest-path tools/shader_carve_native/Cargo.toml and ran python -I tests/test_shader_carve_native.py with LEONIDA_TEST_REQUIRE_SHADER_CARVE_NATIVE=1. Also ran the new carve regression with LEONIDA_SHADER_CARVE_NATIVE=0.
  • Measured on one 1.0.2.1 translation index (counts only): 6,275 of 26,503 shader names (24%) have a first character whose code equals the name's own length, which is the stray length byte this change removes; chance alone would give about 1-2%. Those names, and the index keys built from them, change; the shaders stage must therefore run again (carve, then translation) on existing work folders.
  • 126 targeted tests passed. One shader-library symlink subtest was skipped because Windows denied symlink creation. Python compilation, make_game.py --help, the game-data check and git diff --check passed.

GPUs tested: n/a. CPU-only synthetic fixtures and mocked pipeline tools on Windows. No retail corpus run.

AI-assisted: yes.

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys or decryption.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5481425193 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1361). Originally posted by [x2Tweek](https://github.com/x2Tweek) on 2026-11-24T22:31:17Z. --- Claimed in the coordination issue as: SHADER-CARVE-NAME-LENGTH (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146324024) ### What and why A printable name-length byte can be captured as the first letter of a shader name. Interpret the length after matching the candidate header so both the Python and optional native scanners use the same name handling. Check for a length field immediately before the match to preserve a real first character that happens to have the same value as the matched name length. The correction changes some output filenames and translation-index keys. Existing work folders need the shaders stage again. Run `python -I make_game.py --stages shaders` with your usual game and work-folder options. A missing or stale carve-source digest tells that stage to recarve, unpack, disassemble and translate. ### Tested - `python -I tests/test_shader_carve.py`, `python -I tests/test_shader_stage_resume.py`, `python -I tests/test_shader_stage_manifest.py`, `python -I tests/test_shader_library.py`, and `python -I tests/test_text_write_line_endings.py`. - Built the optional scanner with `cargo build --release --offline --manifest-path tools/shader_carve_native/Cargo.toml` and ran `python -I tests/test_shader_carve_native.py` with `LEONIDA_TEST_REQUIRE_SHADER_CARVE_NATIVE=1`. Also ran the new carve regression with `LEONIDA_SHADER_CARVE_NATIVE=0`. - Measured on one 1.0.2.1 translation index (counts only): 6,275 of 26,503 shader names (24%) have a first character whose code equals the name's own length, which is the stray length byte this change removes; chance alone would give about 1-2%. Those names, and the index keys built from them, change; the shaders stage must therefore run again (carve, then translation) on existing work folders. - 126 targeted tests passed. One shader-library symlink subtest was skipped because Windows denied symlink creation. Python compilation, `make_game.py --help`, the game-data check and `git diff --check` passed. GPUs tested: n/a. CPU-only synthetic fixtures and mocked pipeline tools on Windows. No retail corpus run. AI-assisted: yes. ### Checklist - [x] Based on current main. - [x] One topic. - [x] No game data, keys or decryption.
x2Tweek commented 2026-11-25 03:47:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by x2Tweek on 2026-11-25T03:47:44Z.


Local verification of PR #1361 changes (shader_carve length-byte fix), run on Windows with Python 3.15.2:

  • tests/test_shader_carve.py: 32 passed, 0 failed
  • tests/test_shader_stage_resume.py: 48 passed, 0 failed
  • python -m compileall -q make_game.py tools/shader_carve.py tests/test_shader_carve.py tests/test_shader_stage_resume.py: clean
  • python -I scripts/check_no_game_data.py tools/shader_carve.py make_game.py tests/test_shader_carve.py tests/test_shader_stage_resume.py: clean
  • python -I make_game.py --help: clean

The Windows CI check (windows in Runtime workflow) shows FAILURE; all other completed checks pass (change-scope, no-game-data, linux-gpu-tools). Several CI checks are still QUEUED. Local tests pass on this machine; the Windows failure may be environmental or pre-existing.

AI-assisted: yes (Claude Code)

No game data, no local paths, no secrets.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152248485 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1361#issuecomment-7152248485). Originally posted by [x2Tweek](https://github.com/x2Tweek) on 2026-11-25T03:47:44Z. --- Local verification of PR #1361 changes (shader_carve length-byte fix), run on Windows with Python 3.15.2: - `tests/test_shader_carve.py`: 32 passed, 0 failed - `tests/test_shader_stage_resume.py`: 48 passed, 0 failed - `python -m compileall -q make_game.py tools/shader_carve.py tests/test_shader_carve.py tests/test_shader_stage_resume.py`: clean - `python -I scripts/check_no_game_data.py tools/shader_carve.py make_game.py tests/test_shader_carve.py tests/test_shader_stage_resume.py`: clean - `python -I make_game.py --help`: clean The Windows CI check (`windows` in Runtime workflow) shows FAILURE; all other completed checks pass (change-scope, no-game-data, linux-gpu-tools). Several CI checks are still QUEUED. Local tests pass on this machine; the Windows failure may be environmental or pre-existing. AI-assisted: yes (Claude Code) No game data, no local paths, no secrets.
x2Tweek commented 2026-11-25 07:49:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by x2Tweek on 2026-11-25T07:49:00Z.


The three failures at merge commit 3e48a50eb reproduce on upstream baselines:

  • windows: CTest counted the Vulkan readback test's exit 77 as a failure when the runner lacked bufferDeviceAddress. #1418 reproduces this on main at e8fee01cd and adds the missing skip registration.
  • translator-tests: LLVM 21.1.8 rejected the text-only cs_dpp_cmp.asm fixture in two pytest cases before translation. #1375 documents the same failures on main at 4a50cafc7 and 89d7dfcf5 and updates the pytest helper.
  • stdlib-tests-linux: I reproduced the same registration assertion locally on the exact CI base, main at 2a5ff9714. The scanner missed inherited tests in test_sub_co_same_operand.py. The fixture itself ran six tests successfully. The scanner fix has since merged in #1365.

AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7156284129 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1361#issuecomment-7156284129). Originally posted by [x2Tweek](https://github.com/x2Tweek) on 2026-11-25T07:49:00Z. --- The three failures at merge commit `3e48a50eb` reproduce on upstream baselines: - `windows`: CTest counted the Vulkan readback test's exit 77 as a failure when the runner lacked `bufferDeviceAddress`. #1418 reproduces this on `main` at `e8fee01cd` and adds the missing skip registration. - `translator-tests`: LLVM 21.1.8 rejected the text-only `cs_dpp_cmp.asm` fixture in two pytest cases before translation. #1375 documents the same failures on `main` at `4a50cafc7` and `89d7dfcf5` and updates the pytest helper. - `stdlib-tests-linux`: I reproduced the same registration assertion locally on the exact CI base, `main` at `2a5ff9714`. The scanner missed inherited tests in `test_sub_co_same_operand.py`. The fixture itself ran six tests successfully. The scanner fix has since merged in #1365. AI-assisted: yes.
DadaCap commented 2026-11-28 07:21:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T07:21:12Z.


Thanks for this! Excluding the length byte from carved shader names fixes names that picked up a stray first character.

During maintainer testing (local, 2026-11-28) (head 4adb40988, merged on main b1619e0a3 / 6dfca6428, Windows 11, Python tests via pytest/unittest) we found:

  • Review finding: this changes carved and translated shader names, so every existing work folder re-carves, and the format claim has no row in docs/design.md and no count over the corpus.

To get this merged:

  • Add the corpus count and the docs/design.md row.
  • Confirm nothing looks shaders up by the old name, and note the forced re-carve in the PR description.

AI-assisted (Claude Code), posted for DadaCap (maintainer).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7235879064 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1361#issuecomment-7235879064). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T07:21:12Z. --- Thanks for this! Excluding the length byte from carved shader names fixes names that picked up a stray first character. During maintainer testing (local, 2026-11-28) (head 4adb40988, merged on main b1619e0a3 / 6dfca6428, Windows 11, Python tests via pytest/unittest) we found: - Review finding: this changes carved and translated shader names, so every existing work folder re-carves, and the format claim has no row in `docs/design.md` and no count over the corpus. To get this merged: - Add the corpus count and the `docs/design.md` row. - Confirm nothing looks shaders up by the old name, and note the forced re-carve in the PR description. _AI-assisted (Claude Code), posted for DadaCap (maintainer)._

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