Skip to content

fix: Bugbot findings from promotion PR #383 (probe timeout + kubectl version + Windows leftover-data guard) - #406

Merged
shujaatTracebloc merged 4 commits into
developfrom
fix/bugbot-ps-guard-probe-kubever
Jul 27, 2026
Merged

fix: Bugbot findings from promotion PR #383 (probe timeout + kubectl version + Windows leftover-data guard)#406
shujaatTracebloc merged 4 commits into
developfrom
fix/bugbot-ps-guard-probe-kubever

Conversation

@shujaatTracebloc

@shujaatTraceblocshujaatTracebloc commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Resolves three Cursor Bugbot findings on the client promotion PR (#383, develop → main).

Fixes:

  • Probe hangs on wedged Docker (High) — _probe_runtime_usable (scripts/lib/probe.sh) ran a bare docker info with no timeout, and run_host_probes calls it on every install, so a wedged Docker daemon hung a headless SSH install indefinitely. Now bounded with timeout/gtimeout (a 5s cap, TB_PROBE_TIMEOUT-overridable) when either is present, falling back to the bare call otherwise. Read-only and never fatal — a timeout just reads as "not usable". (Release develop → main #383 (comment))
  • Retry notices corrupt kubectl version (High) — install_kubectl (scripts/lib/setup-linux.sh) captured retry's stdout notices into KUBE_VER, polluting the version and breaking the download URL. Isolated the value the same way the Helm resolver does: tail -1 + tr -d '[:space:]' + a version-tag regex that fails closed on an unresolvable value. (Release develop → main #383 (comment))
  • Windows missing leftover-data guard (Medium) — New-K3dCluster (scripts/install-k8s.ps1) never checked for leftover data, so Windows reinstalls silently adopted prior MySQL/dataset data (bash has guard_leftover_data; the README documents the guarantee). Ported the guard to PowerShell: detects leftover data (flat + per-release layouts), and on a fresh cluster prompts reuse / wipe / different-dir, honoring $env:TB_LEFTOVER_ACTION (reuse|wipe), $env:HOST_DATA_DIR (different dir), and $env:TRACEBLOC_SKIP_LEFTOVER_GUARD, with a non-interactive fail-safe abort — matching the bash contract and the README. Windows is hostpath-only (New-K3dCluster always bind-mounts HOST_DATA_DIR), so it's scoped to hostpath; node-local (RFC-0003 Option C) is a Linux/k3s prototype with no Windows path. Refactored the HOST_DATA_DIR validation out of Confirm-Config into a shared Confirm-DataDir rather than duplicating it. (Release develop → main #383 (comment))

Coverage: bats tests for the bounded docker probe (timeout applied / fallback / non-zero → not usable) and the kubectl version isolation (clean capture / fails closed on a notice-only result); Pester tests for Get-LeftoverDataDirs detection and Invoke-LeftoverDataGuard (skip / reuse / wipe / non-interactive abort / interactive w / default abort). scripts/manifest.sha256 refreshed for the probe.sh + setup-linux.sh + install-k8s.ps1 changes. No golden impact (probe/kubectl/leftover paths aren't captured in the copy-catalog goldens).

Lands on develop; the promotion PR head picks these up on the next develop sync and Bugbot re-reviews.

🤖 Generated with Claude Code


Note

Medium Risk
Changes affect every install’s runtime probe and fresh Windows cluster creation (data wipe paths); mistakes could hang installs, fetch wrong kubectl, or mishandle user data—mitigated by fail-closed behavior and extensive tests.

Overview
Addresses three Bugbot findings from promotion PR #383: installer reliability on wedged Docker, corrupted kubectl version strings, and missing Windows parity for leftover-data protection.

Linux (probe.sh, setup-linux.sh)_probe_runtime_usable now caps docker info with timeout/gtimeout (default 5s, TB_PROBE_TIMEOUT) so every install’s host probe cannot hang on a wedged daemon; failures stay non-fatal (“not usable”). install_kubectl isolates the version from dl.k8s.io/release/stable.txt with tail -1, whitespace strip, and a tag regex so retry stdout notices no longer pollute KUBE_VER and break the download URL.

Windows (install-k8s.ps1) — Ports bash guard_leftover_data before new k3d cluster creation: detects real MySQL/dataset data (flat and per-release layouts), prompts reuse / wipe / new dir / abort, honors TB_LEFTOVER_ACTION, HOST_DATA_DIR, and TRACEBLOC_SKIP_LEFTOVER_GUARD, and fails closed when non-interactive with no choice. Shared Confirm-DataDir replaces duplicated HOST_DATA_DIR validation; wipe uses Remove-TreeNoFollow so nested junctions are unlinked without deleting targets outside the tree. Help documents reinstall behavior.

Docs & supply chain.cursor/BUGBOT.md updates reviewer guidance (curl_secure(), ingestor prodDigest in chart defaults). scripts/manifest.sha256 refreshed for touched bootstrap scripts.

Tests — New/extended bats (probe.bats, setup-linux.bats) and Pester coverage for detection, guard actions, and junction-safe wipe.

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

…version + Windows leftover-data guard)
A) Probe hangs on wedged Docker (High): _probe_runtime_usable ran bare
`docker info` (no timeout) on every install, so a wedged daemon hung a
headless SSH install forever. Bound it with timeout/gtimeout when present
(fallback to bare call); read-only and never fatal.
B) Retry notices corrupt kubectl version (High): KUBE_VER captured retry's
stdout notices, polluting the version and breaking the download URL. Isolate
it the way the Helm resolver does — tail -1 + tr + a version-tag regex that
fails closed on an unresolvable value.
C) Windows missing leftover-data guard (Medium): New-K3dCluster silently
adopted prior data. Port guard_leftover_data to PowerShell (detect flat +
per-release layouts, prompt reuse/wipe/new/abort, honor TB_LEFTOVER_ACTION /
HOST_DATA_DIR / TRACEBLOC_SKIP_LEFTOVER_GUARD, non-interactive fail-safe
abort). Windows is hostpath-only (node-local has no Windows path). Refactored
HOST_DATA_DIR validation into a shared Confirm-DataDir.
Regenerate scripts/manifest.sha256 (probe.sh, setup-linux.sh, install-k8s.ps1).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment threadscripts/install-k8s.ps1
Comment threadscripts/lib/setup-linux.sh
Comment threadscripts/install-k8s.ps1
…d-probe-kubever
# Conflicts:
#	scripts/manifest.sha256
#	scripts/tests/install-k8s.Tests.ps1

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6c282d7. Configure here.

Comment threadscripts/install-k8s.ps1
shujaat hasanand others added 2 commits July 27, 2026 11:08
…llow-ups)
1) Pester (ubuntu-latest) failed: the new leftover-data-guard tests hardcoded
Windows '\' separators, which are literal chars (not separators) under Linux
pwsh, so Get-LeftoverDataDirs (Join-Path -> '/') never matched the expected
paths. Build all test paths with Join-Path / [IO.Path]::Combine so they pass
on both Windows and Linux pwsh. Behavior/coverage unchanged.
2) Wipe could follow nested junctions (Bugbot r3655703571): Remove-LeftoverData
guarded only the TOP-LEVEL reparse point, then `Remove-Item -Recurse`, which
on Windows PowerShell 5.1 descends into nested junctions and can delete
targets OUTSIDE HOST_DATA_DIR. Add Remove-TreeNoFollow (rm -rf semantics):
walk depth-first and unlink any reparse point without descending, so a nested
junction is removed but its target is never touched. Add a Pester test for it.
Regenerate scripts/manifest.sha256 for the install-k8s.ps1 change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ugbot #383
A) Curl TLS section described CURL_SECURE as a hand-spliced constant with a stale
"already missing" list. The real rule is the curl_secure() wrapper in
common.sh, enforced by check-style.sh rule 3 ("no bare curl"). Rewrote the
bullet to flag bare curl bypassing curl_secure(), with the real exemptions.
B) Prod overlay section told reviewers CI ignores client/values-prod.yaml and to
flag overlay digest edits. That overlay was deleted; the fleet-wide prod pin
moved to the chart default images.ingestor.prodDigest, which
ingestor-multiarch (helm-ci.yaml) reads and hard-fails on (empty or
single-arch). Rewrote to the real contract.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@shujaatTracebloc
shujaatTracebloc merged commit 37817c8 into developJul 27, 2026
31 checks passed
@shujaatTracebloc
shujaatTracebloc deleted the fix/bugbot-ps-guard-probe-kubever branch July 27, 2026 09:26
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.

3 participants

@shujaatTracebloc@saadqbal@LukasWodka