carlos / platform Public

domains list: zoneless domains get attach guidance; moves say so

Final-review fix F8.

- The account list API gains dns_elsewhere (registered here with no
  zone) and purchase.kind.
- carlos domains list no longer offers domains point for a domain whose
  DNS is hosted elsewhere; it says to attach its addresses instead. A
  transfer under way reads "moving here", not "being bought".
- Ordinary bought and buying output is unchanged; no golden case moves.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 9e91da5b3cecf8444cf59780a8196e2b56275801 parent ce34cca
5 files changed, +122 −11
  • domains_account_cli.go +17 −5
  • domains_account_cli_test.go +33 −0
  • domains_buy_copy.go +4 −0
  • internal/console/apidomainbuy.go +13 −6
  • internal/console/domaintransfer_bounded_test.go +55 −0
diff --git a/domains_account_cli.go b/domains_account_cli.go
index e8d2a6fd8..56bba2e60 100644
--- a/domains_account_cli.go
+++ b/domains_account_cli.go
@@ -24,12 +24,17 @@ import (
// apiAccountDomain is one entry of GET /api/cli/accounts/{account}/domains.
type apiAccountDomain struct {
- Domain string `json:"domain"`
- Bought bool `json:"bought"`
- Expires *time.Time `json:"expires"`
- Purchase *struct {
+ Domain string `json:"domain"`
+ Bought bool `json:"bought"`
+ Expires *time.Time `json:"expires"`
+ // DNSElsewhere: registered here with its DNS hosted elsewhere (moved in
+ // by a transfer): nothing to point, its addresses are attached instead.
+ // False from a console that predates it.
+ DNSElsewhere bool `json:"dns_elsewhere"`
+ Purchase *struct {
ID string `json:"id"`
State string `json:"state"`
+ Kind string `json:"kind"` // "transfer" for a move in; "" or "buy" otherwise
} `json:"purchase"`
Addresses []struct {
Host string `json:"host"`
@@ -177,6 +182,8 @@ func domainsAccountList(ctx context.Context, s *apiSession, acct apiAcct, out io
for _, d := range ds {
var about string
switch {
+ case d.Purchase != nil && d.Purchase.Kind == "transfer":
+ about = fmt.Sprintf(domainsAccountCopy["moving"], d.Purchase.State)
case d.Purchase != nil:
about = fmt.Sprintf(domainsAccountCopy["buying"], d.Purchase.State)
case d.Bought && d.Expires != nil:
@@ -188,7 +195,12 @@ func domainsAccountList(ctx context.Context, s *apiSession, acct apiAcct, out io
}
fmt.Fprintf(out, "%s %s\n", d.Domain, about)
if len(d.Addresses) == 0 {
- if d.Bought && d.Purchase == nil {
+ switch {
+ case d.Bought && d.Purchase == nil && d.DNSElsewhere:
+ // Nothing to point: its DNS is elsewhere (domains point
+ // refuses it), so its addresses are attached instead.
+ fmt.Fprintf(out, " %s\n", fmt.Sprintf(domainsAccountCopy["dnsElsewhere"], d.Domain))
+ case d.Bought && d.Purchase == nil:
fmt.Fprintf(out, " %s\n", fmt.Sprintf(domainsAccountCopy["unpointed"], d.Domain))
}
continue
diff --git a/domains_account_cli_test.go b/domains_account_cli_test.go
index c74bbbf38..c74184faf 100644
--- a/domains_account_cli_test.go
+++ b/domains_account_cli_test.go
@@ -336,3 +336,36 @@ func TestDomainsContactsRoundTrip(t *testing.T) {
t.Fatalf("missing file: %v", err)
}
}
+
+// TestDomainsListZonelessAndTransfers: a domain moved here with its DNS
+// hosted elsewhere is never offered domains point: the line says to attach
+// its addresses; a transfer under way reads as a move, not a purchase.
+// Ordinary bought and buying entries read as before.
+func TestDomainsListZonelessAndTransfers(t *testing.T) {
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprint(w, `{"domains":[
+ {"domain":"moved.com","bought":true,"dns_elsewhere":true,"expires":"2027-11-19T10:00:00Z","addresses":[]},
+ {"domain":"moving.com","bought":false,"purchase":{"id":"t1","state":"transfer_pending","kind":"transfer"},"addresses":[]},
+ {"domain":"new.com","bought":false,"purchase":{"id":"p1","state":"awaiting_payment","kind":"buy"},"addresses":[]},
+ {"domain":"shop.com","bought":true,"expires":"2027-11-19T10:00:00Z","addresses":[]}]}`)
+ }))
+ defer ts.Close()
+ var out bytes.Buffer
+ if err := domainsAccountList(context.Background(), newTestSession(ts.URL), apiAcct{Seg: "bab"}, &out); err != nil {
+ t.Fatal(err)
+ }
+ got := out.String()
+ for _, want := range []string{
+ "moved.com " + fmt.Sprintf(domainsAccountCopy["bought"], "2027-11-19") + "\n " + fmt.Sprintf(domainsAccountCopy["dnsElsewhere"], "moved.com") + "\n",
+ "moving.com " + fmt.Sprintf(domainsAccountCopy["moving"], "transfer_pending") + "\n",
+ "new.com " + fmt.Sprintf(domainsAccountCopy["buying"], "awaiting_payment") + "\n",
+ "shop.com " + fmt.Sprintf(domainsAccountCopy["bought"], "2027-11-19") + "\n " + fmt.Sprintf(domainsAccountCopy["unpointed"], "shop.com") + "\n",
+ } {
+ if !strings.Contains(got, want) {
+ t.Fatalf("missing %q:\n%s", want, got)
+ }
+ }
+ if strings.Count(got, "domains point") != 1 {
+ t.Fatalf("domains point offered beyond the zoned domain:\n%s", got)
+ }
+}
diff --git a/domains_buy_copy.go b/domains_buy_copy.go
index 455f3e84f..140edd2ef 100644
--- a/domains_buy_copy.go
+++ b/domains_buy_copy.go
@@ -136,6 +136,10 @@ var domainsAccountCopy = map[string]string{
"fileRead": "read --file: %w",
"fileJSON": "--file must contain one contact JSON object",
"fileSize": "--file is too large (maximum 16 KiB)",
+ // Drafts for the Luna pass (final review fixes, F8): a transfer in
+ // under way, and a domain moved here whose DNS is hosted elsewhere.
+ "moving": "moving here: %s",
+ "dnsElsewhere": "its DNS is hosted elsewhere, so there is nothing to point. attach its addresses to an app with: carlos domains attach --app <app> %s",
}
// carlos domains transfer (transfers in), approved by delegation (Luna), 2026-11-22:
diff --git a/internal/console/apidomainbuy.go b/internal/console/apidomainbuy.go
index bd0d2606b..e6f3f783c 100644
--- a/internal/console/apidomainbuy.go
+++ b/internal/console/apidomainbuy.go
@@ -373,14 +373,20 @@ type apiDomainAddress struct {
type apiDomainPurchaseRef struct {
ID string `json:"id,omitempty"` // owners only: the status door is theirs
State PurchaseState `json:"state"`
+ // Kind is "buy" or "transfer" (a transfer in under way).
+ Kind PurchaseKind `json:"kind"`
}
type apiAccountDomain struct {
- Domain string `json:"domain"`
- Bought bool `json:"bought"`
- Expires *time.Time `json:"expires,omitempty"`
- Purchase *apiDomainPurchaseRef `json:"purchase,omitempty"`
- Addresses []apiDomainAddress `json:"addresses"`
+ Domain string `json:"domain"`
+ Bought bool `json:"bought"`
+ Expires *time.Time `json:"expires,omitempty"`
+ // DNSElsewhere: registered here with no zone here (moved in by a
+ // transfer), so there is nothing to point; its addresses are attached
+ // to apps instead.
+ DNSElsewhere bool `json:"dns_elsewhere,omitempty"`
+ Purchase *apiDomainPurchaseRef `json:"purchase,omitempty"`
+ Addresses []apiDomainAddress `json:"addresses"`
}
// handleAPIAccountDomains is GET /api/cli/accounts/{account}/domains: the
@@ -403,9 +409,10 @@ func (s *Server) handleAPIAccountDomains(w http.ResponseWriter, r *http.Request)
d.Bought = true
expires := c.Registration.Expires.UTC()
d.Expires = &expires
+ d.DNSElsewhere = c.Registration.ZoneID == ""
}
if c.Purchase != nil {
- d.Purchase = &apiDomainPurchaseRef{State: c.Purchase.State}
+ d.Purchase = &apiDomainPurchaseRef{State: c.Purchase.State, Kind: purchaseKindOf(c.Purchase)}
if role == RoleOwner {
d.Purchase.ID = c.Purchase.ID
}
diff --git a/internal/console/domaintransfer_bounded_test.go b/internal/console/domaintransfer_bounded_test.go
index ce5d2304b..d721c6028 100644
--- a/internal/console/domaintransfer_bounded_test.go
+++ b/internal/console/domaintransfer_bounded_test.go
@@ -433,3 +433,58 @@ func TestTransferRefundNoteIncludesTax(t *testing.T) {
t.Fatal("no fallback to the price")
}
}
+
+// TestAPIDomainsListTransferShapes: the account list says which registered
+// domains have their DNS hosted elsewhere (moved in by a transfer, nothing
+// to point) and which purchase under way is a transfer, so the CLI can say
+// so; a domain bought here with its zone reads as before.
+func TestAPIDomainsListTransferShapes(t *testing.T) {
+ tf := newTransferFixture(t)
+ tf.boughtUnpointed(t) // shop.com, bought with its zone
+ adTransferred(t, tf.consoleFixture, tf.acct, "moved.com", time.Now().AddDate(1, 0, 0))
+ if _, ref := tf.startTransfer(t, tf.acct, "other.com"); ref != nil {
+ tf.reg.TransferChecks["other.com"] = tf.reg.TransferChecks["shop.com"]
+ if _, ref := tf.startTransfer(t, tf.acct, "other.com"); ref != nil {
+ t.Fatalf("start: %+v", ref)
+ }
+ }
+ status, body := buyRequest(t, tf.purchaseFixture, "GET", buyAPIPath(tf.purchaseFixture), buyToken(t, tf.purchaseFixture), "")
+ if status != 200 {
+ t.Fatalf("list: %d %s", status, body)
+ }
+ var got struct {
+ Domains []struct {
+ Domain string `json:"domain"`
+ Bought bool `json:"bought"`
+ DNSElsewhere bool `json:"dns_elsewhere"`
+ Purchase *struct {
+ State string `json:"state"`
+ Kind string `json:"kind"`
+ } `json:"purchase"`
+ } `json:"domains"`
+ }
+ if err := json.Unmarshal([]byte(body), &got); err != nil {
+ t.Fatal(err)
+ }
+ seen := map[string]bool{}
+ for _, d := range got.Domains {
+ seen[d.Domain] = true
+ switch d.Domain {
+ case "shop.com":
+ if !d.Bought || d.DNSElsewhere || d.Purchase != nil {
+ t.Fatalf("bought with its zone: %+v", d)
+ }
+ case "moved.com":
+ if !d.Bought || !d.DNSElsewhere {
+ t.Fatalf("moved here: %+v", d)
+ }
+ case "other.com":
+ if d.Purchase == nil || d.Purchase.Kind != string(PurchaseKindTransfer) {
+ t.Fatalf("transfer under way: %+v", d)
+ }
+ }
+ }
+ if !seen["shop.com"] || !seen["moved.com"] || !seen["other.com"] {
+ t.Fatalf("domains: %s", body)
+ }
+}