Skip both BC validation test classes when NumPy is absent #3271

Merged
merzleckeier merged 1 commit from upstream-pr/3271 into main 2026-12-03 15:35:22 +00:00
merzleckeier commented 2026-12-03 01:05:34 +00:00 (Migrated from github.com)

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


Claimed in the coordination issue as BC-FEATURE-NUMPY-SKIP. Reported by fiestorra in #2570.

What and why

The standalone BC feature suite had one NumPy skip guard for two classes. With NumPy absent, the other class raised NameError. The same import guard also caught errors from bc_feature and labeled them as missing NumPy.

Apply the skip guard to both classes and limit it to a missing top-level numpy package. An import failure in bc_feature or inside an installed NumPy now surfaces the original exception.

Tested

  • In a Python virtual environment without NumPy, python -I tests/test_bc_feature_validation.py fails on main and exits successfully with all eight tests skipped on this branch.
  • With NumPy 2.5.5, all eight tests pass through the standalone command and unittest discovery.
  • Two synthetic import controls leave the original exceptions visible for a failing bc_feature import and for a missing NumPy backend module.
  • The independent read-only review, clean-room scanner and git diff --check passed.

GPUs tested: n/a (Python test fixtures).

AI-assisted: OpenAI Codex (GPT-6 family), with independent read-only review by GPT-6.2 Sol.

Checklist

  • Based on upstream main at 1a163523.
  • One topic.
  • Clean-room scan passed.
  • Translator rule: n/a.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5617685573 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3271). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T01:05:34Z. --- Claimed in the coordination issue as [BC-FEATURE-NUMPY-SKIP](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7363885914). Reported by fiestorra [in #2570](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7363834946). ### What and why The standalone BC feature suite had one NumPy skip guard for two classes. With NumPy absent, the other class raised `NameError`. The same import guard also caught errors from `bc_feature` and labeled them as missing NumPy. Apply the skip guard to both classes and limit it to a missing top-level `numpy` package. An import failure in `bc_feature` or inside an installed NumPy now surfaces the original exception. ### Tested - In a Python virtual environment without NumPy, `python -I tests/test_bc_feature_validation.py` fails on `main` and exits successfully with all eight tests skipped on this branch. - With NumPy 2.5.5, all eight tests pass through the standalone command and unittest discovery. - Two synthetic import controls leave the original exceptions visible for a failing `bc_feature` import and for a missing NumPy backend module. - The independent read-only review, clean-room scanner and `git diff --check` passed. GPUs tested: n/a (Python test fixtures). AI-assisted: OpenAI Codex (GPT-6 family), with independent read-only review by GPT-6.2 Sol. ### Checklist - [x] Based on upstream `main` at `1a163523`. - [x] One topic. - [x] Clean-room scan passed. - Translator rule: n/a.
fiestorra commented 2026-12-03 01:35:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T01:35:55Z.


VERIFY-3271 — the NumPy fix does exactly what the finding asked, and I ran it both ways

This branch's top commit is the fix for the test_bc_feature_validation.py finding I posted in #2570 an hour ago — and it closes both halves of it, which is more than I asked for.

The diff, at cfecc6ba9:

-except ImportError:
-    HAVE_NUMPY = False
+except ModuleNotFoundError as exc:
+    if exc.name != "numpy":
+        raise
+    HAVE_NUMPY = False
 ...
+@unittest.skipUnless(HAVE_NUMPY, "numpy not installed")     # the second class, which had none

The first half is the one I had not thought to ask for: except ImportError also swallowed a broken bc_feature — so the file reported "numpy not installed" whatever had actually failed — and if exc.name != "numpy": raise makes the message tell the truth. That is the right narrower exception, not a decoration.

Ran both ways on this machine:

python3 -I tests/test_bc_feature_validation.py      Ran 8 tests — OK (skipped=8)      ← numpy hidden: skips
python              tests/test_bc_feature_validation.py   Ran 8 tests — OK             ← numpy present: runs

Control (the file from main, same invocation):

python3 -I tests/test_bc_feature_validation.py
  FAILED (errors=6, skipped=4)
  NameError: name 'np' is not defined

So the change turns six errors into eight skips, and the full run still passes.

The other two commits on this branch — 4f344387b (frame generation with ray tracing on Series X from 20 GB) and 092a06957 (no automatic frame generation with ray tracing) — change the launcher's decision table, and I have not verified them: this comment is about the top commit, and the branch is a stack of three. Saying that plainly is the correction I had to post three times tonight (#3188, #3130, #3124).

What I could not test

  • The two launcher commits: they need the title (which switch combination it starts with, and what the menu shows).
  • The BC helpers with numpy: python without -I runs the 8 tests, which is not the same as the tools being right — they pass, nothing more.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7364523246 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3271#issuecomment-7364523246). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T01:35:55Z. --- ## VERIFY-3271 — the NumPy fix does exactly what the finding asked, and I ran it both ways **This branch's top commit is the fix for the `test_bc_feature_validation.py` finding I posted in #2570 an hour ago** — **and it closes both halves of it, which is more than I asked for.** **The diff, at `cfecc6ba9`**: ```python -except ImportError: - HAVE_NUMPY = False +except ModuleNotFoundError as exc: + if exc.name != "numpy": + raise + HAVE_NUMPY = False ... +@unittest.skipUnless(HAVE_NUMPY, "numpy not installed") # the second class, which had none ``` **The first half is the one I had not thought to ask for**: **`except ImportError` also swallowed a broken `bc_feature`** — **so the file reported "numpy not installed" whatever had actually failed** — **and `if exc.name != "numpy": raise` makes the message tell the truth.** **That is the right narrower exception, not a decoration.** **Ran both ways on this machine**: ``` python3 -I tests/test_bc_feature_validation.py Ran 8 tests — OK (skipped=8) ← numpy hidden: skips python tests/test_bc_feature_validation.py Ran 8 tests — OK ← numpy present: runs ``` **Control** (the file from `main`, same invocation): ``` python3 -I tests/test_bc_feature_validation.py FAILED (errors=6, skipped=4) NameError: name 'np' is not defined ``` **So the change turns six errors into eight skips, and the full run still passes.** **The other two commits on this branch** — `4f344387b` (frame generation with ray tracing on Series X from 20 GB) and `092a06957` (no automatic frame generation with ray tracing) — **change the launcher's decision table, and I have not verified them**: **this comment is about the top commit, and the branch is a stack of three.** **Saying that plainly is the correction I had to post three times tonight** (`#3188`, `#3130`, `#3124`). ## What I could not test - **The two launcher commits**: they need the title (which switch combination it starts with, and what the menu shows). - **The BC helpers with numpy**: `python` without `-I` runs the 8 tests, **which is not the same as the tools being right** — they pass, nothing more. Written with an AI assistant.
aegish-zagi commented 2026-12-03 04:58:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aegish-zagi on 2026-12-03T04:58:41Z.


VERIFY-3271 — PASS

PR #3271 | head cfecc6ba91 | merged cleanly with current main (d9b618f10) in a scratch worktree, no conflicts
Tests run: tests/test_bc_feature_validation.py (python -I, stdlib unittest), 8 tests. This machine HAS NumPy, so absence was simulated by blocking the import (sys.modules['numpy']=None before running the suite) — MEASURED under that simulation.
Red on main: with NumPy blocked, main's pristine suite FAILED (errors=6, skipped=4) — one class errored instead of skipping. With NumPy present, main is OK 8/8.
Green on PR: with NumPy blocked, OK (skipped=8) — both classes now skip with 'numpy not installed'; with NumPy present, OK 8/8, no behaviour change.
Diff audit: tests/test_bc_feature_validation.py only — READ IN CODE
Platform: Linux, Python 3.12.3, no GPU

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7368242956 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3271#issuecomment-7368242956). Originally posted by [aegish-zagi](https://github.com/aegish-zagi) on 2026-12-03T04:58:41Z. --- VERIFY-3271 — PASS PR #3271 | head cfecc6ba917f0fdb2f7b9643f62b39047996905b | merged cleanly with current main (d9b618f10) in a scratch worktree, no conflicts Tests run: tests/test_bc_feature_validation.py (python -I, stdlib unittest), 8 tests. This machine HAS NumPy, so absence was simulated by blocking the import (sys.modules['numpy']=None before running the suite) — MEASURED under that simulation. Red on main: with NumPy blocked, main's pristine suite FAILED (errors=6, skipped=4) — one class errored instead of skipping. With NumPy present, main is OK 8/8. Green on PR: with NumPy blocked, OK (skipped=8) — both classes now skip with 'numpy not installed'; with NumPy present, OK 8/8, no behaviour change. Diff audit: tests/test_bc_feature_validation.py only — READ IN CODE Platform: Linux, Python 3.12.3, no GPU AI-assisted: yes (Muse Wonder, Muse by Meta)
TurboTheTurtle commented 2026-12-03 05:34:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TurboTheTurtle on 2026-12-03T05:34:39Z.


tested: same on both sides, and the skip is what this machine needs. Machine: Windows 11, NVIDIA GeForce RTX 5080, driver 621.47, hardware-accelerated GPU scheduling on, page file 49,152 MB. The tree's own python is 3.13.0 with no NumPy on its path, which is exactly the case the two classes are skipped for.

python -I tests/test_bc_feature_validation.py -> Ran 8 tests, OK (skipped=8), rc 0 (before the change that file errored at import). python -I tests/test_bc_feature.py -> Ran 15 tests, OK (skipped=6), rc 0. node --test tests/test_*.cjs -> 113 tests, 0 fail. cargo test --workspace --exclude xtask --locked in d3d12/ -> the same seven ok results plus leonida-gpu 715 passed / 1 failed / 59 ignored, the one failure being the known descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in, which passes with LEONIDA_VIEW_COPY=0 and is unrelated to this file. Head cfecc6ba9 on main d9b618f10.

No GPU start was needed: the file is import-and-skip only.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7368887741 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3271#issuecomment-7368887741). Originally posted by [TurboTheTurtle](https://github.com/TurboTheTurtle) on 2026-12-03T05:34:39Z. --- tested: same on both sides, and the skip is what this machine needs. Machine: Windows 11, NVIDIA GeForce RTX 5080, driver 621.47, hardware-accelerated GPU scheduling on, page file 49,152 MB. The tree's own python is 3.13.0 with no NumPy on its path, which is exactly the case the two classes are skipped for. `python -I tests/test_bc_feature_validation.py` -> `Ran 8 tests`, `OK (skipped=8)`, rc 0 (before the change that file errored at import). `python -I tests/test_bc_feature.py` -> `Ran 15 tests`, `OK (skipped=6)`, rc 0. `node --test tests/test_*.cjs` -> 113 tests, 0 fail. `cargo test --workspace --exclude xtask --locked` in `d3d12/` -> the same seven `ok` results plus `leonida-gpu` 715 passed / 1 failed / 59 ignored, the one failure being the known `descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in`, which passes with `LEONIDA_VIEW_COPY=0` and is unrelated to this file. Head `cfecc6ba9` on main `d9b618f10`. No GPU start was needed: the file is import-and-skip only.
lixonik commented 2026-12-03 06:29:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T06:29:50Z.


Windows native verification -- PASS on head cfecc6ba9 (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
  • python -I tests/test_bc_feature_validation.py -v -> Ran 8 tests in 0.002s / OK
  • Test-only change (red side not constructible without reverting the test itself).

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369900353 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3271#issuecomment-7369900353). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-03T06:29:50Z. --- **Windows native verification -- PASS** on head `cfecc6ba9` (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** - `python -I tests/test_bc_feature_validation.py -v` -> **Ran 8 tests in 0.002s / OK** - Test-only change (red side not constructible without reverting the test itself). AI-assisted: yes (Antigravity -- Gemini 4 Neon).
fiestorra commented 2026-12-03 07:51:29 +00:00 (Migrated from github.com)

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


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_bc_feature_validation.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:7371514291 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3271#issuecomment-7371514291). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T07:51:29Z. --- ## 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_bc_feature_validation.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:52:58 +00:00 (Migrated from github.com)

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


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

tests/test_bc_feature_validation.py      8 passed + 20 subtests   (0,5 s)

Verde. Las pruebas de la validación de features BC pasan sobre main.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7371545064 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3271#issuecomment-7371545064). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T07:52:58Z. --- **Y lo comprobado, como dije**: **los tests de esta PR pasan sobre `main` de hoy.** ``` tests/test_bc_feature_validation.py 8 passed + 20 subtests (0,5 s) ``` **Verde.** Las pruebas de la validación de features BC pasan sobre `main`.
merzleckeier commented 2026-12-03 08:12:28 +00:00 (Migrated from github.com)

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


I also checked the actual missing-NumPy case on head cfecc6ba9 merged with main d9b618f1. Windows Python 3.12.10 under Wine used an installation without NumPy. The original test file exits 1 with six NameError results and four skips. With this head, it exits 0 and skips all eight tests with numpy not installed. On Linux with NumPy 2.5.5 present, all eight tests ran and passed. The diff on current main is confined to the test file. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7371963164 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3271#issuecomment-7371963164). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T08:12:28Z. --- I also checked the actual missing-NumPy case on head `cfecc6ba9` merged with `main` `d9b618f1`. Windows Python 3.12.10 under Wine used an installation without NumPy. The original test file exits 1 with six `NameError` results and four skips. With this head, it exits 0 and skips all eight tests with `numpy not installed`. On Linux with NumPy 2.5.5 present, all eight tests ran and passed. The diff on current `main` is confined to the test file. AI-assisted with OpenAI Codex.
fiestorra commented 2026-12-03 08:19:27 +00:00 (Migrated from github.com)

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


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: 8 tests y 20 subtests en verde (0,5 s)). 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:7372115876 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3271#issuecomment-7372115876). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T08:19:27Z. --- ## 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: 8 tests y 20 subtests en verde (0,5 s)**). **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!3271
No description provided.