Report Cargo test targets that exit early in red-green #3307

Code

Clone this repository

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u origin "github-pr/3307:github-pr/3307"
git switch "github-pr/3307"
Open
leonida/mandy
merzleckeier wants to merge 3 commits from github-pr/3307 into main

This pull request has changes conflicting with the target branch.

Merge manually to resolve the conflicts.

Conversation
Reviewers 0 approvals
  • No reviewers
Details

This pull request has changes conflicting with the target branch.

Merge manually to resolve the conflicts.

  • scripts/red_green.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'github-pr/3307:github-pr/3307'
git switch 'github-pr/3307'
merzleckeier commented 2026-12-03 08:00:25 +00:00

Claimed as TEST-RED-GREEN-CARGO-TARGET-EXIT. Coordination comment

Depends on: none.

What and why

With cargo test --no-fail-fast, Cargo can finish one test target and then report that another target exited early. The checker used the successful target’s parsed results and could return red then green with exit 0 even though the second executable failed.

Record Cargo’s rerun command when a failed target exits before reporting a test summary. An incomplete red side gets red test run failed. An incomplete green side gets green fails. An interrupted target during a mutation is reported as test run failed. Ordinary assertion failures stay in the per-test results.

Tested

  • Added regression checks for interrupted red and green targets, a mutation, and diagnostic-shaped output from a normal failing test. The tests failed against main and passed with this change.
  • Real Cargo 1.97.1 with two synthetic crates reproduced exit 0 on main and exit 1 with the fix. A separate mutation fixture now reports test run failed instead of not caught.
  • python3 -I tests/test_red_green.py -q: 42 tests, one platform skip. Scratch merge with #3304: 44 tests, one platform skip.
  • git diff --check and python3 -I scripts/check_no_game_data.py docs/testing.md scripts/red_green.py tests/test_red_green.py passed.

GPUs tested: CPU-only checks on Linux. No game files were used.

AI-assisted with OpenAI Codex (GPT-6). A separate read-only Codex GPT reviewer checked the final diff and reproduced the Cargo cases independently. The reviewer’s exact runtime variant was unavailable.

Claimed as `TEST-RED-GREEN-CARGO-TARGET-EXIT`. [Coordination comment](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7371529495) Depends on: none. ### What and why With `cargo test --no-fail-fast`, Cargo can finish one test target and then report that another target exited early. The checker used the successful target’s parsed results and could return `red then green` with exit 0 even though the second executable failed. Record Cargo’s rerun command when a failed target exits before reporting a test summary. An incomplete red side gets `red test run failed`. An incomplete green side gets `green fails`. An interrupted target during a mutation is reported as `test run failed`. Ordinary assertion failures stay in the per-test results. ### Tested - Added regression checks for interrupted red and green targets, a mutation, and diagnostic-shaped output from a normal failing test. The tests failed against `main` and passed with this change. - Real Cargo 1.97.1 with two synthetic crates reproduced exit 0 on `main` and exit 1 with the fix. A separate mutation fixture now reports `test run failed` instead of `not caught`. - `python3 -I tests/test_red_green.py -q`: 42 tests, one platform skip. Scratch merge with #3304: 44 tests, one platform skip. - `git diff --check` and `python3 -I scripts/check_no_game_data.py docs/testing.md scripts/red_green.py tests/test_red_green.py` passed. GPUs tested: CPU-only checks on Linux. No game files were used. AI-assisted with OpenAI Codex (GPT-6). A separate read-only Codex GPT reviewer checked the final diff and reproduced the Cargo cases independently. The reviewer’s exact runtime variant was unavailable.
lixonik commented 2026-12-03 08:13:31 +00:00

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

Checks (Windows 10 x64, Python 3.12)

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

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

**Windows native verification (`red -> green`) -- PASS** on head `11da4b655` (merged cleanly via `git merge --no-ff` onto `main` `d9b618f10`). ### Checks (Windows 10 x64, Python 3.12) - `python -I scripts/check_no_game_data.py` -> **PASS** - **Green:** `python -I tests/test_red_green.py -v` -> **Ran 42 tests in 77.147s / OK** - **Red** (reverted `scripts/red_green.py` to `main` `d9b618f10`, keeping the PR's `tests/test_red_green.py`): **Ran 42 tests in 77.838s / FAILED (failures=3)** (exit `1`) AI-assisted: yes (Antigravity -- Gemini 4 Neon).
fiestorra commented 2026-12-03 08:39:08 +00:00

Las dos nuevas, corridas

#3306  d3d12 port 2: wrap RTL/safe copy imports & GetProcAddress    8 files, +878/−39
       cargo test -p leonida-gpu --lib  →  720 passed; 1 failed; 59 ignored

#3307  Report Cargo test targets that exit early in red-green       3 files, +106/−16
       pytest tests/test_red_green.py   →  42 passed + 10 subtests  (97 s)

En #3306 el fallo es el de siempre (views_are_made_beside…, la iGPU de esta máquina), y 720 contra los 715 de main — cinco tests más, medidos en el diff.

Y el cambio es de los que no se pueden probar sin el juego: envolver los GetProcAddress del port 2 y marcar las importaciones «al lado» — o sea, hacer que una llamada que no existe en la DLL del juego se vea como tal y no como un salto a la nada. Lo que el test cubre es el envoltorio; lo que no cubre es una DLL real sin ese símbolo.

En #3307 la proporción vuelve a ser la buena: 106 líneas, de las cuales la mayoría son test (+10 subtests sobre los 8 que tenía), en una herramienta de medición. Y es la tercera de la noche sobre red_green (con #3304 y el propio fichero), que empieza a ser el instrumento más revisado del repositorio — y con razón: es el que dice si algo está rojo.

Lo que no verifiqué en ninguna: el caso que las motiva — una DLL del juego sin el símbolo (#3306) y una suite mutada que sale antes de tiempo (#3307). Los dos necesitan un binario concreto, y los dos están simulados en los tests.

## Las dos nuevas, corridas ``` #3306 d3d12 port 2: wrap RTL/safe copy imports & GetProcAddress 8 files, +878/−39 cargo test -p leonida-gpu --lib → 720 passed; 1 failed; 59 ignored #3307 Report Cargo test targets that exit early in red-green 3 files, +106/−16 pytest tests/test_red_green.py → 42 passed + 10 subtests (97 s) ``` **En `#3306` el fallo es el de siempre** (**`views_are_made_beside…`, la iGPU de esta máquina**), **y `720` contra los `715` de `main`** — **cinco tests más, medidos en el diff.** **Y el cambio es de los que no se pueden probar sin el juego**: **envolver los `GetProcAddress` del *port* 2 y marcar las importaciones «al lado»** — **o sea, hacer que una llamada que no existe en la DLL del juego se vea como tal y no como un salto a la nada.** **Lo que el test cubre es el envoltorio; lo que no cubre es una DLL real sin ese símbolo.** **En `#3307` la proporción vuelve a ser la buena**: **106 líneas, de las cuales la mayoría son test** (**+10 subtests** sobre los 8 que tenía), **en una herramienta de medición.** **Y es la tercera de la noche sobre `red_green`** (**con `#3304` y el propio fichero**), **que empieza a ser el instrumento más revisado del repositorio** — **y con razón: es el que dice si algo está rojo.** **Lo que no verifiqué en ninguna**: **el caso que las motiva** — **una DLL del juego sin el símbolo** (`#3306`) **y una suite mutada que sale antes de tiempo** (`#3307`). **Los dos necesitan un binario concreto, y los dos están simulados en los tests.**
merzleckeier commented 2026-12-03 09:18:25 +00:00

Found a remaining false green on 11da4b65 with real Cargo 1.97.1 and a synthetic Rust crate. The green target starts a child libtest that prints a successful summary, then the enclosing target exits before its own summary. Cargo exits 101 and reports a target failure. red_green.py still exits 0 with red then green and an empty green.test_run_errors list. I reproduced this with enclosing test exit statuses 2 and 101.

The child summary sets target_finished before Cargo reports the enclosing failure. Using Cargo’s process-exit diagnostic is enough for the status-2 case here. Cargo omits that detail for the status-101 case. A local control that tracks the nested libtest starts and summaries reports green fails for both. Its existing checker suite ran 42 tests with 41 passing and one platform skip. The control was exercised locally. AI-assisted with OpenAI Codex.

Found a remaining false green on `11da4b65` with real Cargo 1.97.1 and a synthetic Rust crate. The green target starts a child libtest that prints a successful summary, then the enclosing target exits before its own summary. Cargo exits 101 and reports a target failure. `red_green.py` still exits 0 with `red then green` and an empty `green.test_run_errors` list. I reproduced this with enclosing test exit statuses 2 and 101. The child summary sets `target_finished` before Cargo reports the enclosing failure. Using Cargo’s process-exit diagnostic is enough for the status-2 case here. Cargo omits that detail for the status-101 case. A local control that tracks the nested libtest starts and summaries reports `green fails` for both. Its existing checker suite ran 42 tests with 41 passing and one platform skip. The control was exercised locally. AI-assisted with OpenAI Codex.
icdmkg2 commented 2026-12-03 11:47:42 +00:00

Verified natively on Windows 11 (Python 3.12, no game files): \python -I scripts/red_green.py 3307 --no-cargo\ against \origin/main\ (\053a1813, head \11da4b655) — *\ erdict: red then green* (1 red→green: \Mutation.test_a_mutation_that_interrupts_another_test_target_reports_it, 1 green-only \ok: \Sides.test_a_cargo_target_that_exits_early_cancels_the_sides_verdict, 40 pass on both). AI-assisted: Gemini 4 Neon (Antigravity).

Verified natively on Windows 11 (Python 3.12, no game files): \python -I scripts/red_green.py 3307 --no-cargo\ against \origin/main\ (\053a1813\, head \11da4b655\) — **\ erdict: red then green\** (1 red→green: \Mutation.test_a_mutation_that_interrupts_another_test_target_reports_it\, 1 green-only \ok\: \Sides.test_a_cargo_target_that_exits_early_cancels_the_sides_verdict\, 40 pass on both). AI-assisted: Gemini 4 Neon (Antigravity).
aegish-zagi commented 2026-12-03 14:39:24 +00:00

VERIFY-3307 — PASS

  • PR: #3307 | head 11da4b65 | merge with current main 128579e9e: clean (ort merge, no conflicts)
  • Tests run: python3 -I tests/test_red_green.py
  • Red on main: FAILED (failures=3, skipped=3) — the PR's new 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 only (plus its tests and docs/testing.md). The parser now tracks a per-target error: test failed, to rerun pass … line and keeps it only when that target never prints a test result: summary, clearing all such errors when Cargo exits 0 — so a target that exits early is reported instead of silently dropped, without misreporting ordinary failed tests. No game data, stdlib only.
  • Platform: Linux, Python 3.12.3, Profile Z (no GPU)

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

VERIFY-3307 — PASS - PR: #3307 | head `11da4b65` | merge with current main `128579e9e`: clean (ort merge, no conflicts) - Tests run: `python3 -I tests/test_red_green.py` - Red on main: FAILED (failures=3, skipped=3) — the PR's new 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` only (plus its tests and `docs/testing.md`). The parser now tracks a per-target `error: test failed, to rerun pass …` line and keeps it only when that target never prints a `test result:` summary, clearing all such errors when Cargo exits 0 — so a target that exits early is reported instead of silently dropped, without misreporting ordinary failed tests. No game data, stdlib only. - Platform: Linux, Python 3.12.3, Profile Z (no GPU) AI-assisted: yes (Muse Wonder, Muse by Meta)
merzleckeier commented 2026-12-03 14:45:34 +00:00

I checked #3224 22e03b5e, #3304 4a848b05, and #3307 11da4b65 together on 128579e9. Merging the three heads in forward and reverse order was conflict-free and produced the identical tree a0046cad. The combined tests/test_red_green.py run under Python 3.14.10 had 44 passes and one Windows-only skip.

One additional mixed run used real Cargo 1.98.1 with synthetic crates plus Python unittest fixtures. The report retained the passing Rust and Python tests, marked the Python parent method failed after a subtest failure, recorded the other Python file as unable to import, and reported the separate Cargo target that exited early. This checks how the three changes compose. AI-assisted (Codex).

I checked #3224 `22e03b5e`, #3304 `4a848b05`, and #3307 `11da4b65` together on `128579e9`. Merging the three heads in forward and reverse order was conflict-free and produced the identical tree `a0046cad`. The combined `tests/test_red_green.py` run under Python 3.14.10 had 44 passes and one Windows-only skip. One additional mixed run used real Cargo 1.98.1 with synthetic crates plus Python unittest fixtures. The report retained the passing Rust and Python tests, marked the Python parent method failed after a subtest failure, recorded the other Python file as unable to import, and reported the separate Cargo target that exited early. This checks how the three changes compose. AI-assisted (Codex).
Member

Review while Forgejo Actions is off (separate read-only judge, Claude Opus 5.5): not mergeable as is. It now conflicts with main in scripts/red_green.py (cargo_once), because #3367 changed that block: --message-format=json-render-diagnostics, named groups in UNIT (m["exe"], m["unit"], m["doc"]) and cargo_integration_targets. Please rebase on main, keep the named groups, and check that the error: test failed, to rerun pass line still reaches the parser with the JSON message format. The test_run_errors logic and its place in mutate() look right and compose with #3304 (merged).

Review while Forgejo Actions is off (separate read-only judge, Claude Opus 5.5): not mergeable as is. It now conflicts with main in `scripts/red_green.py` (`cargo_once`), because #3367 changed that block: `--message-format=json-render-diagnostics`, named groups in `UNIT` (`m["exe"]`, `m["unit"]`, `m["doc"]`) and `cargo_integration_targets`. Please rebase on main, keep the named groups, and check that the `error: test failed, to rerun pass` line still reaches the parser with the JSON message format. The `test_run_errors` logic and its place in `mutate()` look right and compose with #3304 (merged).
Sign in to join this conversation.
No description provided.