fix(cli): delete honors --kubeconfig/--context; clears active-client pointer under --keep-data#165
Merged
Conversation
…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>
divyasinghds
approved these changes
Jul 7, 2026
aptracebloc
approved these changes
Jul 7, 2026
This was referenced Jul 7, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves both Cursor Bugbot findings on the develop→main PR #164.
High — delete ignored --kubeconfig/--context
tracebloc deleteregistered--kubeconfig/--contextbutrunDeletenever read them, sohelm uninstallran against the ambient current-context. An operator whose current context isn't the local tracebloc cluster could uninstall the wrong release.nodeboot.UninstallChartnow takeskubeconfig+kubeContextand appends--kubeconfig/--kube-contextto the helm call (only when non-empty, so default-context behavior is unchanged).runDeletethreadso.kubeconfigPath/o.contextOverridethrough.k3d cluster deletetargets 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.ActiveClientID/Name/Namespaceeven under--keep-data; the token and on-host datasets stay, and re-runningclient createre-adopts bycluster_id(§7.5 principle: a dead credential must not leave a live-looking pointer).Tests
--kubeconfig/--kube-contextappear in the helm args.--keep-dataclears 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 targeting —
runDeleteforwards--kubeconfigand--contextintonodeboot.UninstallChart, which adds--kubeconfig/--kube-contexttohelm uninstallwhen set so offboard hits the intended cluster instead of the ambient current-context.--keep-dataenrollment state — After revoke, offboard still clearsActiveClientID,ActiveClientName, andActiveClientNamespacein config and saves, while leaving~/.traceblocon disk so laterclient createcan 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.