semantic_mutants: mutate the Python logic around the emission too (MUTANTS-PY-LOGIC) #734
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!734
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/734/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@qhukz13 on GitHub · 2026-11-24 13:06 UTC · original
qhukz13:cont/mutants-py-logic→main· +353 −1 · 2 files · 4 commits · merged 2026-11-24 16:06 UTCClaimed in the coordination issue as: MUTANTS-PY-LOGIC
Depends on: #660 (same file; this branch is on top of it, so its two commits show here until #660 is merged)
What and why
tools/semantic_mutants.pyonly mutated SPIR-V emission (opcode pairs,self.cuconstants,OpSelectarms, the last operand), so the translator's Python analysis code - register liveness, lane-mask tracking, operand checks - got no mutants:--function read_before_write_vgprslisted 0. In the reviews of #658, #647, #593 and #637 the logic mutations had to be written by hand.This adds token-based mutations of that code (strings, f-strings and comments are left alone):
==/!=,</<=,>/>=,in/not in,is/is not(theinof aforloop or comprehension stays);and/or, anotdropped,True/False;pass: a call that is not anemit, an augmented assignment, or a rebinding of a name assigned earlier in the range (removing a first assignment would only be a NameError).The branch's own
if op ...condition gets none (a mutant there only sends other ops through the branch). The same flip twice on one line is numbered from the left (and -> or #1,#2).Tested
python -I tests/test_semantic_mutants.py: 19 tests OK. The newPythonLogicclass covers each mutation kind, what is left alone (strings, comments, emit lines, the branch condition, first assignments, loopin), the numbering, and that every mutant still compiles.--function read_before_write_vgprs tests/semantic/test_writelane_read_before_write.py: 36 mutants, 27 caught in 40 s. The survivors includecarried.difference_update(dst)removed, which my hand-written review of #658 found equivalent, andregs += x["r"]removed (vlist operands), which no case reaches.tests/test_text_write_line_endings.pyOK,scripts/check_no_game_data.pyclean,compileallclean.Linux, CPU only; no GPU, no game files.
AI-assisted (Claude Code).
🤖 Generated with Claude Code
@abnalstlll-byte on GitHub · 2026-11-24 13:24 UTC · original · approved these changes
Audited and verified. Clean-room compliant.