red_green: report does not build when any mutated suite fails to build (TEST-RED-GREEN-MUTATE-NO-BUILD) #3304

Open
icdmkg2 wants to merge 1 commit from upstream-pr/3304 into main
icdmkg2 commented 2026-12-03 06:52:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by icdmkg2 on 2026-12-03T06:52:10Z.


Claimed in the coordination issue as: TEST-RED-GREEN-MUTATE-NO-BUILD

What and why

In scripts/red_green.py (mutate()), undoing a code hunk previously classified the mutated run as does not build only when not any(t in s["tests"] for t in targets).

When a pull request has red-to-green target tests across multiple suites (for example, Rust cargo tests plus a Python unittest file, as observed while verifying #3206, or two Python test files):

  • Undoing a hunk that breaks compilation or import of one suite leaves s["no_build"] non-empty and omits that suite's target test(s) from s["tests"].
  • Because the other suite's target test(s) still ran and passed, any(t in s["tests"] for t in targets) evaluated to True, misreporting the broken build as not caught.

This changes the check in mutate() to:

elif s["no_build"] or not all(t in s["tests"] for t in targets):
    entry["result"] = "does not build"
  • s["no_build"] catches a broken suite (cargo build error or Python import/syntax error) even when other suites still run and pass.
  • not all(t in s["tests"] for t in targets) also catches partial build failures within a multi-binary cargo test --no-fail-fast run where one binary ran tests (leaving s["no_build"] empty) while another binary containing a target failed to compile.

The existing precedence is preserved: compiler crashed, caught (any target test failed), timed out building, and caught by timeout are still checked first.

Tested

  • Red on origin/main (a51cda3aa): Both new regression tests (Mutation.test_a_broken_suite_in_a_mixed_run_is_does_not_build_not_not_caught and Mutation.test_a_python_import_failure_with_another_passing_suite_is_does_not_build) fail on main with AssertionError: 'not caught' != 'does not build'.
  • Green with fix:
    • python -I tests/test_red_green.py -v — 42 passed, 0 failed.
    • python -I scripts/red_green.py fix/red-green-mutate-no-build --base origin/main --no-fetch --no-cargo --mutate — verdict: red then green (2 red→green, 40 pass on both, 1/1 hunk caught at scripts/red_green.py:812).
    • python -I tests/test_text_write_line_endings.py — 3 passed, 0 failed.
    • python -m compileall -q scripts/red_green.py tests/test_red_green.py — exit 0.
    • python -I scripts/check_no_game_data.py scripts/red_green.py tests/test_red_green.py — exit 0.
  • Independent review: separate read-only reviewer subagent (Gemini 4 Neon) — APPROVE (no blocking findings or nits).

GPUs tested: n/a (standard-library Python test runner; synthetic throwaway git repos with stub cargo, no game files or GPU needed).

AI-assisted: yes — Gemini 4 Neon via Antigravity (implementation, tests, and a separate read-only reviewer subagent using Gemini 4 Neon).

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed (n/a: no translator rule changed).
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5621533383 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3304). Originally posted by [icdmkg2](https://github.com/icdmkg2) on 2026-12-03T06:52:10Z. --- Claimed in the coordination issue as: [`TEST-RED-GREEN-MUTATE-NO-BUILD`](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7358779964) ### What and why In `scripts/red_green.py` (`mutate()`), undoing a code hunk previously classified the mutated run as `does not build` only when `not any(t in s["tests"] for t in targets)`. When a pull request has red-to-green target tests across multiple suites (for example, Rust `cargo` tests plus a Python `unittest` file, as observed while verifying #3206, or two Python test files): - Undoing a hunk that breaks compilation or import of one suite leaves `s["no_build"]` non-empty and omits that suite's target test(s) from `s["tests"]`. - Because the other suite's target test(s) still ran and passed, `any(t in s["tests"] for t in targets)` evaluated to `True`, misreporting the broken build as `not caught`. This changes the check in `mutate()` to: ```python elif s["no_build"] or not all(t in s["tests"] for t in targets): entry["result"] = "does not build" ``` - `s["no_build"]` catches a broken suite (cargo build error or Python import/syntax error) even when other suites still run and pass. - `not all(t in s["tests"] for t in targets)` also catches partial build failures within a multi-binary `cargo test --no-fail-fast` run where one binary ran tests (leaving `s["no_build"]` empty) while another binary containing a target failed to compile. The existing precedence is preserved: `compiler crashed`, `caught` (any target test failed), `timed out building`, and `caught by timeout` are still checked first. ### Tested - **Red on `origin/main` (`a51cda3aa`):** Both new regression tests (`Mutation.test_a_broken_suite_in_a_mixed_run_is_does_not_build_not_not_caught` and `Mutation.test_a_python_import_failure_with_another_passing_suite_is_does_not_build`) fail on `main` with `AssertionError: 'not caught' != 'does not build'`. - **Green with fix:** - `python -I tests/test_red_green.py -v` — `42` passed, `0` failed. - `python -I scripts/red_green.py fix/red-green-mutate-no-build --base origin/main --no-fetch --no-cargo --mutate` — `verdict: red then green` (`2` red→green, `40` pass on both, `1/1` hunk caught at `scripts/red_green.py:812`). - `python -I tests/test_text_write_line_endings.py` — `3` passed, `0` failed. - `python -m compileall -q scripts/red_green.py tests/test_red_green.py` — exit `0`. - `python -I scripts/check_no_game_data.py scripts/red_green.py tests/test_red_green.py` — exit `0`. - **Independent review:** separate read-only reviewer subagent (Gemini 4 Neon) — `APPROVE` (no blocking findings or nits). GPUs tested: n/a (standard-library Python test runner; synthetic throwaway git repos with stub cargo, no game files or GPU needed). AI-assisted: yes — Gemini 4 Neon via Antigravity (implementation, tests, and a separate read-only reviewer subagent using Gemini 4 Neon). ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed (n/a: no translator rule changed).
merzleckeier commented 2026-12-03 07:03:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T07:03:47Z.

Review: COMMENTED


Reviewed 4a848b05 on d9b618f1. Both new tests fail as expected when pointed at main's checker, and both pass with this head.

I also used a real Cargo build and a Python test in a disposable repository. Both targets go red then green. When one independent Rust hunk is undone, a compile-time assertion fails while the Python target still passes. Main reports that mutation as not caught. This head reports does not build. Undoing either of the other two hunks still reports caught on both checkers.

The full heads of #3203, #3224, #3227, #3245 and #3251 merge with this head on current main. The combined checker suite passed 46 tests with one skip under Linux and PowerShell 7.7.0. No actionable findings in this diff. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6165101308 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3304#pullrequestreview-6165101308). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T07:03:47Z. **Review:** COMMENTED --- Reviewed `4a848b05` on `d9b618f1`. Both new tests fail as expected when pointed at main's checker, and both pass with this head. I also used a real Cargo build and a Python test in a disposable repository. Both targets go red then green. When one independent Rust hunk is undone, a compile-time assertion fails while the Python target still passes. Main reports that mutation as `not caught`. This head reports `does not build`. Undoing either of the other two hunks still reports `caught` on both checkers. The full heads of #3203, #3224, #3227, #3245 and #3251 merge with this head on current main. The combined checker suite passed 46 tests with one skip under Linux and PowerShell 7.7.0. No actionable findings in this diff. AI-assisted with OpenAI Codex.
fiestorra commented 2026-12-03 07:06:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T07:06:24Z.


VERIFY-3304 — 42 tests en verde (86 s), y una línea de producción con 52 de test

scripts/red_green.py       +1/−1
tests/test_red_green.py   +52
pytest                    42 passed + 8 subtests   (86 s)

El título describe el fallo exacto: «report does not build when any mutated suite fails to build» — el informe se construía igual cuando una suite mutada no compilaba, o sea un informe que miente sobre lo que midió.

Y la proporción es la correcta para una herramienta de medición: una línea de cambio, 52 de prueba. Una herramienta que mide otras herramientas tiene que ser la más probada del repositorio, porque un error suyo se propaga a todas las conclusiones que se saquen con ella — y esta noche he usado gpu-test-results/ y red_green como referencia varias veces sin comprobarlos.

Lo que verifiqué: los 42 tests y 8 subtests en 86 segundos.
Lo que no: la herramienta contra una suite que no compila de verdad — que es lo que el test simula, y con 52 líneas probablemente bien; lo que no puedo decir es si el caso existe en un repositorio real o sólo en el fixture.

Y una nota: 86 segundos para 42 tests es el segundo más lento de la noche después de test_docs_cli_flags (34 s para 4), y en los dos casos es porque arrancan procesos. Vale la pena saberlo antes de meterlos en un bucle.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7370600240 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3304#issuecomment-7370600240). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T07:06:24Z. --- ## VERIFY-3304 — 42 tests en verde (86 s), y una línea de producción con 52 de test ``` scripts/red_green.py +1/−1 tests/test_red_green.py +52 pytest 42 passed + 8 subtests (86 s) ``` **El título describe el fallo exacto**: **«report does not build when any mutated suite fails to build»** — **el informe se construía igual cuando una suite mutada no compilaba**, **o sea un informe que miente sobre lo que midió.** **Y la proporción es la correcta para una herramienta de medición**: **una línea de cambio, 52 de prueba.** **Una herramienta que mide otras herramientas tiene que ser la más probada del repositorio, porque un error suyo se propaga a todas las conclusiones que se saquen con ella** — **y esta noche he usado `gpu-test-results/` y `red_green` como referencia varias veces sin comprobarlos.** **Lo que verifiqué**: **los 42 tests y 8 subtests en 86 segundos.** **Lo que no**: **la herramienta contra una suite que no compila de verdad** — **que es lo que el test simula, y con 52 líneas probablemente bien; lo que no puedo decir es si el caso existe en un repositorio real o sólo en el fixture.** **Y una nota**: **86 segundos para 42 tests es el segundo más lento de la noche después de `test_docs_cli_flags`** (**34 s para 4**), **y en los dos casos es porque arrancan procesos.** **Vale la pena saberlo antes de meterlos en un bucle.**
lixonik commented 2026-12-03 07:43:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T07:43:53Z.


Windows native verification (red -> green) -- PASS on head 4a848b055 (merged cleanly via git merge --no-ff onto main d9b618f10).

Checks (Windows 10 x64, Python 3.12, PowerShell 5.1)

  • python -I scripts/check_no_game_data.py -> PASS
  • Green: python -I tests/test_red_green.py -v -> Ran 42 tests in 78.336s / OK
  • Red (reverted scripts/red_green.py to main d9b618f10, keeping the PR's tests/test_red_green.py): Ran 42 tests in 78.301s / FAILED (failures=2) (exit 1)

AI-assisted: yes (Antigravity -- Gemini 4 Neon).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7371356343 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3304#issuecomment-7371356343). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-03T07:43:53Z. --- **Windows native verification (`red -> green`) -- PASS** on head `4a848b055` (merged cleanly via `git merge --no-ff` onto `main` `d9b618f10`). ### Checks (Windows 10 x64, Python 3.12, PowerShell 5.1) - `python -I scripts/check_no_game_data.py` -> **PASS** - **Green:** `python -I tests/test_red_green.py -v` -> **Ran 42 tests in 78.336s / OK** - **Red** (reverted `scripts/red_green.py` to `main` `d9b618f10`, keeping the PR's `tests/test_red_green.py`): **Ran 42 tests in 78.301s / FAILED (failures=2)** (exit `1`) AI-assisted: yes (Antigravity -- Gemini 4 Neon).
aegish-zagi commented 2026-12-03 14:40:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aegish-zagi on 2026-12-03T14:40:04Z.


VERIFY-3304 — PASS

  • PR: #3304 | head 4a848b05 | merge with current main 128579e9e: clean (ort merge, no conflicts)
  • Tests run: python3 -I tests/test_red_green.py
  • Red on main: FAILED (failures=2, skipped=3) — the PR's new does-not-build cases fail against main's scripts/red_green.py
  • Green on PR (merged tree): OK — 42 tests (skipped=3)
  • Diff audit: scripts/red_green.py plus its tests. A mutated suite that fails to build is now reported as does-not-build instead of passing silently. No game data, stdlib only.
  • Platform: Linux, Python 3.12.3, Profile Z (no GPU)

AI-assisted: yes (Muse Wonder, Muse by Meta)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7381829095 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3304#issuecomment-7381829095). Originally posted by [aegish-zagi](https://github.com/aegish-zagi) on 2026-12-03T14:40:04Z. --- VERIFY-3304 — PASS - PR: #3304 | head `4a848b05` | merge with current main `128579e9e`: clean (ort merge, no conflicts) - Tests run: `python3 -I tests/test_red_green.py` - Red on main: FAILED (failures=2, skipped=3) — the PR's new does-not-build cases fail against main's `scripts/red_green.py` - Green on PR (merged tree): OK — 42 tests (skipped=3) - Diff audit: `scripts/red_green.py` plus its tests. A mutated suite that fails to build is now reported as does-not-build instead of passing silently. No game data, stdlib only. - Platform: Linux, Python 3.12.3, Profile Z (no GPU) AI-assisted: yes (Muse Wonder, Muse by Meta)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3304:upstream-pr/3304'
git switch 'upstream-pr/3304'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3304'
git switch 'upstream-pr/3304'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3304'
git switch 'upstream-pr/3304'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3304'
git switch 'main'
git merge --squash 'upstream-pr/3304'
git switch 'main'
git merge --ff-only 'upstream-pr/3304'
git switch 'main'
git merge 'upstream-pr/3304'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!3304
No description provided.