carlos / platform Public

reviews: plan-domains-2a whole-branch findings (Astra, Fable)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 7a90dd3580e630c78591fb7944b03e90489facb8 parent af95f0c
2 files changed, +154 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-domains-2a-branch.md +74 −0
  • docs/superpowers/reviews/FABLE-FINDINGS-domains-2a-branch.md +80 −0
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-domains-2a-branch.md b/docs/superpowers/reviews/CODEX-FINDINGS-domains-2a-branch.md
new file mode 100644
index 000000000..1bf1f6ea9
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-domains-2a-branch.md
@@ -0,0 +1,74 @@
+Reviewed `40d7a9cf..58830d44`, whole-branch round 1. No files edited or subagents used. Targeted tests could not start: the read-only sandbox prevented Go from creating its build directory. Findings below are based on verified source paths.
+
+**P1 — Purge can permanently strand a domain after a transient claim-read failure.**
+
+- **Evidence:** [lifetimes_purge.go:348](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/internal/console/lifetimes_purge.go:348) logs every unread custom-domain claim and returns success. `UnreadClaim` includes transient GET failures, not just corrupt objects: [claimcache.go:85](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/internal/domains/claimcache.go:85), [claims.go:936](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/internal/domains/claims.go:936). Purge then removes the marker and app row at [lifetimes_purge.go:258](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/internal/console/lifetimes_purge.go:258).
+- **Failure:** With a cold cache, one GET for a valid, verified bought-domain claim fails. Purge skips it and completes. After storage recovers, the claim still names the deleted app; pointing at another app is refused by [claims.go:758](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/internal/domains/claims.go:758). The overview filters out the deleted app, so it misleadingly offers pointing.
+- **Invariant:** Spec §11.7 C2: purge releases the addresses before relinquishing the marker and row, allowing another app to use them.
+- **Fix:** Require a complete claim inventory before completing purge; retain the marker and row when completeness cannot be established. Add a cold-cache, single-GET-failure witness followed by recovery and successful pointing.
+- **History:** This repeats Task 6’s claim-completeness fault family. The ledger’s skip-all ruling causes a concrete spec failure, which is why it is reported. Apply stopping rule 2: choose a conservative refusal gate or one durable cleanup invariant, rather than another ownership-cache patch.
+
+**P2 — A pending or partial Point loses its browser retry action.**
+
+- **Evidence:** [domainpoint.go:121](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/internal/console/domainpoint.go:121) requires another Point call after proof becomes visible. The browser is redirected to app settings, but [accountdomainspage.go:268](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/internal/console/accountdomainspage.go:268) only offers Point when there are **zero** addresses. Pending and partially attached claims already count as addresses.
+- **Failure:** An ordinary DNS propagation delay leaves pending claims. The owner is told to point again, but returning to the domain page provides only Detach. The existing test retries by constructing another POST directly, bypassing this missing UI.
+- **Invariant:** The planned partial/pending flow must be completable through the browser.
+- **Fix:** Preserve a retry action targeting the same app while pointing is pending or incomplete. Keep admission in the existing attach core.
+
+**P2 — The destructive first-route cleanup paths lack their deferred witnesses.**
+
+- **Evidence:** [lifetimes_purge_test.go:467](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/internal/console/lifetimes_purge_test.go:467) creates aliases or instance catch-alls, never an ordinary first-route claim. [domainbuy_account_test.go:182](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/internal/console/domainbuy_account_test.go:182) exercises claim-delete failure, not first-route retirement failure. Production branches differ at [domainattach.go:465](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/internal/console/domainattach.go:465).
+- **Failure scenario left untested:** Record retirement fails after partial purchase attachment or during purge. Releasing the claim or marker prematurely would leave a route behind an available hostname.
+- **Invariant:** Retire the first-route record before releasing its claim; retain durable retry state on failure.
+- **Fix:** Add the deferred first-route purchase-cleanup and purge witnesses, including legacy purge and demo retry branches. Assert retirement, claim deletion and marker deletion order.
+
+**P2 — An open purchase card retains obsolete app steps after switching to unpointed cleanup.**
+
+- **Evidence:** [domain_buy.html:78](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/internal/console/templates/domain_buy.html:78) changes each existing row’s state but never hides the last two rows or switches their labels. The no-app stages supply only two populated states.
+- **Failure:** A card opened before the app disappears switches to the no-app lede while still displaying the app’s DNS/HTTPS steps with empty states.
+- **Invariant:** The purchase card must accurately describe the current workflow.
+- **Fix:** Update row visibility and labels when `noApp` changes; cover the transition on an already-open card.
+
+**P2 — One explicitly deferred copy-review join remains unresolved.**
+
+- **Evidence:** The ledger identifies the rewritten CLI introduction as unreviewed. It remains at [cli.md:1772](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/docs/site/cli.md:1772). The subsequent [join review](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/docs/superpowers/specs/LUNA-COPY-RESULT-DOMAINS-2A-JOIN.md:1) covers the buy help only.
+- **Failure:** This sentence ships without the required review.
+- **Invariant:** Spec §7.3’s copy-review gate.
+- **Fix:** Review that sentence or remove the redundant introduction. No new branch-review round is needed for that correction alone.
+
+**P3 — The Route 53 preservation test reads its expected SOA/NS values after the operation.**
+
+- **Evidence:** [route53_test.go:327](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/internal/zonehost/route53zones/route53_test.go:327) builds `want` from the resulting records.
+- **Failure:** Incorrect changes to the surviving SOA/NS values can satisfy the assertion.
+- **Invariant:** Unpointing leaves unmanaged records unchanged.
+- **Fix:** Snapshot those records before `SetManaged`. Follow-up; this does not establish a production defect.
+
+**Census verdicts**
+
+| Entry | Verdict and evidence |
+|---|---|
+| Removed `domains_buy_cli.go:readDomainContact` | **APPROVE.** The declaration was renamed, not silently discarded. Its reads are accounted for by the new unit below; no validation disappeared. |
+| New `domains_buy_cli.go:readContactFile`, `legacy / accepted-legacy` | **APPROVE.** Read [lines 251–276](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/domains_buy_cli.go:251): caller-selected file, bounded read, strict JSON, non-null object and trailing-input rejection. Only error wording is parameterized. New callers at [domains_account_cli.go:364](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/domains_account_cli.go:364) supply the CLI user’s `--file`; no tenant-, app- or agent-selected root path is introduced. |
+| Re-pinned envelope `.` | **APPROVE.** Reviewed the changed CLI dispatch/list functions at [domains_cli.go:105](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/domains_cli.go:105) and [371](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/domains_cli.go:371), account commands and API calls throughout [domains_account_cli.go](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/domains_account_cli.go:48), buy selection/confirmation and completion at [domains_buy_cli.go:129](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/domains_buy_cli.go:129), request serialization at [apimode.go:5011](/home/paulca/.cache/tmp/claude-1001/domains-plan-2/apimode.go:5011), and copy constants. These extend authenticated CLI operations without introducing privileged filesystem reads, execution, or weakening root validation. |
+
+These are source-review approvals for tip `58830d44bf17f09ba517789bedb8d66ab880a628`; the census test was not executed here.
+
+**Deferred-minor triage**
+
+| Task | Disposition |
+|---|---|
+| **1** | Shipped code resolves the stacked country form, short-list filter and DNS-guidance concerns. Mockup-only layout, repeated notes, apostrophes and Not-yet wording can follow up. |
+| **2** | Whole-branch deployment resolves the intermediate backfill hazard; registration snapshots are now supplied. Stale migration prose, repeated empty-registrant lookup and missing `Touch` witness can follow up. Malformed database JSON failing startup is not evidence of failure on valid Plan 1 data. |
+| **3** | **Delete ordering is not a verified blocker.** The batch includes both apex and alias deletions. AWS documents transactional batches, and its bulk-delete guidance says aliases need no special handling: [https://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html](https://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html), [https://repost.aws/articles/ARutEr_b3iQD2TGsJ6ViNpAA/backup-and-bulk-deletion-of-route-53-records](https://repost.aws/articles/ARutEr_b3iQD2TGsJ6ViNpAA/backup-and-bulk-deletion-of-route-53-records). No live witness was run. SOA/NS assertion and explicit nil-apex test can follow up. Canonical pointed construction is now used. |
+| **4** | **Fix first-route coverage before merge**, as above. Unpointing lede is resolved. Concurrent captured passes remain the explicitly excluded existing race; restored-app cleanup follows the accepted durable-Unpointing decision. |
+| **5** | Blank-state fallback and registrable-path validation are resolved. One-render Trash skew can follow up. |
+| **6** | **Fix first-route and legacy/demo retry coverage before merge.** Logging, account-zero audit attribution, comments and the test wrapper can follow up. `finishDemoClaimAbort` is not a demonstrated new leak: destination mutations are refused while its reservation is active. The unread-claim ruling separately fails under the P1 scenario above. |
+| **7** | Resolved: `domains-point` is `both` in parity. |
+| **8** | Singular/today expiry wording is resolved. The empty-app `#point` link needs explanatory UI but can follow up. Repeated guidance, context plumbing and guidance-composition coupling can follow up. Pending-point retry is the separate P2 above. |
+| **9** | **Fix stale app rows before merge.** Currency-change reconfirmation is safe. Historical no-app cards, prepayment timing wording and redirect comments can follow up; the purchase card retains ownership wording. |
+| **10** | Foreign-contact API witness, stderr prefix and duplicate label formatting can follow up; account scoping is enforced in the shared selection code. CLI introduction review remains the P2 above. |
+| **11** | Buy-help join is resolved. **Resolve the CLI introduction’s review before merge.** Brief post-capture payment wording and draft mockup copy can follow up. |
+
+No additional defect found in frozen-contact write-back, valid Plan 1 migrations, SQL classification, payment ordering, registrar auto-renew suppression, account-deletion exclusion, or the steady-state/per-box request budget.
+
+NOT READY
\ No newline at end of file
diff --git a/docs/superpowers/reviews/FABLE-FINDINGS-domains-2a-branch.md b/docs/superpowers/reviews/FABLE-FINDINGS-domains-2a-branch.md
new file mode 100644
index 000000000..9eb8278c1
--- /dev/null
+++ b/docs/superpowers/reviews/FABLE-FINDINGS-domains-2a-branch.md
@@ -0,0 +1,80 @@
+# Review: plan-domains-2a whole branch, round 1
+
+Reviewed `40d7a9cf..58830d44`; the worktree tip is af95f0c5, which only adds the brief. Nothing was edited. Census skipped as instructed.
+
+Targeted tests pass for `internal/zonehost/...` and for `internal/console` (`-run 'Domain|SavedContact|Point|ReleaseApp|PurgeApp|DeleteAccount|Registrant|Backfill'`, 85 s). The root-package CLI tests did not run: the sandbox's Go build cache is read-only for that package (`[setup failed]`), so the CLI is reviewed by reading only.
+
+## P1
+
+None found.
+
+## P2
+
+**1. Unpointing batch deletes the apex A sets before the www alias that targets them.**
+- **Where:** `internal/zonehost/route53zones/route53.go:264-267`. Deletes are emitted in listing order, and Route 53 lists the apex before `www`.
+- **Would Route 53 reject it?** I could not confirm either way. Two doc searches found no referential check on deleting an alias target, and batches are documented as atomic, which suggests order does not matter. `DeleteZone` already emits the same order (`route53.go:~322-328`), but I found no recorded witness of it against a pointed zone.
+- **Failure if it does reject:** `finishPurchaseUnpointed` (`domainbuy.go:825`) fails on every pass. A paid purchase whose app is gone stays `captured` forever, alerting at attempt 10.
+- **Fix:** emit alias deletes before non-alias deletes in `SetManaged`, and the same in `DeleteZone`. Add a test on batch order, then witness one unpoint on dev before release.
+- **Invariant:** a captured purchase always finishes.
+
+**2. App purge frees a bought domain's claims but leaves its zone pointing at the edge.**
+- **Where:** `lifetimes_purge.go:100` and the three lifetimes-off branches release the claims; nothing calls `SetManaged(empty)`.
+- **Failure:** `CONSOLE_DOMAIN_PROOF` is off by default (`domainpolicy.go:297-302`), and attach admission never reads `domain_registrations`. After a purge, any other account can attach `example.com` and serve on a domain this account registered and pays for. Before this branch the stale claim blocked that.
+- **Fix:** in purge, unpoint the zone when a released host is the apex or `www` of one of the account's registrations. That matches §11.4's "no apex or www records until pointed" and the app-gone path. Alternatively, refuse attaching a host under another account's registration.
+- **Scope note:** a manual Detach leaves the same state and predates this branch, so I am not reopening the attach door. This is only about what the new purge release adds.
+
+**3. A malformed purchase `details` row stops the console booting (ledger line 64).**
+- **Where:** `domainstore.go:256`, in `newestPurchaseContact`, called from `migrateDomains` on every boot while any registration has registrant `'{}'`.
+- **Failure:** one bad row is a console crash loop, where it should be one skipped backfill.
+- **Fix:** log and skip the row.
+- **Invariant:** a data backfill never gates boot.
+
+**4. No test for a first-route claim in purge or in app-gone cleanup (ledger lines 85, 109).**
+- **Where:** `releaseDomainHostHeld` has the record-before-claim ordering (`domainattach.go:465-490`) and the `record=false` shortcut under lifetimes.
+- **Risk:** this is the only place a route record could outlive its claim, for a host anyone may then claim. Only alias claims are tested.
+- **Fix:** add a first-route case to each, including a record-retirement failure that leaves the claim in place.
+
+**5. Two controller-written copy joins have not been through copy review (ledger line 183).**
+- The merged buy help line for `--not-yet` and the `cli.md` attach/detach sentence. §11.8 requires review before they ship.
+
+## P3
+
+- **Unpaid domains can be pointed.** `pointBoughtDomain` (`domainpoint.go:129`) needs only a registration row, so a domain whose purchase ended `unpaid` can be pointed and shows as bought. The attach door already allowed this; decide in Plan 3.
+- **Personal data outlives its owner's removal.** `domain_contacts` rows stay after the backfill (`domainstore.go:189`), invisible and unremovable. `DeleteAccount` (`ownership.go:842-847`) leaves `domain_saved_contacts`. Delete both. `Store.DomainContact` and `SetDomainContact` now have only test callers.
+- **Each purge and demo retirement now lists the whole claims prefix** (`lifetimes_purge.go:338`, `demo_expiry.go:336`). Not steady-state and not per-box, so it passes item 7. At demo volume, list once per pass.
+- **Members see the registrant's name** (`accountdomainspage.go:455`). This is the line-132 ruling and §11.6 does not forbid it; noted because the brief's item 4 says registrant data is owners only.
+- **Old purchase URLs answer members differently.** `handleAppDomainPurchaseRedirect` gives a member 303 for a real purchase ID and 404 otherwise; the target then 404s. Harmless.
+- **Wrong refusal variable.** `buyPayAgain` renders `ref` where it means `qref` (`accountdomainbuy.go:~424`).
+
+## Checked and sound
+
+- **Money flow:** purchases start under the plan lock and billing hold, with the account re-read. Capture happens only from `registered`; registration only after `requires_capture`. Ambiguous answers stay indeterminate. `Unpointing` is durable before the first release. Auto-renew is unchanged from Plan 1 (`AutoRenew: true` on the registration row, cleared on `unpaid`); no renewal code exists yet, and §11.4 says "auto-renew on", so the brief's "auto-renew off" needs your reading.
+- **R12:** the contact is frozen in purchase details. `EnsureContact` is always called with an empty handle. Handle write-back is conditional on version and empty handle. Legacy purchases keep their own copy.
+- **Account deletion:** the obligations check runs under the billing hold before the tombstone, and again inside the `DeleteAccount` transaction.
+- **Security gates:** every new API door calls `apiPerson` with an empty service-role set. Browser POSTs check CSRF. Non-owners get 404. Foreign contact and purchase IDs are indistinguishable from unknown ones. Redirect targets are built from escaped path parts.
+- **SQL gate:** the classifications for the two new tables and `FreeWhenNoApp` are correct.
+
+## Minor triage
+
+**Fix before merge:**
+- Line 71: Route 53 delete order (P2-1).
+- Line 64: backfill failing boot (P2-3).
+- Lines 85 and 109: first-route tests (P2-4).
+- Line 183: Luna check on the two joins (P2-5).
+- Line 135: "in 1 days" / "in 0 days". User-visible and a one-line fix.
+
+**Fix soon, not blocking:**
+- Line 111: log when `ReapAccount` reaps an account holding registrations. Needed before renewals.
+- Line 114: confirm a demo-claim target cannot hold custom claims.
+- Line 110: legacy-branch retry subtest.
+- Line 153: the no-app purchase card should link to the domain page.
+- Line 156: stale app rows on the purchase card.
+
+**Defer:** every other "minor (deferred)" line: 46-53, 62-63, 65-66, 72-74, 89-90, 96-98, 112-113, 117-118, 126, 136-145, 151-152, 159, 169-172, 184-185.
+
+Sources for the Route 53 question:
+- [ChangeResourceRecordSets API reference](https://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html)
+- [AliasTarget API reference](https://docs.aws.amazon.com/Route53/latest/APIReference/API_AliasTarget.html)
+- [Deleting records](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-deleting.html)
+
+**READY AFTER FIXES**