SEMANTIC-PROCESS-TIMEOUT: bound hung test subprocesses #468

Merged
csmith105 merged 2 commits from upstream-pr/468 into main 2026-11-24 06:32:55 +00:00
csmith105 commented 2026-11-24 05:53:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by csmith105 on 2026-11-24T05:53:24Z.


Claimed in the coordination issue as: SEMANTIC-PROCESS-TIMEOUT

What and why

A hanging test subprocess can block the semantic regression runner indefinitely. Add an optional positive finite --timeout SECONDS (at most 86,400 seconds / 24 hours): it limits each module in parallel mode, or the entire existing unittest-discovery subprocess with -j 1. Timeouts return failure, retain partial output, and allow other parallel modules to finish. Omitting the option preserves existing behavior.

The limit terminates the direct subprocess; it does not promise descendant-process cleanup. This change does not alter shader translation or test discovery.

Tested

Windows 11, Python 3.12.14:

  • python -I tests/test_run_semantic_tests.py: 15 tests passed, including hanging synthetic modules, preserved output, healthy parallel modules, serial behavior, invalid/out-of-range timeout values, and a passing fixture at the maximum supported timeout.
  • python -m compileall -q make_game.py tools tests: passed.
  • python -I make_game.py --help: passed.
  • python -I scripts/run_semantic_tests.py tests/semantic -j 4 --timeout 300: 465 files / 6,104 tests in 484 seconds; two modules failed because spirv-as and spirv-val were absent (test_sopc_validation, test_unary_f16_validation). No timeout failures occurred.
  • After adding checksum-verified SPIRV-Tools 2026.4 to the task-local PATH, reran those two modules with python -m unittest discover -s tests/semantic -p <filename>: 11 and 5 tests passed respectively. The full suite was not rerun after that environment change; the initial failures are retained in the validation record.
  • python -I scripts/check_no_game_data.py scripts/run_semantic_tests.py tests/test_run_semantic_tests.py: passed.
  • git diff --check: passed. Independent source review found no blockers.

GPUs tested: n/a (test-runner change; no GPU execution).

AI-assisted: yes, OpenAI Codex, supervised through csmith105's session.

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption, including in quoted logs.
  • Translator contract table: not applicable; no translator rule changes.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5466906696 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/468). Originally posted by [csmith105](https://github.com/csmith105) on 2026-11-24T05:53:24Z. --- Claimed in the coordination issue as: [SEMANTIC-PROCESS-TIMEOUT](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7123225660) ### What and why A hanging test subprocess can block the semantic regression runner indefinitely. Add an optional positive finite `--timeout SECONDS` (at most 86,400 seconds / 24 hours): it limits each module in parallel mode, or the entire existing unittest-discovery subprocess with `-j 1`. Timeouts return failure, retain partial output, and allow other parallel modules to finish. Omitting the option preserves existing behavior. The limit terminates the direct subprocess; it does not promise descendant-process cleanup. This change does not alter shader translation or test discovery. ### Tested Windows 11, Python 3.12.14: - `python -I tests/test_run_semantic_tests.py`: 15 tests passed, including hanging synthetic modules, preserved output, healthy parallel modules, serial behavior, invalid/out-of-range timeout values, and a passing fixture at the maximum supported timeout. - `python -m compileall -q make_game.py tools tests`: passed. - `python -I make_game.py --help`: passed. - `python -I scripts/run_semantic_tests.py tests/semantic -j 4 --timeout 300`: 465 files / 6,104 tests in 484 seconds; two modules failed because `spirv-as` and `spirv-val` were absent (`test_sopc_validation`, `test_unary_f16_validation`). No timeout failures occurred. - After adding checksum-verified SPIRV-Tools 2026.4 to the task-local PATH, reran those two modules with `python -m unittest discover -s tests/semantic -p <filename>`: 11 and 5 tests passed respectively. The full suite was not rerun after that environment change; the initial failures are retained in the validation record. - `python -I scripts/check_no_game_data.py scripts/run_semantic_tests.py tests/test_run_semantic_tests.py`: passed. - `git diff --check`: passed. Independent source review found no blockers. GPUs tested: n/a (test-runner change; no GPU execution). AI-assisted: yes, OpenAI Codex, supervised through csmith105's session. ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption, including in quoted logs. - [x] Translator contract table: not applicable; no translator rule changes.
Dezmonius commented 2026-11-24 06:02:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Dezmonius on 2026-11-24T06:02:17Z.


Independent Windows check on 973593f with CPython 3.14.7. All 13 runner tests passed. A one-test synthetic fixture also passed with --timeout 300 and with the option omitted, using both -j 1 and -j 2.

One validation edge case: --timeout 1e100 is accepted in both modes, but the same passing fixture immediately exits with status 1. With -j 1 the runner reports TIMED OUT after 1e+100 s. With -j 2 it prints an uncaught OverflowError: timestamp out of range for C PyTime_t from the subprocess output reader's thread join. To reproduce, run python -I scripts/run_semantic_tests.py <directory-with-a-passing-test> -j 2 --timeout 1e100, then repeat with -j 1.

Could the parser reject values above a documented, supported maximum before launching the subprocess? A finite out-of-range value in the argument validation test would cover both modes.

Synthetic tests only. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7123512917 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/468#issuecomment-7123512917). Originally posted by [Dezmonius](https://github.com/Dezmonius) on 2026-11-24T06:02:17Z. --- Independent Windows check on `973593f` with CPython 3.14.7. All 13 runner tests passed. A one-test synthetic fixture also passed with `--timeout 300` and with the option omitted, using both `-j 1` and `-j 2`. One validation edge case: `--timeout 1e100` is accepted in both modes, but the same passing fixture immediately exits with status 1. With `-j 1` the runner reports `TIMED OUT after 1e+100 s`. With `-j 2` it prints an uncaught `OverflowError: timestamp out of range for C PyTime_t` from the subprocess output reader's thread join. To reproduce, run `python -I scripts/run_semantic_tests.py <directory-with-a-passing-test> -j 2 --timeout 1e100`, then repeat with `-j 1`. Could the parser reject values above a documented, supported maximum before launching the subprocess? A finite out-of-range value in the argument validation test would cover both modes. Synthetic tests only. AI-assisted (Codex).
csmith105 commented 2026-11-24 06:20:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by csmith105 on 2026-11-24T06:20:49Z.


Fixed in 90eb7284fe. I reproduced both reported failures before the change. The optional timeout now accepts positive finite values up to a documented 86,400 seconds (24 hours), keeping the wait within portable platform limits. Larger values are rejected by argparse before discovery or subprocess launch. Added regressions for 86,400.1 and 1e100 in both modes, plus a passing fixture at the exact maximum. All 15 focused runner tests pass on Windows/Python 3.12.14; independent source review found no blockers. The default remains unlimited.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7123838249 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/468#issuecomment-7123838249). Originally posted by [csmith105](https://github.com/csmith105) on 2026-11-24T06:20:49Z. --- Fixed in 90eb7284feaae3d2e1511ffef0685d95a7dd7525. I reproduced both reported failures before the change. The optional timeout now accepts positive finite values up to a documented 86,400 seconds (24 hours), keeping the wait within portable platform limits. Larger values are rejected by argparse before discovery or subprocess launch. Added regressions for 86,400.1 and 1e100 in both modes, plus a passing fixture at the exact maximum. All 15 focused runner tests pass on Windows/Python 3.12.14; independent source review found no blockers. The default remains unlimited.
Dezmonius commented 2026-11-24 06:22:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Dezmonius on 2026-11-24T06:22:14Z.


Confirmed the fix at 90eb728 on Windows with CPython 3.14.7. All 15 runner tests passed. On the original synthetic fixture, both -j 1 and -j 2 pass with the option omitted and at 86400, and reject 86400.1 and 1e100 with argparse exit 2 and the documented maximum. Thanks for the fix.

AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7123862427 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/468#issuecomment-7123862427). Originally posted by [Dezmonius](https://github.com/Dezmonius) on 2026-11-24T06:22:14Z. --- Confirmed the fix at `90eb728` on Windows with CPython 3.14.7. All 15 runner tests passed. On the original synthetic fixture, both `-j 1` and `-j 2` pass with the option omitted and at `86400`, and reject `86400.1` and `1e100` with argparse exit 2 and the documented maximum. Thanks for the fix. AI-assisted (Codex).
QemmHD commented 2026-11-24 06:32:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-24T06:32:52Z.


Merging. Why merged: scripts/run_semantic_tests.py gains a per-file timeout and rejects a zero timeout, so one hung semantic test file can't stall the whole run.
Why it's good: security-reviewed (argv-list subprocess on sys.executable only). Tested on Windows 11 merged onto main 8f481cf: tests/test_run_semantic_tests.py 10 passed on main -> 15 passed with this PR (new tests fail without the fix); a real run with --timeout 300 over test_sdwa* ran 40 tests with 0 failures and --timeout 0 is refused. Merges cleanly together with #474.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7124045726 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/468#issuecomment-7124045726). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-24T06:32:52Z. --- Merging. Why merged: scripts/run_semantic_tests.py gains a per-file timeout and rejects a zero timeout, so one hung semantic test file can't stall the whole run. Why it's good: security-reviewed (argv-list subprocess on sys.executable only). Tested on Windows 11 merged onto main 8f481cf: tests/test_run_semantic_tests.py 10 passed on main -> 15 passed with this PR (new tests fail without the fix); a real run with --timeout 300 over test_sdwa* ran 40 tests with 0 failures and --timeout 0 is refused. Merges cleanly together with #474. AI-assisted (Claude Code, Claude Opus 5.5).
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!468
No description provided.