scripts/run_conservative_tier3_reference.ps1: validate prereqs, anchor ctest filter, guard stderr and env #1873

Closed
kirigayakazima wants to merge 3 commits from upstream-pr/1873 into main
kirigayakazima commented 2026-11-25 13:49:42 +00:00 (Migrated from github.com)

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


Claimed in the coordination issue as: RUN-CONSERVATIVE-TIER3-REF-PS1-SAFETY-AND-TESTS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7164301040)

What and why

  • Check for cmake and ctest upfront via Get-Command in scripts/run_conservative_tier3_reference.ps1 so a missing ctest fails before configuring and building runtime.
  • Wrap native cmake / ctest invocations in Invoke-Native with temporary $ErrorActionPreference = "Continue" so benign stderr warnings never raise NativeCommandError under strict error policies while non-zero exit codes still fail cleanly with their exit status.
  • Pass --no-tests=error and anchored exact test filter ^d3d12_conservative_tier3_reference$ to ctest so zero matched tests cannot silently pass.
  • Track $hadPreviousFilter = Test-Path Env:LEONIDA_VK_DEVICE and trim non-empty -Device before invoking ctest, restoring exact prior variable presence/value in finally. Preserve CRLF line endings (PS1_CRLF=68, PS1_LF_ONLY=0).
  • Add regression coverage using temporary PATH shims in tests/test_run_conservative_tier3_reference.py.

Tested

  • Patched: python -I tests/test_run_conservative_tier3_reference.py -v -> Ran 3 tests in 3.279s (OK).
  • Baseline check (upstream/main 5e95fa2f with tests/test_run_conservative_tier3_reference.py copied into detached worktree): Ran 3 tests in 2.800s (FAILED (failures=1, errors=3)).
  • Repo gates: PS1_CRLF=68 PS1_LF_ONLY=0, python -I tests/test_ci_registration.py (Ran 16 tests in 5.041s, OK), python -I tests/test_text_write_line_endings.py (Ran 3 tests in 12.657s, 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 (PowerShell runner prerequisite, ctest filter, and environment isolation tests)

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:5492613225 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1873). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-25T13:49:42Z. --- Claimed in the coordination issue as: RUN-CONSERVATIVE-TIER3-REF-PS1-SAFETY-AND-TESTS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7164301040) ### What and why - Check for `cmake` and `ctest` upfront via `Get-Command` in `scripts/run_conservative_tier3_reference.ps1` so a missing `ctest` fails before configuring and building `runtime`. - Wrap native `cmake` / `ctest` invocations in `Invoke-Native` with temporary `$ErrorActionPreference = "Continue"` so benign stderr warnings never raise `NativeCommandError` under strict error policies while non-zero exit codes still fail cleanly with their exit status. - Pass `--no-tests=error` and anchored exact test filter `^d3d12_conservative_tier3_reference$` to `ctest` so zero matched tests cannot silently pass. - Track `$hadPreviousFilter = Test-Path Env:LEONIDA_VK_DEVICE` and trim non-empty `-Device` before invoking `ctest`, restoring exact prior variable presence/value in `finally`. Preserve CRLF line endings (`PS1_CRLF=68, PS1_LF_ONLY=0`). - Add regression coverage using temporary `PATH` shims in `tests/test_run_conservative_tier3_reference.py`. ### Tested - Patched: `python -I tests/test_run_conservative_tier3_reference.py -v` -> `Ran 3 tests in 3.279s` (`OK`). - Baseline check (`upstream/main` `5e95fa2f` with `tests/test_run_conservative_tier3_reference.py` copied into detached worktree): `Ran 3 tests in 2.800s` (`FAILED (failures=1, errors=3)`). - Repo gates: `PS1_CRLF=68 PS1_LF_ONLY=0`, `python -I tests/test_ci_registration.py` (`Ran 16 tests in 5.041s`, `OK`), `python -I tests/test_text_write_line_endings.py` (`Ran 3 tests in 12.657s`, `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 (PowerShell runner prerequisite, ctest filter, and environment isolation tests) 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.
zmasi commented 2026-11-28 12:57:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T12:57:24Z.


#1873 | head b63c28f678 (merged cleanly with main d48a957bb) | python -I tests/test_run_conservative_tier3_reference.py | red on main: FAILED (failures=1, errors=3) (threw CommandNotFoundException instead of clear prerequisite message on missing cmake/ctest, lacked --no-tests=error and anchored ^d3d12_conservative_tier3_reference$, and left Env:LEONIDA_VK_DEVICE unset-restoration edge cases) | green on PR+main: 3 tests OK | Windows 11 (10.0.26200.9974, powershell.exe 5.1.26100.9818), Python 3.12.10 | AI-assisted: yes

Audited scripts/run_conservative_tier3_reference.ps1 and tests/test_run_conservative_tier3_reference.py on Windows 11 PowerShell 5.1, verifying fast prerequisite checks for cmake and ctest before configure, Invoke-Native $ErrorActionPreference = "Continue" scoping so benign native stderr under caller 2>&1 redirection does not abort while non-zero exit codes still throw labeled errors, --no-tests=error + anchored -R ^d3d12_conservative_tier3_reference$, -Device trimming, and exact Test-Path Env:LEONIDA_VK_DEVICE restoration in finally. Also verified tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), and scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7239585006 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1873#issuecomment-7239585006). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T12:57:24Z. --- #1873 | head b63c28f6785a94e3ea0da42ea0be14be98ddf8e7 (merged cleanly with main d48a957bb) | `python -I tests/test_run_conservative_tier3_reference.py` | red on main: `FAILED (failures=1, errors=3)` (threw `CommandNotFoundException` instead of clear prerequisite message on missing `cmake`/`ctest`, lacked `--no-tests=error` and anchored `^d3d12_conservative_tier3_reference$`, and left `Env:LEONIDA_VK_DEVICE` unset-restoration edge cases) | green on PR+main: `3 tests OK` | Windows 11 (`10.0.26200.9974`, `powershell.exe` `5.1.26100.9818`), Python 3.12.10 | AI-assisted: yes Audited `scripts/run_conservative_tier3_reference.ps1` and `tests/test_run_conservative_tier3_reference.py` on Windows 11 PowerShell 5.1, verifying fast prerequisite checks for `cmake` and `ctest` before configure, `Invoke-Native` `$ErrorActionPreference = "Continue"` scoping so benign native stderr under caller `2>&1` redirection does not abort while non-zero exit codes still throw labeled errors, `--no-tests=error` + anchored `-R ^d3d12_conservative_tier3_reference$`, `-Device` trimming, and exact `Test-Path Env:LEONIDA_VK_DEVICE` restoration in `finally`. Also verified `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), and `scripts/check_no_game_data.py`.
OreoFR commented 2026-11-28 21:55:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:55:41Z.


Verified by OreoFR

  • Base: main 3408969a7 + PR head b63c28f67
  • Test: python -I tests/test_run_conservative_tier3_reference.py
  • Red on main: 2 FAIL + 3 ERROR
  • Green with the PR: 1 FAIL + 3 ERROR
  • Verdict: FAILS (with Windows 11's default execution policy (Undefined everywhere, so Restricted) the test runs the .ps1 via powershell.exe -Command without -ExecutionPolicy Bypass (test line 56): UnauthorizedAccess, then ctest.json missing. With PSExecutionPolicyPreference=Bypass for that process only: green 3 OK, red 1 FAIL + 3 ERROR, so the script is fixed and only the test fails on a stock Windows)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246373695 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1873#issuecomment-7246373695). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:55:41Z. --- **Verified by OreoFR** - Base: main `3408969a7` + PR head `b63c28f67` - Test: `python -I tests/test_run_conservative_tier3_reference.py` - Red on main: 2 FAIL + 3 ERROR - Green with the PR: 1 FAIL + 3 ERROR - Verdict: FAILS (with Windows 11's default execution policy (Undefined everywhere, so Restricted) the test runs the .ps1 via `powershell.exe -Command` without `-ExecutionPolicy Bypass` (test line 56): UnauthorizedAccess, then ctest.json missing. With PSExecutionPolicyPreference=Bypass for that process only: green 3 OK, red 1 FAIL + 3 ERROR, so the script is fixed and only the test fails on a stock Windows) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 10:42:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T10:42:35Z.

Review: CHANGES_REQUESTED


The hardening in scripts/run_conservative_tier3_reference.ps1 (upfront cmake/ctest checks, Invoke-Native, --no-tests=error + anchored regex, $hadPreviousFilter + Trim()) looks solid, but requesting changes on two items:

  1. Test fails under default Windows execution policy: In tests/test_run_conservative_tier3_reference.py:56, _run_ps_wrapper invokes powershell.exe -NoProfile -NonInteractive -Command ... without -ExecutionPolicy Bypass (unlike the -File invocations at lines 73, 84, and 168). As confirmed by @OreoFR, this causes UnauthorizedAccess failures on Windows 11 machines using the default Restricted execution policy when running the staged .ps1 script.
  2. Stale/failing CI: The previous CI run had cancelled/failed jobs (windows, check, linux-gpu-tools, translator-tests, stdlib-tests-linux).

Please add "-ExecutionPolicy", "Bypass" to _run_ps_wrapper and re-run CI to green.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6129644873 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1873#pullrequestreview-6129644873). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T10:42:35Z. **Review:** CHANGES_REQUESTED --- The hardening in `scripts/run_conservative_tier3_reference.ps1` (upfront `cmake`/`ctest` checks, `Invoke-Native`, `--no-tests=error` + anchored regex, `$hadPreviousFilter` + `Trim()`) looks solid, but requesting changes on two items: 1. **Test fails under default Windows execution policy:** In `tests/test_run_conservative_tier3_reference.py:56`, `_run_ps_wrapper` invokes `powershell.exe -NoProfile -NonInteractive -Command ...` without `-ExecutionPolicy Bypass` (unlike the `-File` invocations at lines 73, 84, and 168). As confirmed by @OreoFR, this causes `UnauthorizedAccess` failures on Windows 11 machines using the default `Restricted` execution policy when running the staged `.ps1` script. 2. **Stale/failing CI:** The previous CI run had cancelled/failed jobs (`windows`, `check`, `linux-gpu-tools`, `translator-tests`, `stdlib-tests-linux`). Please add `"-ExecutionPolicy", "Bypass"` to `_run_ps_wrapper` and re-run CI to green. *(AI-assisted review.)*
kirigayakazima commented 2026-12-01 11:16:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-12-01T11:16:52Z.


Updated this PR at 4fdd5d053:

  1. Added "-ExecutionPolicy", "Bypass" to _run_ps_wrapper in tests/test_run_conservative_tier3_reference.py:56 (matching lines 73, 84, and 168).
  2. Merged upstream/main (3ee508b46) into the branch (no rebase, no force-push) to refresh CI.

Thanks @aslan2142 and @OreoFR for catching the stock Windows Restricted execution-policy failure!

Verification (Windows 11, PowerShell 5.1, no game data)

  • Red (with PSExecutionPolicyPreference=Restricted before 4fdd5d053): FAILED (failures=1, errors=3) (UnauthorizedAccess)
  • Green (at 4fdd5d053, default policy): python -I tests/test_run_conservative_tier3_reference.py: 3 tests OK
  • Green (at 4fdd5d053, PSExecutionPolicyPreference=Restricted): python -I tests/test_run_conservative_tier3_reference.py: 3 tests OK
  • python -I tests/test_text_write_line_endings.py: 3 tests OK
  • python -I scripts/check_no_game_data.py & git diff --check upstream/main...HEAD: clean (exit 0)

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7309422290 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1873#issuecomment-7309422290). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-12-01T11:16:52Z. --- Updated this PR at `4fdd5d053`: 1. **Added `"-ExecutionPolicy", "Bypass"` to `_run_ps_wrapper`** in `tests/test_run_conservative_tier3_reference.py:56` (matching lines 73, 84, and 168). 2. **Merged `upstream/main` (`3ee508b46`)** into the branch (no rebase, no force-push) to refresh CI. Thanks @aslan2142 and @OreoFR for catching the stock Windows `Restricted` execution-policy failure! ### Verification (Windows 11, PowerShell 5.1, no game data) - **Red** (with `PSExecutionPolicyPreference=Restricted` before `4fdd5d053`): `FAILED (failures=1, errors=3)` (`UnauthorizedAccess`) - **Green** (at `4fdd5d053`, default policy): `python -I tests/test_run_conservative_tier3_reference.py`: **3 tests OK** - **Green** (at `4fdd5d053`, `PSExecutionPolicyPreference=Restricted`): `python -I tests/test_run_conservative_tier3_reference.py`: **3 tests OK** - `python -I tests/test_text_write_line_endings.py`: **3 tests OK** - `python -I scripts/check_no_game_data.py` & `git diff --check upstream/main...HEAD`: clean (exit 0) AI-assisted.
aslan2142 commented 2026-12-01 17:24:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:24:19Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319245601 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1873#issuecomment-7319245601). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:24:19Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

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