Repository navigation
Conversation
merge_shard_parts() checks that the shard set is complete, that the markers agree with the parts, and that the plan agrees with the markers, all so a partial index is never published. One case was left: the same shader in two parts. `merged.update(doc)` then published whichever part was read last and dropped the other silently. That is reachable without anyone doing anything wrong. A bucket assignment moves when the listing changes, so parts written before a shader was added or removed can overlap parts written after; the parts are individually valid and the set is complete, so every existing check passes, and the index ends up describing one of two translations of the same shader -- possibly the one whose .spv the current run did not write. The merge now intersects the keys it already has with the part it is reading and raises ShardSetError naming the shaders and saying what to do (delete the parts, run every shard again). The check is a dict-key intersection per part: on a synthetic set of 26,400 entries in 8 parts the merge still takes tens of milliseconds, so there is no measurable cost. tests/test_rdna2spirv_merge.py: one new case, two parts that share a shader, expecting the refusal and the name.
|
Code read at b26fa62, Windows 11 (26200.9974), CPU only: skorex's duplicate claim checks out.
I did not build or run either branch's tests here and did not close either PR — just confirming the overlap for the maintainer. No game data used. AI-assisted. |
|
Duplicate — closing. #3306 ( For the record, the measurement that led to it, in case it is useful to #3306's review: |
|
Tested b26fa62 on RTX 2060 (Turing, NVIDIA 621.24), Windows 11, Python 3.13.1: pass.
Not run: the GPU suite, since the change does not touch translation. Synthetic inputs only, no game data. AI-assisted check. |
Claimed in the coordination issue: #7496
What and why
I went looking for a performance problem in
--mergeand did not find one: 26,400 entries in 8 synthetic parts merge in tens of milliseconds (4 µs per entry, linear —json.loadper part plusdict.update). What the same reading turned up is a correctness hole next to the checks it already has.merge_shard_parts()refuses an incomplete shard set, markers that disagree with the parts, a plan that disagrees with the markers, and a complete-but-empty set — all so a partialindex.jsonis never published. It does not refuse the same shader appearing in two parts:merged.update(doc)publishes whichever part was read last and drops the other without a word.That is reachable without anyone doing anything wrong. A bucket assignment moves when the directory listing changes, so parts written before a shader was added or removed can overlap parts written after; each part is valid and the set is complete, so every existing check passes, and
index.jsonends up describing one of two translations of that shader — possibly the one whose.spvthis run did not write, while the other stays on disk.The merge now intersects the keys it already holds with the part it is reading and raises
ShardSetErrornaming the shaders and what to do:Cost
The check is a dict-key intersection per part, and it does not show up in the merge time: on the 26,400-entry synthetic set (8 parts) the merge is still tens of milliseconds, and the same measurement before the change gives the same order of magnitude. This is a small change on purpose — the point is that the fail-closed policy the function already follows now has no gap in it.
Tested
python -I tests/test_rdna2spirv_merge.py: 31 tests, OK (30 before; one new case with two parts that share a shader, asserting the refusal and that the message names it).cc @ItsNotRexed @KoertLichtendonk.
Checklist
docs/design.md. (Not applicable: no translation change.)