Skip to content

fix(client create): honest conflict message — name the owner, handle cluster_in_use#191

Open
LukasWodka wants to merge 1 commit into
developfrom
fix/cli-conflict-owner-email
Open

fix(client create): honest conflict message — name the owner, handle cluster_in_use#191
LukasWodka wants to merge 1 commit into
developfrom
fix/cli-conflict-owner-email

Conversation

@LukasWodka

@LukasWodka LukasWodka commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

The CLI mapped every provisioning 409 to a single static message — "registered to a different tracebloc account — sign in to that account, or ask your admin" — which was frequently false (the same-account phantom case) and a dead end.

With the backend's fix #2 (backend#1021) the 409 body now distinguishes two cases, and this PR makes the CLI read them:

Backend 409 body CLI message
cluster_conflict (+ owner_email) "this cluster is already registered to another tracebloc account (owner@…) — ask them to release it, or sign in as that account"
cluster_in_use (+ holder_name) "another tracebloc client (name) in your account is already live on this cluster — offboard it first with tracebloc delete, or provision on a separate machine"

This is the CLI companion to fix #2, and part of the phantom-client migration alongside cli#190 (fix #1).

Notes

  • Names the owner so the user knows who to ask — no more dead-end "ask your admin". Guidance is contact-the-owner, never "delete the cluster" (it isn't ours to wipe), per the agreed UX.
  • Degrades gracefully: against a backend without fix Phase 2: kubeconfig discovery + parent release detection + SA token #2 (empty/unparseable body), it falls back to the generic cross-account text — no hard dependency on deploy order.
  • The client-side not-owned refusal (no HTTP body) keeps the generic message. crossAccountConflictMsg reworded to match ("another … ask its owner to release it").

Tests

owner_email surfaced + contact-the-owner guidance; cluster_in_use names the live client and must not read as cross-account; existing cross-account + client-side-refusal assertions updated to the new wording. Full go test ./... green; gofmt -s / errcheck / ineffassign / misspell clean.


Note

Low Risk
User-facing error text and JSON parsing only; no auth or provisioning flow changes beyond clearer 409 handling.

Overview
tracebloc client create no longer treats every provisioning 409 as a generic cross-account conflict. It parses the API error body and shows guidance that matches what the backend reports (fix #2).

For cluster_conflict, the message can include owner_email and tells the user to ask that owner to release the cluster or sign in as that account. For cluster_in_use, it names the live client (holder_name) and points to tracebloc delete or another machine—without implying another account. The same conflictMessage logic applies on PATCH anchor backfill 409s during R7 adopt.

If the body is missing or old, behavior falls back to updated generic cross-account copy (“another tracebloc account … ask its owner to release it”). Tests cover owner email, cluster_in_use, and updated wording.

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

…cluster_in_use

The CLI mapped every provisioning 409 to a static "registered to a different
tracebloc account — sign in to that account, or ask your admin" — which was
often FALSE (the same-account phantom case) and a dead end. With the backend's
fix #2 (backend#1021) the 409 body now distinguishes:
  • cluster_conflict — genuinely another account; body carries owner_email;
  • cluster_in_use   — a same-account client is live on this cluster.

New conflictMessage() parses the 409 body and picks the right guidance:
  • cross-account → "registered to another tracebloc account (<owner_email>) —
    ask them to release it, or sign in as that account" (contact-the-owner, never
    "delete the cluster" — it isn't ours to wipe; names the owner when supplied);
  • cluster_in_use → "another tracebloc client (<name>) in your account is already
    live on this cluster — offboard it first with `tracebloc delete`, or provision
    on a separate machine".

Degrades gracefully against a backend without fix #2 (empty/unparseable body →
the generic cross-account text). The client-side not-owned refusal (no HTTP body)
keeps the generic message. Reworded crossAccountConflictMsg to match.

Companion to backend#1021 (fix #2) and cli#190 (fix #1) of the phantom-client
migration.

Tests: owner_email surfaced; cluster_in_use names the live client and does NOT
read as cross-account; existing cross-account + client-side-refusal messages
updated to the new wording. Full suite green; gofmt -s / errcheck / ineffassign /
misspell clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@LukasWodka LukasWodka requested a review from aptracebloc July 9, 2026 06:11
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.

1 participant