semantic_mutants: reject zero-test baselines (MUTANTS-ZERO-TEST-BASELINE) #987

Open
github-bot wants to merge 1 commit from github-bot/gh-987 into main AGit
Owner

@⁠TheGeogeo on GitHub · 2026-11-24 16:29 UTC · original
TheGeogeo:fix/semantic-mutants-zero-test-baseline → main · +26 −11 · 2 files · 1 commits · open

Claimed in the coordination issue as: MUTANTS-ZERO-TEST-BASELINE — #14

What and why

When setUpClass skips the only test class before any test starts, unittest reports Ran 0 tests and exits successfully. semantic_mutants.py then runs the mutations against that empty baseline and reports them all as survivors. Recognize the zero-test summary as a baseline error and stop before running mutants. A synthetic CLI regression checks the exit code, diagnostic and absence of mutant results.

Tested

After a rebase on main 6293c1c4 (e8fa6b12, same patch as f2346123), on Windows 11, Python 3.12.4: tests/test_semantic_mutants.py 21 OK; test_tool_stdout_encoding.py, test_docs_cli_flags.py and test_text_write_line_endings.py OK; git diff --check and the no-game-data check clean.

  • Windows, Python 3.12.4. On main at cf4c00cb, the synthetic regression returned 1 and reported three survivors. It now returns 2 with no tests ran.
  • python -I -B tests/test_semantic_mutants.py: 21 passed.
  • python -I -B tests/test_run_semantic_tests.py: 19 passed. The nested failing fixture is intentional.
  • Combined with #863 at 1f76d4a7 in a temporary worktree: clean application, 22 mutation-tool tests and 20 semantic-runner tests passed.
  • git diff --check and python -I -B scripts/check_no_game_data.py tools/semantic_mutants.py tests/test_semantic_mutants.py: passed.

GPUs tested: n/a (CPU-only test tooling)

AI-assisted: yes (Codex).

Checklist

  • Based on current main when branched; two-file diff checked against main before publication.
  • One topic.
  • No game data, keys or decryption.
**@⁠TheGeogeo** on GitHub · 2026-11-24 16:29 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/987) `TheGeogeo:fix/semantic-mutants-zero-test-baseline` → `main` · +26 −11 · 2 files · 1 commits · open Claimed in the coordination issue as: MUTANTS-ZERO-TEST-BASELINE — https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 ### What and why When `setUpClass` skips the only test class before any test starts, `unittest` reports `Ran 0 tests` and exits successfully. `semantic_mutants.py` then runs the mutations against that empty baseline and reports them all as survivors. Recognize the zero-test summary as a baseline error and stop before running mutants. A synthetic CLI regression checks the exit code, diagnostic and absence of mutant results. ### Tested After a rebase on `main` `6293c1c4` (`e8fa6b12`, same patch as `f2346123`), on Windows 11, Python 3.12.4: `tests/test_semantic_mutants.py` 21 OK; `test_tool_stdout_encoding.py`, `test_docs_cli_flags.py` and `test_text_write_line_endings.py` OK; `git diff --check` and the no-game-data check clean. - Windows, Python 3.12.4. On `main` at `cf4c00cb`, the synthetic regression returned 1 and reported three survivors. It now returns 2 with `no tests ran`. - `python -I -B tests/test_semantic_mutants.py`: 21 passed. - `python -I -B tests/test_run_semantic_tests.py`: 19 passed. The nested failing fixture is intentional. - Combined with #863 at `1f76d4a7` in a temporary worktree: clean application, 22 mutation-tool tests and 20 semantic-runner tests passed. - `git diff --check` and `python -I -B scripts/check_no_game_data.py tools/semantic_mutants.py tests/test_semantic_mutants.py`: passed. GPUs tested: n/a (CPU-only test tooling) AI-assisted: yes (Codex). ### Checklist - [x] Based on current `main` when branched; two-file diff checked against `main` before publication. - [x] One topic. - [x] No game data, keys or decryption.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:32:04 +00:00
Author
Owner

@⁠morodirule on GitHub · 2026-11-24 16:33 UTC · original

Independent Linux check (Python 3.14.10, stdlib only, no game/GPU): full tests/test_semantic_mutants.py passes 21/21 on head f23461231. The new test_class_skipped_before_any_test_is_a_baseline_error exercises the fix — with the unmodified run_test it fails exactly as reported (exit 1, all 3 mutants SURVIVED) instead of exit 2 with "no tests ran". This also confirms my earlier finding reproduction on #14. Not claiming; review evidence.

**@⁠morodirule** on GitHub · 2026-11-24 16:33 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/987#issuecomment-7137857520) Independent Linux check (Python 3.14.10, stdlib only, no game/GPU): full tests/test_semantic_mutants.py passes 21/21 on head f23461231. The new test_class_skipped_before_any_test_is_a_baseline_error exercises the fix — with the unmodified run_test it fails exactly as reported (exit 1, all 3 mutants SURVIVED) instead of exit 2 with "no tests ran". This also confirms my earlier finding reproduction on #14. Not claiming; review evidence.
Author
Owner

@⁠fin-github on GitHub · 2026-11-24 18:00 UTC · original · reviewed

  • python -I tests/test_semantic_mutants.py on the PR: 21 tests OK (100 s).
  • The new test_class_skipped_before_any_test_is_a_baseline_error against main's tool:
    AssertionError: 1 != 2, so it catches the bug.

The regex matches the OK / OK (skipped=N) summary on 3.14. Python 3.12+ normally exits 5 with
NO TESTS RAN for zero tests, and the existing returncode == 5 branch covers that, so the two together handle both
forms. Looks good to me.

Tested on Windows 11 Pro 26200, CPython 3.14.4, MSVC from VS 18 Community, applied on main 32950551e. No GPU or game files used. AI-assisted (Claude Code).

**@⁠fin-github** on GitHub · 2026-11-24 18:00 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/987#pullrequestreview-6044650490) · **reviewed** - `python -I tests/test_semantic_mutants.py` on the PR: 21 tests OK (100 s). - The new `test_class_skipped_before_any_test_is_a_baseline_error` against `main`'s tool: `AssertionError: 1 != 2`, so it catches the bug. The regex matches the `OK` / `OK (skipped=N)` summary on 3.14. Python 3.12+ normally exits 5 with `NO TESTS RAN` for zero tests, and the existing `returncode == 5` branch covers that, so the two together handle both forms. Looks good to me. Tested on Windows 11 Pro 26200, CPython 3.14.4, MSVC from VS 18 Community, applied on main 32950551e. No GPU or game files used. AI-assisted (Claude Code).
Author
Owner

@⁠TheGeogeo on GitHub · 2026-11-24 21:22 UTC · original

Rebased on main 6293c1c4: f2346123 -> e8fa6b12, same patch (git range-diff). The previous base failed tests/test_tool_stdout_encoding.py, which #948 fixed on main, and the earlier CI run never started (action_required).

  • Windows 11, Python 3.12.4, after the rebase: tests/test_semantic_mutants.py 21 OK; test_tool_stdout_encoding.py, test_docs_cli_flags.py and test_text_write_line_endings.py OK; git diff --check and the no-game-data check clean.
  • The earlier feedback here was on f2346123.

No code change in this rebase. CI on the new head is still queued.

AI-assisted: yes (Claude Code).

**@⁠TheGeogeo** on GitHub · 2026-11-24 21:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/987#issuecomment-7144844272) Rebased on `main` `6293c1c4`: `f2346123` -> `e8fa6b12`, same patch (`git range-diff`). The previous base failed `tests/test_tool_stdout_encoding.py`, which #948 fixed on `main`, and the earlier CI run never started (action_required). - Windows 11, Python 3.12.4, after the rebase: `tests/test_semantic_mutants.py` 21 OK; `test_tool_stdout_encoding.py`, `test_docs_cli_flags.py` and `test_text_write_line_endings.py` OK; `git diff --check` and the no-game-data check clean. - The earlier feedback here was on `f2346123`. No code change in this rebase. CI on the new head is still queued. AI-assisted: yes (Claude Code).
Author
Owner

@⁠tiguan26 on GitHub · 2026-11-25 03:57 UTC · original · approved these changes

Approving. Merged into current main with no conflicts; the PR's tests pass (Linux, Python 3.13). Exit 0 with "Ran 0 tests ... OK" (a class or module fixture that skipped everything) is now treated like exit 5, so a mutant run cannot pass against a baseline that tested nothing.

AI-assisted (Claude).

**@⁠tiguan26** on GitHub · 2026-11-25 03:57 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/987#pullrequestreview-6051647189) · **approved these changes** Approving. Merged into current main with no conflicts; the PR's tests pass (Linux, Python 3.13). Exit 0 with "Ran 0 tests ... OK" (a class or module fixture that skipped everything) is now treated like exit 5, so a mutant run cannot pass against a baseline that tested nothing. AI-assisted (Claude).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/987/head:github-bot/gh-987'
git switch 'github-bot/gh-987'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-987'
git switch 'github-bot/gh-987'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-987'
git switch 'github-bot/gh-987'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-987'
git switch 'main'
git merge --squash 'github-bot/gh-987'
git switch 'main'
git merge --ff-only 'github-bot/gh-987'
git switch 'main'
git merge 'github-bot/gh-987'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.