[PR #660] [MERGED] semantic_mutants: leave docstrings alone, so their op names are not reported as surviving mutants (OLD-9432) #701

Closed
opened 2026-11-26 20:18:46 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/660
Author: @qhukz13
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: cont/semantic-mutants-docstrings


📝 Commits (3)

  • a8a0990 semantic_mutants: leave docstrings alone, so their op names are not reported as surviving mutants
  • dc29310 semantic_mutants: a --lines range that starts inside a docstring is widened to the whole string
  • ea10ffd semantic_mutants: a """ in a comment and adjacent string literals no longer hide or split a docstring

📊 Changes

2 files changed (+138 additions, -0 deletions)

View changed files

📝 tests/test_semantic_mutants.py (+58 -0)
📝 tools/semantic_mutants.py (+80 -0)

📄 Description

Claimed in the coordination issue as: OLD-9432 (restoration of ItsNotRexed/Leonida#9432, closed unmerged when that repository went private)

mutants_for treated any line starting with a quote as code (meant for f"... OpIAdd ..." emit lines), so a docstring naming an opcode produced mutants that can never fail a test and were always reported SURVIVED: --function nminmax_f32 listed 5 mutants, 4 of them in its docstring, and 47 across rdna2spirv.py.

  • Tokenize the mutated range and skip strings that stand alone as a statement; a range that does not tokenize keeps the old behaviour.
  • A --lines range that starts inside a docstring is widened to the whole string (from review on the original PR: --lines 595-595 inside u16_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) on main 21625bca8, Linux, CPU only; no GPU needed. No game files.

AI-assisted (Claude Code).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/660 **Author:** [@qhukz13](https://github.com/qhukz13) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `cont/semantic-mutants-docstrings` --- ### 📝 Commits (3) - [`a8a0990`](https://github.com/ubiquitarianism/leonida/commit/a8a09903b4662717b9d81fe32ee8225310dcca6c) semantic_mutants: leave docstrings alone, so their op names are not reported as surviving mutants - [`dc29310`](https://github.com/ubiquitarianism/leonida/commit/dc2931044b0cf89bccab7c149b0fcda99cb4cc99) semantic_mutants: a --lines range that starts inside a docstring is widened to the whole string - [`ea10ffd`](https://github.com/ubiquitarianism/leonida/commit/ea10ffd572c9af0298a98f6427209e2bde402b7c) semantic_mutants: a """ in a comment and adjacent string literals no longer hide or split a docstring ### 📊 Changes **2 files changed** (+138 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_semantic_mutants.py` (+58 -0) 📝 `tools/semantic_mutants.py` (+80 -0) </details> ### 📄 Description Claimed in the coordination issue as: OLD-9432 (restoration of ItsNotRexed/Leonida#9432, closed unmerged when that repository went private) `mutants_for` treated any line starting with a quote as code (meant for `f"... OpIAdd ..."` emit lines), so a docstring naming an opcode produced mutants that can never fail a test and were always reported SURVIVED: `--function nminmax_f32` listed 5 mutants, 4 of them in its docstring, and 47 across `rdna2spirv.py`. - Tokenize the mutated range and skip strings that stand alone as a statement; a range that does not tokenize keeps the old behaviour. - A `--lines` range that starts inside a docstring is widened to the whole string (from review on the original PR: `--lines 595-595` inside `u16_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) on `main` 21625bca8, Linux, CPU only; no GPU needed. No game files. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:46 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#701
No description provided.