tests: the two write-failure cases in test_feature_scan need preexec_fn, which Windows does not have #2667

Manually merged
github merged 3 commits from github-bot/gh-2667 into gh-pr/2667/base 2026-12-01 11:32:33 +00:00 AGit
Owner

@⁠fiestorra on GitHub · 2026-11-30 00:56 UTC · original
fiestorra:fix/feature-scan-posix-only → main · +8 −1 · 1 files · 3 commits · merged 2026-12-01 11:29 UTC

Two tests in tests/test_feature_scan.py fail on Windows and CI cannot see it, because that file runs on Linux there.

Found while verifying #2665 - which is not the cause (the same two fail on main without it, and its only change to the file is a docstring line).

The cause

FeatureScanAtomicOutputTests.run_scan passes

preexec_fn=self.fail_file_writes if fail_writes else None,

and preexec_fn is POSIX-only. The two cases that use it (test_failed_write_keeps_existing_report, test_failed_write_leaves_no_temporary_file) therefore cannot run here at all - they die in subprocess.Popen before the tool is started.

The change

Two decorators, one per case:

@unittest.skipIf(os.name == "nt", "preexec_fn, which these two cases need, is POSIX-only")
before (main b8bd37111, Windows 11, Python 3.13):  2 failed, 14 passed
after:                                            14 passed, 2 skipped

The skip prints its reason, so the suite no longer reports a red that a Windows contributor cannot distinguish from their own breakage. On POSIX nothing changes: the decorator is a no-op there, and the cases run exactly as before.

What this does not do

It does not test the same behaviour on Windows. The intent of those cases - a failed write must leave the previous report intact and no temporary file behind - is real and worth covering; preexec_fn is simply the POSIX way to inject the failure. A portable variant would make the destination unwritable instead (a directory where the file should go is enough), which would exercise the same intent on every platform. I did not write it because it tests a different failure point - after the tool opens its temp file rather than before - and that is a judgement for whoever owns this tool.

A third commit the description above did not mention (463f7593d)

runtime.yml's selectors send each tests/test_*.py through python -I <file> unless it imports pytest or defines HAVE_NUMPY =, and this file does neither. Its __main__ scans globals() for names starting with test_, so FeatureScanAtomicOutputTests never ran in CI at all - which meant the two skips above had no effect there either.

The script path now loads the class explicitly:

python -I tests/test_feature_scan.py  ->  13 top-level tests, then "Ran 3 tests ... OK (skipped=2)", exit 0
python3 -m pytest tests/test_feature_scan.py -q  ->  14 passed, 2 skipped

merzleckeier spotted the gap by reading the call site rather than the diff; the fix is mine, and it is the reason this change now protects something in the job that matters.

The extra commit at the tip (no longer carried)

The branch used to carry a3b5ebea1 (test(semantic): align computed-I/J f16 interp oracle…), added only because semantic-tests was red on main for that oracle and every branch cut from main inherited it. main now has the same edit as c717967d0, so a rebase drops the commit and this pull request no longer touches tests/semantic/test_interp_computed_ij_fallback.py - the diff is only what this change actually needs.

AI-assisted: yes - DeepSeek v4.1 (flash) as the coding agent, with a separate reviewer agent reading the change before submission. Where and on what: the measurements above were taken on Windows 11 with MSVC 19.44.35226 on an RTX 4090 (NVIDIA driver 621.24) where a C++ or GPU path is involved; Python and docs cases need none of it.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-30 00:56 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2667) `fiestorra:fix/feature-scan-posix-only` → `main` · +8 −1 · 1 files · 3 commits · merged 2026-12-01 11:29 UTC **Two tests in `tests/test_feature_scan.py` fail on Windows and CI cannot see it, because that file runs on Linux there.** Found while verifying **#2665** - which is not the cause (the same two fail on `main` without it, and its only change to the file is a docstring line). ### The cause `FeatureScanAtomicOutputTests.run_scan` passes ```python preexec_fn=self.fail_file_writes if fail_writes else None, ``` and `preexec_fn` is **POSIX-only**. The two cases that use it (`test_failed_write_keeps_existing_report`, `test_failed_write_leaves_no_temporary_file`) therefore cannot run here at all - they die in `subprocess.Popen` before the tool is started. ### The change Two decorators, one per case: ```python @unittest.skipIf(os.name == "nt", "preexec_fn, which these two cases need, is POSIX-only") ``` ``` before (main b8bd37111, Windows 11, Python 3.13): 2 failed, 14 passed after: 14 passed, 2 skipped ``` The skip prints its reason, so the suite no longer reports a red that a Windows contributor cannot distinguish from their own breakage. On POSIX nothing changes: the decorator is a no-op there, and the cases run exactly as before. ### What this does not do **It does not test the same behaviour on Windows.** The intent of those cases - a failed write must leave the previous report intact and no temporary file behind - is real and worth covering; `preexec_fn` is simply the POSIX way to inject the failure. A portable variant would make the destination unwritable instead (a directory where the file should go is enough), which would exercise the same intent on every platform. I did not write it because it tests a different failure point - after the tool opens its temp file rather than before - and that is a judgement for whoever owns this tool. ### A third commit the description above did not mention (`463f7593d`) `runtime.yml`'s selectors send each `tests/test_*.py` through `python -I <file>` unless it imports `pytest` or defines `HAVE_NUMPY =`, and this file does neither. Its `__main__` scans `globals()` for names starting with `test_`, so **`FeatureScanAtomicOutputTests` never ran in CI at all** - which meant the two skips above had no effect there either. The script path now loads the class explicitly: ``` python -I tests/test_feature_scan.py -> 13 top-level tests, then "Ran 3 tests ... OK (skipped=2)", exit 0 python3 -m pytest tests/test_feature_scan.py -q -> 14 passed, 2 skipped ``` merzleckeier spotted the gap by reading the call site rather than the diff; the fix is mine, and it is the reason this change now protects something in the job that matters. ### The extra commit at the tip (no longer carried) **The branch used to carry `a3b5ebea1`** (`test(semantic): align computed-I/J f16 interp oracle…`), added only because `semantic-tests` was red on `main` for that oracle and every branch cut from `main` inherited it. **`main` now has the same edit as `c717967d0`**, so a rebase **drops the commit** and **this pull request no longer touches `tests/semantic/test_interp_computed_ij_fallback.py`** - the diff is only what this change actually needs. **AI-assisted:** yes - DeepSeek v4.1 (flash) as the coding agent, with a separate reviewer agent reading the change before submission. **Where and on what:** the measurements above were taken on Windows 11 with MSVC 19.44.35226 on an RTX 4090 (NVIDIA driver 621.24) where a C++ or GPU path is involved; Python and docs cases need none of it. Written with an AI assistant.
They fail on Windows today, and CI cannot see it because that file runs on Linux
there: FeatureScanAtomicOutputTests' two "failed write" cases pass
preexec_fn=fail_file_writes to subprocess, which is POSIX-only.

Measured on main b8bd37111, Windows 11, Python 3.13: 2 failed, 14 passed before;
14 passed, 2 skipped after, with the reason printed. On POSIX nothing changes.

Written with an AI assistant.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 01:01:25 +00:00
Author
Owner

@⁠merzleckeier on GitHub · 2026-11-30 01:14 UTC · original

Independent Python 3.12 A/B with #2665. I merged #2665 3209231b3 and this PR c6f4b809c into main 0eab02a8b, then restored only tests/test_feature_scan.py from the #2665-only merge for the control. Windows job · Linux job.

  • MEASURED pytest collected 16 tests in both arms. Windows 3.12.10 went from 14 passed and two ValueError failures at Popen(preexec_fn=…) to 14 passed and two explicit skips. Linux 3.12.16 passed all 16 in both arms, including the atomic-write failure checks.
  • READ IN CODE The current CI selectors send this file through python -I <file>, including the Windows standard-library step. Its __main__ invokes only the top-level test_* functions, so the entire FeatureScanAtomicOutputTests class is absent from that invocation. The standalone control printed OK on both operating systems. I also tried loading that class with unittest.defaultTestLoader from __main__ on Linux, and all three class methods ran alongside the existing standalone checks.

Synthetic fixtures only. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-11-30 01:14 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2667#issuecomment-7265966913) Independent Python 3.12 A/B with #2665. I merged #2665 `3209231b3` and this PR `c6f4b809c` into `main` `0eab02a8b`, then restored only `tests/test_feature_scan.py` from the #2665-only merge for the control. [Windows job](https://github.com/merzleckeier/mandy/actions/runs/46333356361/job/141567998990) · [Linux job](https://github.com/merzleckeier/mandy/actions/runs/46333356361/job/141567998630). - **MEASURED** `pytest` collected 16 tests in both arms. Windows 3.12.10 went from 14 passed and two `ValueError` failures at `Popen(preexec_fn=…)` to 14 passed and two explicit skips. Linux 3.12.16 passed all 16 in both arms, including the atomic-write failure checks. - **READ IN CODE** The current CI selectors send this file through `python -I <file>`, including the Windows standard-library step. Its `__main__` invokes only the top-level `test_*` functions, so the entire `FeatureScanAtomicOutputTests` class is absent from that invocation. The standalone control printed OK on both operating systems. I also tried loading that class with `unittest.defaultTestLoader` from `__main__` on Linux, and all three class methods ran alongside the existing standalone checks. Synthetic fixtures only. AI-assisted with OpenAI Codex.
Update `tests/semantic/test_interp_computed_ij_fallback.py` (#2239) to
narrow `v_interp_p2_f16` reference expectations toward zero (`f16_rtz` /
`f16_rtz_bits`), matching `SHADER-468` (#1181).

AI-assisted.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-30 03:07 UTC · original

Rebased onto current main with the one commit main is missing, like my other pull requests:

a3b5ebea1  (TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ, the commit #2633 carries)

semantic-tests was the only failing check here and it fails on main, for the interp oracle - so a branch cut from main inherits it and cannot show a result of its own. Nothing about this change touches the translator.

Verified after the rebase, on this branch:

python3 -m pytest tests/test_feature_scan.py tests/semantic/test_interp_computed_ij_fallback.py -q
  -> 23 passed, 2 skipped, 13 subtests

If #2633 merges first this second commit becomes a duplicate and can be dropped; if this lands first, #2633 becomes a no-op.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-30 03:07 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2667#issuecomment-7267605343) Rebased onto current `main` with the one commit `main` is missing, like my other pull requests: ``` a3b5ebea1 (TEST-INTERP-COMPUTED-IJ-FALLBACK-RTZ, the commit #2633 carries) ``` `semantic-tests` was the only failing check here and it fails on **`main`**, for the interp oracle - so a branch cut from `main` inherits it and cannot show a result of its own. Nothing about this change touches the translator. Verified after the rebase, on this branch: ``` python3 -m pytest tests/test_feature_scan.py tests/semantic/test_interp_computed_ij_fallback.py -q -> 23 passed, 2 skipped, 13 subtests ``` If **#2633** merges first this second commit becomes a duplicate and can be dropped; if this lands first, #2633 becomes a no-op. Written with an AI assistant.
The `__main__` scan collects the `test_*` globals, so the class's three methods
never ran in the plain-script invocation CI uses - which means the two skips this
PR adds never took effect there either. The class is loaded explicitly now.

Measured here: the script run goes from 13 top-level tests to those plus
"Ran 3 tests ... OK (skipped=2)", and pytest still reports 14 passed, 2 skipped.

Written with an AI assistant.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-30 03:16 UTC · original

Your "READ IN CODE" point turned out to be the most useful line in the review, and it needed a third commit: 463f7593d.

You noted that the CI selectors send this file through python -I <file>, and that its __main__ only invokes the top-level test_* functions, so FeatureScanAtomicOutputTests is absent from that invocation. That means the two skips this PR adds never took effect in CI - they only mattered for a pytest run, which is what a contributor does locally and what CI does not.

So the script run now loads the class explicitly:

class_result = unittest.TextTestRunner(verbosity=0).run(
    unittest.defaultTestLoader.loadTestsFromTestCase(FeatureScanAtomicOutputTests))
class_failed = len(class_result.failures) + len(class_result.errors)
ok = not failures and not raised and not class_failed

Measured here, in both invocation paths:

python -I tests/test_feature_scan.py     -> 13 top-level tests, then "Ran 3 tests ... OK (skipped=2)", exit 0
python3 -m pytest tests/test_feature_scan.py -q   -> 14 passed, 2 skipped

So the class runs in the script path now, with its two Windows skips doing what the PR says, and the three Linux cases passing as your defaultTestLoader experiment predicted.

What this says about the PR as a whole: it was fixing a failure that CI could not see and doing so in an invocation CI does not use. Thank you for reading the call site rather than just the diff - the change is now worth something where it matters.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-30 03:16 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2667#issuecomment-7267746543) **Your "READ IN CODE" point turned out to be the most useful line in the review, and it needed a third commit: `463f7593d`.** You noted that the CI selectors send this file through `python -I <file>`, and that its `__main__` only invokes the top-level `test_*` functions, so `FeatureScanAtomicOutputTests` is **absent from that invocation**. That means the two skips this PR adds **never took effect in CI** - they only mattered for a pytest run, which is what a contributor does locally and what CI does not. So the script run now loads the class explicitly: ```python class_result = unittest.TextTestRunner(verbosity=0).run( unittest.defaultTestLoader.loadTestsFromTestCase(FeatureScanAtomicOutputTests)) class_failed = len(class_result.failures) + len(class_result.errors) ok = not failures and not raised and not class_failed ``` **Measured here, in both invocation paths:** ``` python -I tests/test_feature_scan.py -> 13 top-level tests, then "Ran 3 tests ... OK (skipped=2)", exit 0 python3 -m pytest tests/test_feature_scan.py -q -> 14 passed, 2 skipped ``` So the class runs in the script path now, with its two Windows skips doing what the PR says, and the three Linux cases passing as your defaultTestLoader experiment predicted. **What this says about the PR as a whole:** it was fixing a failure that CI could not see *and* doing so in an invocation CI does not use. Thank you for reading the call site rather than just the diff - the change is now worth something where it matters. Written with an AI assistant.
github-bot force-pushed github-bot/gh-2667 from 463f7593d9 to 0d94741771 2026-11-30 13:58:31 +00:00 Compare
Author
Owner

@⁠fiestorra on GitHub · 2026-11-30 14:00 UTC · original

Re-verified after the rebase onto main 20fe0c754, on this machine (Windows 11, MSVC 19.44.35226): the diff no longer carries the interp-oracle commit (main has it as c717967d0), and what is left still passes.

python3 -m pytest tests/test_feature_scan.py -q
14 passed, 2 skipped in 2.63s

What I did not test: the rest of the change, and anything the rebase did not touch. This confirms the rebase kept the change working, not that the change is correct - that is what the review and the CI are for.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-30 14:00 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2667#issuecomment-7280687188) **Re-verified after the rebase onto `main` `20fe0c754`, on this machine (Windows 11, MSVC 19.44.35226):** the diff no longer carries the interp-oracle commit (`main` has it as `c717967d0`), and what is left still passes. ``` python3 -m pytest tests/test_feature_scan.py -q 14 passed, 2 skipped in 2.63s ``` **What I did not test:** the rest of the change, and anything the rebase did not touch. **This confirms the rebase kept the change working, not that the change is correct** - that is what the review and the CI are for. Written with an AI assistant.
Author
Owner

@⁠aegish-zagi on GitHub · 2026-11-30 14:36 UTC · original

VERIFY-2667 — PASS

  • PR: #2667 | head 0d94741771 | merge state vs main b17b22d33: CLEAN (scratch merge, no conflicts)
  • Tests run (PR head merged with current main): python -I tests/test_feature_scan.py — OK (0 failed checks, 0 failed tests), exit 0; python -m unittest discover -s tests -p test_feature_scan.py — the FeatureScanAtomicOutputTests class (3 tests, including the two write-failure cases) passes.
  • Red-on-main vs green-on-PR: the red here is a silent skip, not an exit code. On plain main the same script run also prints OK, but main's main block never loads FeatureScanAtomicOutputTests (grep: no class run in the script entry point), so the class's 3 cases — including test_failed_write_keeps_existing_report and test_failed_write_leaves_no_temporary_file — do not execute at all in the CI script run. The PR adds that class run to the script entry point and counts its failures into the exit code; measured above, the class now executes and passes. The two skipIf(os.name == 'nt') decorators are inert on this Linux host (both cases ran) and correct by inspection: preexec_fn is POSIX-only.
  • Diff audit: 1 file, tests only, +9/-1 lines of substance (plus the entry-point block). No production code, no game data.
  • Platform: Linux, Python 3.12, Profile Z (no GPU)
  • AI-assisted: yes (Muse Wonder, Muse by Meta)
**@⁠aegish-zagi** on GitHub · 2026-11-30 14:36 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2667#issuecomment-7281630453) VERIFY-2667 — PASS - PR: #2667 | head 0d947417717cdfb519d35d5cbb0686089a9ad390 | merge state vs main b17b22d33: CLEAN (scratch merge, no conflicts) - Tests run (PR head merged with current main): python -I tests/test_feature_scan.py — OK (0 failed checks, 0 failed tests), exit 0; python -m unittest discover -s tests -p test_feature_scan.py — the FeatureScanAtomicOutputTests class (3 tests, including the two write-failure cases) passes. - Red-on-main vs green-on-PR: the red here is a silent skip, not an exit code. On plain main the same script run also prints OK, but main's __main__ block never loads FeatureScanAtomicOutputTests (grep: no class run in the script entry point), so the class's 3 cases — including test_failed_write_keeps_existing_report and test_failed_write_leaves_no_temporary_file — do not execute at all in the CI script run. The PR adds that class run to the script entry point and counts its failures into the exit code; measured above, the class now executes and passes. The two skipIf(os.name == 'nt') decorators are inert on this Linux host (both cases ran) and correct by inspection: preexec_fn is POSIX-only. - Diff audit: 1 file, tests only, +9/-1 lines of substance (plus the entry-point block). No production code, no game data. - Platform: Linux, Python 3.12, Profile Z (no GPU) - AI-assisted: yes (Muse Wonder, Muse by Meta)
Author
Owner

@⁠KelboLive on GitHub · 2026-11-30 16:19 UTC · original

Independent check on Windows (not the author), at e5c849280.

  • python -I tests/test_feature_scan.py: 3 tests, OK, 2 skipped. The skips are the intended ones: both cases declare preexec_fn ... is POSIX-only.
  • The remaining test runs its write-failure checks: broken report, bare-assert propagation, per-check counts — all PASS (0 failed checks, 0 failed tests).

So the PR does exactly what it says on Windows: gates the two POSIX-only cases instead of failing them. Coverage of the two write-failure paths is not exercised on this OS (they need fork/preexec), which is worth knowing but is the documented reason.

Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10.

AI-assisted: yes (opencode).

**@⁠KelboLive** on GitHub · 2026-11-30 16:19 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2667#issuecomment-7284479370) Independent check on Windows (not the author), at `e5c849280`. - `python -I tests/test_feature_scan.py`: **3 tests, OK, 2 skipped**. The skips are the intended ones: both cases declare `preexec_fn ... is POSIX-only`. - The remaining test runs its write-failure checks: broken report, bare-assert propagation, per-check counts — all PASS (`0 failed checks, 0 failed tests`). So the PR does exactly what it says on Windows: gates the two POSIX-only cases instead of failing them. Coverage of the two write-failure paths is not exercised on this OS (they need fork/preexec), which is worth knowing but is the documented reason. Environment: Windows 11 Pro 10.0.26200.9711, Python 3.12.10. AI-assisted: yes (opencode).
github-bot changed target branch from main to gh-pr/2667/base 2026-12-01 11:31:32 +00:00
github manually merged commit e5c8492806 into gh-pr/2667/base 2026-12-01 11:31:33 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-12-01 11:29 UTC · original · approved these changes

LGTM. Skipping the two POSIX-only preexec_fn write-failure tests on Windows and running FeatureScanAtomicOutputTests in tests/test_feature_scan.py's __main__ block fixes both Windows compatibility and silent skipping under python -I. Clean-room verified, 5/5 CI green, and independently verified. Merging.

(AI-assisted review.)

**@⁠aslan2142** on GitHub · 2026-12-01 11:29 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2667#pullrequestreview-6130326441) · **approved these changes** LGTM. Skipping the two POSIX-only `preexec_fn` write-failure tests on Windows and running `FeatureScanAtomicOutputTests` in `tests/test_feature_scan.py`'s `__main__` block fixes both Windows compatibility and silent skipping under `python -I`. Clean-room verified, 5/5 CI green, and independently verified. Merging. *(AI-assisted review.)*
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida!2667
No description provided.