Skip to content

fix(pi): a 5s test deadline cannot cover a cold Python launch on Windows - #496

Merged
SUaDtL merged 2 commits into
mainfrom
fix/495-windows-spawn-deadline
Jul 26, 2026
Merged

fix(pi): a 5s test deadline cannot cover a cold Python launch on Windows#496
SUaDtL merged 2 commits into
mainfrom
fix/495-windows-spawn-deadline

Conversation

@SUaDtL

@SUaDtL SUaDtL commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

What

The pi security-evidence test gets a platform-aware deadline. Both tests in the file that spawn Python synchronously get it.

Why

test/security.test.ts:412 fails on windows-latest with Error: Test timed out in 5000ms — a harness timeout, not an assertion. Observed three times on 2026-07-26 across two branches and both pinned Pi runtimes, while ubuntu-latest and macos-latest passed every one of those runs. It also fails on main (run 30203161506, commit e0557558), so it is not branch-specific.

Three lines of evidence that the code under test is not the problem:

  • test_pi_security.py --contract-only runs in 72ms locally.
  • It imports neither module recently changed in this area (_sloplib, _bashguardlib) — zero references.
  • The failure is a timeout, and every assertion in the test passes when it completes.

What does not fit in 5s is a cold CPython process launch on a loaded Windows runner, and the whole cost is billed against the test's own budget because spawnSync is synchronous. The deadline was provisioned for the script's runtime when what it has to cover is a process creation.

Why it is not cosmetic

[GATE ] | [REPO] | Merge readiness aggregates this suite, and the release preflight requires that gate green for the exact commit being tagged (#385). So a flake here does not just cost a re-run — it blocks the release lane for that SHA, and it trains readers to re-run a red gate without reading it, which is the habit the gate exists to prevent. It cost two merge attempts on #494.

How

PYTHON_SPAWN_TIMEOUT_MS = process.platform === "win32" ? 30_000 : 5_000, applied as the third argument to both Python-spawning tests. Platform-aware rather than uniformly larger, so a genuine hang on the fast platforms still surfaces as a hang. The reasoning lives in the code, not just here.

No assertion is weakened or removed — the secret-bearing ambient-value checks are byte-identical.

Versions

No bump. plugins/ca-pi/tools/** is outside the shipped payload per payload_scope.py, and this changes a test only. Confirmed: payload_scope.py --plugin plugins/ca-pi reports unchanged.

Locally: tsc --noEmit clean, test/security.test.ts 19/19 passed.

Closes #495

https://claude.ai/code/session_01Y8UPz5RZwgnda3NbAVfd6L

SUaDtL added 2 commits July 26, 2026 10:11
The pi security-evidence test fails on windows-latest with "Test timed out in
5000ms" - a harness timeout, not an assertion. Seen three times on 2026-07-26
across two branches and both pinned Pi runtimes, while ubuntu-latest and
macos-latest passed every one of those runs. It fails on main too (run
30203161506), so it is not branch-specific.

The script is not the slow part: `test_pi_security.py --contract-only` runs in
about 70ms, and it imports nothing this repository changed recently. What does
not fit in 5s is a cold CPython process launch on a loaded Windows runner, and
the whole cost lands inside the test's budget because the spawn is synchronous.
The deadline was provisioned for the script's runtime when what it has to cover
is a process creation.

So the timeout is what is wrong, not the code under test, and it is now
platform-aware rather than uniformly larger - a genuine hang on the fast
platforms still surfaces as a hang. Both tests in the file that spawn Python
synchronously get it, so the second does not resurface separately (AC-4). No
assertion is touched: the secret-bearing ambient-value checks are unchanged.

This is not cosmetic. `[GATE ] | [REPO] | Merge readiness` aggregates this
suite, and the release preflight requires that gate green for the EXACT commit
being tagged (#385), so a flake here blocks the release lane for that SHA and
trains readers to re-run a red gate without reading it. It cost two merge
attempts on PR #494.

No version bump: plugins/ca-pi/tools/** is outside the shipped payload
(payload_scope.py), and this changes a test only.

Closes #495

Claude-Session: https://claude.ai/code/session_01Y8UPz5RZwgnda3NbAVfd6L
The audit log is resolved as an append-only union: main's committed order first,
then this session's rows. Taking either side outright would drop real gate
events, and gate-events.log is an audit artifact (H-05), not a scratch file.
@SUaDtL
SUaDtL merged commit dd2653f into main Jul 26, 2026
37 checks passed
@SUaDtL
SUaDtL deleted the fix/495-windows-spawn-deadline branch July 26, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flaky: pi security-evidence test times out on windows-latest (5s deadline covers a cold Python launch)

1 participant