Skip to content

fix(cli): delete guard fails fast on 426; keep-data save failure marks offboard degraded - #169

Merged
LukasWodka merged 1 commit into
developfrom
fix/delete-426-guard-keepdata-save
Jul 7, 2026
Merged

fix(cli): delete guard fails fast on 426; keep-data save failure marks offboard degraded#169
LukasWodka merged 1 commit into
developfrom
fix/delete-426-guard-keepdata-save

Conversation

@saadqbal

@saadqbalsaadqbal commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Resolves the two new Cursor Bugbot findings on #164 (same never-lie / fail-fast class as the prior rounds).

High — keep-data save failure left a stale on-disk pointer + clean closing

Under --keep-data, the active-client fields are cleared in memory, but if cfg.Save() failed the on-disk config still named the revoked client and the closing line could still read as a clean offboard. Now that Save failure marks the offboard degraded (honest closing) and the warning points the user at tracebloc logout / manual removal.

Medium — online guard softened HTTP 426

The pre-offboard online check treated anylookupClientStatus error — including *api.UpgradeRequiredError (426, CLI too old) — as warn-and-continue. A 426 won't recover by proceeding (the whole offboard hits the same backend), so it now fails fast with the upgrade message, matching runClientStatus. Transient errors (5xx/429/network) still warn and continue, since the teardown is the real gate.

Note on scope of degraded

degraded intentionally tracks tracebloc-side / enrollment state left behind (release, cluster, on-host data, the active-client pointer). Image reclaim and CLI self-removal are local-disk niceties with their own actionable hints and are excluded — the machine is genuinely offboarded from tracebloc's side once the credential is revoked, so those don't flip the closing to a warning.

Tests

Added: a 426 during the guard fails fast with the upgrade message and runs neither revoke nor any teardown. go build/vet/test ./... green (11 pkgs).

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

🤖 Generated with Claude Code


Note

Low Risk
Targeted offboarding UX and error-handling fixes in the CLI delete path; no auth or API contract changes beyond aborting delete earlier on 426.

Overview
Pre-offboard online guard now treats HTTP 426 (*api.UpgradeRequiredError) as fail-fast with the standard upgrade message instead of warn-and-continue. Transient lookup errors (5xx, 429, network) still warn and skip the guard, since teardown is the real safety gate.

Under --keep-data, if clearing the active-client pointer in memory succeeds but cfg.Save() fails, offboard is marked degraded so the closing line does not read as a full success, and the warning directs users to tracebloc logout or manual config cleanup.

Adds TestDelete_Guard426_FailsFast to assert no revoke or teardown runs after a 426 on the status lookup.

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

…s offboard degraded
Two more Cursor Bugbot findings on the develop->main PR (#164), same
"never-lie / fail-fast" class as the prior rounds:
- High: under --keep-data, if cfg.Save() fails after clearing the pointer
in memory, the on-disk config still names the revoked client AND the
closing line could still read as a clean offboard. Mark the offboard
degraded on that Save failure (honest closing) and point the user at
`tracebloc logout` / manual removal.
- Medium: the pre-offboard online guard treated ANY lookupClientStatus
error — including *api.UpgradeRequiredError (426, CLI too old) — as a
warn-and-continue. A 426 won't recover by proceeding (the whole offboard
hits the same backend), so fail fast with the upgrade message, matching
runClientStatus. Other errors (5xx/429/network) stay transient.
Test added: a 426 during the guard fails fast with the upgrade message and
runs neither revoke nor any teardown step. 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>
@LukasWodka
LukasWodka merged commit d960e01 into developJul 7, 2026
20 checks passed
@saadqbal
saadqbal deleted the fix/delete-426-guard-keepdata-save branch July 9, 2026 11: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.

2 participants

@saadqbal@LukasWodka