Shader checks: preserve subprocess diagnostics and validate probe output #1325

Merged
delysidemanYT1 merged 1 commit from upstream-pr/1325 into main 2026-11-29 15:45:05 +00:00
delysidemanYT1 commented 2026-11-24 21:53:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by delysidemanYT1 on 2026-11-24T21:53:39Z.


Claimed in the coordination issue as: GPU-CHECK-CLI-OUTPUT, GPU-CHECK-MESH-OUTPUT, GPU-CHECK-PROBE-JSON
Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7145499474

  • Escape undecodable bytes from ordinary shader test processes, preserving their return code and diagnostics.
  • Apply the same capture policy to the wave64 mesh harness, which captures its output separately.
  • Treat non-object JSON from the barycentric capability probe as unavailable and keep the fallback disabled for that response. Valid object responses still work.

Reproduced all three failures on Windows before the change and verified all three afterward with synthetic subprocess output: invalid bytes in both streams for the ordinary and mesh paths, and JSON arrays/null plus a valid object for the capability probe. All 219 related unit tests and git diff --check passed. No GPU execution or game files. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5480961913 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1325). Originally posted by [delysidemanYT1](https://github.com/delysidemanYT1) on 2026-11-24T21:53:39Z. --- Claimed in the coordination issue as: GPU-CHECK-CLI-OUTPUT, GPU-CHECK-MESH-OUTPUT, GPU-CHECK-PROBE-JSON Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7145499474 - Escape undecodable bytes from ordinary shader test processes, preserving their return code and diagnostics. - Apply the same capture policy to the wave64 mesh harness, which captures its output separately. - Treat non-object JSON from the barycentric capability probe as unavailable and keep the fallback disabled for that response. Valid object responses still work. Reproduced all three failures on Windows before the change and verified all three afterward with synthetic subprocess output: invalid bytes in both streams for the ordinary and mesh paths, and JSON arrays/null plus a valid object for the capability probe. All 219 related unit tests and git diff --check passed. No GPU execution or game files. AI-assisted (Codex).
PierreEbele commented 2026-11-25 14:59:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T14:59:44Z.


Reviewed dc64524: ran the three shader-check test files on the PR tree (87/64/6 OK) and main (88/68/6 OK); probes on both trees reproduce both fixed crashes — undecodable tool output kills main's check.run with an uncaught UnicodeDecodeError, and valid non-dict JSON in the probe answer makes main raise AttributeError at import; the PR keeps the log (\xNN escapes) and answers False (mesh path not run: no GPU). Non-blocking: the dict guard needs stdout contamination (the probe tool prints one ASCII JSON line), scripts/run_gpu_tests.py:364/379 keeps the same unguarded .get() (pre-existing, reproduced); a small regression test would pin the crashes. AI-assisted review.

Recommendation: Merge

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7166136639 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1325#issuecomment-7166136639). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T14:59:44Z. --- Reviewed dc64524: ran the three shader-check test files on the PR tree (87/64/6 OK) and main (88/68/6 OK); probes on both trees reproduce both fixed crashes — undecodable tool output kills main's check.run with an uncaught UnicodeDecodeError, and valid non-dict JSON in the probe answer makes main raise AttributeError at import; the PR keeps the log (\xNN escapes) and answers False (mesh path not run: no GPU). Non-blocking: the dict guard needs stdout contamination (the probe tool prints one ASCII JSON line), scripts/run_gpu_tests.py:364/379 keeps the same unguarded .get() (pre-existing, reproduced); a small regression test would pin the crashes. AI-assisted review. **Recommendation:** Merge
OreoFR commented 2026-11-28 21:39:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:39:52Z.


Verified by OreoFR

  • Base: main aa918e5d9 + PR head dc64524e4 (merge --no-ff, no conflict)
  • Test: the PR adds no test, so red/green uses a local probe (not committed) that loads runtime/test/shaders/check.py: run() on a child writing cp1252-undecodable bytes to stdout and stderr with exit code 3, and barycentric_fallback() with a probe answering a JSON array. Also python -I tests/test_shader_checks.py, tests/test_run_gpu_tests.py, tests/test_vk_subgroup_info.py
  • Red on main: both cases fail: the reader threads raise UnicodeDecodeError and run() then raises TypeError (exit code lost); barycentric_fallback() raises AttributeError on the list
  • Green with the PR: run() returns 3 with the output kept (backslash-escaped); barycentric_fallback() returns False. The three test files pass on both sides (88, 75, 57 tests)
  • Verdict: READY (small Python-only change; consider adding the probe cases as a unit test)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246181870 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1325#issuecomment-7246181870). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:39:52Z. --- **Verified by OreoFR** - Base: main `aa918e5d9` + PR head `dc64524e4` (merge --no-ff, no conflict) - Test: the PR adds no test, so red/green uses a local probe (not committed) that loads `runtime/test/shaders/check.py`: `run()` on a child writing cp1252-undecodable bytes to stdout and stderr with exit code 3, and `barycentric_fallback()` with a probe answering a JSON array. Also `python -I tests/test_shader_checks.py`, `tests/test_run_gpu_tests.py`, `tests/test_vk_subgroup_info.py` - Red on main: both cases fail: the reader threads raise `UnicodeDecodeError` and `run()` then raises `TypeError` (exit code lost); `barycentric_fallback()` raises `AttributeError` on the list - Green with the PR: `run()` returns 3 with the output kept (backslash-escaped); `barycentric_fallback()` returns `False`. The three test files pass on both sides (88, 75, 57 tests) - Verdict: READY (small Python-only change; consider adding the probe cases as a unit test) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-29 01:12:22 +00:00 (Migrated from github.com)

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


#1325 | head dc64524e46 (merged cleanly onto origin/main 818d881b1f) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Independent Verification (Windows 11)

  • Diff & safety audit: Inspected 100% of the diff in runtime/test/shaders/check.py (errors="backslashreplace" on subprocess.run(..., text=True) in barycentric_fallback, run, and mesh_w64x_test, plus isinstance(answer, dict) guard on parsed JSON in barycentric_fallback). python -I scripts/check_no_game_data.py runtime/test/shaders/check.py passed (rc=0).
  • Red -> Green on Windows 11 (cp1252 preferred encoding, python -I without PYTHONUTF8):
    • Red (origin/main 818d881b1f):
      1. Passing undefined cp1252 bytes (0x81, 0x8d) on child stderr into check.run(...) raised UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 inside subprocess._readerthread, leaving r.stderr = None and crashing check.run with TypeError: can only concatenate str (not "NoneType") to str.
      2. Returning valid non-object JSON (123) from the subgroup probe crashed check.barycentric_fallback() with AttributeError: 'int' object has no attribute 'get'.
    • Green (#1325 + origin/main):
      1. check.run(...) returned (1, 'diag:\\x81\\x8d\n') cleanly without losing diagnostics or crashing _readerthread.
      2. check.barycentric_fallback() on non-dict JSON (123) returned False cleanly.
  • Regression suites & sibling merge check:
    • python -I tests/test_shader_checks.py -> 88/88 passed (OK, 2.355s)
    • python -I tests/test_run_gpu_tests.py -> 75/75 passed (OK, 3.021s)
    • Verified clean 3-way merge alongside sibling runtime/test/shaders/check.py PR #1350 (0 conflicts).
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248630538 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1325#issuecomment-7248630538). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T01:12:22Z. --- #1325 | head dc64524e46e726bd408b23867bdc5c0f5b6f4dee (merged cleanly onto origin/main 818d881b1f) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes ### Independent Verification (Windows 11) - **Diff & safety audit**: Inspected 100% of the diff in `runtime/test/shaders/check.py` (`errors="backslashreplace"` on `subprocess.run(..., text=True)` in `barycentric_fallback`, `run`, and `mesh_w64x_test`, plus `isinstance(answer, dict)` guard on parsed JSON in `barycentric_fallback`). `python -I scripts/check_no_game_data.py runtime/test/shaders/check.py` passed (`rc=0`). - **Red -> Green on Windows 11 (`cp1252` preferred encoding, `python -I` without `PYTHONUTF8`)**: - **Red (`origin/main` `818d881b1f`)**: 1. Passing undefined `cp1252` bytes (`0x81`, `0x8d`) on child `stderr` into `check.run(...)` raised `UnicodeDecodeError: 'charmap' codec can't decode byte 0x81` inside `subprocess._readerthread`, leaving `r.stderr = None` and crashing `check.run` with `TypeError: can only concatenate str (not "NoneType") to str`. 2. Returning valid non-object JSON (`123`) from the subgroup probe crashed `check.barycentric_fallback()` with `AttributeError: 'int' object has no attribute 'get'`. - **Green (`#1325 + origin/main`)**: 1. `check.run(...)` returned `(1, 'diag:\\x81\\x8d\n')` cleanly without losing diagnostics or crashing `_readerthread`. 2. `check.barycentric_fallback()` on non-dict JSON (`123`) returned `False` cleanly. - **Regression suites & sibling merge check**: - `python -I tests/test_shader_checks.py` -> `88/88` passed (`OK`, `2.355s`) - `python -I tests/test_run_gpu_tests.py` -> `75/75` passed (`OK`, `3.021s`) - Verified clean 3-way merge alongside sibling `runtime/test/shaders/check.py` PR `#1350` (`0` conflicts).
MoonEyes commented 2026-11-29 15:45:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T15:45:09Z.


Merged. Tested by @OreoFR on head dc64524e4 (RTX 4070 Laptop / Windows 11 (Python tool, CPU path)): Red on main: UnicodeDecodeError->TypeError in run(), AttributeError on non-dict JSON; green: returns 3 / False; 3 test f. Correction: no CI check run or commit status exists for this head, so CI did not validate it. My earlier sentence about red jobs was wrong. Thanks @delysidemanYT1!

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7258337879 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1325#issuecomment-7258337879). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T15:45:09Z. --- Merged. Tested by @OreoFR on head dc64524e4 (RTX 4070 Laptop / Windows 11 (Python tool, CPU path)): Red on main: UnicodeDecodeError->TypeError in run(), AttributeError on non-dict JSON; green: returns 3 / False; 3 test f. Correction: no CI check run or commit status exists for this head, so CI did not validate it. My earlier sentence about red jobs was wrong. Thanks @delysidemanYT1! AI-assisted: yes
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!1325
No description provided.