tools/shader_stage_manifest.py: case-insensitive suffix and conflicting stage guard #2287

Merged
leonida/mandy
kirigayakazima merged 1 commit from fix/shader-stage-manifest-safety into main 2026-11-28 15:10:04 +00:00

Pull request successfully merged and closed

kirigayakazima commented 2026-11-26 12:46:44 +00:00

Claimed in the coordination issue as: SHADER-STAGE-MANIFEST-CASE-SUFFIX-AND-CONFLICT-GUARD (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7192416492)

What and why

  • Match filename suffix case-insensitively in _stem_rows() (tools/shader_stage_manifest.py) so uppercase/mixed-case extensions such as .DXBC resolve to the same stems instead of failing suffix validation.
  • Track duplicate stem stage conflicts in shader_stages(): when two rows for the same stem specify conflicting non-empty stages (e.g. "ps" and "vs"), record None (unknown) instead of silently letting the last row overwrite earlier entries, while preserving agreeing duplicates and None/empty + known pairs.
  • Add unit tests in tests/test_shader_stage_manifest.py covering case-insensitive suffix matching and duplicate stage conflict resolution.

Tested

  • python -I tests/test_shader_stage_manifest.py -v: 19 passed, 0 failed (detached upstream/main baseline with only the updated test file fails with 1 failure and 1 error).
  • python -I tests/test_ci_registration.py: 16 passed.
  • python -I tests/test_text_write_line_endings.py: 3 passed.
  • python -I scripts/check_no_game_data.py, python -I -m compileall -q tools/shader_stage_manifest.py tests/test_shader_stage_manifest.py, and git diff --cached --check: passed.

GPUs tested: n/a

AI-assisted: yes

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.
Claimed in the coordination issue as: SHADER-STAGE-MANIFEST-CASE-SUFFIX-AND-CONFLICT-GUARD (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7192416492) ### What and why - Match filename `suffix` case-insensitively in `_stem_rows()` (`tools/shader_stage_manifest.py`) so uppercase/mixed-case extensions such as `.DXBC` resolve to the same stems instead of failing suffix validation. - Track duplicate stem stage conflicts in `shader_stages()`: when two rows for the same stem specify conflicting non-empty stages (e.g. `"ps"` and `"vs"`), record `None` (`unknown`) instead of silently letting the last row overwrite earlier entries, while preserving agreeing duplicates and `None`/empty + known pairs. - Add unit tests in `tests/test_shader_stage_manifest.py` covering case-insensitive suffix matching and duplicate stage conflict resolution. ### Tested - `python -I tests/test_shader_stage_manifest.py -v`: 19 passed, 0 failed (detached `upstream/main` baseline with only the updated test file fails with 1 failure and 1 error). - `python -I tests/test_ci_registration.py`: 16 passed. - `python -I tests/test_text_write_line_endings.py`: 3 passed. - `python -I scripts/check_no_game_data.py`, `python -I -m compileall -q tools/shader_stage_manifest.py tests/test_shader_stage_manifest.py`, and `git diff --cached --check`: passed. GPUs tested: n/a AI-assisted: yes ### 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.
tiguan26 approved these changes 2026-11-27 04:39:46 +00:00
tiguan26 left a comment

Approving 6c1a97ecf.

The suffix is matched case-insensitively and the stem cut by length, and duplicate index entries for one stem that name different stages now make it unknown (None) instead of the last one winning; a duplicate without a stage no longer erases a known one.

Merged onto main d1dff7949 in one batch with 15 other tool PRs of this series (no conflicts), on Linux with Python 3.13. tests/test_shader_stage_manifest.py: 19 passed (main: 17). AI-assisted (Claude Code, Claude Opus 5.5).

Approving 6c1a97ecf. The suffix is matched case-insensitively and the stem cut by length, and duplicate index entries for one stem that name different stages now make it unknown (None) instead of the last one winning; a duplicate without a stage no longer erases a known one. Merged onto `main` `d1dff7949` in one batch with 15 other tool PRs of this series (no conflicts), on Linux with Python 3.13. `tests/test_shader_stage_manifest.py`: 19 passed (main: 17). AI-assisted (Claude Code, Claude Opus 5.5).
MSedgeMC reviewed 2026-11-27 15:29:33 +00:00
MSedgeMC left a comment
No description provided.
Verified on the PR branch: python3 -m unittest tests.test_shader_stage_manifest -> 19 tests OK and tests.test_shader_stage_resume -> 47 tests OK, including the new case-insensitive suffix/conflicting-stage cases. Not approving yet: the branch is 446 commits behind current main, so a rebase is needed before the final diff can be reviewed.
zmasi commented 2026-11-28 10:23:53 +00:00

#2287 | head 6c1a97ecf7d9d9bc277d18f942867d19d4031a17 (merged cleanly with main 901b6c1bf) | python -I tests/test_shader_stage_manifest.py | red on main: FAILED (failures=1, errors=1) (ValueError on mixed-case .DXBC/.DxBc suffixes and conflicting duplicate shader stage entries silently retaining the last stage instead of None) | green on PR+main: 19 tests OK | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited _stem_rows (value.lower().endswith(suffix.lower()) with value[:-len(suffix)] preserving stem case and . / .. traversal guards) and shader_stages (conflicted set marking disagreeing duplicate non-empty stages None while allowing agreeing or None/empty duplicates to resolve cleanly) in tools/shader_stage_manifest.py. Also passed tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), tests/test_runner_calls_all_tests.py (3 OK), and scripts/check_no_game_data.py on the merged tree.

#2287 | head 6c1a97ecf7d9d9bc277d18f942867d19d4031a17 (merged cleanly with main 901b6c1bf) | `python -I tests/test_shader_stage_manifest.py` | red on main: `FAILED (failures=1, errors=1)` (`ValueError` on mixed-case `.DXBC`/`.DxBc` suffixes and conflicting duplicate shader stage entries silently retaining the last stage instead of `None`) | green on PR+main: `19 tests OK` | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `_stem_rows` (`value.lower().endswith(suffix.lower())` with `value[:-len(suffix)]` preserving stem case and `.` / `..` traversal guards) and `shader_stages` (`conflicted` set marking disagreeing duplicate non-empty stages `None` while allowing agreeing or `None`/empty duplicates to resolve cleanly) in `tools/shader_stage_manifest.py`. Also passed `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), `tests/test_runner_calls_all_tests.py` (`3 OK`), and `scripts/check_no_game_data.py` on the merged tree.
MoonEyes commented 2026-11-28 15:10:01 +00:00

Red/green: classified READY by cloud-6 (red on main 09c153948, green on head merged with main); head 6c1a97ecf7d9 unchanged since 2026-11-26, before that run.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

Red/green: classified READY by cloud-6 (red on main 09c153948, green on head merged with main); head 6c1a97ecf7d9 unchanged since 2026-11-26, before that run. Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No description provided.