Scripts: validate smoke duration before launching XCL #1071

Open
broccolize wants to merge 1 commit from upstream-pr/1080 into main
broccolize commented 2026-11-24 11:23:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by broccolize on 2026-11-24T11:23:41Z.


Validate the smoke run duration and startup allowance before launching XCL so their combined wait fits the Windows process wait API. -Seconds 0 remains available for startup diagnostics.

What is in it

  • Reject negative durations during parameter binding. Validate the combined duration and -StartupTimeoutSeconds before starting XCL, then pass the validated timeout to WaitForExit.
  • Test zero, negative inputs, and both sides of the combined limit with default and custom startup timeouts.
  • Run the PowerShell duration fixture from scripts/test.ps1, the entry point used by Windows CI.
  • Document zero-duration startup diagnostics. RavenCurseBurg’s compatibility patch

Tested

  • Clean head 319c5cf0a7eb40a250f1cc0a7ad5b2b3a99858b2 on main 493dbd3. The duration, smoke-title, and smoke-artifacts fixtures passed in PowerShell 7.6.9 and Windows PowerShell 5.1.26100.9818. Test-runner probes with a Cargo stand-in confirmed all existing Cargo steps run after a passing duration fixture and a failed fixture stops before Cargo.

  • Earlier head 4fc779e1db2ffea1586a84c60e0de58c10fc5230 on upstream main 8b957be. scripts/test-smoke-duration.tests.ps1 passed in PowerShell 7.6.9 and Windows PowerShell 5.1.26100.9818.

  • Ten additional mock-launcher cases passed in each shell. The default, zero, and boundary durations reached the child with the expected XCL_RUN_SECONDS. Invalid and overflowing combinations exited before launch.

  • On the earlier compatibility revision 267d794 based on cbc296a, cargo build --locked --workspace passed. cargo test --locked --workspace --no-fail-fast -- --test-threads=4 reported 1,153 passed, 1 failed, 46 ignored, and 34 skip diagnostics on Windows 11 build 26300.9974, Intel i5-10300H, and NVIDIA GTX 1650 driver 617.14, with Rust 1.100.0 MSVC in debug mode. execute_indirect_reads_the_arguments_written_before_it also failed in the earlier focused run on its clean upstream base.

Not tested

  • A retail title or an actual multi-day wait. The full Rust workspace suite above ran on the earlier revision.

AI use

  • OpenAI Codex (GPT-6) applied the credited compatibility patch, updated it for the configurable startup allowance, wired the duration fixture into the Windows test runner, and ran the PowerShell and workspace verification.
<!-- greyfinch-sync:ivall/xcl:issue:5471200824 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1080). Originally posted by [broccolize](https://github.com/broccolize) on 2026-11-24T11:23:41Z. --- Validate the smoke run duration and startup allowance before launching XCL so their combined wait fits the Windows process wait API. `-Seconds 0` remains available for startup diagnostics. **What is in it** - Reject negative durations during parameter binding. Validate the combined duration and `-StartupTimeoutSeconds` before starting XCL, then pass the validated timeout to `WaitForExit`. - Test zero, negative inputs, and both sides of the combined limit with default and custom startup timeouts. - Run the PowerShell duration fixture from `scripts/test.ps1`, the entry point used by Windows CI. - Document zero-duration startup diagnostics. [RavenCurseBurg’s compatibility patch](https://github.com/RavenCurseBurg/xcl/commit/36050bb04d62915bfa2711f87944951d8644f256) **Tested** - Clean head `319c5cf0a7eb40a250f1cc0a7ad5b2b3a99858b2` on `main` `493dbd3`. The duration, smoke-title, and smoke-artifacts fixtures passed in PowerShell 7.6.9 and Windows PowerShell 5.1.26100.9818. Test-runner probes with a Cargo stand-in confirmed all existing Cargo steps run after a passing duration fixture and a failed fixture stops before Cargo. - Earlier head `4fc779e1db2ffea1586a84c60e0de58c10fc5230` on upstream `main` `8b957be`. `scripts/test-smoke-duration.tests.ps1` passed in PowerShell 7.6.9 and Windows PowerShell 5.1.26100.9818. - Ten additional mock-launcher cases passed in each shell. The default, zero, and boundary durations reached the child with the expected `XCL_RUN_SECONDS`. Invalid and overflowing combinations exited before launch. - On the earlier compatibility revision `267d794` based on `cbc296a`, `cargo build --locked --workspace` passed. `cargo test --locked --workspace --no-fail-fast -- --test-threads=4` reported 1,153 passed, 1 failed, 46 ignored, and 34 skip diagnostics on Windows 11 build 26300.9974, Intel i5-10300H, and NVIDIA GTX 1650 driver 617.14, with Rust 1.100.0 MSVC in debug mode. `execute_indirect_reads_the_arguments_written_before_it` also failed in the earlier focused run on its clean upstream base. **Not tested** - A retail title or an actual multi-day wait. The full Rust workspace suite above ran on the earlier revision. **AI use** - OpenAI Codex (GPT-6) applied the credited compatibility patch, updated it for the configurable startup allowance, wired the duration fixture into the Windows test runner, and ran the PowerShell and workspace verification.
futurepro62 commented 2026-11-24 15:05:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:15:21Z.


Tested exact head 04fcd86, script tests only, since this PR has no test report yet.

Tested

  • Windows 11 Home 26300, Python 3.14.3 with pytest 9.0.3, Windows PowerShell 5.1.26100.9818 (no PowerShell 7 here).
  • powershell.exe -NoProfile -File scripts/test-smoke-duration.tests.ps1 at the head: exit 0.
  • The PR's test file(s) against current main's script (930e8b4): exit 1: main's smoke.ps1 does not check the duration first and fails later with no <...>.exe - build it first. So the new test catches the problem the PR fixes.

Not tested

  • PowerShell 7, the CI workflow itself, a game (no runtime code changed).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7134081494 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1080#issuecomment-7134081494). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T14:15:21Z. --- Tested exact head `04fcd86`, script tests only, since this PR has no test report yet. **Tested** - Windows 11 Home 26300, Python 3.14.3 with pytest 9.0.3, Windows PowerShell 5.1.26100.9818 (no PowerShell 7 here). - `powershell.exe -NoProfile -File scripts/test-smoke-duration.tests.ps1` at the head: exit 0. - The PR's test file(s) against current main's script (`930e8b4`): exit 1: main's `smoke.ps1` does not check the duration first and fails later with `no <...>.exe - build it first`. So the new test catches the problem the PR fixes. **Not tested** - PowerShell 7, the CI workflow itself, a game (no runtime code changed). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
DavidM1911 commented 2026-11-25 09:08:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T08:36:53Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7157255995 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1080#issuecomment-7157255995). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T08:36:53Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
RavenCurseBurg commented 2026-11-25 14:35:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-25T14:35:47Z.


Verified c86fa9b055957129961edb23ae86b3c86a1b3794 through <shell> -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts\smoke.ps1 -Game Fixture -Xcl <stub.exe> [-Seconds N]. The native stub recorded its inherited XCL_RUN_SECONDS, printed the fixture log path and exited immediately. Results matched in Windows PowerShell 5.1.26100.9711 and PowerShell 7.6.9:

Duration argument Child observed Smoke script exit
omitted 60 0
1 1 0
2,147,363 2,147,363 0
−1, 0, or 2,147,364 no child launched for any of the three 1

Each valid case also printed the matching seconds: field and exit: 0x0. scripts\test-smoke-duration.tests.ps1 passed in both shells. The upper-bound case exercised the actual process-wait call with a short-lived child. It does not measure an elapsed multi-day timeout.

Windows 11 26100.9711, i7-13700, RTX 4060. No retail run, Rust build or GPU workload. OpenAI Codex (GPT-6) ran the fixture and wrote the report.

Follow-up on review feedback

I checked the zero-duration review against the PR head and the smoke script from main b49be1836844. On Windows PowerShell 5.1 and PowerShell 7, main forwarded XCL_RUN_SECONDS=0 to an immediately exiting native stand-in and printed seconds: 0. The PR head rejected zero before starting the stand-in. The runtime source parses the value as u64 and passes it to Duration::from_secs.

Compatibility candidate keeps the 120-second grace period and the existing upper bound. On both shells, 0, 1 and 2147363 reached the child with their exact values. −1 and 2147364 exited before the child could write its marker. scripts/test-smoke-duration.tests.ps1 also passed in both shells. Actual title startup, GPU shutdown and a long-running child were outside these checks.

Parent of the PR-based candidate: c86fa9b055957129961edb23ae86b3c86a1b3794. OpenAI Codex (GPT-6) prepared the changes and ran the Windows CPU fixtures. No game, Rust workspace build or GPU workload.

Retest on the rebased head 4fc779e1db2f

The rebased script now accepts zero and checks the sum of the guest duration and startup timeout. On Windows PowerShell 5.1 and PowerShell 7, the checked-in duration suite passed. I also ran nine CLI cases per shell with an immediately exiting native fixture. With the default startup timeout, the child received 0, 1 and 2,147,363 seconds exactly. Durations of −1 and 2,147,364 were rejected before the child started. With a 1-second startup timeout, 2,147,482 seconds reached the child, and raising that timeout to 2 seconds rejected the same duration. With an 86,400-second startup timeout, 2,061,083 seconds reached the child and 2,061,084 was rejected before launch.

This covers the zero-duration feedback and the revised wait limit. OpenAI Codex (GPT-6) ran the CPU-only fixtures. Actual title startup and elapsed multi-day waits were outside this run.

<!-- greyfinch-sync:ivall/xcl:comment:7165520206 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1080#issuecomment-7165520206). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T14:35:47Z. --- Verified `c86fa9b055957129961edb23ae86b3c86a1b3794` through `<shell> -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts\smoke.ps1 -Game Fixture -Xcl <stub.exe> [-Seconds N]`. The native stub recorded its inherited `XCL_RUN_SECONDS`, printed the fixture log path and exited immediately. Results matched in Windows PowerShell 5.1.26100.9711 and PowerShell 7.6.9: | Duration argument | Child observed | Smoke script exit | | --- | --- | --- | | omitted | 60 | 0 | | 1 | 1 | 0 | | 2,147,363 | 2,147,363 | 0 | | −1, 0, or 2,147,364 | no child launched for any of the three | 1 | Each valid case also printed the matching `seconds:` field and `exit: 0x0`. `scripts\test-smoke-duration.tests.ps1` passed in both shells. The upper-bound case exercised the actual process-wait call with a short-lived child. It does not measure an elapsed multi-day timeout. Windows 11 26100.9711, i7-13700, RTX 4060. No retail run, Rust build or GPU workload. OpenAI Codex (GPT-6) ran the fixture and wrote the report. **Follow-up on review feedback** I checked the zero-duration review against the PR head and the smoke script from main `b49be1836844`. On Windows PowerShell 5.1 and PowerShell 7, main forwarded `XCL_RUN_SECONDS=0` to an immediately exiting native stand-in and printed `seconds: 0`. The PR head rejected zero before starting the stand-in. The runtime source parses the value as `u64` and passes it to `Duration::from_secs`. [Compatibility candidate](https://github.com/RavenCurseBurg/xcl/commit/36050bb04d62915bfa2711f87944951d8644f256) keeps the 120-second grace period and the existing upper bound. On both shells, 0, 1 and 2147363 reached the child with their exact values. −1 and 2147364 exited before the child could write its marker. `scripts/test-smoke-duration.tests.ps1` also passed in both shells. Actual title startup, GPU shutdown and a long-running child were outside these checks. Parent of the PR-based candidate: `c86fa9b055957129961edb23ae86b3c86a1b3794`. OpenAI Codex (GPT-6) prepared the changes and ran the Windows CPU fixtures. No game, Rust workspace build or GPU workload. **Retest on the rebased head `4fc779e1db2f`** The rebased script now accepts zero and checks the sum of the guest duration and startup timeout. On Windows PowerShell 5.1 and PowerShell 7, the checked-in duration suite passed. I also ran nine CLI cases per shell with an immediately exiting native fixture. With the default startup timeout, the child received 0, 1 and 2,147,363 seconds exactly. Durations of −1 and 2,147,364 were rejected before the child started. With a 1-second startup timeout, 2,147,482 seconds reached the child, and raising that timeout to 2 seconds rejected the same duration. With an 86,400-second startup timeout, 2,061,083 seconds reached the child and 2,061,084 was rejected before launch. This covers the zero-duration feedback and the revised wait limit. OpenAI Codex (GPT-6) ran the CPU-only fixtures. Actual title startup and elapsed multi-day waits were outside this run.
luckyteagirl commented 2026-11-26 05:44:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T05:44:30Z.

Review: COMMENTED


Could the lower bound remain 0? -Seconds 0 currently reaches XCL as XCL_RUN_SECONDS=0; the host accepts that value and immediately writes its run report, flushes the log, and ends the title. With a mock launcher on both Windows PowerShell 5.1 and PowerShell 7, main produced a seconds: 0 smoke block, while this head rejected the parameter before launching. ValidateRange(0, 2147363) keeps the timeout bound and preserves that startup-diagnostic use; the fixture could move zero to the accepted cases. Verified at exact head c86fa9b055957129961edb23ae86b3c86a1b3794 with a mock, not a retail run. AI-assisted review with Codex.

<!-- greyfinch-sync:ivall/xcl:review:6069115295 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1080#pullrequestreview-6069115295). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T05:44:30Z. **Review:** COMMENTED --- Could the lower bound remain `0`? `-Seconds 0` currently reaches XCL as `XCL_RUN_SECONDS=0`; the host accepts that value and immediately writes its run report, flushes the log, and ends the title. With a mock launcher on both Windows PowerShell 5.1 and PowerShell 7, main produced a `seconds: 0` smoke block, while this head rejected the parameter before launching. `ValidateRange(0, 2147363)` keeps the timeout bound and preserves that startup-diagnostic use; the fixture could move zero to the accepted cases. Verified at exact head `c86fa9b055957129961edb23ae86b3c86a1b3794` with a mock, not a retail run. AI-assisted review with Codex.
JJAutoCompare commented 2026-11-27 00:24:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T00:24:52Z.


Tested: Clean 4fc779e1db2ffea1586a84c60e0de58c10fc5230, Windows 11 build 26200.9974, Ryzen 7 3800X. Windows PowerShell 5.1.26100.9818: powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File <script> passed for scripts/test-smoke-duration.tests.ps1, scripts/smoke-title.tests.ps1 and scripts/test-smoke-artifacts.tests.ps1. A supplementary synthetic batch launcher probe passed all five cases. Duration/startup pairs (-1,120), (2147482,2), (1,0) and (1,86401) exited 1 without launching the child. The (0,1) control launched with XCL_RUN_SECONDS=0 and both processes exited 0. No failed, ignored or skipped cases.

Not tested: PowerShell 7, multi-day elapsed waits, Rust workspace tests, retail smoke and GPU.

AI use: T3 Code / Codex (gpt-6.2-sol) ran and reran the checks and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7206439982 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1080#issuecomment-7206439982). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-27T00:24:52Z. --- **Tested:** Clean `4fc779e1db2ffea1586a84c60e0de58c10fc5230`, Windows 11 build 26200.9974, Ryzen 7 3800X. Windows PowerShell 5.1.26100.9818: `powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File <script>` passed for `scripts/test-smoke-duration.tests.ps1`, `scripts/smoke-title.tests.ps1` and `scripts/test-smoke-artifacts.tests.ps1`. A supplementary synthetic batch launcher probe passed all five cases. Duration/startup pairs `(-1,120)`, `(2147482,2)`, `(1,0)` and `(1,86401)` exited 1 without launching the child. The `(0,1)` control launched with `XCL_RUN_SECONDS=0` and both processes exited 0. No failed, ignored or skipped cases. **Not tested:** PowerShell 7, multi-day elapsed waits, Rust workspace tests, retail smoke and GPU. **AI use:** T3 Code / Codex (`gpt-6.2-sol`) ran and reran the checks and wrote this report.
Foniass commented 2026-12-01 04:46:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:46:52Z.


Triage (#1607) – head 319c5cf

No open or merged PR makes the same change. #1073 edits the same WaitForExit(($Seconds + $StartupTimeoutSeconds) * 1000) line in scripts/smoke.ps1, and its test fixture looks for that exact expression, so whichever merges second needs a rebase.
scripts/test.ps1 now runs scripts/test-smoke-duration.tests.ps1, so CI runs it with the rest of the suite.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7301093045 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1080#issuecomment-7301093045). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:46:52Z. --- **Triage (#1607)** – head 319c5cf No open or merged PR makes the same change. #1073 edits the same `WaitForExit(($Seconds + $StartupTimeoutSeconds) * 1000)` line in scripts/smoke.ps1, and its test fixture looks for that exact expression, so whichever merges second needs a rebase. scripts/test.ps1 now runs scripts/test-smoke-duration.tests.ps1, so CI runs it with the rest of the suite. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Foniass commented 2026-12-01 20:49:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T20:49:40Z.


Follow-up review (head 319c5cf0, since 4fc779e, diff read, not a merge-check):

  • Keep open; conflicts with #1073: still open. #1073 changes the same WaitForExit(($Seconds + $StartupTimeoutSeconds) * 1000) line and its fixture looks for that exact string, while this PR replaces it with [int]$waitMilliseconds (scripts/smoke.ps1 ~74). Whichever merges second needs a rebase and #1073's fixture string updated.

New: none. Since the earlier head the change is a rebase plus wiring the fixture into scripts/test.ps1 (~5-6), so CI runs it.

Fine: [ValidateRange(0, 2147482)] with the [long] sum check (~16, ~26-29) rejects every combination above [int]::MaxValue ms before XCL starts; the fixture covers both sides of the limit with default and custom startup allowances; XCL_RUN_SECONDS=0 does end the title right after host setup (host.rs ~294), as the README sentence says.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7325332304 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1080#issuecomment-7325332304). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T20:49:40Z. --- Follow-up review (head 319c5cf0, since 4fc779e, diff read, not a merge-check): - **Keep open; conflicts with #1073:** still open. #1073 changes the same `WaitForExit(($Seconds + $StartupTimeoutSeconds) * 1000)` line and its fixture looks for that exact string, while this PR replaces it with `[int]$waitMilliseconds` (`scripts/smoke.ps1` ~74). Whichever merges second needs a rebase and #1073's fixture string updated. New: none. Since the earlier head the change is a rebase plus wiring the fixture into `scripts/test.ps1` (~5-6), so CI runs it. Fine: `[ValidateRange(0, 2147482)]` with the `[long]` sum check (~16, ~26-29) rejects every combination above `[int]::MaxValue` ms before XCL starts; the fixture covers both sides of the limit with default and custom startup allowances; `XCL_RUN_SECONDS=0` does end the title right after host setup (`host.rs` ~294), as the README sentence says. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1080:upstream-pr/1080'
git switch 'upstream-pr/1080'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1080'
git switch 'upstream-pr/1080'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1080'
git switch 'upstream-pr/1080'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1080'
git switch 'main'
git merge --squash 'upstream-pr/1080'
git switch 'main'
git merge --ff-only 'upstream-pr/1080'
git switch 'main'
git merge 'upstream-pr/1080'
git push origin 'main'
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
xcl-dev/xcl!1071
No description provided.