Skip to content

fix(cli): honest offboard closing + clear pointer on failed wipe; drop stale client-list hints - #168

Merged
saadqbal merged 1 commit into
developfrom
fix/delete-pointer-after-wipe
Jul 7, 2026
Merged

fix(cli): honest offboard closing + clear pointer on failed wipe; drop stale client-list hints#168
saadqbal merged 1 commit into
developfrom
fix/delete-pointer-after-wipe

Conversation

@saadqbal

@saadqbalsaadqbal commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Thorough review pass on the develop→main PR #164 — resolves the new Cursor Bugbot finding and the adjacent issues a full review surfaced, so #164 can go clean.

Bugbot: stale client pointer after a failed wipe

After revoke, if rm -rf ~/.tracebloc failed, the default path left the active-client pointer intact (the --keep-data path cleared it — an asymmetry my earlier #165 fix introduced). Now the pointer is cleared in memory once after revoke and persisted in both paths, including the wipe-failure branch. The host never looks enrolled under a dead credential.

Misleading success line

The closing Offboarded … no longer connected printed unconditionally, even when uninstall / cluster teardown / data wipe left real state behind (all best-effort warns). Now a degraded flag tracks the state-leaving steps and the closing tells the truth — "the credential is revoked, but some cleanup didn't complete; finish the flagged steps by hand."

  • Image reclaim is pure disk cleanup, so it's excluded from degraded (its own warning already surfaces).
  • Exit stays 0: the credential revoke — the security-critical core — succeeded. (Happy to make degraded exit non-zero for automation if you'd prefer — flag it.)

Online guard found=false

A stored id not in the signed-in account now emits a hint instead of silently passing the guard (wrong-account / stale-pointer case).

Stale copy

  • client status errors pointed at the now-hidden client list; retargeted to client create / the installer (matching the phrasing used elsewhere in the diff).
  • Fixed a create/use comment (use was removed this release).

Review scope

Fanned out a full correctness review across the whole #164 diff (offboard, surface/API, schema+parity/goldens). The schema/parity + registry changes came back clean. Remaining offboard candidates were either documented invariants (release-name = namespace) or speculative, and are left as-is.

Tests

Added: failed wipe still clears the pointer; a failed teardown produces the degraded closing. go build/vet/test ./... green (11 pkgs).

Rolls up under the §7.10 offboarding work (Bugbot follow-up — no separate ticket).

🤖 Generated with Claude Code


Note

Medium Risk
Changes offboarding behavior and local config persistence after revoke; mistakes could leave users thinking offboard succeeded or still enrolled, but scope is CLI UX/guards with tests and exit 0 only when revoke succeeds.

Overview
Offboard (tracebloc delete) now reports outcomes honestly and keeps local enrollment state consistent after revoke.

After credential revoke, the active-client pointer is cleared in memory once (before --keep-data vs full wipe), so the host does not still look enrolled under a dead credential. If rm -rf ~/.tracebloc fails, the cleared pointer is persisted via cfg.Save() anyway.

A degraded flag tracks best-effort steps that leave real state behind (Helm uninstall, cluster teardown, missing namespace skip, failed data wipe). The final line is a warning when cleanup was incomplete, not an unconditional “no longer connected” success. Image prune failures still only warn and do not set degraded.

The pre-offboard online guard now hints when the stored client id is missing from the signed-in account (stale pointer / wrong env) instead of passing silently.

client status errors for a missing active client retarget guidance from hidden client list to client create / the installer. Tests cover failed wipe + pointer clear and degraded closing.

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

…p stale client-list hints
Thorough review pass on the develop->main PR (#164), addressing the new
Bugbot finding plus adjacent gaps a review flagged:
- Stale client pointer after a failed wipe (Bugbot): after revoke, if
`rm -rf ~/.tracebloc` failed the default path left the active-client
pointer intact (the --keep-data path cleared it). Now the pointer is
cleared in memory once after revoke and persisted in BOTH paths, incl.
the wipe-failure branch — the host never looks enrolled under a dead
credential.
- Misleading success line: the closing "Offboarded … no longer connected"
printed unconditionally even when uninstall/teardown/wipe left real state
behind (all best-effort warns). Track a `degraded` flag over the
state-leaving steps and print an honest closing that tells the user to
finish the flagged steps by hand. (Image reclaim is pure disk cleanup —
excluded; exit stays 0 since the credential revoke, the core, succeeded.)
- Online guard: a stored id not in the signed-in account (found=false) now
emits a hint instead of silently passing the guard.
- Stale copy: `client status` errors pointed at the now-hidden
`client list`; retargeted to `client create` / the installer, matching
the phrasing used elsewhere. Fixed a `create/use` comment (use removed).
Tests added: wipe-failure clears the pointer; a failed teardown produces
the degraded closing. go build/vet/test green (11 pkgs). Rolls up under
the §7.10 offboarding work (Bugbot follow-up).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@saadqbalsaadqbal self-assigned this Jul 7, 2026
@saadqbal
saadqbal merged commit 8095647 into developJul 7, 2026
20 checks passed
saadqbal added a commit that referenced this pull request Jul 8, 2026
…atch phase)
Four low/medium follow-ups from the Bugbot review of PR #164; the other
five Bugbot items were already fixed by #165/#168/#171.
- delete: fail fast on a 401/403 from the pre-offboard online check
(revoked/expired credential) with a `tracebloc login` hint, instead of
warning and marching the user through the confirm only to fail at revoke.
- delete: clear + persist the active-client pointer IMMEDIATELY after the
revoke succeeds (before the best-effort teardown), so a failed or
interrupted teardown can't leave the host looking enrolled under a dead
credential.
- delete: mark the offboard degraded when removeSelf can't remove the CLI
binary / own `tb` alias, so the closing line stops claiming a clean
offboard while the CLI is still on disk.
- data ingest: a pod already in Succeeded prints "Ingestion complete —
showing its logs:" (replayed) instead of the "live progress:" line.
Tests added for each; full internal/... suite + go vet + gofmt green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@saadqbal
saadqbal deleted the fix/delete-pointer-after-wipe branch July 10, 2026 10:37
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

@saadqbal@divyasinghds@LukasWodka