semantic_mutants: leave docstrings alone, so their op names are not reported as surviving mutants (OLD-9432) #660
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!660
Loading…
Reference in a new issue
No description provided.
Delete branch "cont/semantic-mutants-docstrings"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as: OLD-9432 (restoration of ItsNotRexed/Leonida#9432, closed unmerged when that repository went private)
mutants_fortreated any line starting with a quote as code (meant forf"... OpIAdd ..."emit lines), so a docstring naming an opcode produced mutants that can never fail a test and were always reported SURVIVED:--function nminmax_f32listed 5 mutants, 4 of them in its docstring, and 47 acrossrdna2spirv.py.--linesrange that starts inside a docstring is widened to the whole string (from review on the original PR:--lines 595-595insideu16_half's docstring was mutated as code). Every one of the translator's 1,049 docstring lines now gives 0 mutants as a one-line range.Tested:
python -I tests/test_semantic_mutants.py(13 tests OK) onmain21625bca8, Linux, CPU only; no GPU needed. No game files.AI-assisted (Claude Code).
🤖 Generated with Claude Code
Ran
e3c4d0c1fon Apple M5 Pro, macOS 26.7.3 (25G342), Python 3.15.2, againstmaind42773d07:tests/test_semantic_mutants.py: 13 tests OK at this head.main'stools/semantic_mutants.pyfails 5 of 13, so the docstring handling is covered by the new cases.No GPU leg (CPU tool). AI-assisted.
Thanks — both reproduced and fixed in 4a5458b05:
"""in a comment no longer counts as a delimiter:string_contextnow follows triple quotes with a small scanner that skips comments, one-line strings and escaped delimiters, instead of counting them in raw lines.docstring_linestakes a run of string tokens that ends the statement ("OpIAdd is an example. " "Emit an instruction."). A literal the code goes on to read (("..." "...") and self.emit(...)) stays code and is still mutated.Both cases are in
test_docstring_after_a_comment_with_quotes_and_concatenated_docstring, plus the stays-code one; it fails on e3c4d0c1f and passes now.tests/test_semantic_mutants.py: 14 tests OK. #734, which builds on this branch, is rebased on it (20 tests OK).Thanks for the fix. I independently retested
4a5458b05from a full Git checkout on Windows. The new regression test covering the quote-in-comment case, the concatenated docstring, and the expression that should remain mutable passes. The fullpython -I -B tests/test_semantic_mutants.py -vrun passed all 14 tests.AI-assisted testing with synthetic inputs. No game data or GPU used.