Skip to content

fix(cli): delete honors --kubeconfig/--context; clears active-client pointer under --keep-data#165

Merged
saadqbal merged 1 commit into
developfrom
fix/delete-bugbot-kubeconfig-keepdata
Jul 7, 2026
Merged

fix(cli): delete honors --kubeconfig/--context; clears active-client pointer under --keep-data#165
saadqbal merged 1 commit into
developfrom
fix/delete-bugbot-kubeconfig-keepdata

Conversation

@saadqbal

@saadqbal saadqbal commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Resolves both Cursor Bugbot findings on the develop→main PR #164.

High — delete ignored --kubeconfig/--context

tracebloc delete registered --kubeconfig/--context but runDelete never read them, so helm uninstall ran against the ambient current-context. An operator whose current context isn't the local tracebloc cluster could uninstall the wrong release.

  • nodeboot.UninstallChart now takes kubeconfig + kubeContext and appends --kubeconfig / --kube-context to the helm call (only when non-empty, so default-context behavior is unchanged).
  • runDelete threads o.kubeconfigPath / o.contextOverride through.
  • k3d cluster delete targets the cluster by name, so it's context-independent — no change needed there.

Medium — --keep-data left a dangling active-client pointer

Under --keep-data, offboard revoked the credential but left the active-client pointer in ~/.tracebloc, so a later sign-in / reinstall still treated the host as enrolled as the (now-revoked) client.

  • Clear ActiveClientID/Name/Namespace even under --keep-data; the token and on-host datasets stay, and re-running client create re-adopts by cluster_id (§7.5 principle: a dead credential must not leave a live-looking pointer).

Tests

  • unit: --kubeconfig/--kube-context appear in the helm args.
  • delete-level: the flags reach the uninstall seam; --keep-data clears the pointer while sparing the data dir.
  • go build/vet/test ./... green (11 pkgs).

Once merged to develop, #164 (develop→main) picks these up. Rolls up under the §7.10 offboarding work (no separate ticket — Bugbot follow-up).

🤖 Generated with Claude Code


Note

Medium Risk
Changes offboarding teardown (Helm cluster selection) and local enrollment state after revoke; mistakes could uninstall the wrong release or confuse reinstall, but scope is limited to the delete path with new tests.

Overview
Helm uninstall targetingrunDelete forwards --kubeconfig and --context into nodeboot.UninstallChart, which adds --kubeconfig / --kube-context to helm uninstall when set so offboard hits the intended cluster instead of the ambient current-context.

--keep-data enrollment state — After revoke, offboard still clears ActiveClientID, ActiveClientName, and ActiveClientNamespace in config and saves, while leaving ~/.tracebloc on disk so later client create can re-adopt without the host looking still enrolled.

Tests cover Helm args, delete-level flag threading, and active-client clearing under --keep-data.

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

…inter under --keep-data

Two Cursor Bugbot findings on the develop->main PR (#164):

- High: `tracebloc delete` registered --kubeconfig/--context but runDelete
  never read them, so `helm uninstall` ran against the ambient
  current-context — offboarding could uninstall the wrong release when the
  operator's context isn't the tracebloc cluster. UninstallChart now takes
  kubeconfig + kubeContext and appends --kubeconfig/--kube-context (only
  when set, preserving default-context behavior); runDelete threads the
  flags through. (k3d cluster delete targets the cluster by name, so it's
  context-independent.)

- Medium: under --keep-data, offboard revoked the credential but left the
  active-client pointer in ~/.tracebloc, so a later sign-in/reinstall still
  saw the host as enrolled as the (now-revoked) client. Clear
  ActiveClientID/Name/Namespace even under --keep-data (token + on-host data
  stay; re-running `client create` re-adopts by cluster_id), per §7.5.

Tests: flags reach helm (unit + delete-level); --keep-data clears the
pointer while sparing the data dir. go build/vet/test green (11 pkgs).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@saadqbal saadqbal self-assigned this Jul 7, 2026
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.

4 participants