tests: run_game_wine.sh's runs get a timeout above the script's own watchdog (PY-TEST-WINE-RUN-TIMEOUT) #3241

Merged
LouisRiverstone merged 2 commits from upstream-pr/3241 into main 2026-12-03 15:49:54 +00:00
LouisRiverstone commented 2026-12-02 22:04:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-12-02T22:04:02Z.


Claim: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7360132896 (PY-TEST-WINE-RUN-TIMEOUT), following Neutron-0's finding on tests/test_run_game_wine.py:94.

Why

run_script gave every run of scripts/run_game_wine.sh timeout=120. The script's own watchdog (sleep $((LIMIT + 180)), run_game_wine.sh:318) ends a run 180 s after --seconds, and --seconds defaults to LIMIT=600 (:115). That is 210 s for the --seconds 30 runs and 780 s for the rest. A broken run therefore failed with the test's own TimeoutExpired before the script's error path could report it. This is the same class of defect Neutron-0 claimed for tests/test_run_game_wine_safety.py (PY-TEST-WINE-SAFETY-TIMEOUT), here in the other file.

What changed

tests/test_run_game_wine.py only:

  • run_timeout(args) reads the script's default LIMIT= and its watchdog margin from the script text, takes the last --seconds given before -- (as the script's parser does), and adds 60 s for teardown and the summary. If either line can't be found, it fails with a clear assertion.
  • run_script uses it instead of 120.
  • test_a_runs_timeout_stands_above_the_scripts_own_watchdog covers an explicit --seconds, the default, a non-numeric value and the game's own arguments after --.

With stubs every run still finishes in about a second. The longer timeout only matters when a run really hangs.

Verification (WSL Ubuntu, Python 3.14; this class skips on Windows; no game files, Wine or GPU needed)

  • python3 -I tests/test_run_game_wine.py: 17 tests OK.
  • Red: with run_timeout pinned to the old 120, the new test fails. Green with the change.
  • python -I scripts/check_no_game_data.py tests/test_run_game_wine.py: exit 0. The file stays LF.

AI assistance

AI-assisted: written with Claude Code (Claude Opus 5.5). It was reviewed by a separate read-only reviewer agent (Claude Opus 5.5), which checked that the regexes match the intended lines, that no other wait in the script outlasts the watchdog, the teardown room and the test's coverage. It found nothing blocking; I applied its two small suggestions (a clear assertion, and taking the last --seconds).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5615511804 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3241). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-12-02T22:04:02Z. --- Claim: https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7360132896 (PY-TEST-WINE-RUN-TIMEOUT), following Neutron-0's finding on `tests/test_run_game_wine.py:94`. ## Why `run_script` gave every run of `scripts/run_game_wine.sh` `timeout=120`. The script's own watchdog (`sleep $((LIMIT + 180))`, `run_game_wine.sh:318`) ends a run 180 s after `--seconds`, and `--seconds` defaults to `LIMIT=600` (`:115`). That is 210 s for the `--seconds 30` runs and 780 s for the rest. A broken run therefore failed with the test's own `TimeoutExpired` before the script's error path could report it. This is the same class of defect Neutron-0 claimed for `tests/test_run_game_wine_safety.py` (PY-TEST-WINE-SAFETY-TIMEOUT), here in the other file. ## What changed `tests/test_run_game_wine.py` only: - `run_timeout(args)` reads the script's default `LIMIT=` and its watchdog margin from the script text, takes the last `--seconds` given before `--` (as the script's parser does), and adds 60 s for teardown and the summary. If either line can't be found, it fails with a clear assertion. - `run_script` uses it instead of 120. - `test_a_runs_timeout_stands_above_the_scripts_own_watchdog` covers an explicit `--seconds`, the default, a non-numeric value and the game's own arguments after `--`. With stubs every run still finishes in about a second. The longer timeout only matters when a run really hangs. ## Verification (WSL Ubuntu, Python 3.14; this class skips on Windows; no game files, Wine or GPU needed) - `python3 -I tests/test_run_game_wine.py`: 17 tests OK. - Red: with `run_timeout` pinned to the old 120, the new test fails. Green with the change. - `python -I scripts/check_no_game_data.py tests/test_run_game_wine.py`: exit 0. The file stays LF. ## AI assistance AI-assisted: written with Claude Code (Claude Opus 5.5). It was reviewed by a separate read-only reviewer agent (Claude Opus 5.5), which checked that the regexes match the intended lines, that no other wait in the script outlasts the watchdog, the teardown room and the test's coverage. It found nothing blocking; I applied its two small suggestions (a clear assertion, and taking the last `--seconds`). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
merzleckeier commented 2026-12-02 22:19:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T22:19:27Z.

Review: COMMENTED


Reviewed 8bc989c12 and ran all 17 launcher tests in a Linux sandbox with the existing stubs. One coverage gap in tests/test_run_game_wine.py:114–122: the new test checks run_timeout directly, so it misses the old timeout if run_script stops using the helper. I changed only line 114 back to timeout=120, kept the helper and the new test intact, and all 17 tests still passed. Could the regression test also call run_script with subprocess.run mocked and check the timeout it actually receives? That catches the old wiring without waiting for a real timeout.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6160042384 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3241#pullrequestreview-6160042384). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T22:19:27Z. **Review:** COMMENTED --- Reviewed `8bc989c12` and ran all 17 launcher tests in a Linux sandbox with the existing stubs. One coverage gap in `tests/test_run_game_wine.py:114–122`: the new test checks `run_timeout` directly, so it misses the old timeout if `run_script` stops using the helper. I changed only line 114 back to `timeout=120`, kept the helper and the new test intact, and all 17 tests still passed. Could the regression test also call `run_script` with `subprocess.run` mocked and check the `timeout` it actually receives? That catches the old wiring without waiting for a real timeout.
LouisRiverstone commented 2026-12-02 22:23:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-12-02T22:23:57Z.


@merzleckeier done in 4b91d82b4. The check now also mocks subprocess.run and asserts the timeout that run_script really passes, for an explicit --seconds 30 and for the default. With your mutation (run_script back to timeout=120), it fails with 120 != 270; with the fix, all 17 tests pass (WSL Ubuntu). I also rewrote the branch's commits without a co-author trailer, which changed the SHAs. The tree is otherwise unchanged.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360637821 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3241#issuecomment-7360637821). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-12-02T22:23:57Z. --- @merzleckeier done in `4b91d82b4`. The check now also mocks `subprocess.run` and asserts the `timeout` that `run_script` really passes, for an explicit `--seconds 30` and for the default. With your mutation (`run_script` back to `timeout=120`), it fails with `120 != 270`; with the fix, all 17 tests pass (WSL Ubuntu). I also rewrote the branch's commits without a co-author trailer, which changed the SHAs. The tree is otherwise unchanged.
merzleckeier commented 2026-12-02 22:25:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T22:25:49Z.


Re-tested 4b91d82b4 in the same Linux sandbox. All 17 tests pass. With only run_script changed back to timeout=120, the suite now fails on the new assertion (120 != 270) and the other 16 tests still pass. This resolves my review finding.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360681165 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3241#issuecomment-7360681165). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T22:25:49Z. --- Re-tested `4b91d82b4` in the same Linux sandbox. All 17 tests pass. With only `run_script` changed back to `timeout=120`, the suite now fails on the new assertion (`120 != 270`) and the other 16 tests still pass. This resolves my review finding.
fiestorra commented 2026-12-02 22:48:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T22:48:05Z.


VERIFY-3241 — no verificable en esta máquina, y lo digo antes de nada

Own commit 4b91d82b4 — tests/test_run_game_wine.py (+6)
Ran python -I tests/test_run_game_wine.py
Ran 17 tests in 0.000s — OK (skipped=17)

All seventeen skip on Windows: the file is POSIX only (bash -n, stub wine/wineserver/setsid, a KWin-less path) and its own header says so. So nothing about this change is verified here — not the new assertion, not the file it guards. On a Windows runner this pull request reads green because nothing ran, which is worth knowing before someone treats that as evidence.

What it changes, from the diff: the timeout the script computes (run_timeout(args)) must be the one subprocess.run is actually given — the new test patches subprocess.run and checks run.call_args.kwargs["timeout"] == run_timeout(args) for --visible --seconds 30 and --visible. The point is a run_script that went back to a fixed bound would pass the earlier checks and fail this one — a good shape of test, on a host that can run it.

What would verify it: a POSIX host with bash (the test needs nothing else). I do not have one here; git bash on Windows is not what this file's stubs expect.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7361178000 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3241#issuecomment-7361178000). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T22:48:05Z. --- ## VERIFY-3241 — **no verificable en esta máquina**, y lo digo antes de nada | | | |---|---| | Own commit | `4b91d82b4` — `tests/test_run_game_wine.py` (+6) | | Ran | `python -I tests/test_run_game_wine.py` | ``` Ran 17 tests in 0.000s — OK (skipped=17) ``` **All seventeen skip on Windows**: the file is POSIX only (`bash -n`, stub `wine`/`wineserver`/`setsid`, a KWin-less path) and its own header says so. **So nothing about this change is verified here** — not the new assertion, not the file it guards. **On a Windows runner this pull request reads green because nothing ran**, which is worth knowing before someone treats that as evidence. **What it changes, from the diff**: the timeout the script computes (`run_timeout(args)`) must be the one `subprocess.run` is **actually given** — the new test patches `subprocess.run` and checks `run.call_args.kwargs["timeout"] == run_timeout(args)` for `--visible --seconds 30` and `--visible`. **The point is a `run_script` that went back to a fixed bound would pass the earlier checks and fail this one** — a good shape of test, on a host that can run it. **What would verify it**: a POSIX host with `bash` (the test needs nothing else). I do not have one here; `git bash` on Windows is not what this file's stubs expect. Written with an AI assistant.
LouisRiverstone commented 2026-12-03 02:11:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by LouisRiverstone on 2026-12-03T02:11:14Z.


@fiestorra right: this suite is POSIX-only and skips on Windows. I ran it on WSL Ubuntu (Python 3.14): 17 OK with the change, and the new check fails without it. merzleckeier also re-ran it in a Linux sandbox. The CI linux-python-and-viewer job runs it too, and it is green here.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7365180682 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3241#issuecomment-7365180682). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-12-03T02:11:14Z. --- @fiestorra right: this suite is POSIX-only and skips on Windows. I ran it on WSL Ubuntu (Python 3.14): 17 OK with the change, and the new check fails without it. merzleckeier also re-ran it in a Linux sandbox. The CI `linux-python-and-viewer` job runs it too, and it is green here.
fiestorra commented 2026-12-03 07:51:31 +00:00 (Migrated from github.com)

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


Lo que queda de esta PR son sus tests: el código ya está en main

Aplicada sobre main de hoy (d9b618f10) con el cherry-pick del rango, el diff resultante no toca nada fuera de tests/:

git cherry-pick del rango sobre origin/main
git diff --name-only origin/main..HEAD
  tests/test_run_game_wine.py

O sea que el cambio de producción entró por otra vía (otra PR, o el mismo cambio dentro de un merge más grande), y lo que esta PR aporta desde hoy son las pruebas de algo que ya está en main.

Lo que eso significa, en las dos direcciones:

  • se puede fusionar sin revisar código nuevo — es el merge más barato de la cola;
  • y es fácil que se pierda, porque nadie va a notar que falta hasta que alguien toque ese código y no haya test que lo defienda.

Lo que verifiqué: que el diff sobre main es sólo de tests (con el rango, no con el tip: las PRs de varios commits aplican mal por partes).
Lo que no: que los tests pasen sobre main — eso lo compruebo en el lote siguiente y lo dejo escrito aquí si algo falla.

Si el autor prefiere cerrarla para no acumular, las pruebas siguen teniendo valor: se pueden mover a la PR que trajo el código, o a una propia más pequeña.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7371515054 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3241#issuecomment-7371515054). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T07:51:31Z. --- ## Lo que queda de esta PR son **sus tests**: el código ya está en `main` **Aplicada sobre `main` de hoy (`d9b618f10`) con el *cherry-pick* del rango, el diff resultante no toca nada fuera de `tests/`**: ``` git cherry-pick del rango sobre origin/main git diff --name-only origin/main..HEAD tests/test_run_game_wine.py ``` **O sea que el cambio de producción entró por otra vía** (**otra PR, o el mismo cambio dentro de un merge más grande**), **y lo que esta PR aporta desde hoy son las pruebas de algo que ya está en `main`.** **Lo que eso significa, en las dos direcciones**: - **se puede fusionar sin revisar código nuevo** — **es el merge más barato de la cola**; - **y es fácil que se pierda**, **porque nadie va a notar que falta** hasta que alguien toque ese código y no haya test que lo defienda. **Lo que verifiqué**: **que el diff sobre `main` es sólo de tests** (**con el rango, no con el tip: las PRs de varios commits aplican mal por partes**). **Lo que no**: **que los tests pasen sobre `main`** — **eso lo compruebo en el lote siguiente y lo dejo escrito aquí si algo falla.** **Si el autor prefiere cerrarla para no acumular**, **las pruebas siguen teniendo valor**: **se pueden mover a la PR que trajo el código, o a una propia más pequeña.**
fiestorra commented 2026-12-03 07:53:02 +00:00 (Migrated from github.com)

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


Y lo comprobado, como dije: los tests de esta PR pasan sobre main de hoy.

tests/test_run_game_wine.py             17 skipped              (0,4 s)

Y estos 17 no son un aprobado: se saltan porque este equipo no tiene Wine (pytest da 17 skipped en 0,4 s). No puedo decir si pasan; sí puedo decir que no fallan aquí, y esa frase no es lo mismo.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7371546529 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3241#issuecomment-7371546529). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T07:53:02Z. --- **Y lo comprobado, como dije**: **los tests de esta PR pasan sobre `main` de hoy.** ``` tests/test_run_game_wine.py 17 skipped (0,4 s) ``` **Y estos 17 no son un aprobado**: se **saltan** porque este equipo no tiene Wine (`pytest` da `17 skipped` en 0,4 s). **No puedo decir si pasan; sí puedo decir que no fallan aquí**, y esa frase no es lo mismo.
fiestorra commented 2026-12-03 08:19:31 +00:00 (Migrated from github.com)

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


Corrección: esto no es una PR a medio fusionar — es una PR de sólo tests, y lo fue desde el principio

Escribí que «su código ya entró por otra vía y sólo queda el test», y es falso. Su diff propio, contra su base, nunca tocó nada fuera de tests/:

git diff --name-only $(git merge-base origin/main <head>)..<head>
  1 fichero, y está en tests/

Así que el test no es lo que sobra de un cambio ya fusionado: es lo único que la PR ha tenido siempre.

Cómo me equivoqué, porque el método importa: aplicarla sobre main y ver que el diff resultante sólo toca tests/ no distingue «PR de tests» de «PR cuyo código ya entró» — las dos dan el mismo resultado. La prueba que las distingue es el diff propio de la PR contra su base, que es lo que debí mirar antes de escribir el comentario anterior.

Lo que sí sigue en pie: aplicada sobre el main de hoy, su fichero de test entra limpio, y los tests pasan (medido: 17 saltados por no haber Wine en esta máquina). Eso es lo que hacía falta saber, y no dependía de mi clasificación.

Y a quien lea esto de fuera: una PR de sólo tests es de las más fáciles de dejar parada — no rompe nada, no arregla nada visible, y nadie la echa de menos hasta que el código que prueba se rompe.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7372117483 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3241#issuecomment-7372117483). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T08:19:31Z. --- ## Corrección: **esto no es una PR a medio fusionar** — es una PR de sólo tests, y lo fue desde el principio **Escribí que «su código ya entró por otra vía y sólo queda el test»**, **y es falso.** **Su diff propio, contra su base, nunca tocó nada fuera de `tests/`**: ``` git diff --name-only $(git merge-base origin/main <head>)..<head> 1 fichero, y está en tests/ ``` **Así que el test no es lo que sobra de un cambio ya fusionado: es lo único que la PR ha tenido siempre.** **Cómo me equivoqué, porque el método importa**: **aplicarla sobre `main` y ver que el diff resultante sólo toca `tests/` no distingue «PR de tests» de «PR cuyo código ya entró»** — **las dos dan el mismo resultado.** **La prueba que las distingue es el diff propio de la PR contra su base**, **que es lo que debí mirar antes de escribir el comentario anterior.** **Lo que sí sigue en pie**: **aplicada sobre el `main` de hoy, su fichero de test entra limpio, y los tests pasan** (**medido: 17 saltados por no haber Wine en esta máquina**). **Eso es lo que hacía falta saber, y no dependía de mi clasificación.** **Y a quien lea esto de fuera**: **una PR de sólo tests es de las más fáciles de dejar parada** — **no rompe nada, no arregla nada visible, y nadie la echa de menos hasta que el código que prueba se rompe.**
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!3241
No description provided.