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

Closed
github-bot wants to merge 1 commit from github-bot/gh-1856 into main AGit
Owner

@⁠kirigayakazima on GitHub · 2026-11-25 13:18 UTC · original
kirigayakazima:fix/ci-expected-failures-safety → main · +50 −3 · 2 files · 1 commits · closed without merging

Claimed in the coordination issue as: CI-EXPECTED-FAILURES-WINDOWS-CRASH-AND-DEDUP (#1608)

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.
**@⁠kirigayakazima** on GitHub · 2026-11-25 13:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1856) `kirigayakazima:fix/ci-expected-failures-safety` → `main` · +50 −3 · 2 files · 1 commits · closed without merging Claimed in the coordination issue as: CI-EXPECTED-FAILURES-WINDOWS-CRASH-AND-DEDUP (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:08:49 +00:00
Author
Owner

@⁠madvillain91 on GitHub · 2026-11-25 13:27 UTC · original · reviewed

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.

**@⁠madvillain91** on GitHub · 2026-11-25 13:27 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1856#pullrequestreview-6058465153) · **reviewed** 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.
Author
Owner

@⁠GeorgiyDemo on GitHub · 2026-11-25 14:50 UTC · original

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.

**@⁠GeorgiyDemo** on GitHub · 2026-11-25 14:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1856#issuecomment-7165909509) 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.
Author
Owner

@⁠DeadlyChirp on GitHub · 2026-11-25 15:23 UTC · original

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.)

**@⁠DeadlyChirp** on GitHub · 2026-11-25 15:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1856#issuecomment-7166780740) 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.)
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 17:27 UTC · original

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).

**@⁠aslan2142** on GitHub · 2026-11-25 17:27 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1856#issuecomment-7169532251) 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).
github-bot closed this pull request 2026-11-27 12:03:57 +00:00
Author
Owner

@⁠kirigayakazima on GitHub · 2026-11-27 11:54 UTC · original

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.

**@⁠kirigayakazima** on GitHub · 2026-11-27 11:54 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1856#issuecomment-7217606767) 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.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.