| index 99d8a0188..bc6467014 100644 |
| --- a/docs/superpowers/plans/2026-11-19-domain-registration-2a-account-domains.md |
| +++ b/docs/superpowers/plans/2026-11-19-domain-registration-2a-account-domains.md |
| @@ -2,7 +2,7 @@ |
| |
| > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| |
| -**Goal:** An account gets a **Domains** page listing every domain it uses (bought here or registered elsewhere), buys a domain in three steps with or without an app, keeps saved contacts, and points an unpointed bought domain at an app later. |
| +**Goal:** An account gets a **Domains** page listing every domain it uses (bought here or registered elsewhere), buys a domain in three steps with or without an app, keeps saved contacts, and points a bought domain at an app later through the existing attach door. |
| |
| **Architecture:** The purchase, registration and contact tables already live in console.db (`internal/console/domainstore.go`, migrated from `store.go:793`); what ties them to an app is the SQL gate classification (`store_gate.go:231`), the per-app mutation in `purchaseMutation` (`domainbuy.go:414`) and the app-scoped doors. This plan makes `app` optional on a purchase, freezes a versioned saved contact into each purchase, derives "registered elsewhere" cards from the existing claims, and moves the doors to `/a/{sqid}/domains/...` with redirects from the old app-scoped URLs. No new storage location and no data move. |
| |
| @@ -10,11 +10,11 @@ |
| |
| **Spec:** `docs/superpowers/specs/2026-11-01-domain-registration-design.md`, revision 4. §11 is this plan; read §11 whole, plus §4.1, §5.1 and §5.3. Plan 1 (`docs/superpowers/plans/2026-11-01-domain-registration-1-buy.md`) built the engine this plan changes. |
| |
| -**Plans in this series:** 1 buy (merged 20c867c, live). **2a account-level domains (this plan).** 2b keep it working: daily registrar reconcile, apex reconverge on edge-set change, balance alert, nameserver setup check verb, registrant email verification (§4.4), contact 429 not final, log the registry message on code 399. 3 renewals. 4 customer records, change owner, transfer out. Transfers in (R7) come after Plan 3 as a spec revision; their entry point is the "Registered elsewhere" card this plan builds. |
| +**Plans in this series:** 1 buy (merged 20c867c, live). **2a account-level domains (this plan).** 2b keep it working: daily registrar reconcile, apex reconverge on edge-set change, balance alert, nameserver setup check verb, registrant email verification (§4.4), contact 429 not final, log the registry message on code 399. 3 renewals. 4 customer records, change owner, transfer out. Transfers in (R7) come after Plan 3 as a spec revision; their entry point is the "Registered elsewhere" card this plan builds. Addresses under a bought domain other than the apex and `www` (for example `docs.`) move to Plan 4 with customer records (Paul, round 2 cut). |
| |
| **Switch-on:** the Domains page and nav item are visible to every account on merge (no flag): "registered elsewhere" cards need nothing configured. Buying keeps Plan 1's switch (`domainBuyReady`), already on for dev and flagship. Roll dev first, then flagship with the next release. |
| |
| -**Review history:** Astra round 1 on d6352683 (`docs/superpowers/reviews/CODEX-FINDINGS-domains-plan-2a.md`): NOT READY, 9 P1 and 5 P2, all accepted and folded in below; each change is marked **(r1 N)**. |
| +**Review history:** Astra round 1 on d6352683 (`docs/superpowers/reviews/CODEX-FINDINGS-domains-plan-2a.md`): NOT READY, 9 P1 and 5 P2, all accepted and folded in; each change is marked **(r1 N)**. Astra round 2 on 6108a068 (`CODEX-FINDINGS-domains-plan-2a-R2.md`): NOT READY, 4 P1 and 3 P2; three fault families repeated (proofs for extra names, pointing admission and retry, armed-gate purchases), so stopping rule 2 applied. **Paul's cut, 2026-11-19:** (a) buying is off while `CARLOS_HOST_CLAIM` is on; (b) extra addresses under a bought domain move to Plan 4; (c) pointing writes the zone's canonical records and then runs the existing app attach door's own admission and attach, with no new pointing logic. Changes from round 2 are marked **(r2 N)**. Round 3 is the last. |
| |
| ## Global Constraints |
| |
| @@ -22,15 +22,15 @@ |
| - Storage finding, recorded in the spec by Task 2: §11.1 says Plan 1 keeps purchases "in its app's own database"; they are in console.db. §11.7's "move to the account store" therefore means: add columns and tables, backfill, keep the gate classification correct. Purchase IDs, states and URLs keep working (old URLs redirect, Task 9). |
| - Every money and registration rule from Plan 1 stands unchanged: no money without a registration, no registration without an authorised payment, an ambiguous answer is never a failure, registrar-side auto-renew OFF (spec §5.1, §5.5). |
| - **A purchase is bound to one frozen contact (R12, r1 1).** At start, the purchase copies the saved contact's `Contact`, `Version` and `Handle` into its `details`. Every later step reads only the purchase's frozen copy: the handle it registers with and the registrant snapshot both come from the purchase, never from the saved contact's current row. A saved contact's handle is never passed to `Registrar.EnsureContact` again (the Openprovider adapter updates an existing handle in place when the name matches, `internal/registrar/openprovider/client.go:136-155`). An edit bumps `Version` and clears the handle; a handle minted for a purchase is written back to the saved contact only when its `Version` still equals the purchase's frozen version and its handle is still empty. |
| -- **The HostClaim gate is shelved and inert in production** (`CARLOS_HOST_CLAIM`; claims shelved 2026-10-25). Code stays correct with it armed, but where armed behaviour would cost new machinery this plan refuses or parks the case instead (r1 8): see Task 4. |
| -- Permissions (§11.7, my calls marked): every account member sees the Domains page, a domain's page and the CLI list. Owners only: buy, saved contacts (list, add, edit, remove), point a bought domain at an app, add an address under a bought domain (my call: these move or extend a paid domain), and the purchase card. "Add a domain you own" uses the existing attach door's own permission for the chosen app. |
| +- **Buying is off while the HostClaim gate is on (Paul's cut, r2 4).** `CARLOS_HOST_CLAIM` is shelved (2026-10-25) and off on dev and flagship. With it on, `domainBuyReady()` and `domainPurchaseReady()` return false and the console logs one line at boot saying why; purchases in flight wait, untouched, until it is off again. No purchase code path has to handle the armed gate. The gate classification stays accurate (`FreeWhenNoApp` on `domain_purchases`) for the gate's own tests. |
| +- Permissions (§11.7, my calls marked): every account member sees the Domains page, a domain's page and the CLI list. Owners only: buy, saved contacts (list, add, edit, remove), the purchase card, and pointing a bought domain at an app (the attach door is already owner-only, `appdomains.go:42`). "Add a domain you own" is the existing attach door. |
| - Every new console route gets its `parity/parity.tsv` row and every new CLI word its `clireg` node and row, then `make parity-doc` regenerates `docs/parity.md` (never edited by hand); new routes also join the route registers in Task 9's Files (r1 9). |
| - Root-package (CLI) changes go through the census (AGENTS.md "The census: the reviewer decides"): Task 12 carries the card, claims, proposal and Astra's approval (r1 9). |
| - No registrar or DNS host name in any customer-facing string. Every new string lives in a `*_copy.go` file as a draft, replaced by the copy pass (Task 11). Copy house rules: no em or en dashes, curly quotes in prose, `cli.`/`door.` keys lower case with no final full stop. |
| - Renewals do not exist until Plan 3. Nothing in this plan says or implies a domain "renews"; the Renewal card shows the expiry date and next year's price only, and the auto-renew switch ships with Plan 3 (my call: a switch that changes nothing would mislead). |
| - Request budget (r1 13): no new steady-state or per-box requests. The Domains overview, on a page view only, costs one `s.claims.ListWithUnread` (one bucket `ListMod`, as every claims page does today) plus, for each app that has addresses, the reads `settingsDomains` already does for that app's Domains tab. The domain's own page costs the same for the apps holding that domain's addresses. The CLI list costs the same as the overview. |
| - Writing Go here (AGENTS.md): every function with a `ctx` passes it on; no `time.Sleep` in tests (pause with a seam or channel); `errors.Is`/`As`; no function over 300 lines or file over 3,000 (`make code-health` before pushing). |
| -- Review budget (AGENTS.md stopping rules): plan review round 2 of 3 next. Astra per-task review only on Tasks 4, 6, 7 and 9 (money flow, termination, claim ownership, security gates); Fable joins Astra on Task 6 and the whole-branch review. At most three rounds each; stop at the first round with no P1. |
| +- Review budget (AGENTS.md stopping rules): plan review round 3 of 3 (the last) next. Astra per-task review only on Tasks 4, 6, 7 and 9 (money flow, termination, claim ownership, security gates); Fable joins Astra on Task 6 and the whole-branch review. At most three rounds each; stop at the first round with no P1. |
| - Local verification: only the touched packages' tests with `-run` (AGENTS.md "Targeted local tests"; no full suites on docs-t1). CI runs everything. |
| |
| ## Review Focus |
| @@ -39,7 +39,7 @@ |
| 2. **An app holding a bought domain's addresses is purged** (spec C2). Expected: the app's custom-domain claims are released before the purge gives up its trash marker and row, the card shows the domain with no addresses and "Point at an app", and pointing it at another app of the same account then succeeds. Tests in Task 6: `TestPurgeReleasesTheAppsDomainClaims` and Task 7: `TestPointAfterPurgeSucceeds`. |
| 3. **A saved contact is edited or removed while a purchase using it is in flight.** Expected: the purchase registers with the contact and handle it froze at start, its registration's registrant is that frozen contact, and the edited contact's handle stays empty so the next purchase mints a new one. Test in Task 4: `TestContactEditDuringPurchaseKeepsFrozenContact`. |
| 4. **One domain's addresses sit on several apps, some in Trash, plus platform names.** Expected: one card per registrable domain, one row per address naming its app, Trash shown as a state chip, the app's own `*.<apps-domain>` names absent; `shop.example.co.uk` is an address on the `example.co.uk` card (r1 11). Test in Task 5: `TestAccountDomainsGroupsByRegistrableDomain`. |
| -5. **Pointing a bought domain whose apex or `www` is already attached somewhere.** Expected: refused up front, nothing detached and no DNS written, with a message to detach it from its current app first (r1 6); another account's claim gets the neutral `domains.ErrHostUnavailable` refusal. Test in Task 7: `TestPointRefusesAttachedDomainTouchesNothing`. |
| +5. **Pointing a bought domain whose apex or `www` is attached to another app, or half-attached after a failure.** Expected: another app's claim (this account's or another's) gets the attach door's own neutral refusal and nothing is detached; the same call retried after a partial or pending attach completes it (the attach door's idempotence for the caller's own claim). Test in Task 7: `TestPointOtherAppsClaimRefusedNothingDetached` and `TestPointRetryCompletesPartialAttach`. |
| |
| --- |
| |
| @@ -50,7 +50,7 @@ The approved mockups (`docs/superpowers/mockups/domains-account/`) predate the k |
| **Files:** |
| - Create: `docs/superpowers/mockups/domains-account-kit/overview.html`, `buy-name.html`, `buy-app.html`, `buy-pay.html`, `domain-bought.html`, `domain-elsewhere.html`, `contacts.html`, `purchase-card.html` (each from `docs/console-mockup-kit/shell.html`, components from `docs/console-styleguide.md`) |
| |
| -- [ ] **Step 1:** Draw each screen in the kit, following the approved layouts (overview option A; three buy steps; domain page cards in §11.6 order; the contacts view placed on the Domains page, my call: a "Saved contacts" section below the cards, owners only). The purchase card keeps Plan 1's step list (0c2ab2e) and adds the "ready to point at an app" end state. A bought domain whose apex is attached shows "Detach from <app>" beside the address, not a move button (r1 6). |
| +- [ ] **Step 1:** Draw each screen in the kit, following the approved layouts (overview option A; three buy steps; domain page cards in §11.6 order; the contacts view placed on the Domains page, my call: a "Saved contacts" section below the cards, owners only). The purchase card keeps Plan 1's step list (0c2ab2e) and adds the "ready to point at an app" end state. A bought domain whose apex is attached shows "Detach" beside the address (the app's existing detach door), not a move button (r1 6). No "Add address" on a bought domain (Plan 4). |
| - [ ] **Step 2:** UX pass: each screen at 390 px and desktop, light and dark; lead with state (chips for "Bought here", "Registered elsewhere", attach state, "In Trash"; expiry as a date tile). Run the `impeccable` critique and distill passes; fix what reads badly. |
| - [ ] **Step 3:** Commit `mockups: domains at the account level, redrawn in the kit`, push, and post the mockup paths on the branch's amadan discussion for Paul to look at. Tasks 2-7 do not wait on his look; Tasks 8-9 do. |
| |
| @@ -91,29 +91,35 @@ The approved mockups (`docs/superpowers/mockups/domains-account/`) predate the k |
| ContactVersion int64 |
| ``` |
| Schema: `domain_saved_contacts(id TEXT PRIMARY KEY, account_id INTEGER NOT NULL, contact TEXT NOT NULL, version INTEGER NOT NULL DEFAULT 1, handle TEXT NOT NULL DEFAULT '', last_used INTEGER NOT NULL DEFAULT 0, created_at INTEGER NOT NULL)` with an index on `account_id`; `ALTER TABLE domain_registrations ADD COLUMN registrant TEXT NOT NULL DEFAULT '{}'` (the existing duplicate-column tolerant loop). Gate: `domain_purchases` gains `FreeWhenNoApp: true` (it keeps its `app` column, so it cannot be NonApp: `store_gate_test.go:719`); `domain_saved_contacts` is NonApp ("saved registrant contacts and handles, keyed by account; names no app"). |
| - One-time backfills inside `migrateDomains`, idempotent: each `domain_contacts` row becomes a saved contact (same handle, version 1, `last_used = updated_at`) unless the account already has one with an equal contact. Every registration with `registrant = '{}'` takes the `Contact` from the `details` of the newest purchase for the same account and domain whose details carry a contact, in any state (r1 2). Existing purchases are not rewritten: an empty `ContactID` marks a legacy purchase, which keeps using its own frozen `Contact` and `OwnerHandle` (Task 4). `domain_contacts` stays in place, no longer read or written after Task 4. |
| + One-time backfills inside `migrateDomains`: each `domain_contacts` row becomes a saved contact (same handle, version 1, `last_used = updated_at`), in one transaction that also inserts the row `('saved_contacts_backfilled', '1')` into a new `domain_meta(key TEXT PRIMARY KEY, value TEXT NOT NULL)` table; the backfill runs only when that row is absent, so an edited or removed contact never comes back on restart (r2 7). Every registration with `registrant = '{}'` takes the `Contact` from the `details` of the newest purchase for the same account and domain whose details carry a contact, in any state (r1 2). Existing purchases are not rewritten: an empty `ContactID` marks a legacy purchase, which keeps using its own frozen `Contact` and `OwnerHandle` (Task 4). `domain_contacts` stays in place, no longer read or written after Task 4. |
| |
| -- [ ] **Step 1: Write failing tests:** `TestSavedContactsOrderAndAccountScope` (two accounts; `SavedContact` with another account's ID returns nil; order by LastUsed then CreatedAt), `TestEditSavedContactBumpsVersionClearsHandle`, `TestSetSavedContactHandleIsConditional` (stale version → false and unchanged; existing handle → false; matching version and empty handle → true), `TestMigrateDomainsBackfillsContactsAndRegistrant` (seed a `domain_contacts` row; a registration with `'{}'` whose only purchase is in `registered`, and one in `done`; migrate twice; one saved contact with the old handle; both registrants equal their purchase's contact), `TestDomainObligations`, `TestAppLessPurchaseRowAllowedByGate` (with the gate armed in the harness `cli_tokens`' `FreeWhenNoApp` test uses, found with `git grep -n FreeWhenNoApp -- '*_test.go'`, an `app=''` purchase inserts and updates). |
| +- [ ] **Step 1: Write failing tests:** `TestSavedContactsOrderAndAccountScope` (two accounts; `SavedContact` with another account's ID returns nil; order by LastUsed then CreatedAt), `TestEditSavedContactBumpsVersionClearsHandle`, `TestSetSavedContactHandleIsConditional` (stale version → false and unchanged; existing handle → false; matching version and empty handle → true), `TestMigrateDomainsBackfillsContactsAndRegistrant` (seed a `domain_contacts` row; a registration with `'{}'` whose only purchase is in `registered`, and one in `done`; migrate twice; one saved contact with the old handle; both registrants equal their purchase's contact), `TestMigratedContactRemovalSurvivesReopen` (migrate, remove the saved contact, close and reopen the store: still gone), `TestDomainObligations`, `TestAppLessPurchaseRowAllowedByGate` (the gate's classification harness that covers `cli_tokens`' `FreeWhenNoApp`, found with `git grep -n FreeWhenNoApp -- '*_test.go'`, accepts an `app=''` purchase row). |
| - [ ] **Step 2: Run** `go test ./internal/console/ -run 'SavedContact|MigrateDomains|DomainObligations|AppLessPurchase'`; expect FAIL. |
| - [ ] **Step 3: Implement**, and the spec note. |
| - [ ] **Step 4: Run**; expect PASS. Also `go test ./internal/console/ -run 'StoreGate|ClaimSQL'` (the gate's own classification tests). |
| - [ ] **Step 5: Commit** `console: versioned saved domain contacts, registrant snapshot, app-less purchases`. |
| |
| -### Task 3: Zone host: unpointed zones, extra names and their proofs |
| +### Task 3: Zone host: unpointed zones and one canonical pointed set |
| |
| **Files:** |
| - Modify: `internal/zonehost/zonehost.go`, `internal/zonehost/zonehost_test.go`, `internal/zonehost/zonehosttest/fake.go` |
| -- Modify: `internal/zonehost/route53zones/route53.go`, `internal/zonehost/route53zones/route53_test.go` |
| +- Modify: `internal/zonehost/route53zones/route53_test.go` (and `route53.go` only if the empty set needs it) |
| |
| **Interfaces:** |
| -- Produces: `ManagedSet` gains `Names []string` (full hostnames strictly under the zone, each written as an ALIAS A to the apex, `EvaluateTargetHealth: true`). `Validate()` now accepts an empty set (no apex, `WWW` false, no `Names`, no TXT): an unpointed zone. `WWW` or any `Names` without apex targets is refused. Challenge TXT is accepted for the apex, `www` and each entry of `Names`, and for nothing else (r1 5; today only apex and `www`, `zonehost.go:89`). `SetManaged` refuses a name not under `z.Domain` and deletes any managed record not in `m`. Managed, for the Route 53 adapter: apex A sets, any A record that is an ALIAS to the zone apex, and the challenge TXT names of the apex, `www` and every name currently aliased to the apex (customer records in Plan 4 are never ALIAS records, so the rule keeps them apart). |
| - `func ManagedFor(apex []ApexTarget, names []string, proof func(host string) TXT) ManagedSet` builds the one canonical set for a pointed zone: apex targets, `WWW: true`, `Names`, and, when `proof` is non-nil, one challenge TXT per host (apex, `www`, each name). Every writer (Plan 1's `authorised` step, Task 4, Task 7) uses it, so a later write never drops an earlier name or proof. |
| +- Produces: `Validate()` accepts an empty `ManagedSet` (no apex, `WWW` false, no TXT): an unpointed zone; `WWW` or TXT without apex targets is refused. `SetManaged` with the empty set deletes the apex A sets, the `www` alias and the apex/`www` challenge TXT (the records it manages today), nothing else. |
| + ```go |
| + func ManagedFor(domain string, apex []ApexTarget, proof func(host string) TXT) ManagedSet |
| + // The one canonical set for a pointed zone (r2 1): apex targets, WWW: true, and, when proof is non-nil, |
| + // proof(domain) and proof("www."+domain). Plan 1's authorised step, Task 4 and Task 7 all use it, so every |
| + // write of a pointed zone is the same set and rewriting it is a no-op. |
| + ``` |
| + No extra names (Paul's cut, r2): addresses under a bought domain other than apex and `www` are Plan 4. |
| |
| -- [ ] **Step 1: Write failing tests:** `TestManagedSetValidateEmptyAndNames` (empty valid; `WWW` without apex refused; `Names` without apex refused; a challenge TXT for a name in `Names` accepted, for a name outside it refused), `TestManagedForIncludesEveryProof`, `TestFakeSetManagedEmptyClearsApex`, `TestSetManagedWritesNamesAsApexAlias` (`docs.shop.example` → ALIAS A to `shop.example.`), `TestSetManagedRefusesNameOutsideZone` (`docs.other.example`), `TestSetManagedEmptyDeletesApexWWWNamesAndProofs`. |
| +- [ ] **Step 1: Write failing tests:** `TestManagedSetValidateEmpty` (empty valid; `WWW` without apex refused; TXT without apex refused), `TestManagedForProofsWithoutExtraNames` (proof on: TXT for `shop.example` and `www.shop.example`; proof nil: no TXT), `TestFakeSetManagedEmptyClearsApex`, `TestSetManagedEmptyDeletesApexWWWAndProofs` (Route 53 fake: the managed records go, an unrelated MX stays). |
| - [ ] **Step 2: Run** `go test ./internal/zonehost/... -run 'ManagedSet|ManagedFor|SetManaged'`; expect FAIL. |
| -- [ ] **Step 3: Implement.** |
| +- [ ] **Step 3: Implement**; switch Plan 1's `authorised` step to `ManagedFor` in Task 4. |
| - [ ] **Step 4: Run**; expect PASS. |
| -- [ ] **Step 5: Commit** `zonehost: unpointed zones, extra names and their proofs`. |
| +- [ ] **Step 5: Commit** `zonehost: unpointed zones and one canonical pointed set`. |
| |
| ### Task 4: Purchase engine: optional app, frozen contacts, app gone, deletion exclusion (risky: per-task review) |
| |
| @@ -131,7 +137,7 @@ The approved mockups (`docs/superpowers/mockups/domains-account/`) predate the k |
| func (s *Server) startDomainPurchase(ctx context.Context, acct *Account, app, name string, contact purchaseContact, principal string, confirmed domainreg.Quote) (*DomainPurchase, string, *domainreg.Quote, *doorRefusal) |
| // app "" is "Not yet" (§11.4). A non-empty app must be one of AppsIn(acct.ID), as today. |
| func (s *Server) purchaseManagedSet(ctx context.Context, p *DomainPurchase) (zonehost.ManagedSet, error) |
| - // App "": the empty set. Otherwise ManagedFor(apex, nil, proof when DomainProof). |
| + // App "": the empty set. Otherwise ManagedFor(p.Domain, apex, proof when DomainProof). |
| func (s *Server) defaultQuoteCountry(acct *Account) string |
| // the most recently used saved contact's Country, else ""; replaces both DomainContact reads (r1 14) |
| ``` |
| @@ -140,12 +146,13 @@ The approved mockups (`docs/superpowers/mockups/domains-account/`) predate the k |
| - **Checkout step** (`purchaseCheckoutStep`, replacing the `DomainContact`/`SetDomainContact` read and write): `OwnerHandle` already set → no registrar call. Empty → `EnsureContact(ctx, "", details.Contact)`, store the handle in the purchase, then `SetSavedContactHandle(accountID, ContactID, ContactVersion, handle)` (a false result is fine: the contact was edited meanwhile). Legacy purchases (empty `ContactID`) keep Plan 1's behaviour on their own frozen `Contact`, without writing `domain_contacts`. `TouchSavedContact` on success. |
| - **`authorised` step:** `SetManaged(zone, purchaseManagedSet(p))`. |
| - **`registered`:** `registeredPurchase` stores `Registrant = details.Contact` (the frozen copy). When the registration row already exists (the insert-before-state-update crash window, `domainbuy.go:738`) and its registrant is `'{}'`, it updates it (r1 2). |
| - - **`captured` step:** `App == ""` → `done`, no attach. App not in `AppsIn(acct.ID)` (purged or in Trash, my call: attaching to a trashed app would serve nothing): flag-off, `SetManaged(zone, ManagedSet{})`, then `done` with `App = ""` and `Reason = "app_gone"`. With the HostClaim gate armed, the purchase stays `captured` with `Reason = "app_gone"` and the existing attempts alert pages the operator (r1 8: clearing `app` on a gated row needs the gone app's permit, `store_gate.go:646`; the gate is not the production path). |
| + - **`captured` step:** `App == ""` → `done`, no attach. App not in `AppsIn(acct.ID)` (purged or in Trash, my call: attaching to a trashed app would serve nothing): `SetManaged(zone, ManagedSet{})`, then `done` with `App = ""` and `Reason = "app_gone"`. Buying is off while the HostClaim gate is on (Global Constraints), so this never runs against an armed gate (r2 4). |
| + - **Switch (r2 4):** `domainBuyReady()` and `domainPurchaseReady()` return false when `s.cfg.HostClaim`; `cmd/console` logs one line at boot naming `CARLOS_HOST_CLAIM` as the reason. |
| - **`purchaseMutation` (r1 8):** `App == ""` runs the same closure (re-read the purchase, refuse with `ErrPurchaseStateMoved` unless `State` and `Revision` match, then `call`) without `claimAppMutation`. With an app, unchanged. |
| - **Legacy contact readers (r1 14):** `checkDomainBuy` (`apidomainbuy.go:43`) and the browser check (`appdomainbuy.go:157`) take their default country from `defaultQuoteCountry`; nothing reads `DomainContact` after this task (`git grep -n 'DomainContact(' -- '*.go'` lists only the store and its test). |
| |
| -- [ ] **Step 1: Write failing tests** on `newPurchaseFixture`: `TestPurchaseWithoutAppRegistersAndAttachesNothing` (reaches `done`; registration row with registrant; no claim for apex or `www`; zone's managed set empty), `TestPurchaseAppPurgedMidwayFinishesUnpointed` (remove the app after `registered`; reaches `done`, `App` empty, `Reason` `app_gone`, managed set empty, payment captured once), `TestPurchaseAppGoneGateArmedParksAndAlerts`, `TestPurchaseSavedContactWithHandleSkipsRegistrar`, `TestContactEditDuringPurchaseKeepsFrozenContact` (pause the fake registrar inside `EnsureContact` on a channel; edit the contact; release; the purchase registers with the frozen contact's new handle, the registration's registrant is the frozen contact, and the saved contact's handle is still empty), `TestContactRemovedDuringPurchaseStillFinishes`, `TestLegacyPurchaseFinishesFromItsOwnContact` (a purchase row with no `ContactID` in `awaiting_payment` and one in `registering` both reach `done`), `TestRegisteredRetryBackfillsRegistrant`, `TestPurchaseOtherAccountsContactRefused`, `TestStartWithoutAppStillNeedsPaidPlanAndCap`, `TestStartRefusedOnceAccountRetiring` (retire the account while the start is paused just before the insert; no row is written), `TestStaleAppLessSnapshotHasNoEffects` (advance an app-less purchase with a stale revision; the fakes record no calls). Existing Plan 1 engine tests keep passing with `purchaseContact{New: &c}` in place of the old contact argument. |
| -- [ ] **Step 2: Run** `go test ./internal/console/ -run 'TestPurchase|TestStart|TestContact|TestLegacyPurchase|TestRegisteredRetry|TestStale'`; expect the new tests to FAIL. |
| +- [ ] **Step 1: Write failing tests** on `newPurchaseFixture`: `TestPurchaseWithoutAppRegistersAndAttachesNothing` (reaches `done`; registration row with registrant; no claim for apex or `www`; zone's managed set empty), `TestPurchaseAppPurgedMidwayFinishesUnpointed` (remove the app after `registered`; reaches `done`, `App` empty, `Reason` `app_gone`, managed set empty, payment captured once), `TestBuyingOffWhileHostClaimOn` (doors absent, the pass advances nothing, a live purchase is unchanged), `TestPurchaseSavedContactWithHandleSkipsRegistrar`, `TestContactEditDuringPurchaseKeepsFrozenContact` (pause the fake registrar inside `EnsureContact` on a channel; edit the contact; release; the purchase registers with the frozen contact's new handle, the registration's registrant is the frozen contact, and the saved contact's handle is still empty), `TestContactRemovedDuringPurchaseStillFinishes`, `TestLegacyPurchaseFinishesFromItsOwnContact` (a purchase row with no `ContactID` in `awaiting_payment` and one in `registering` both reach `done`), `TestRegisteredRetryBackfillsRegistrant`, `TestPurchaseOtherAccountsContactRefused`, `TestStartWithoutAppStillNeedsPaidPlanAndCap`, `TestStartRefusedOnceAccountRetiring` (retire the account while the start is paused just before the insert; no row is written), `TestStaleAppLessSnapshotHasNoEffects` (advance an app-less purchase with a stale revision; the fakes record no calls). Existing Plan 1 engine tests keep passing with `purchaseContact{New: &c}` in place of the old contact argument. |
| +- [ ] **Step 2: Run** `go test ./internal/console/ -run 'TestPurchase|TestStart|TestContact|TestLegacyPurchase|TestRegisteredRetry|TestStale|TestBuyingOff'`; expect the new tests to FAIL. |
| - [ ] **Step 3: Implement.** |
| - [ ] **Step 4: Run** the same, plus `-run 'DomainBuy|APIDomain'`; expect PASS. |
| - [ ] **Step 5: Commit** `console: purchases with no app, frozen contacts, unpointed finish`. |
| @@ -176,7 +183,7 @@ The approved mockups (`docs/superpowers/mockups/domains-account/`) predate the k |
| ``` |
| Rules: addresses come from one `ListWithUnread` snapshot, claims with `Account == acct.Sqid`, an app in `AppsIncludingTrashIn`, and `customDomain(strings.TrimPrefix(host, "*."), sqid)` true; the card key is `EffectiveTLDPlusOne` of the host without `*.`. Registrations and live purchases add cards with no addresses when nothing is attached. Unread claims (the snapshot's `unread` set) make the call return an error rather than a short list. State comes from one `settingsDomains` call per app that has addresses, never per address; `accountDomain` makes those calls only for the apps holding that domain's addresses. |
| |
| -- [ ] **Step 1: Write failing tests:** `TestAccountDomainsGroupsByRegistrableDomain` (Review Focus 4: claims for `shop.example`, `www.shop.example` on app `a`, `docs.shop.example` on app `b` in Trash, `kass.<apps-domain>` platform name, `shop.example.co.uk` on app `a`, another account's `other.example`; exactly two cards, `shop.example` and `example.co.uk`, rows and chips as stated), `TestAccountDomainsBoughtWithoutAddresses`, `TestAccountDomainsShowsLivePurchase`, `TestAccountDomainsUnreadClaimsIsError`, `TestAccountDomainOtherAccountIsNil`, `TestAccountDomainsOneClaimsListPerCall` (a counting claims source sees one list). |
| +- [ ] **Step 1: Write failing tests:** `TestAccountDomainsGroupsByRegistrableDomain` (Review Focus 4: claims for `shop.example`, `www.shop.example` on app `a`, `docs.shop.example` on app `b` in Trash, `kass.<apps-domain>` platform name, `shop.example.co.uk` on app `a`, another account's `other.example`; exactly two cards, `shop.example` and `example.co.uk`, rows and chips as stated), `TestAccountDomainsBoughtWithoutAddresses`, `TestAccountDomainsShowsLivePurchase`, `TestAccountDomainsUnreadClaimsIsError`, `TestAccountDomainOtherAccountIsNil`, `TestAccountDomainsClaimsListBudget` (a counting claims source sees `1 + N` lists for `N` apps with addresses: one snapshot plus one per `settingsDomains` call, r2 5). |
| - [ ] **Step 2: Run** `go test ./internal/console/ -run AccountDomain`; expect FAIL. |
| - [ ] **Step 3: Implement.** |
| - [ ] **Step 4: Run**; expect PASS. |
| @@ -203,35 +210,34 @@ Today the claims-off purge (`purgeAppWithLifetimes`, `lifetimes_purge.go:40`) le |
| - [ ] **Step 5: Commit** `console: purge releases domain claims; accounts holding domains cannot be deleted`. |
| - [ ] **Step 6: Astra and Fable task review** (termination: purge and account deletion). |
| |
| -### Task 7: Point an unpointed bought domain at an app; add an address (risky: per-task review) |
| +### Task 7: Point a bought domain at an app, through the attach door (risky: per-task review) |
| |
| -Pointing only fills an empty binding; it never moves one (r1 6). Moving a domain between apps is "Detach" on its current app (the existing per-app detach door, linked from the domain page) followed by "Point". |
| +Paul's cut (r2): pointing adds no admission or retry logic of its own. It is an app-scoped door beside the existing attach door, gated exactly as that door is, that writes the bought zone's canonical records and then attaches the apex and `www` with the same `attachDomain` call the attach door makes. Destination admission (membership, the app exists in this account, linked apps refused: `accountApp`, `server.go:4279`; owner and CSRF: `appdomains.go:31-44`; temporary and linked destinations inside `attachDomainAs`, `domainattach.go:134`), refusals of claims held by another app or account, pending proofs and retries are all the attach door's, unchanged. Moving a domain between apps is "Detach" on its current app followed by "Point" (r1 6). |
| |
| **Files:** |
| - Create: `internal/console/domainpoint.go`, `internal/console/domainpoint_test.go` |
| +- Modify: `internal/console/routedecls.go` (beside `:332`), `parity/parity.tsv` (then `make parity-doc`), and the route registers listed in Task 9 |
| |
| **Interfaces:** |
| -- Consumes: Task 3 (`ManagedFor`), Task 5 (`accountDomain`), `attachDomain` (`domainattach.go:112`), the attach door's destination checks (`domainattach.go:134`: linked and temporary apps refused), `s.cfg.DomainApex` / static fallback as Plan 1's `authorised` step uses, `domainChallenge`. |
| +- Consumes: Task 3 (`ManagedFor`), Task 2 (`DomainRegistrationFor`, `AccountDomainPurchases`), `attachDomain` (`domainattach.go:112`), `s.cfg.DomainApex` / static fallback as Plan 1's `authorised` step uses, `domainChallenge`. |
| - Produces: |
| ```go |
| - func (s *Server) pointBoughtDomain(ctx context.Context, acct *Account, domain, app, principal string) *doorRefusal |
| - func (s *Server) addBoughtAddress(ctx context.Context, acct *Account, domain, host, app, principal string) *doorRefusal |
| - func (s *Server) pointDestinationRefusal(ctx context.Context, acct *Account, app string) *doorRefusal // the attach door's destination admission, factored out of attachDomainAs and used by both |
| + // POST /a/{sqid}/apps/{app}/domains/point, form field "domain". Gate: accountApp, CSRF, owner, domainBuyReady. |
| + func (s *Server) handleAppDomainPoint(w http.ResponseWriter, r *http.Request) |
| + func (s *Server) pointBoughtDomain(ctx context.Context, acct *Account, app, domain, principal string) *doorRefusal |
| ``` |
| - Order for both, every refusal before any write (r1 6, r1 7): |
| - 1. Under the per-account domain mutex (`s.domainPointLocks`, a `sync.Map` of `*sync.Mutex` by account ID, my call: two calls for one account must not interleave their `SetManaged` writes). |
| - 2. The domain must be one of the account's registrations (else the neutral not-found refusal), with **no non-terminal purchase** for it (else refused "still being bought"). Terminal purchase states never become live again and a registered domain cannot be bought a second time, so this check needs no lock shared with the purchase pass (r1 7). |
| - 3. `pointDestinationRefusal(app)`. |
| - 4. Point: neither the apex nor `www` may have a claim (any account): an own-account claim → refused "detach it from <app> first"; another account's → the neutral `domains.ErrHostUnavailable` refusal. Add address: the domain must already be pointed (the apex claim exists and names an app of this account, else refused "point the domain at an app first", r1 5); `host` strictly under `domain`, not apex or `www`, and unclaimed. |
| - 5. `SetManaged(zone, ManagedFor(apex, names, proof))` with the zone's current names plus the new one, so every existing name and proof survives, and the new name's challenge TXT is published before attach (r1 5). |
| - 6. `attachDomain` for each new host. A failure here leaves DNS written and nothing detached; the caller retries the same call (attach is idempotent for the caller's own claim). |
| - |
| -- [ ] **Step 1: Write failing tests:** `TestPointUnpointedDomainWritesApexAndAttaches`, `TestPointRefusesAttachedDomainTouchesNothing` (Review Focus 5: own-account apex claim on another app, and a foreign claim on `www`; no SetManaged call, claims unchanged), `TestPointRefusesLinkedAndTemporaryDestinations` (no DNS write), `TestPointRefusedWhilePurchaseLive` (purchase paused in `registered`), `TestPointAfterPurgeSucceeds` (with Task 6's purge), `TestPointNotOwnedDomainIsNeutralNotFound`, `TestAddAddressPublishesProofThenAttaches` (with `DomainProof`: the new name's TXT is in the managed set before attach; the existing names and proofs remain), `TestAddAddressRefusedOnUnpointedDomain`, `TestAddAddressRefusesApexWWWAndOutsideDomain`. |
| -- [ ] **Step 2: Run** `go test ./internal/console/ -run 'TestPoint|TestAddAddress'`; expect FAIL. |
| + `pointBoughtDomain`, in order: |
| + 1. `domain` must be one of the account's registrations (`DomainRegistrationFor`), else the neutral not-found refusal; and no non-terminal purchase for it (else refused "still being bought"). Terminal purchase states never become live again and a registered domain cannot be bought twice, so this check needs no lock shared with the purchase pass (r1 7). |
| + 2. `SetManaged(zone, ManagedFor(domain, apex, proof when DomainProof))`. The canonical pointed set, so a repeat is a no-op. If a later step refuses, the zone answers with the edge addresses for a name no app claims, which serves nothing (the same as any unclaimed host). |
| + 3. `attachDomain(ctx, acct, app, domain, "", "", principal)`, then the same for `www.` + domain, exactly as the purchase engine's `captured` step does. The first refusal is returned as the attach door returns it. A retry of the same call completes a partial or pending attach (r2 3). |
| + - CLI API twin: `POST /api/cli/apps/{account}/{app}/domains/point` `{"domain"}`, gated as the per-app attach API door (`postDomainAttachFull`'s server side, found from `apimode.go:4890-5206`'s path), calling `pointBoughtDomain`. |
| + |
| +- [ ] **Step 1: Write failing tests:** `TestPointUnpointedDomainWritesApexAndAttaches`, `TestPointOtherAppsClaimRefusedNothingDetached` (an own-account claim on app `b` for the apex, a foreign claim for `www`: the attach door's neutral refusal, both claims unchanged), `TestPointRetryCompletesPartialAttach` (the first call's `www` attach fails; the second call attaches `www`, the apex claim unchanged, one canonical `SetManaged` each time), `TestPointGateMatchesAttachDoor` (member 404, service token refused, missing app 404, linked app refused, no CSRF 403: the same answers as `POST .../domains/attach`), `TestPointRefusedWhilePurchaseLive` (purchase paused in `registered`), `TestPointAfterPurgeSucceeds` (with Task 6's purge), `TestPointNotOwnedDomainIsNeutralNotFound`. |
| +- [ ] **Step 2: Run** `go test ./internal/console/ -run 'TestPoint'`; expect FAIL. |
| - [ ] **Step 3: Implement.** |
| -- [ ] **Step 4: Run**; expect PASS. Also `-run 'DomainAttach'` (the factored destination check). |
| -- [ ] **Step 5: Commit** `console: point an unpointed bought domain at an app; add an address under it`. |
| -- [ ] **Step 6: Astra task review** (claim ownership across apps and accounts). |
| +- [ ] **Step 4: Run**; expect PASS. Also `-run 'DomainAttach'`. |
| +- [ ] **Step 5: Commit** `console: point a bought domain at an app through the attach door`. |
| +- [ ] **Step 6: Astra task review** (claim ownership; the door's gate equals the attach door's). |
| |
| ### Task 8: Domains nav item, overview page and a domain's page |
| |
| @@ -246,7 +252,7 @@ Waits on Paul's look at Task 1 (or his "go on" on the discussion). |
| - Consumes: Task 5; `domainGuidance(host, s.dnsTargets(ctx))` (`view.go:182`) for registered-elsewhere records; the catalog's renew price for the account's currency (`DomainCatalog.TLDs[tld].Renew[currency]`). |
| - Produces routes (members; `p.ActiveNav = "domains"`; no `domainBuyReady` requirement): |
| - `GET /a/{sqid}/domains` → overview: one card per `domainCard`; header chip "Bought here" or "Registered elsewhere", an in-flight purchase links to its card; bought cards show the expiry date and next year's price; page actions "Buy a domain" (owners, when `domainBuyReady`) and "Add a domain you own" (asks for the app and host, posts to the existing app attach door). Owners also see the Saved contacts section (Task 9 builds its forms; this task renders the list). |
| - - `GET /a/{sqid}/domains/{domain}` → the domain's page in §11.6 order: Addresses (each with app, state, and a "Detach" form posting to that app's existing detach door for members it already allows; "Point at an app" when unpointed and "Add address" when pointed, owners only, bought domains only); for bought domains Renewal (expiry, price, the card on file and "Change card" to the billing page, no switch) and Registered to (the registrant snapshot, no Change owner); DNS records shows the managed-records line only (customer records are Plan 4); no Transfer out card yet. Registered elsewhere: Addresses plus the records to set at the other registrar. An unknown or other account's domain → 404. |
| + - `GET /a/{sqid}/domains/{domain}` → the domain's page in §11.6 order: Addresses (each with app, state, and a "Detach" form posting to that app's existing detach door, shown to whoever that door allows); for bought domains, owners see "Point at an app" (an app picker posting to that app's `.../domains/point`, Task 7); for bought domains Renewal (expiry, price, the card on file and "Change card" to the billing page, no switch) and Registered to (the registrant snapshot, no Change owner); DNS records shows the managed-records line only (customer records are Plan 4); no Transfer out card yet. Registered elsewhere: Addresses plus the records to set at the other registrar. An unknown or other account's domain → 404. |
| - Accounts whose list is empty show an empty state with the two actions. |
| |
| - [ ] **Step 1: Write failing tests:** `TestDomainsNavBetweenAppsAndFleet`, `TestDomainsOverviewCards` (one bought card with expiry and price, one elsewhere card with two app rows and a Trash chip), `TestDomainsOverviewWithoutBuyConfigured` (page renders, no Buy action), `TestDomainsOverviewMemberSeesNoBuyOrContacts`, `TestDomainPageBoughtCardsInOrder`, `TestDomainPageElsewhereShowsRecordsToSet`, `TestDomainPageOtherAccount404`, `TestAppSettingsLinksToAccountDomains`. |
| @@ -255,7 +261,7 @@ Waits on Paul's look at Task 1 (or his "go on" on the discussion). |
| - [ ] **Step 4: Run**; expect PASS. Also `go test ./internal/console/ -run 'Styleguide|Nav|Parity'` and `go test ./internal/parity/`. |
| - [ ] **Step 5: Commit** `console: Domains page and a domain's own page`. |
| |
| -### Task 9: Three-step buy, saved contacts and pointing in the browser (risky: per-task review) |
| +### Task 9: Three-step buy and saved contacts in the browser (risky: per-task review) |
| |
| **Files:** |
| - Create: `internal/console/accountdomainbuy.go`, `internal/console/accountdomainbuy_test.go`, `internal/console/templates/account_domain_buy.html` |
| @@ -263,20 +269,19 @@ Waits on Paul's look at Task 1 (or his "go on" on the discussion). |
| - Modify the route registers: `parity/parity.tsv` (then `make parity-doc`), `internal/console/linkedpolicy.go:73-80`, `claim_invariant_fixtures_test.go:2522-2528`, `claim_invariant_probes_read_test.go:256-258`, `svcroutes_test.go:238`, `apilinks_test.go:489` |
| |
| **Interfaces:** |
| -- Consumes: Tasks 2, 4, 7; `domainBuyBrowserGate`'s checks (owner, CSRF on POST, `domainBuyReady`, `allowDomains`), generalised to the account (no app in the path). |
| +- Consumes: Tasks 2, 4; `domainBuyBrowserGate`'s checks (owner, CSRF on POST, `domainBuyReady`, `allowDomains`), generalised to the account (no app in the path). |
| - Produces routes (owners, CSRF on every POST): |
| - `GET /a/{sqid}/domains/buy?step=name|app|pay&name=&app=¬yet=` and `POST /a/{sqid}/domains/buy/check` (step 1 → quote → step 2), `POST /a/{sqid}/domains/buy` (step 3 → `startDomainPurchase` → Checkout). Step state travels in the query and hidden fields; the quote is re-checked at pay (Plan 1's `price_changed` path). `app=` preselects (from app Settings) and stays changeable; "Not yet" is `notyet=1` with `app` empty, so an empty value is never a silent default. |
| - `GET /a/{sqid}/domains/purchases/{id}` and `.../status` (the Plan 1 card and JSON, account-scoped; another account's ID → 404 identical to unknown). |
| - Old app-scoped routes: `GET .../apps/{app}/domains/buy` → 303 to `/a/{sqid}/domains/buy?app=<app>`; `GET .../apps/{app}/domains/purchases/{id}[/status]` → 303 to the account paths (`fetch` follows a 303 for an open page); the old `POST .../domains/check` and `POST .../domains/buy` (stale forms only) → 303 to the new buy page with `app` preselected, starting nothing (r1 14). |
| - `POST /a/{sqid}/domains/contacts` (add), `POST /a/{sqid}/domains/contacts/{id}` (edit), `POST /a/{sqid}/domains/contacts/{id}/remove`. |
| - - `POST /a/{sqid}/domains/{domain}/point` (`app`), `POST /a/{sqid}/domains/{domain}/addresses` (`host`, `app`). |
| - Step 3's "Registered to" is a searchable list of saved contacts with the most recently used preselected, ending with "Add a new contact" (fields in place, saved by the purchase). |
| |
| -- [ ] **Step 1: Write failing tests:** `TestAccountBuyThreeStepsToCheckout` (name → app → pay; Checkout created with the chosen app), `TestAccountBuyNotYetNeedsExplicitChoice` (empty `app` without `notyet=1` re-shows step 2), `TestAccountBuyMemberAndServiceTokenRefused`, `TestAccountBuyCSRFRequired`, `TestOldPurchaseURLsRedirect`, `TestOldBuyPostsRedirectAndStartNothing`, `TestPurchaseCardOtherAccount404`, `TestContactsEditRemoveOwnerOnly`, `TestPointDoorOwnerOnlyAndCSRF`. |
| -- [ ] **Step 2: Run** `go test ./internal/console/ -run 'AccountBuy|OldPurchaseURLs|OldBuyPosts|PurchaseCard|ContactsEdit|PointDoor'`; expect FAIL. |
| +- [ ] **Step 1: Write failing tests:** `TestAccountBuyThreeStepsToCheckout` (name → app → pay; Checkout created with the chosen app), `TestAccountBuyNotYetNeedsExplicitChoice` (empty `app` without `notyet=1` re-shows step 2), `TestAccountBuyMemberAndServiceTokenRefused`, `TestAccountBuyCSRFRequired`, `TestOldPurchaseURLsRedirect`, `TestOldBuyPostsRedirectAndStartNothing`, `TestPurchaseCardOtherAccount404`, `TestContactsEditRemoveOwnerOnly`. |
| +- [ ] **Step 2: Run** `go test ./internal/console/ -run 'AccountBuy|OldPurchaseURLs|OldBuyPosts|PurchaseCard|ContactsEdit'`; expect FAIL. |
| - [ ] **Step 3: Implement**; strings in `accountdomains_copy.go` (drafts). |
| - [ ] **Step 4: Run**; expect PASS. Also the registers: `go test ./internal/console/ -run 'SvcRoutes|APILinks|ClaimInvariant|LinkedPolicy|Parity'` and `go test ./internal/parity/`. |
| -- [ ] **Step 5: Commit** `console: three-step buy, saved contacts and pointing at the account`. |
| +- [ ] **Step 5: Commit** `console: three-step buy and saved contacts at the account`. |
| - [ ] **Step 6: Astra task review** (security gates: owner checks, CSRF, neutral 404s, redirects). |
| |
| ### Task 10: CLI and its API doors |
| @@ -291,16 +296,16 @@ Waits on Paul's look at Task 1 (or his "go on" on the discussion). |
| - Consumes: Tasks 2, 4, 5, 7. |
| - Produces API (persons only): |
| - **Read gate (r1 10):** `GET /api/cli/accounts/{account}/domains` uses a new `domainListAPIGate` (`apiPerson`, any member role, the domains rate limit), with no `domainBuyReady` requirement → `{"domains":[{"domain","bought":bool,"expires"?,"purchase"?:{"id","state"},"addresses":[{"host","app","in_trash","state"}]}]}`. |
| - - Everything below keeps `domainBuyAPIGate` (owners, `domainBuyReady`): `POST .../domains/purchases` body gains `"contact_id"`; `"app"` may be `""` only with `"not_yet": true`, else 422 `code:"app"`. `POST .../domains/{domain}/point` `{"app"}`; `POST .../domains/{domain}/addresses` `{"host","app"}`; `GET|POST .../domains/contacts`, `PUT|DELETE .../contacts/{id}`. The purchase status answer gains `"pointed": bool` (false when `App` is empty). |
| + - Everything below keeps `domainBuyAPIGate` (owners, `domainBuyReady`): `POST .../domains/purchases` body gains `"contact_id"`; `"app"` may be `""` only with `"not_yet": true`, else 422 `code:"app"`. `GET|POST .../domains/contacts`, `PUT|DELETE .../contacts/{id}`. The purchase status answer gains `"pointed": bool` (false when `App` is empty). |
| - Produces CLI: |
| - `carlos domains buy <name> (--app <a> | --not-yet) [--contact <id> | --contact-file f]`: neither `--app` nor `--not-yet` is a usage error (my call: an unpointed domain is never a silent default). With neither contact flag, the most recently used saved contact is used and named in the confirm line; none saved falls back to Plan 1's prompt. |
| - **Waiting (r1 12):** `waitDomainPurchase` (`domains_buy_cli.go:271`) treats `done` with `pointed: false` as an immediate successful end: it prints the unpointed message (for `--not-yet`, and for `app_gone` naming that the app went away) and exits 0, without waiting for `domain_state`. |
| - `carlos domains list` without `--app`: the account overview, one block per domain, its addresses indented. With `--app`: unchanged. |
| - - `carlos domains point <domain> --app <a>`; `carlos domains point <domain> --host docs.<domain> --app <a>` adds an address. |
| + - `carlos domains point <domain> --app <a>`: calls Task 7's per-app API door and prints the attach state, as `carlos domains attach` does. |
| - `carlos domains contacts [list | add --file f | edit <id> --file f | remove <id>]`. |
| |
| -- [ ] **Step 1: Write failing tests:** API: `TestAPIDomainsListGroups`, `TestAPIDomainsListWithoutBuyConfigured` (members get the list when `domainBuyReady` is false), `TestAPIPurchaseNotYetExplicit`, `TestAPIContactsOwnerOnly`, `TestAPIPointOtherAccount404`. CLI (httptest + `newTestSession`): `TestDomainsBuyNeedsAppOrNotYet`, `TestDomainsBuyUsesLastContactAndNamesIt`, `TestDomainsBuyNotYetEndsAtDone`, `TestDomainsBuyAppGoneEndsAtDoneAndSaysSo`, `TestDomainsListAccountOverview`, `TestDomainsPointPrintsState`, `TestDomainsContactsRoundTrip`. |
| -- [ ] **Step 2: Run** `go test ./internal/console/ -run 'TestAPIDomains|TestAPIPurchase|TestAPIContacts|TestAPIPoint'` and `go test . -run 'TestDomainsBuy|TestDomainsList|TestDomainsPoint|TestDomainsContacts'`; expect FAIL. |
| +- [ ] **Step 1: Write failing tests:** API: `TestAPIDomainsListGroups`, `TestAPIDomainsListWithoutBuyConfigured` (members get the list when `domainBuyReady` is false), `TestAPIPurchaseNotYetExplicit`, `TestAPIContactsOwnerOnly`. CLI (httptest + `newTestSession`): `TestDomainsBuyNeedsAppOrNotYet`, `TestDomainsBuyUsesLastContactAndNamesIt`, `TestDomainsBuyNotYetEndsAtDone`, `TestDomainsBuyAppGoneEndsAtDoneAndSaysSo`, `TestDomainsListAccountOverview`, `TestDomainsPointPrintsState`, `TestDomainsContactsRoundTrip`. |
| +- [ ] **Step 2: Run** `go test ./internal/console/ -run 'TestAPIDomains|TestAPIPurchase|TestAPIContacts'` and `go test . -run 'TestDomainsBuy|TestDomainsList|TestDomainsPoint|TestDomainsContacts'`; expect FAIL. |
| - [ ] **Step 3: Implement**; strings in `domains_buy_copy.go` (drafts). |
| - [ ] **Step 4: Run**; expect PASS. Also `go test ./internal/parity/ . -run 'Parity|CLIReg'`, `GOOS=darwin go build ./...` and `GOOS=windows go build ./...` (the CI cross-compile gate). |
| - [ ] **Step 5: Commit** `cli: account-wide domains list, buy without an app, point, contacts`. |
| @@ -311,7 +316,7 @@ Waits on Paul's look at Task 1 (or his "go on" on the discussion). |
| - Create: `docs/superpowers/specs/LUNA-COPY-BRIEF-DOMAINS-2A.md`, then `LUNA-COPY-RESULT-DOMAINS-2A.md` |
| - Modify: `internal/console/accountdomains_copy.go`, `internal/console/domainbuy_copy.go`, `domains_buy_copy.go`, `approved_domains_buy_copy_test.go` |
| |
| -- [ ] **Step 1:** Write the brief: every new or changed key with where it appears (screen and kit mockup path), and the facts that must stay true: the customer is the registrant; editing a contact changes future purchases only; nothing renews yet (no "renews" wording); "Not yet" means paid and registered but not serving; moving a domain means detaching it first; no registrar or DNS host names. |
| +- [ ] **Step 1:** Write the brief: every new or changed key with where it appears (screen and kit mockup path), and the facts that must stay true: the customer is the registrant; editing a contact changes future purchases only; nothing renews yet (no "renews" wording); "Not yet" means paid and registered but not serving; moving a domain means detaching it first; addresses other than the domain and `www` are not offered yet; no registrar or DNS host names. |
| - [ ] **Step 2:** Run the Luna pass (delegated copy review, as Plan 1's Task 11); apply the result table verbatim. |
| - [ ] **Step 3:** Pin approved strings; run `go test . ./internal/console/ -run Approved`; expect PASS. |
| - [ ] **Step 4: Commit** `domains: approved copy (Luna pass DOMAINS-2A)`. |