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

Closed
kirigayakazima wants to merge 1 commit from upstream-pr/1856 into main
kirigayakazima commented 2026-11-25 13:18:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-25T13:18:19Z.


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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5492095675 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1856). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-25T13:18:19Z. --- 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 commented 2026-11-25 13:27:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by madvillain91 on 2026-11-25T13:27:24Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6058465153 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1856#pullrequestreview-6058465153). Originally posted by [madvillain91](https://github.com/madvillain91) on 2026-11-25T13:27:24Z. **Review:** COMMENTED --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-25T14:50:55Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7165909509 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1856#issuecomment-7165909509). Originally posted by [GeorgiyDemo](https://github.com/GeorgiyDemo) on 2026-11-25T14:50:55Z. --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-25T15:23:57Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7166780740 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1856#issuecomment-7166780740). Originally posted by [DeadlyChirp](https://github.com/DeadlyChirp) on 2026-11-25T15:23:57Z. --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T17:27:31Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7169532251 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1856#issuecomment-7169532251). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T17:27:31Z. --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-27T11:54:09Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7217606767 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1856#issuecomment-7217606767). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-27T11:54:09Z. --- 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

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!1856
No description provided.