parse_file reads tab-indented instruction lines only, so a hand-written or
re-indented .s parses to an empty shader. That used to translate to a module
that passes spirv-val, lands in index.json and does no work at all: the CLI
printed "1 shaders: 1 translated, 1 pass spirv-val" for a file whose only
line was a comment.
Refuse it in translate() with "no instructions (nothing tab-indented?)", so
it is reported like any other unsupported shader and no .spv is published.
Found while writing a fixture with spaces instead of tabs; the new test uses
that exact shape.
A shader that raises Unsupported or a translator error on a retried partial
run kept the .spv and index.json entry an earlier successful run published:
only spirv-as/val rejections went through the invalid set that the index
merge pops. The stale entry masks the regression from make_game.py, which
takes index.json as proof the translation finished, and the stale module
stays loadable by the runtime.
Route all three failure paths through one drop_stale helper: unlink the old
.spv and mark the name for the index merge to drop. The .spvasm text stays
for diagnosis, as it does on a rejection. Shard and --limit runs write their
index fresh from this run's metadata, so they only gain the unlink.
Tests: two synthetic CLI tests (s_barrier in a PS is Unsupported before any
SPIR-V tool runs; a mocked ValueError covers the translator-error path).
Both fail without the change. Standard library only, no game data.
AI-assisted. Tested on CPU (Windows 11, Python 3.12): tests/test_rdna2spirv_cli.py
(14 tests), unittest discover tests/semantic, and pytest tests/test_rdna2spirv_cli.py
tests/test_translate.py with llvm-mc 23.1.5 (AMDGPU) and SPIRV-Tools v2026.4.
No GPU was used.
`files[: a.limit] if a.limit else files` read --limit 0 as "no limit"
and translated the whole corpus, and a negative --limit dropped the
last shaders instead of being refused. --shard was split and used
unchecked: 0/0 ended in "slice step cannot be zero", 9/8 translated
nothing and wrote an empty index.part9.json that --merge then reads,
and anything that isn't i/n was a traceback.
Both are now argparse types: --limit must be at least 1, and --shard
must be i/n with n >= 1 and 0 <= i < n. A bad value is a usage error
(exit 2) before --out is created. The translation itself is unchanged,
and make_game.py's own "--shard i/jobs" values are all valid.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>