scripts/ci_expected_failures: detect Windows crash codes, dedup annotations, avoid blank stdout #1856

Closed
leonida/mandy
kirigayakazima wants to merge 0 commits from fix/ci-expected-failures-safety into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

kirigayakazima commented 2026-11-25 13:18:19 +00:00

Claimed in the coordination issue as: CI-EXPECTED-FAILURES-WINDOWS-CRASH-AND-DEDUP (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163483985)

What and why

  • Deduplicate failed and expected in insertion order inside judge() in scripts/ci_expected_failures.py so repeated test names or duplicate workflow arguments do not emit duplicate GitHub Actions workflow commands (::error::, ::warning::, ::notice::).
  • Broaden abnormal test-runner termination detection from 128 < status <= 255 to status < 0 or status > 128, catching unsigned Windows NTSTATUS / Win32 crash exit codes (such as 0xC0000005 / 3221225477 and 0xC00000FD / 3221225725) in addition to POSIX signal codes 128+N.
  • Print workflow command lines in main() only when lines is non-empty so clean runs emit empty stdout instead of a stray blank line.
  • Add regression unit tests in tests/test_ci_expected_failures.py covering Windows NTSTATUS exit codes, order-preserving deduplication, and clean main() stdout output.

Tested

  • Patched: python -I tests/test_ci_expected_failures.py -v -> Ran 17 tests in 0.054s (OK).
  • Baseline check (upstream/main 98c2f777 with updated tests copied into detached worktree): Ran 17 tests in 0.059s (FAILED (failures=3) on all 3 new regression tests).
  • Repo gates: python -I tests/test_ci_registration.py (Ran 16 tests in 5.226s, OK), python -I tests/test_text_write_line_endings.py (Ran 3 tests in 13.044s, OK), python -I scripts/check_no_game_data.py (exit 0), python -I -m compileall -q (exit 0), git diff --check (exit 0).

GPUs tested: n/a (host CI script and unittest coverage)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
Claimed in the coordination issue as: CI-EXPECTED-FAILURES-WINDOWS-CRASH-AND-DEDUP (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163483985) ### What and why - Deduplicate `failed` and `expected` in insertion order inside `judge()` in `scripts/ci_expected_failures.py` so repeated test names or duplicate workflow arguments do not emit duplicate GitHub Actions workflow commands (`::error::`, `::warning::`, `::notice::`). - Broaden abnormal test-runner termination detection from `128 < status <= 255` to `status < 0 or status > 128`, catching unsigned Windows NTSTATUS / Win32 crash exit codes (such as `0xC0000005` / `3221225477` and `0xC00000FD` / `3221225725`) in addition to POSIX signal codes `128+N`. - Print workflow command lines in `main()` only when `lines` is non-empty so clean runs emit empty stdout instead of a stray blank line. - Add regression unit tests in `tests/test_ci_expected_failures.py` covering Windows NTSTATUS exit codes, order-preserving deduplication, and clean `main()` stdout output. ### Tested - Patched: `python -I tests/test_ci_expected_failures.py -v` -> `Ran 17 tests in 0.054s` (`OK`). - Baseline check (`upstream/main` `98c2f777` with updated tests copied into detached worktree): `Ran 17 tests in 0.059s` (`FAILED (failures=3)` on all 3 new regression tests). - Repo gates: `python -I tests/test_ci_registration.py` (`Ran 16 tests in 5.226s`, `OK`), `python -I tests/test_text_write_line_endings.py` (`Ran 3 tests in 13.044s`, `OK`), `python -I scripts/check_no_game_data.py` (exit 0), `python -I -m compileall -q` (exit 0), `git diff --check` (exit 0). GPUs tested: n/a (host CI script and unittest coverage) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
madvillain91 reviewed 2026-11-25 13:27:24 +00:00
madvillain91 left a comment
No description provided.
Independent Windows 11 26H2 (26300.9711) check at 20764bee8 against main 384abe5b0, using CPython 3.12.3 (python -I) and Git for Windows 2.56.0.windows.2. Passed test_ci_expected_failures.py (17/17 in 0.126s) and test_text_write_line_endings.py (3/3 in 18.750s), with check_no_game_data.py and compileall clean. Verified unsigned Windows NTSTATUS exit codes (e.g. 0xC0000005 / 0xC00000FD) are flagged as abnormal exits (status > 128), duplicate failed/expected names are deduplicated in order, and clean runs emit empty stdout without a trailing blank line. LGTM.
GeorgiyDemo commented 2026-11-25 14:50:55 +00:00

Tested 20764bee8 on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main 446574e76 (CI helper; no GPU):

  • pytest 9.2.0 on tests/test_ci_expected_failures.py: 17 passed, 2 subtests passed at this head.
  • The same file on main: 3 failed, 14 passed, 2 subtests — the Windows crash-code detection and annotation handling are new.
  • Not run: real Windows crash exit codes; the tests synthesise them.

AI-assisted; synthetic fixtures only, no game data.

Tested `20764bee8` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `446574e76` (CI helper; no GPU): - pytest 9.2.0 on `tests/test_ci_expected_failures.py`: **17 passed, 2 subtests passed** at this head. - The same file on `main`: **3 failed**, 14 passed, 2 subtests — the Windows crash-code detection and annotation handling are new. - Not run: real Windows crash exit codes; the tests synthesise them. AI-assisted; synthetic fixtures only, no game data.
DeadlyChirp commented 2026-11-25 15:23:57 +00:00

Tested on Windows 11, Python 3.12.10, with this PR merged onto upstream main b0f3d3998 (merge commit 7ed2de634).

python -I tests/test_ci_expected_failures.py:

  • PR: 17 tests OK. main: 14 tests OK. The 3 new tests pass on Windows.

(AI-assisted test run; output checked by hand.)

Tested on Windows 11, Python 3.12.10, with this PR merged onto upstream main b0f3d3998 (merge commit 7ed2de634). `python -I tests/test_ci_expected_failures.py`: - PR: 17 tests OK. main: 14 tests OK. The 3 new tests pass on Windows. (AI-assisted test run; output checked by hand.)
aslan2142 commented 2026-11-25 17:27:31 +00:00

Thanks. A question before this goes further:

  • The only callers of this script are the macOS steps in runtime.yml. They pass ${PIPESTATUS[0]}, which is always 0–255, so the new status > 255 branch can't fire.
  • Is a Windows caller planned? If not, we'd rather not take it: the dedup and blank-line changes are cosmetic on their own.

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

Thanks. A question before this goes further: - The only callers of this script are the macOS steps in `runtime.yml`. They pass `${PIPESTATUS[0]}`, which is always 0–255, so the new `status > 255` branch can't fire. - Is a Windows caller planned? If not, we'd rather not take it: the dedup and blank-line changes are cosmetic on their own. AI-assisted (Claude Code, Claude Opus 5.5).
kirigayakazima commented 2026-11-27 11:54:09 +00:00

Thanks @aslan2142 — agreed. Since scripts/ci_expected_failures.py is only invoked from macOS runtime.yml steps where ${PIPESTATUS[0]} stays in 0..255 and no Windows caller is planned, closing this PR to keep the helper lean.

Thanks @aslan2142 — agreed. Since `scripts/ci_expected_failures.py` is only invoked from macOS `runtime.yml` steps where `${PIPESTATUS[0]}` stays in 0..255 and no Windows caller is planned, closing this PR to keep the helper lean.
Sign in to join this conversation.
No description provided.