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

Merged
leonida/mandy
icdmkg2 merged 2 commits from github-pr/3304 into main 2026-12-03 23:10:54 +00:00

Pull request successfully merged and closed

icdmkg2 commented 2026-12-03 06:52:10 +00:00

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).
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 reviewed 2026-12-03 07:03:47 +00:00
merzleckeier left a comment
No description provided.
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

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.

## 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

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).

**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

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)

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)
Member

Merge check while Forgejo Actions is off: tests/test_red_green.py passes on this PR merged with main 78ac03cb27 (head judged: 5cd4c0e34e), and the two new tests fail with main's script ('not caught' != 'does not build'), so they cover the change; check_no_game_data.py clean; a separate read-only judge (Claude Opus 5.5) accepted it. Main moved only in launcher files since, and the server's update merge gives the same tree as the judged head merged on it.

Merge check while Forgejo Actions is off: `tests/test_red_green.py` passes on this PR merged with main `78ac03cb27` (head judged: `5cd4c0e34e`), and the two new tests fail with main's script ('not caught' != 'does not build'), so they cover the change; `check_no_game_data.py` clean; a separate read-only judge (Claude Opus 5.5) accepted it. Main moved only in launcher files since, and the server's update merge gives the same tree as the judged head merged on it.
Sign in to join this conversation.
No description provided.