Skip to content

Fail semantic runs that exit without a trustworthy result (SEMANTIC-RUNNER-COMPLETION) - #1437

Merged
DadaCap merged 2 commits into
ProjectLeonida:mainfrom
titoreinaldo:fix/semantic-runner-completion
Nov 28, 2026
Merged

DadaCap merged 2 commits into
ProjectLeonida:mainfrom
titoreinaldo:fix/semantic-runner-completion

Conversation

@titoreinaldo

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: SEMANTIC-RUNNER-COMPLETION (#14 claim).

What and why

An incomplete semantic run can report success. A synthetic module calling os._exit(0) during import leaves no unittest result; the parallel runner counts zero for that worker and accepts its process status, and the serial runner simply forwards success. An exit handler can also overwrite the status after unittest has completed with a failure.

Use unittest’s completed result as well as the process exit status in both modes. Status 0 without a result, or after unittest reported a nonzero status, is an error. Empty package initializers are still ignored based on the recorded result, and timeouts retain their existing diagnostics. Discovery rules are unchanged.

Tested

  • Both synthetic regressions fail against main 1154976d with either -j 1 or -j 2: four false-green cases before, all four detected after.
  • python -I tests/test_run_semantic_tests.py: 24 tests pass.
  • python -I scripts/run_semantic_tests.py tests/semantic -j 8: 476 files, 6,223 tests, zero failing files.
  • Compile, diff whitespace and no-game-data checks passed.

GPUs tested: none, Linux x86-64 / Python 3.12.14, CPU-only. No game files, keys, decryption, or online game services. AI-assisted: yes, OpenAI Codex.

@PierreEbele

Copy link
Copy Markdown
Contributor

Reviewed 84f8fee: run_semantic_tests.py now takes the verdict from the child's {testsRun, exitCode} result file: a child that exits 0 without a result, or against unittest's own verdict, fails the run, and -j 1 shares the child program instead of a bare python -m unittest discover. Ran tests/test_run_semantic_tests.py on both trees: 24 tests OK on the PR, and on main exactly the two new tests fail; both bugs reproduce (an import-time os._exit(0) and an atexit-forced exit 0 after a failed test report "0 files failed" on main). Ran the runner on tests/semantic -p 'test_alu_add*.py' in both modes on both trees: 6 files, 69 tests, 0 failed, identical output. Probed a passing module with an atexit os._exit(0) (still passes; no false positive) and a mid-test SIGKILL (still fails). No findings. Note, follow-up material only: a module that deliberately writes LEONIDA_TEST_COUNT can still forge a green verdict everywhere except main's serial mode, which was immune by accident.

AI-assisted review.

Recommendation: Merge

@aslan2142 aslan2142 added the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
@MoonEyes

Copy link
Copy Markdown
Collaborator

Hi @titoreinaldo, thanks for this. #1749 by lixonik (SEMANTIC-WORKER-RESULT-REQUIRED) fixes the same false pass for the parallel runner only. Yours is the broader fix (it also covers -j 1 and a nonzero unittest status hidden by an exit handler) and your claim came first, but it now conflicts with main.

Could you rebase it? When you do, please also add the case #1749 tests and yours does not: a module whose worker exits with status 0 in the middle of a test (yours exits at import) next to a healthy module under -j 2. After that, #1749 can be closed in favor of this one. cc @lixonik, no action needed from you yet.

AI-assisted (Claude Code, Claude Opus 5.5)

Retain process tracking and interrupt/timeout handling from main.
Include a worker that exits zero mid-test next to a healthy module under -j 2.

AI-assisted.
@titoreinaldo
titoreinaldo force-pushed the fix/semantic-runner-completion branch from 84f8fee to 53bc0e3 Compare November 27, 2026 23:42
@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Nov 28, 2026
@akimfomin

Copy link
Copy Markdown
Contributor

I ran python -I tests/test_run_semantic_tests.py on 53bc0e3a in a standalone Windows checkout of the runner and its fixtures. It finished with 28 passed and one platform skip. The intentional nested boom-msg failure did not make the outer suite fail. VIctory #3636 has a related false-green control for worker initialization. If you publish a CI summary from this runner, labeling that nested diagnostic separately would keep it from looking like a failed verification.

@DadaCap

DadaCap commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Merged into main (merge commit 7e4093c), approved by DadaCap (maintainer). Thanks!

Checked before merging: Tested in our local release candidate (main + 41 PRs): translator suite 512 files / 6,442 tests clean, Python suite with no new failure versus main, and 360 s game runs on an RTX 5080 with no regression. Note: #2073 touches the same lines of run_semantic_tests.py; it will be asked to rebase on this. The merge was pinned to the head commit that was tested (53bc0e3).

AI-assisted (Claude Code), posted for DadaCap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants