tooling: report malformed PSO pipeline JSON as validation errors #1523

Merged
RenzoWit35 merged 1 commit from upstream-pr/1530 into main 2026-11-24 14:23:50 +00:00
RenzoWit35 commented 2026-11-24 13:43:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RenzoWit35 on 2026-11-24T13:43:22Z.


Change

tools/pso_readiness.py validates pipeline input with specific ValueError messages, but none of them
(duplicate/empty ID, invalid root signature status, repeated stage, no shader references, short SHA-256, and the
CLI PSO report: exit) was asserted in tests/pso_readiness_check.py. Separately, report() raised a bare
TypeError ("string indices must be integers" / "'int' object is not iterable") when a pipeline's shaders was
a dict, string or int, when a shader reference was not an object, or when a pipeline entry was not an object.

  • report() and shader_key() now raise ValueError for those wrong-type cases, in the same style as the
    neighbouring checks (pipeline <id> shaders must be a list, pipeline entries must be JSON objects, and the
    existing shader-reference message for non-object references). 6 added lines, no restructuring.
  • check_invalid_input() in tests/pso_readiness_check.py: a table of 15 rejected inputs asserting the exact
    message, two CLI runs asserting exit 1, empty stdout and PSO report: <message>, and the valid fixture as
    control (still needs_evidence).

The CLI already caught TypeError, so a CLI user saw PSO report: string indices must be integers...; the
change mainly gives API callers and the CLI a consistent, descriptive message.

Verification

Windows 11, Python 3.14.5, base origin/main 1ca0dec1.

  • python -B tests/pso_readiness_check.py on this branch: passes (mesh, compute, new input validation, census).
  • Negative control, unmodified main tool with the new test: fails with
    TypeError: string indices must be integers, not 'str'.
  • Coverage controls (each break applied to the fixed tool, then restored): identity in ids, the root status
    check, stage in stages, the empty-shaders check, the digest regex ({64} to {1,64}) and parser.exit(1
    to parser.exit(0 each make the new test fail on the named case.

Evidence and follow-up

Not run: the pso_ CTests and any C++ build. Not changed: a non-object record inside the extraction manifest and
a non-list top-level pipelines value still raise TypeError; the manifest is tool output, not hand-written
input. Missing keys still raise KeyError, as before.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6583154170 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1530). Originally posted by [RenzoWit35](https://github.com/RenzoWit35) on 2026-11-24T13:43:22Z. --- ## Change `tools/pso_readiness.py` validates pipeline input with specific `ValueError` messages, but none of them (duplicate/empty ID, invalid root signature status, repeated stage, no shader references, short SHA-256, and the CLI `PSO report:` exit) was asserted in `tests/pso_readiness_check.py`. Separately, `report()` raised a bare `TypeError` ("string indices must be integers" / "'int' object is not iterable") when a pipeline's `shaders` was a dict, string or int, when a shader reference was not an object, or when a pipeline entry was not an object. - `report()` and `shader_key()` now raise `ValueError` for those wrong-type cases, in the same style as the neighbouring checks (`pipeline <id> shaders must be a list`, `pipeline entries must be JSON objects`, and the existing shader-reference message for non-object references). 6 added lines, no restructuring. - `check_invalid_input()` in `tests/pso_readiness_check.py`: a table of 15 rejected inputs asserting the exact message, two CLI runs asserting exit 1, empty stdout and `PSO report: <message>`, and the valid fixture as control (still `needs_evidence`). The CLI already caught `TypeError`, so a CLI user saw `PSO report: string indices must be integers...`; the change mainly gives API callers and the CLI a consistent, descriptive message. ## Verification Windows 11, Python 3.14.5, base `origin/main` 1ca0dec1. - `python -B tests/pso_readiness_check.py` on this branch: passes (mesh, compute, new input validation, census). - Negative control, unmodified main tool with the new test: fails with `TypeError: string indices must be integers, not 'str'`. - Coverage controls (each break applied to the fixed tool, then restored): `identity in ids`, the root status check, `stage in stages`, the empty-shaders check, the digest regex (`{64}` to `{1,64}`) and `parser.exit(1` to `parser.exit(0` each make the new test fail on the named case. ## Evidence and follow-up Not run: the `pso_` CTests and any C++ build. Not changed: a non-object record inside the extraction manifest and a non-list top-level `pipelines` value still raise `TypeError`; the manifest is tool output, not hand-written input. Missing keys still raise `KeyError`, as before. AI-assisted.
upstream-sync closed this pull request 2026-11-24 15:01:53 +00:00
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
R0Y00/Xbox2Windows!1523
No description provided.