carlos / platform Public

console: point says waiting while an attach is pending its proof

pointBoughtDomain now returns (pending, ref): pending is true when either
the apex or the www attach left its claim pending (attachResult.Pending).
The browser door then flashes the draft Waiting notice, which opens as the
attach door's pending notice does, instead of saying the domain points at
the app; the API answer gains "pending". Pointing again once the proofs
show finishes it. Tests no longer reach a real resolver with DomainProof on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev a2d2c9040a4b04306cc4d670d543a5e2dc30b850 parent f96c735
3 files changed, +127 −24
  • internal/console/domainbuy_copy.go +4 −2
  • internal/console/domainpoint.go +32 −14
  • internal/console/domainpoint_test.go +91 −8

CI failed — run details

diff --git a/internal/console/domainbuy_copy.go b/internal/console/domainbuy_copy.go
index d0f4a84f7..047aada63 100644
--- a/internal/console/domainbuy_copy.go
+++ b/internal/console/domainbuy_copy.go
@@ -134,9 +134,11 @@ func accountDomainsRefusal(domains []string) string {
}
// domainPointCopy is the point door's (Plan 2a Task 7). DRAFTS
-// (2026-11-19), awaiting the copy pass. Pointed takes {domain} and {app}.
-var domainPointCopy = struct{ Pointed, Buying, Unavailable string }{
+// (2026-11-19), awaiting the copy pass. Pointed and Waiting take {domain}
+// and {app}; Waiting opens as the attach door's pending notice does.
+var domainPointCopy = struct{ Pointed, Waiting, Buying, Unavailable string }{
Pointed: "{domain} now points at {app}.",
+ Waiting: "Saved {domain} for {app}, but it is not live yet. Its DNS records can take a few minutes to show. Point it again then to finish.",
Buying: "this domain is still being bought. point it once the purchase has finished",
Unavailable: "could not point this domain right now. try again in a minute",
}
diff --git a/internal/console/domainpoint.go b/internal/console/domainpoint.go
index bc29a0b3c..6311dbdef 100644
--- a/internal/console/domainpoint.go
+++ b/internal/console/domainpoint.go
@@ -41,11 +41,16 @@ func (s *Server) handleAppDomainPoint(w http.ResponseWriter, r *http.Request) {
domain := normalizePointDomain(r.FormValue("domain"))
ctx, cancel := context.WithTimeout(r.Context(), 20*time.Second)
defer cancel()
- if ref := s.pointBoughtDomain(ctx, acct, app, domain, addr); ref != nil {
+ pending, ref := s.pointBoughtDomain(ctx, acct, app, domain, addr)
+ if ref != nil {
s.renderDoorRefusal(w, r, ref)
return
}
- s.setFlash(w, "ok", strings.NewReplacer("{domain}", domain, "{app}", app).Replace(domainPointCopy.Pointed))
+ msg := domainPointCopy.Pointed
+ if pending {
+ msg = domainPointCopy.Waiting
+ }
+ s.setFlash(w, "ok", pointMessage(msg, domain, app))
http.Redirect(w, r, appSettingsURL(acct.Sqid, app, "domains"), http.StatusSeeOther)
}
@@ -82,11 +87,17 @@ func (s *Server) handleAPIDomainPoint(w http.ResponseWriter, r *http.Request) {
domain := normalizePointDomain(in.Domain)
ctx, cancel := context.WithTimeout(r.Context(), 20*time.Second)
defer cancel()
- if ref := s.pointBoughtDomain(ctx, acct, app, domain, auditActor(p, acct)); ref != nil {
+ pending, ref := s.pointBoughtDomain(ctx, acct, app, domain, auditActor(p, acct))
+ if ref != nil {
writeDoorRefusalJSON(w, r, ref)
return
}
- writeJSON(w, http.StatusOK, map[string]any{"domain": domain, "app": app})
+ writeJSON(w, http.StatusOK, map[string]any{"domain": domain, "app": app, "pending": pending})
+}
+
+// pointMessage fills a domainPointCopy line's {domain} and {app}.
+func pointMessage(msg, domain, app string) string {
+ return strings.NewReplacer("{domain}", domain, "{app}", app).Replace(msg)
}
func normalizePointDomain(domain string) string {
@@ -106,25 +117,30 @@ func normalizePointDomain(domain string) string {
// 3. The apex, then www, are attached with attachDomain, as the purchase
// engine's captured step does. The first refusal is returned as the
// attach door returns it.
-func (s *Server) pointBoughtDomain(ctx context.Context, acct *Account, app, domain, principal string) *doorRefusal {
+//
+// pending is true when either attach left its claim pending (#215: its
+// proof is not visible yet, so nothing serves it). The doors then say the
+// domain is waiting, never that it points at the app; pointing again once
+// the proofs show finishes the attach.
+func (s *Server) pointBoughtDomain(ctx context.Context, acct *Account, app, domain, principal string) (pending bool, ref *doorRefusal) {
if domain == "" {
- return &doorRefusal{Status: http.StatusNotFound}
+ return false, &doorRefusal{Status: http.StatusNotFound}
}
reg, err := s.store.DomainRegistrationFor(ctx, acct.ID, domain)
if err != nil {
log.Printf("console: point %s/%s %s: registration: %v", acct.Sqid, app, domain, err)
- return pointUnavailable()
+ return false, pointUnavailable()
}
if reg == nil {
- return &doorRefusal{Status: http.StatusNotFound}
+ return false, &doorRefusal{Status: http.StatusNotFound}
}
live, err := s.ownLiveDomainPurchase(ctx, acct.ID, domain)
if err != nil {
log.Printf("console: point %s/%s %s: purchases: %v", acct.Sqid, app, domain, err)
- return pointUnavailable()
+ return false, pointUnavailable()
}
if live != nil {
- return &doorRefusal{Status: http.StatusConflict, Msg: domainPointCopy.Buying}
+ return false, &doorRefusal{Status: http.StatusConflict, Msg: domainPointCopy.Buying}
}
m, err := s.pointedManagedSet(ctx, domain, acct.Sqid)
if err == nil {
@@ -132,14 +148,16 @@ func (s *Server) pointBoughtDomain(ctx context.Context, acct *Account, app, doma
}
if err != nil {
log.Printf("console: point %s/%s %s: zone: %v", acct.Sqid, app, domain, err)
- return pointUnavailable()
+ return false, pointUnavailable()
}
for _, host := range []string{domain, "www." + domain} {
- if _, ref := s.attachDomain(ctx, acct, app, host, "", "", principal); ref != nil {
- return ref
+ res, ref := s.attachDomain(ctx, acct, app, host, "", "", principal)
+ if ref != nil {
+ return false, ref
}
+ pending = pending || res.Pending
}
- return nil
+ return pending, nil
}
func pointUnavailable() *doorRefusal {
diff --git a/internal/console/domainpoint_test.go b/internal/console/domainpoint_test.go
index 1b88244d9..4554a959d 100644
--- a/internal/console/domainpoint_test.go
+++ b/internal/console/domainpoint_test.go
@@ -9,6 +9,7 @@ import (
"context"
"errors"
"io"
+ "net"
"net/http"
"net/url"
"os"
@@ -95,6 +96,7 @@ func TestPointUnpointedDomainWritesApexAndAttaches(t *testing.T) {
f := newPurchaseFixture(t)
f.srv.cfg.DomainProof = true
p := f.boughtUnpointed(t)
+ f.srv.lookupTXT = txtForPoint(f, p.Domain, "www."+p.Domain)
c, csrf := f.ownerBrowser(t)
before := setCalls(f, p.Domain)
status, loc, body := postForm(t, c, f.appURL("kass", "/domains/point"), url.Values{"csrf": {csrf}, "domain": {" SHOP.com "}})
@@ -104,14 +106,17 @@ func TestPointUnpointedDomainWritesApexAndAttaches(t *testing.T) {
if n := setCalls(f, p.Domain) - before; n != 1 {
t.Fatalf("SetManaged calls = %d, want 1", n)
}
+ if got, want := flashOf(t, f, c), "ok|"+pointMessage(domainPointCopy.Pointed, p.Domain, "kass"); got != want {
+ t.Fatalf("flash %q, want %q", got, want)
+ }
f.wantPointed(t, p.Domain)
f.wantClaimedBy(t, p.Domain, "kass")
if c := f.claim(t, p.Domain); c.CreatedBy != pointOwner(f) {
t.Fatalf("claim principal: %+v", c)
}
// A repeat is the same canonical set and a re-attach.
- if ref := f.srv.pointBoughtDomain(context.Background(), f.acct, "kass", p.Domain, pointOwner(f)); ref != nil {
- t.Fatalf("repeat: %+v", ref)
+ if pending, ref := f.srv.pointBoughtDomain(context.Background(), f.acct, "kass", p.Domain, pointOwner(f)); ref != nil || pending {
+ t.Fatalf("repeat: pending %v, %+v", pending, ref)
}
f.wantPointed(t, p.Domain)
f.wantClaimedBy(t, p.Domain, "kass")
@@ -128,7 +133,7 @@ func TestPointOtherAppsClaimRefusedNothingDetached(t *testing.T) {
apex, www := f.claim(t, p.Domain), f.claim(t, "www."+p.Domain)
ctx := context.Background()
- ref := f.srv.pointBoughtDomain(ctx, f.acct, "kass", p.Domain, pointOwner(f))
+ _, ref := f.srv.pointBoughtDomain(ctx, f.acct, "kass", p.Domain, pointOwner(f))
_, attachRef := f.srv.attachDomain(ctx, f.acct, "kass", p.Domain, "", "", pointOwner(f))
if ref == nil || attachRef == nil || *ref != *attachRef {
t.Fatalf("point refusal %+v, attach door's %+v", ref, attachRef)
@@ -148,7 +153,7 @@ func TestPointRetryCompletesPartialAttach(t *testing.T) {
putPurgeClaim(t, f.rel, "zzz", "theirs", "www."+p.Domain, false)
before := setCalls(f, p.Domain)
- ref := f.srv.pointBoughtDomain(ctx, f.acct, "kass", p.Domain, pointOwner(f))
+ _, ref := f.srv.pointBoughtDomain(ctx, f.acct, "kass", p.Domain, pointOwner(f))
if ref == nil {
t.Fatal("the www attach was refused, but the point succeeded")
}
@@ -165,7 +170,7 @@ func TestPointRetryCompletesPartialAttach(t *testing.T) {
if err := f.rel.Delete(ctx, domains.ClaimKey("www."+p.Domain)); err != nil {
t.Fatal(err)
}
- if ref := f.srv.pointBoughtDomain(ctx, f.acct, "kass", p.Domain, pointOwner(f)); ref != nil {
+ if _, ref := f.srv.pointBoughtDomain(ctx, f.acct, "kass", p.Domain, pointOwner(f)); ref != nil {
t.Fatalf("retry: %+v", ref)
}
if n := setCalls(f, p.Domain) - before; n != 2 {
@@ -187,7 +192,7 @@ func TestPointRefusedWhilePurchaseLive(t *testing.T) {
t.Fatalf("registration while registered: %+v %v", r, err)
}
before := setCalls(f, p.Domain)
- ref := f.srv.pointBoughtDomain(context.Background(), f.acct, "kass", p.Domain, pointOwner(f))
+ _, ref := f.srv.pointBoughtDomain(context.Background(), f.acct, "kass", p.Domain, pointOwner(f))
if ref == nil || ref.Status != http.StatusConflict || ref.Msg != domainPointCopy.Buying {
t.Fatalf("refusal: %+v", ref)
}
@@ -222,7 +227,7 @@ func TestPointAfterPurgeSucceeds(t *testing.T) {
f.srv.trashSweep(ctx, time.Now())
f.assertNoClaims(t, p.Domain)
- if ref := f.srv.pointBoughtDomain(ctx, f.acct, "web", p.Domain, pointOwner(f)); ref != nil {
+ if _, ref := f.srv.pointBoughtDomain(ctx, f.acct, "web", p.Domain, pointOwner(f)); ref != nil {
t.Fatalf("point after purge: %+v", ref)
}
f.wantPointed(t, p.Domain)
@@ -237,7 +242,7 @@ func TestPointNotOwnedDomainIsNeutralNotFound(t *testing.T) {
}
ctx := context.Background()
for _, domain := range []string{"other.com", "never.com", ""} {
- ref := f.srv.pointBoughtDomain(ctx, f.acct, "kass", domain, pointOwner(f))
+ _, ref := f.srv.pointBoughtDomain(ctx, f.acct, "kass", domain, pointOwner(f))
if ref == nil || ref.Status != http.StatusNotFound {
t.Fatalf("%q: %+v", domain, ref)
}
@@ -407,3 +412,81 @@ func TestPointAPIPersonOwnerOnly(t *testing.T) {
f.wantPointed(t, p.Domain)
f.wantClaimedBy(t, p.Domain, "kass")
}
+
+// txtForPoint is a resolver that sees this account's proof at each of
+// hosts and nothing anywhere else.
+func txtForPoint(f *purchaseFixture, hosts ...string) func(context.Context, string) ([]string, error) {
+ return func(_ context.Context, name string) ([]string, error) {
+ for _, host := range hosts {
+ if c := f.srv.domainChallenge(host, f.acct.Sqid); c.Name == name {
+ return []string{c.Value}, nil
+ }
+ }
+ return nil, &net.DNSError{Err: "no such host", Name: name, IsNotFound: true}
+ }
+}
+
+// flashOf is the notice the console set on c, unescaped ("kind|message").
+func flashOf(t *testing.T, f *purchaseFixture, c *http.Client) string {
+ t.Helper()
+ u, _ := url.Parse(f.ts.URL)
+ for _, ck := range c.Jar.Cookies(u) {
+ if ck.Name == flashCookie {
+ v, err := url.QueryUnescape(ck.Value)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return v
+ }
+ }
+ return ""
+}
+
+// TestPointPendingProofSaysWaiting: while either attach leaves its claim
+// pending (its proof is not visible yet), neither door says the domain
+// points at the app. Pointing again once the proofs show finishes it.
+func TestPointPendingProofSaysWaiting(t *testing.T) {
+ f := newPurchaseFixture(t)
+ f.srv.cfg.DomainProof = true
+ p := f.boughtUnpointed(t)
+ // The apex proof is visible, www's is not yet.
+ f.srv.lookupTXT = txtForPoint(f, p.Domain)
+ ctx := context.Background()
+
+ pending, ref := f.srv.pointBoughtDomain(ctx, f.acct, "kass", p.Domain, pointOwner(f))
+ if ref != nil || !pending {
+ t.Fatalf("direct: pending %v, %+v", pending, ref)
+ }
+ f.wantPointed(t, p.Domain)
+
+ c, csrf := f.ownerBrowser(t)
+ status, loc, body := postForm(t, c, f.appURL("kass", "/domains/point"), url.Values{"csrf": {csrf}, "domain": {p.Domain}})
+ if status != http.StatusSeeOther || loc != appSettingsURL(f.acct.Sqid, "kass", "domains") {
+ t.Fatalf("point = %d %q:\n%s", status, loc, body)
+ }
+ if got, want := flashOf(t, f, c), "ok|"+pointMessage(domainPointCopy.Waiting, p.Domain, "kass"); got != want {
+ t.Fatalf("flash %q, want %q", got, want)
+ }
+
+ owner := cliToken(t, f.consoleFixture, pointOwner(f), "point-owner-api")
+ path := "/api/cli/apps/" + f.acct.Sqid + "/kass/domains/point"
+ status, b := buyRequest(t, f, http.MethodPost, path, owner, `{"domain":"shop.com"}`)
+ if status != http.StatusOK || !strings.Contains(b, `"pending":true`) {
+ t.Fatalf("api while pending: %d %s", status, b)
+ }
+
+ // Both proofs visible: the same call finishes it.
+ f.srv.lookupTXT = txtForPoint(f, p.Domain, "www."+p.Domain)
+ status, b = buyRequest(t, f, http.MethodPost, path, owner, `{"domain":"shop.com"}`)
+ if status != http.StatusOK || !strings.Contains(b, `"pending":false`) {
+ t.Fatalf("api once proven: %d %s", status, b)
+ }
+ status, _, body = postForm(t, c, f.appURL("kass", "/domains/point"), url.Values{"csrf": {csrf}, "domain": {p.Domain}})
+ if status != http.StatusSeeOther {
+ t.Fatalf("point once proven = %d:\n%s", status, body)
+ }
+ if got, want := flashOf(t, f, c), "ok|"+pointMessage(domainPointCopy.Pointed, p.Domain, "kass"); got != want {
+ t.Fatalf("flash once proven %q, want %q", got, want)
+ }
+ f.wantClaimedBy(t, p.Domain, "kass")
+}