Skip to content

ci(windows-e2e): stop the teardown net failing open - #551

Merged
LukasWodka merged 1 commit into
developfrom
fix/542-teardown-startprocess-failopen
Aug 3, 2026
Merged

ci(windows-e2e): stop the teardown net failing open#551
LukasWodka merged 1 commit into
developfrom
fix/542-teardown-startprocess-failopen

Conversation

@LukasWodka

@LukasWodkaLukasWodka commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The always() safety-net teardown ran k3d cluster delete via Start-Process with no-ErrorAction Stop, no null-check on $p, inside an empty catch, and the step never set $ErrorActionPreference.

So a spawn failure left $p null → $p.HasExited threw → the empty catch ate it → the shared runner kept a leftover tbe2ewin cluster. That is the exact state this net exists to clear, and the one that sends the next run's New-K3dCluster down its reuse path for a false PASS with no real create — the same false-green class as #544, one layer up in the workflow rather than the driver script.

Fix:$ErrorActionPreference = 'Stop', explicit null-check, a timeout-kill that surfaces instead of hiding, and an exit-code check. On failure it does not fail the run — this is always() teardown and the run is already over — but emits a ::warning:: naming the stale cluster and the manual remedy, so a leftover can never be silent again.

Found by Bugbot on the release-train staging hop (client#542), High.

Refs: tracebloc/backend#1426

🤖 Generated with Claude Code


Note

Low Risk
CI-only PowerShell in an always() teardown step; behavior change is better observability and stricter delete validation without altering the main e2e driver or installer.

Overview
The Windows e2e always() teardown step no longer fails open when k3d cluster delete does not actually run or finish.

It sets $ErrorActionPreference = 'Stop', validates that Start-Process returned a process, treats 120s timeout + kill and non-zero exit as failures instead of swallowing them, and replaces the empty catch with a ::warning:: that names tbe2ewin, the reuse-path false-pass risk, and the manual delete command. Successful deletes log confirmation; the step still does not fail the job on teardown errors.

Reviewed by Cursor Bugbot for commit 9020bbb. Bugbot is set up for automated code reviews on this repo. Configure here.

Bugbot, release-train staging hop #542, High. The always() safety-net teardown ran
k3d cluster delete via Start-Process with no -ErrorAction Stop and no null-check on
$p, inside an empty catch, and the inline step did not set $ErrorActionPreference.
A SPAWN failure left $p null, $p.HasExited threw into the empty catch, and the shared
runner kept a leftover tbe2ewin cluster -- the exact state this net exists to clear,
and the one that sends the next run's New-K3dCluster down its reuse path for a false
PASS with no real create.
Now: ErrorActionPreference=Stop, an explicit null-check, a timeout-kill that surfaces
rather than hides, and an exit-code check. On any failure it does NOT fail the run
(this is always() teardown, the run is over) but emits a ::warning:: naming the stale
cluster and the manual fix, so a leftover can never be silent again.
Refs: tracebloc/backend#1426
@LukasWodkaLukasWodka self-assigned this Aug 3, 2026

@shujaatTraceblocshujaatTracebloc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and verified locally.

The rewrite fully closes the fail-open: with $ErrorActionPreference = 'Stop' plus the explicit if ($null -eq $p) throw guard, a Start-Process spawn failure can no longer leave $p null and blow up $p.HasExited inside an empty catch — the exact path that let a stale tbe2ewin cluster survive unseen. Timeout (force-kill → throw), non-zero exit code, and null-process are each surfaced; on any of them the always() step emits a ::warning:: naming the cluster and the manual k3d cluster delete remedy rather than swallowing it, and correctly does not fail the already-finished run.

Checked the edges:

  • k3d cluster delete is idempotent (exit 0 when the cluster is absent, per #544), so a teardown running after the driver's own finally already deleted the cluster exits 0 → logs 'deleted', no spurious warning.
  • $ErrorActionPreference is scoped to this run: step (fresh shell per step, no leak).
  • The deferred data-dir Remove-Item stays outside the try/catch and still always runs; its per-command -ErrorAction SilentlyContinue overrides the Stop preference.

windows-e2e.yaml parses as valid YAML; teardown step is guarded by if: always(). All CI green incl. Cursor Bugbot; no open review threads. Correct that the heavy E2E/Prereqs jobs are path-filtered out for a workflow-only change. LGTM.

@LukasWodka
LukasWodka merged commit 2303a07 into developAug 3, 2026
14 checks passed
@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

/fr-pass

@LukasWodka
LukasWodka deleted the fix/542-teardown-startprocess-failopen branch August 14, 2026 13:53
Sign up for freeto 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.

2 participants

@LukasWodka@shujaatTracebloc