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

Open
merzleckeier wants to merge 3 commits from upstream-pr/3307 into main
merzleckeier commented 2026-12-03 08:00:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T08:00:25Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5622408322 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3307). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T08:00:25Z. --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T08:13:31Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7371986555 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3307#issuecomment-7371986555). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-03T08:13:31Z. --- **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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T08:39:08Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7372556500 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3307#issuecomment-7372556500). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T08:39:08Z. --- ## 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T09:18:25Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7373471030 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3307#issuecomment-7373471030). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T09:18:25Z. --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by icdmkg2 on 2026-12-03T11:47:42Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7377187550 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3307#issuecomment-7377187550). Originally posted by [icdmkg2](https://github.com/icdmkg2) on 2026-12-03T11:47:42Z. --- 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 (Migrated from github.com)

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


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)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7381810711 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3307#issuecomment-7381810711). Originally posted by [aegish-zagi](https://github.com/aegish-zagi) on 2026-12-03T14:39:24Z. --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T14:45:34Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7381983618 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3307#issuecomment-7381983618). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T14:45:34Z. --- 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).
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/3307:upstream-pr/3307'
git switch 'upstream-pr/3307'

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/3307'
git switch 'upstream-pr/3307'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3307'
git switch 'upstream-pr/3307'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3307'
git switch 'main'
git merge --squash 'upstream-pr/3307'
git switch 'main'
git merge --ff-only 'upstream-pr/3307'
git switch 'main'
git merge 'upstream-pr/3307'
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!3307
No description provided.