console: purge keeps domain claims; point takes over a purged app's
Paul's ruling 2026-11-19 (stopping rule 2) replaces Task 6's purge claim release. Every purge branch (lifetimes on, purge door, trash sweep, expiry pass, demo retirement) is back to main's behaviour: claims stay. Pointing a bought domain releases this account's apex or www claim whose app is in neither AppsIn nor Trash (releaseDomainHost), then attaches. Account deletion's domain refusal is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 files changed,
+269
−396
docs/superpowers/specs/2026-11-01-domain-registration-design.md+6 −0internal/console/demo_expiry.go+1 −3internal/console/domainpoint.go+47 −4internal/console/domainpoint_test.go+147 −10internal/console/expirypass.go+1 −3internal/console/lifetimes_purge.go+1 −128internal/console/lifetimes_purge_test.go+65 −245internal/console/ownership.go+1 −3
diff --git a/docs/superpowers/specs/2026-11-01-domain-registration-design.md b/docs/superpowers/specs/2026-11-01-domain-registration-design.md| index cabb00ec3..3c9e4ccff 100644 |
| --- a/docs/superpowers/specs/2026-11-01-domain-registration-design.md |
| +++ b/docs/superpowers/specs/2026-11-01-domain-registration-design.md |
| @@ -605,6 +605,12 @@ Renewal, Registered to or Transfer out. |
| when the app is purged they detach and the domain shows as not pointed |
| at an app (my call, builder check C2). Deleting the account is still |
| refused while it holds registrations (§4.3). |
| +- **Purge as built (Paul's ruling, 2026-11-19):** a purge leaves the |
| + app's addresses claimed. They stay claimed until the owner points the |
| + domain again: pointing a bought domain at an app first releases each |
| + apex or www claim of this account whose app no longer exists (not live, |
| + not in Trash), then attaches. A claim of an app that still exists, or of |
| + another account, is left to the attach refusal. |
| - **The chosen app goes away mid-purchase:** payment and registration are |
| never held up by an app's lifecycle. The purchase finishes as a "Not |
| yet" purchase: captured and recorded, nothing attached, and the purchase |
diff --git a/internal/console/demo_expiry.go b/internal/console/demo_expiry.go| index bbbefa33a..b4c8ced1f 100644 |
| --- a/internal/console/demo_expiry.go |
| +++ b/internal/console/demo_expiry.go |
| @@ -333,9 +333,7 @@ func (s *Server) retireDemoLocked(ctx context.Context, d DemoRow, now time.Time, |
| // No absence-based inference is needed if final row deletion then fails. |
| if lifetimesUnit(ctx) { |
| err = s.purgeAppWithLifetimes(ctx, d.AccountSqid, d.App, at, now, true) |
| - } else if err = s.releaseAppDomainClaims(ctx, d.AccountSqid, d.App); err == nil { |
| - // Guards checked above; the claims before the contents, as |
| - // purgeAppWithLifetimes releases them. |
| + } else { |
| err = release.PurgeAppExcept(ctx, s.cfg.Releases, s.cfg.ReleasePub, d.AccountSqid, d.App, at, now, func(key string) bool { return key == release.AppTombstoneKey(d.AccountSqid, d.App) }) |
| } |
| if err != nil { |
diff --git a/internal/console/domainpoint.go b/internal/console/domainpoint.go| index 6311dbdef..f4d18d589 100644 |
| --- a/internal/console/domainpoint.go |
| +++ b/internal/console/domainpoint.go |
| @@ -5,18 +5,25 @@ |
| // attachDomain call the attach door makes. It adds no admission or retry |
| // logic of its own: destination admission (linked, temporary, plan, claims |
| // held by another app or account, pending proofs) is attachDomain's, and a |
| -// retry of the same call completes a partial or pending attach. |
| +// retry of the same call completes a partial or pending attach. The one |
| +// thing it adds: a purge keeps a purged app's claims (spec §11.7), so |
| +// before each attach it releases this account's claim on the host when |
| +// that claim's app no longer exists (takeOverPurgedClaim). |
| // |
| // Moving a domain between apps is Detach on its current app, then Point. |
| package console |
| import ( |
| "context" |
| + "errors" |
| "log" |
| "net/http" |
| + "os" |
| + "slices" |
| "strings" |
| "time" |
| + "github.com/carlosframework/platform/internal/domains" |
| "github.com/carlosframework/platform/internal/zonehost" |
| ) |
| @@ -114,9 +121,10 @@ func normalizePointDomain(domain string) string { |
| // 2. The zone gets 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. |
| -// 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. |
| +// 3. The apex, then www: a claim of this account whose app is gone is |
| +// released (takeOverPurgedClaim), then the host is attached with |
| +// attachDomain, as the purchase engine's captured step does. The first |
| +// refusal is returned as the attach door returns it. |
| // |
| // 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 |
| @@ -150,7 +158,15 @@ func (s *Server) pointBoughtDomain(ctx context.Context, acct *Account, app, doma |
| log.Printf("console: point %s/%s %s: zone: %v", acct.Sqid, app, domain, err) |
| return false, pointUnavailable() |
| } |
| + retained, err := s.store.AppsIncludingTrashIn(acct.ID) |
| + if err != nil { |
| + log.Printf("console: point %s/%s %s: apps: %v", acct.Sqid, app, domain, err) |
| + return false, pointUnavailable() |
| + } |
| for _, host := range []string{domain, "www." + domain} { |
| + if ref := s.takeOverPurgedClaim(ctx, acct, retained, host, principal); ref != nil { |
| + return false, ref |
| + } |
| res, ref := s.attachDomain(ctx, acct, app, host, "", "", principal) |
| if ref != nil { |
| return false, ref |
| @@ -160,6 +176,33 @@ func (s *Server) pointBoughtDomain(ctx context.Context, acct *Account, app, doma |
| return pending, nil |
| } |
| +// takeOverPurgedClaim releases host's claim when it is acct's and names an |
| +// app that no longer exists (not in retained, live or in Trash): a purge |
| +// keeps an app's claims (spec §11.7), and pointing the domain again is how |
| +// the owner takes them over. The release is detach's owner-checked removal |
| +// (releaseDomainHost), which retires a first-route record before the claim. |
| +// No claim, a claim of an app that still exists, and another account's |
| +// claim are left to attachDomain's own answer. A failed read or release is |
| +// a refusal; pointing again retries. |
| +func (s *Server) takeOverPurgedClaim(ctx context.Context, acct *Account, retained []string, host, principal string) *doorRefusal { |
| + c, err := domains.GetClaim(ctx, s.cfg.Releases, host) |
| + if errors.Is(err, os.ErrNotExist) { |
| + return nil |
| + } |
| + if err != nil { |
| + log.Printf("console: point %s: claim read: %v", host, err) |
| + return pointUnavailable() |
| + } |
| + if c.Account != acct.Sqid || slices.Contains(retained, c.App) { |
| + return nil |
| + } |
| + if ref := s.releaseDomainHost(ctx, acct, c.App, host, principal); ref != nil && ref.Status != http.StatusNotFound { |
| + // 404: gone already, or no longer that app's; attach decides. |
| + return ref |
| + } |
| + return nil |
| +} |
| + |
| func pointUnavailable() *doorRefusal { |
| return &doorRefusal{Status: http.StatusServiceUnavailable, Msg: domainPointCopy.Unavailable} |
| } |
diff --git a/internal/console/domainpoint_test.go b/internal/console/domainpoint_test.go| index 4554a959d..951c89896 100644 |
| --- a/internal/console/domainpoint_test.go |
| +++ b/internal/console/domainpoint_test.go |
| @@ -7,6 +7,7 @@ package console |
| import ( |
| "context" |
| + "encoding/json" |
| "errors" |
| "io" |
| "net" |
| @@ -14,6 +15,7 @@ import ( |
| "net/url" |
| "os" |
| "reflect" |
| + "slices" |
| "strings" |
| "testing" |
| "time" |
| @@ -202,12 +204,13 @@ func TestPointRefusedWhilePurchaseLive(t *testing.T) { |
| f.assertNoClaims(t, p.Domain) |
| } |
| -func TestPointAfterPurgeSucceeds(t *testing.T) { |
| - f := newPurchaseFixture(t) |
| - ctx := context.Background() |
| +// boughtIntoKassThenWeb buys shop.com into kass (apex and www claimed by |
| +// kass) and creates web, a second live app of the account with a route. |
| +func (f *purchaseFixture) boughtIntoKassThenWeb(t *testing.T) *DomainPurchase { |
| + t.Helper() |
| p := f.start(t) |
| f.authorise(t, p) |
| - f.until(t, p.ID, PurchaseDone) |
| + p = f.until(t, p.ID, PurchaseDone) |
| f.wantClaimedBy(t, p.Domain, "kass") |
| if _, err := f.st.CreateAppIn(f.acct.ID, "web", "buyer@example.test", time.Now()); err != nil { |
| t.Fatal(err) |
| @@ -215,17 +218,41 @@ func TestPointAfterPurgeSucceeds(t *testing.T) { |
| f.srv.cfg.Registry = attachRegistry(t, |
| registry.Route{Host: "app.example.test", Account: f.acct.Sqid, App: "kass", Kind: "static", Status: "ready", Channel: "canary/live"}, |
| registry.Route{Host: "web.example.test", Account: f.acct.Sqid, App: "web", Kind: "static", Status: "ready", Channel: "canary/live"}) |
| - // kass is trashed long enough ago that the hourly sweep purges it, |
| - // releasing its claims (Task 6). |
| - old := time.Now().Add(-31 * 24 * time.Hour) |
| - if err := release.TrashApp(ctx, f.rel, f.acct.Sqid, "kass", pointOwner(f), old); err != nil { |
| + return p |
| +} |
| + |
| +// trashKassAt moves kass to Trash at when (row and marker). |
| +func (f *purchaseFixture) trashKassAt(t *testing.T, when time.Time) { |
| + t.Helper() |
| + if err := release.TrashApp(context.Background(), f.rel, f.acct.Sqid, "kass", pointOwner(f), when); err != nil { |
| t.Fatal(err) |
| } |
| - if err := f.st.TrashAppRow(f.acct.ID, "kass", old); err != nil { |
| + if err := f.st.TrashAppRow(f.acct.ID, "kass", when); err != nil { |
| t.Fatal(err) |
| } |
| +} |
| + |
| +// TestPointAfterPurgeTakesOverOwnStaleClaim: a purge keeps the purged app's |
| +// claims (spec §11.7); pointing the domain at another app of the same |
| +// account releases each claim whose app no longer exists and attaches. |
| +// A stale first-route claim (Route "") is taken over the same way. |
| +func TestPointAfterPurgeTakesOverOwnStaleClaim(t *testing.T) { |
| + f := newPurchaseFixture(t) |
| + ctx := context.Background() |
| + p := f.boughtIntoKassThenWeb(t) |
| + // kass is trashed long enough ago that the hourly sweep purges it. |
| + f.trashKassAt(t, time.Now().Add(-31*24*time.Hour)) |
| f.srv.trashSweep(ctx, time.Now()) |
| - f.assertNoClaims(t, p.Domain) |
| + if apps, _ := f.st.AppsIncludingTrashIn(f.acct.ID); slices.Contains(apps, "kass") { |
| + t.Fatalf("kass was not purged: %v", apps) |
| + } |
| + f.wantClaimedBy(t, p.Domain, "kass") // the purge kept them |
| + // www's stale claim is a first-route one of an app that never existed |
| + // here any more. |
| + if err := f.rel.Delete(ctx, domains.ClaimKey("www."+p.Domain)); err != nil { |
| + t.Fatal(err) |
| + } |
| + putFirstRouteClaim(t, f.rel, f.acct.Sqid, "gone", "www."+p.Domain) |
| if _, ref := f.srv.pointBoughtDomain(ctx, f.acct, "web", p.Domain, pointOwner(f)); ref != nil { |
| t.Fatalf("point after purge: %+v", ref) |
| @@ -234,6 +261,116 @@ func TestPointAfterPurgeSucceeds(t *testing.T) { |
| f.wantClaimedBy(t, p.Domain, "web") |
| } |
| +// TestPointTakeoverWithLifetimesOn: admitted on, the takeover's release |
| +// (releaseDomainHost under the app and hostname locks) frees a purged |
| +// app's first-route and alias claims, and leaves a live app's. |
| +func TestPointTakeoverWithLifetimesOn(t *testing.T) { |
| + l := newLtOn(t) |
| + l.mustCreate(t, ltOne) |
| + trashShop(t, l) |
| + if err := purgeCore(t, l.fx.srv, onCtx(t, l.fx.srv), time.Time{}); err != nil { |
| + t.Fatalf("purge = %v", err) |
| + } |
| + if err := l.fx.st.PurgeAppRow(OpsAccountID, ltApp); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := l.fx.st.CreateAppIn(OpsAccountID, "web", "paul@keymail.dev", time.Now()); err != nil { |
| + t.Fatal(err) |
| + } |
| + putFirstRouteClaim(t, l.fx.rel, "bab", ltApp, "shop.example") |
| + putPurgeClaim(t, l.fx.rel, "bab", ltApp, "www.shop.example", false) |
| + putPurgeClaim(t, l.fx.rel, "bab", "web", "blog.example", false) |
| + acct, err := l.fx.st.AccountBySqid("bab") |
| + if err != nil || acct == nil { |
| + t.Fatalf("account: %+v %v", acct, err) |
| + } |
| + retained, err := l.fx.st.AppsIncludingTrashIn(acct.ID) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + ctx := onCtx(t, l.fx.srv) |
| + for _, host := range []string{"shop.example", "www.shop.example", "blog.example"} { |
| + if ref := l.fx.srv.takeOverPurgedClaim(ctx, acct, retained, host, "paul@keymail.dev"); ref != nil { |
| + t.Fatalf("%s: %+v", host, ref) |
| + } |
| + } |
| + for _, host := range []string{"shop.example", "www.shop.example"} { |
| + if claimHeld(t, l.fx.rel, host) { |
| + t.Errorf("%s: the purged app's claim was not taken over", host) |
| + } |
| + } |
| + wantClaimsKept(t, l.fx.rel, "bab", "web", "blog.example") |
| +} |
| + |
| +// putFirstRouteClaim writes host's first-route claim (Route "") for |
| +// sqid/app straight into the bucket. |
| +func putFirstRouteClaim(t *testing.T, s release.Store, sqid, app, host string) { |
| + t.Helper() |
| + b, err := json.Marshal(domains.Claim{Schema: 1, Host: host, Account: sqid, App: app, |
| + CreatedAt: time.Now().UTC().Format(time.RFC3339)}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := s.Put(context.Background(), domains.ClaimKey(host), b, ""); err != nil { |
| + t.Fatal(err) |
| + } |
| +} |
| + |
| +// TestPointLeavesTrashedAppsClaim: an app in Trash still exists, so |
| +// pointing elsewhere is attachDomain's refusal and its claims stay. |
| +func TestPointLeavesTrashedAppsClaim(t *testing.T) { |
| + f := newPurchaseFixture(t) |
| + ctx := context.Background() |
| + p := f.boughtIntoKassThenWeb(t) |
| + f.trashKassAt(t, time.Now().Add(-time.Hour)) |
| + apex, www := f.claim(t, p.Domain), f.claim(t, "www."+p.Domain) |
| + |
| + _, ref := f.srv.pointBoughtDomain(ctx, f.acct, "web", p.Domain, pointOwner(f)) |
| + _, attachRef := f.srv.attachDomain(ctx, f.acct, "web", p.Domain, "", "", pointOwner(f)) |
| + if ref == nil || attachRef == nil || *ref != *attachRef { |
| + t.Fatalf("point refusal %+v, attach door's %+v", ref, attachRef) |
| + } |
| + if got := f.claim(t, p.Domain); !reflect.DeepEqual(got, apex) { |
| + t.Fatalf("apex claim changed: %+v -> %+v", apex, got) |
| + } |
| + if got := f.claim(t, "www."+p.Domain); !reflect.DeepEqual(got, www) { |
| + t.Fatalf("www claim changed: %+v -> %+v", www, got) |
| + } |
| +} |
| + |
| +// TestPointNeverTouchesForeignClaim: another account's claim on the apex |
| +// or www, even one naming an app this account does not have, is |
| +// attachDomain's refusal and is left as it was. |
| +func TestPointNeverTouchesForeignClaim(t *testing.T) { |
| + f := newPurchaseFixture(t) |
| + ctx := context.Background() |
| + p := f.boughtUnpointed(t) |
| + putPurgeClaim(t, f.rel, "zzz", "gone", p.Domain, false) |
| + putFirstRouteClaim(t, f.rel, "zzz", "gone", "www."+p.Domain) |
| + apex, www := f.claim(t, p.Domain), f.claim(t, "www."+p.Domain) |
| + |
| + _, 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) |
| + } |
| + if got := f.claim(t, p.Domain); !reflect.DeepEqual(got, apex) { |
| + t.Fatalf("apex claim changed: %+v -> %+v", apex, got) |
| + } |
| + // www is never reached (the apex refused first); a direct check that |
| + // the takeover leaves it too: point with the apex free. |
| + if err := f.rel.Delete(ctx, domains.ClaimKey(p.Domain)); err != nil { |
| + t.Fatal(err) |
| + } |
| + _, ref = f.srv.pointBoughtDomain(ctx, f.acct, "kass", p.Domain, pointOwner(f)) |
| + if ref == nil { |
| + t.Fatal("point succeeded over another account's www claim") |
| + } |
| + if got := f.claim(t, "www."+p.Domain); !reflect.DeepEqual(got, www) { |
| + t.Fatalf("www claim changed: %+v -> %+v", www, got) |
| + } |
| +} |
| + |
| func TestPointNotOwnedDomainIsNeutralNotFound(t *testing.T) { |
| f := newPurchaseFixture(t) |
| other := planAccount(t, f.consoleFixture, 502) |
diff --git a/internal/console/expirypass.go b/internal/console/expirypass.go| index f0947800b..0919d80a8 100644 |
| --- a/internal/console/expirypass.go |
| +++ b/internal/console/expirypass.go |
| @@ -248,9 +248,7 @@ func (s *Server) purgeOne(ctx context.Context, r AppRow, now time.Time, ev evide |
| // Every lifetime of the app retired first, under the lock this |
| // pass holds (lifetimes_purge.go). |
| err = s.purgeAppWithLifetimes(ctx, r.Sqid, r.App, time.Unix(life.PurgeFor, 0), now) |
| - } else if err = s.releaseAppDomainClaimsGuarded(ctx, r.Sqid, r.App, time.Unix(life.PurgeFor, 0), now); err == nil { |
| - // The app's custom-domain claims went first; a failed release |
| - // purges nothing and the next pass retries. |
| + } else { |
| err = release.PurgeAppIfTrashedAt(ctx, s.cfg.Releases, s.cfg.ReleasePub, r.Sqid, r.App, time.Unix(life.PurgeFor, 0), now) |
| } |
| switch { |
diff --git a/internal/console/lifetimes_purge.go b/internal/console/lifetimes_purge.go| index b5abc82ba..dfeedae6d 100644 |
| --- a/internal/console/lifetimes_purge.go |
| +++ b/internal/console/lifetimes_purge.go |
| @@ -5,13 +5,10 @@ import ( |
| "errors" |
| "fmt" |
| "log" |
| - "net/http" |
| "sort" |
| - "strings" |
| "sync" |
| "time" |
| - "github.com/carlosframework/platform/internal/domains" |
| "github.com/carlosframework/platform/internal/provision" |
| "github.com/carlosframework/platform/internal/release" |
| ) |
| @@ -94,12 +91,6 @@ func (s *Server) purgeAppWithLifetimes(ctx context.Context, sqid, app string, wa |
| return fmt.Errorf("console: purge %s/%s: %s: %w", sqid, app, host, err) |
| } |
| } |
| - // The app's custom-domain claims go before the marker (spec §11.7, C2), |
| - // once every record of the app is retired above. A failed release |
| - // returns with the marker and the row in place; the next run resumes. |
| - if err := s.releaseAppDomainClaims(ctx, sqid, app); err != nil { |
| - return err |
| - } |
| return release.PurgeAppExcept(ctx, s.cfg.Releases, s.cfg.ReleasePub, sqid, app, want, now, func(key string) bool { |
| return provision.IsInstanceRecordKeyOf(key, sqid, app) || len(keepMarker) > 0 && keepMarker[0] && key == release.AppTombstoneKey(sqid, app) |
| }) |
| @@ -254,10 +245,7 @@ func (s *Server) sweepTrashedApp(ctx context.Context, a release.TrashedApp, now |
| err = s.purgeAppWithLifetimes(ctx, a.Account, a.App, tomb.DeletedAt, now) |
| } else { |
| s.noteRecordDeletion(a.Account, a.App, time.Now()) // the canary-retire guard's evidence, first (#415) |
| - // The claims before the marker; a failed release purges nothing. |
| - if err = s.releaseAppDomainClaimsGuarded(ctx, a.Account, a.App, tomb.DeletedAt, now); err == nil { |
| - err = release.PurgeAppIfTrashedAt(ctx, s.cfg.Releases, s.cfg.ReleasePub, a.Account, a.App, tomb.DeletedAt, now) |
| - } |
| + err = release.PurgeAppIfTrashedAt(ctx, s.cfg.Releases, s.cfg.ReleasePub, a.Account, a.App, tomb.DeletedAt, now) |
| } |
| if err != nil { |
| log.Printf("console: trash sweep: purge %s/%s: %v", a.Account, a.App, err) |
| @@ -274,121 +262,6 @@ func (s *Server) sweepTrashedApp(ctx context.Context, a release.TrashedApp, now |
| } |
| } |
| -// ---- the app's custom-domain claims ------------------------------------------- |
| - |
| -// purgeActor is the audit actor of the claim releases a purge makes. |
| -const purgeActor = "purge" |
| - |
| -// releaseAppDomainClaims releases every custom-domain claim of sqid/app |
| -// (spec §11.7, builder check C2): each claim whose Account and App are the |
| -// app's and whose host (a catch-all's parent) is a custom domain, so the |
| -// hosts are free for the account's other apps once the app is gone. |
| -// Platform names and other apps' or accounts' claims are never touched. |
| -// |
| -// Every purge branch calls it under the app lock, before the step that |
| -// removes the trash marker. An error stops that purge with the marker and |
| -// the row in place, and the next run lists the claims again and releases |
| -// what is left: each release is idempotent (a claim already gone, or no |
| -// longer the app's, is skipped). |
| -// |
| -// Admitted on, it runs inside purgeAppWithLifetimes once every record of |
| -// the app is retired, so it skips the record step and holds each host's |
| -// exclusion. Admitted off, a first-route claim's record goes before its |
| -// claim, as detach does, so no record outlives its claim. Under the |
| -// host-claim gate it does nothing: alias detach is unsupported there |
| -// (claim_alias.go), and that purge is the claim operation's. |
| -func (s *Server) releaseAppDomainClaims(ctx context.Context, sqid, app string) error { |
| - claims, err := s.appDomainClaims(ctx, sqid, app) |
| - if err != nil { |
| - return err |
| - } |
| - return s.releaseDomainClaims(ctx, sqid, app, claims) |
| -} |
| - |
| -// releaseAppDomainClaimsGuarded is a lifetimes-off purge's claim release: |
| -// when the app holds any, the purge's own guards run first |
| -// (release.PurgeAppGuards, want's clock included), so a purge they would |
| -// refuse releases nothing. The purge call that follows runs them again. |
| -func (s *Server) releaseAppDomainClaimsGuarded(ctx context.Context, sqid, app string, want, now time.Time) error { |
| - claims, err := s.appDomainClaims(ctx, sqid, app) |
| - if err != nil || len(claims) == 0 { |
| - return err |
| - } |
| - if err := release.PurgeAppGuards(ctx, s.cfg.Releases, s.cfg.ReleasePub, sqid, app, want, now); err != nil { |
| - return err |
| - } |
| - return s.releaseDomainClaims(ctx, sqid, app, claims) |
| -} |
| - |
| -// appDomainClaims is sqid/app's custom-domain claims, sorted by host. A |
| -// claim the listing could not read never stops a purge, whatever account |
| -// the listing last knew for it (the claim cache cannot reliably remember an |
| -// unreadable claim's owner): one on a custom-domain host is skipped with one |
| -// log line an hour naming its key, and the purge proceeds. A claim left |
| -// behind that way is what every purge left before. Nothing under the |
| -// host-claim gate (releaseAppDomainClaims). |
| -func (s *Server) appDomainClaims(ctx context.Context, sqid, app string) ([]domains.Claim, error) { |
| - if s.cfg.HostClaim || s.cfg.Releases == nil { |
| - return nil, nil |
| - } |
| - custom := func(host string) bool { |
| - return s.customDomain(strings.TrimPrefix(strings.ToLower(host), "*."), sqid) |
| - } |
| - mine := func(c domains.Claim) bool { return c.Account == sqid && c.App == app && custom(c.Host) } |
| - listed, unread, err := s.claims.ListWithUnread(ctx, s.cfg.Releases) |
| - if err != nil { |
| - return nil, fmt.Errorf("console: purge %s/%s: list the domain claims: %w", sqid, app, err) |
| - } |
| - var out []domains.Claim |
| - for _, c := range listed { |
| - if mine(c) { |
| - out = append(out, c) |
| - } |
| - } |
| - for _, u := range unread { |
| - if custom(u.Host) { |
| - key := domains.ClaimKey(u.Host) |
| - s.lifetimeLogHourly("purge-unread-claim "+key, "console: purge %s/%s: skipping the unread claim %s (last known account %q)", sqid, app, key, u.Account) |
| - } |
| - } |
| - sort.Slice(out, func(i, j int) bool { return out[i].Host < out[j].Host }) |
| - return out, nil |
| -} |
| - |
| -// releaseDomainClaims releases claims of sqid/app one by one through |
| -// detach's own removal (releaseDomainHostHeld), stopping at the first |
| -// failure. |
| -func (s *Server) releaseDomainClaims(ctx context.Context, sqid, app string, claims []domains.Claim) error { |
| - if len(claims) == 0 { |
| - return nil |
| - } |
| - acct, err := s.store.AccountBySqid(sqid) |
| - if err != nil { |
| - return fmt.Errorf("console: purge %s/%s: read the account: %w", sqid, app, err) |
| - } |
| - if acct == nil { |
| - acct = &Account{Sqid: sqid} // a headless app's: no row to audit under |
| - } |
| - on := lifetimesUnit(ctx) |
| - for _, c := range claims { |
| - var ref *doorRefusal |
| - release := func() error { |
| - ref = s.releaseDomainHostHeld(ctx, acct, app, c.Host, purgeActor, !on && !c.Instances) |
| - return nil |
| - } |
| - if on { |
| - _ = s.withHostname(c.Host, release) |
| - } else { |
| - _ = release() |
| - } |
| - // 404: gone already, or no longer this app's. Both are done. |
| - if ref != nil && ref.Status != http.StatusNotFound { |
| - return fmt.Errorf("console: purge %s/%s: release the domain claim %s: %d %s", sqid, app, c.Host, ref.Status, ref.Msg) |
| - } |
| - } |
| - return nil |
| -} |
| - |
| // ---- restore evidence ---------------------------------------------------------- |
| // recordEvidenceMax bounds how many instance keys restore evidence judges; |
diff --git a/internal/console/lifetimes_purge_test.go b/internal/console/lifetimes_purge_test.go| index 0ccfd4199..8ddd32f1f 100644 |
| --- a/internal/console/lifetimes_purge_test.go |
| +++ b/internal/console/lifetimes_purge_test.go |
| @@ -1,16 +1,12 @@ |
| package console |
| import ( |
| - "bytes" |
| "context" |
| "encoding/json" |
| "errors" |
| - "log" |
| "net/http" |
| "net/url" |
| "os" |
| - "slices" |
| - "strings" |
| "sync/atomic" |
| "testing" |
| "time" |
| @@ -460,7 +456,7 @@ func TestMaterializationHoldsTheAppLock(t *testing.T) { |
| }) |
| } |
| -// ---- the purge releases the app's custom-domain claims ------------------------ |
| +// ---- the purge keeps the app's custom-domain claims --------------------------- |
| // putPurgeClaim writes host's claim for sqid/app straight into the bucket: an |
| // alias of route r, or (catchall) an instance catch-all "*.<parent>". |
| @@ -493,287 +489,111 @@ func claimHeld(t *testing.T, s release.Store, host string) bool { |
| return true |
| } |
| -// purgeClaimsWorld is shop (lifetimes on, apps domain oncarlos.test) holding |
| -// two custom-domain aliases and a catch-all, a platform name, and web, a |
| -// live app of the same account, holding blog.example. Then shop is trashed. |
| -func purgeClaimsWorld(t *testing.T) ltOn { |
| +// wantClaimsKept: each host is still claimed by sqid/app. A purge leaves |
| +// every claim where it was (Paul's ruling 2026-11-19, spec §11.7): the |
| +// owner takes a purged app's addresses over by pointing the domain again. |
| +func wantClaimsKept(t *testing.T, s release.Store, sqid, app string, hosts ...string) { |
| t.Helper() |
| - l := newLtOn(t) |
| - l.fx.srv.cfg.AppsDomain = "oncarlos.test" |
| - l.mustCreate(t, ltOne) |
| - if _, err := l.fx.st.CreateAppIn(OpsAccountID, "web", "paul@keymail.dev", time.Now()); err != nil { |
| - t.Fatal(err) |
| - } |
| - putPurgeClaim(t, l.fx.rel, "bab", ltApp, "shop.example", false) |
| - putPurgeClaim(t, l.fx.rel, "bab", ltApp, "www.shop.example", false) |
| - putPurgeClaim(t, l.fx.rel, "bab", ltApp, "*.shop.example", true) |
| - putPurgeClaim(t, l.fx.rel, "bab", ltApp, "shop.bab.oncarlos.test", false) |
| - putPurgeClaim(t, l.fx.rel, "bab", "web", "blog.example", false) |
| - trashShop(t, l) |
| - return l |
| -} |
| - |
| -// wantShopClaimsReleased: the purged app's custom-domain claims gone, its |
| -// platform name and the live app's claim untouched. |
| -func wantShopClaimsReleased(t *testing.T, s release.Store) { |
| - t.Helper() |
| - for _, host := range []string{"shop.example", "www.shop.example", "*.shop.example"} { |
| - if claimHeld(t, s, host) { |
| - t.Errorf("%s is still claimed by the purged app", host) |
| + for _, host := range hosts { |
| + c, err := domains.GetClaim(context.Background(), s, host) |
| + if err != nil { |
| + t.Errorf("%s: %v; the purge must keep the claim", host, err) |
| + continue |
| } |
| - } |
| - for _, host := range []string{"shop.bab.oncarlos.test", "blog.example"} { |
| - if !claimHeld(t, s, host) { |
| - t.Errorf("%s was released; the purge must not touch it", host) |
| + if c.Account != sqid || c.App != app { |
| + t.Errorf("%s is claimed by %s/%s, want %s/%s", host, c.Account, c.App, sqid, app) |
| } |
| } |
| } |
| -func TestPurgeReleasesTheAppsDomainClaims(t *testing.T) { |
| - l := purgeClaimsWorld(t) |
| - if err := purgeCore(t, l.fx.srv, onCtx(t, l.fx.srv), time.Time{}); err != nil { |
| - t.Fatalf("purge = %v", err) |
| - } |
| - wantShopClaimsReleased(t, l.fx.rel) |
| - if tomb, err := release.ReadAppTombstone(context.Background(), l.fx.rel, "bab", ltApp); err != nil || tomb != nil { |
| - t.Fatalf("marker = %+v %v, want gone", tomb, err) |
| - } |
| - // The claims go before the marker: a purge that stops between the two |
| - // still holds the admission evidence it needs to resume. |
| - marker := l.bucket.index("delete " + release.AppTombstoneKey("bab", ltApp)) |
| - for _, host := range []string{"shop.example", "www.shop.example"} { |
| - if i := l.bucket.index("delete " + domains.ClaimKey(host)); i < 0 || i > marker { |
| - t.Fatalf("%s released at op %d, the marker at %d: want the claim first", host, i, marker) |
| - } |
| - } |
| - // The record retirement the purge already made is untouched. |
| - requireRetired(t, l.fx.rel, ltApp, ltOne, 1) |
| -} |
| - |
| -func TestPurgeDomainDetachFailureKeepsMarkerAndRetries(t *testing.T) { |
| +// TestPurgeKeepsDomainClaims: every purge branch (lifetimes on, and with |
| +// lifetimes off the purge door, the hourly trash sweep, the expiry pass's |
| +// early purge, and demo retirement) finishes the purge and leaves the app's |
| +// custom-domain claims in place. |
| +func TestPurgeKeepsDomainClaims(t *testing.T) { |
| ctx := context.Background() |
| - l := purgeClaimsWorld(t) |
| - tomb, _ := release.ReadAppTombstone(ctx, l.fx.rel, "bab", ltApp) |
| - if _, err := l.fx.st.db.Exec(`UPDATE apps SET purge_for = ?, purge_after = ? WHERE app = ?`, tomb.DeletedAt.Unix(), tomb.DeletedAt.Unix()+1, ltApp); err != nil { |
| - t.Fatal(err) |
| - } |
| - now := tomb.DeletedAt.Add(time.Hour) |
| - pass := func() { |
| - t.Helper() |
| - if !l.fx.srv.lifetimesIteration(ctx, "expiry pass", true, false, func(ctx context.Context) { l.fx.srv.expiryPass(ctx, now) }) { |
| - t.Fatal("the expiry pass did not run") |
| + t.Run("lifetimes on", func(t *testing.T) { |
| + l := newLtOn(t) |
| + l.fx.srv.cfg.AppsDomain = "oncarlos.test" |
| + l.mustCreate(t, ltOne) |
| + putPurgeClaim(t, l.fx.rel, "bab", ltApp, "shop.example", false) |
| + putPurgeClaim(t, l.fx.rel, "bab", ltApp, "www.shop.example", false) |
| + putPurgeClaim(t, l.fx.rel, "bab", ltApp, "*.shop.example", true) |
| + trashShop(t, l) |
| + if err := purgeCore(t, l.fx.srv, onCtx(t, l.fx.srv), time.Time{}); err != nil { |
| + t.Fatalf("purge = %v", err) |
| } |
| - } |
| - // www.shop.example's release fails, after the claims sorted before it went. |
| - l.bucket.setHook(failNth("delete", domains.ClaimKey("www.shop.example"), 1, false)) |
| - pass() |
| - l.bucket.setHook(nil) |
| - if tomb, err := release.ReadAppTombstone(ctx, l.fx.rel, "bab", ltApp); err != nil || tomb == nil { |
| - t.Fatalf("marker = %+v %v after a failed release, want it kept", tomb, err) |
| - } |
| - if life, _ := l.fx.st.AppLife(OpsAccountID, ltApp); life == nil { |
| - t.Fatal("the row went with a claim still held") |
| - } |
| - if !claimHeld(t, l.fx.rel, "www.shop.example") { |
| - t.Fatal("the failed release removed the claim") |
| - } |
| - pass() |
| - wantShopClaimsReleased(t, l.fx.rel) |
| - if tomb, err := release.ReadAppTombstone(ctx, l.fx.rel, "bab", ltApp); err != nil || tomb != nil { |
| - t.Fatalf("marker = %+v %v after the retry, want gone", tomb, err) |
| - } |
| - if life, _ := l.fx.st.AppLife(OpsAccountID, ltApp); life != nil { |
| - t.Fatalf("row = %+v after the retry, want gone", life) |
| - } |
| -} |
| - |
| -// TestLegacyPurgeBranchesReleaseClaims: with lifetimes off, the purge door, |
| -// the hourly trash sweep and the expiry pass's early purge each release the |
| -// app's custom-domain claims before the marker goes; a purge its guards |
| -// refuse releases nothing. |
| -func TestLegacyPurgeBranchesReleaseClaims(t *testing.T) { |
| - ctx := context.Background() |
| - setup := func(t *testing.T, fx *consoleFixture, app string) *hookStore { |
| + if tomb, err := release.ReadAppTombstone(ctx, l.fx.rel, "bab", ltApp); err != nil || tomb != nil { |
| + t.Fatalf("marker = %+v %v, want gone", tomb, err) |
| + } |
| + wantClaimsKept(t, l.fx.rel, "bab", ltApp, "shop.example", "www.shop.example", "*.shop.example") |
| + }) |
| + setup := func(t *testing.T, fx *consoleFixture, app string) { |
| t.Helper() |
| fx.srv.cfg.AppsDomain = "oncarlos.test" |
| - if _, err := fx.st.CreateAppIn(OpsAccountID, "web", "paul@keymail.dev", time.Now()); err != nil { |
| - t.Fatal(err) |
| - } |
| putPurgeClaim(t, fx.rel, fx.sqid, app, "shop.example", false) |
| putPurgeClaim(t, fx.rel, fx.sqid, app, "www.shop.example", false) |
| - putPurgeClaim(t, fx.rel, fx.sqid, app, app+"."+fx.sqid+".oncarlos.test", false) |
| - putPurgeClaim(t, fx.rel, fx.sqid, "web", "blog.example", false) |
| - h := &hookStore{Store: fx.rel} |
| - fx.srv.cfg.Releases = h |
| - return h |
| } |
| - check := func(t *testing.T, fx *consoleFixture, h *hookStore, app string) { |
| + check := func(t *testing.T, fx *consoleFixture, app string) { |
| t.Helper() |
| - for _, host := range []string{"shop.example", "www.shop.example"} { |
| - if claimHeld(t, fx.rel, host) { |
| - t.Errorf("%s is still claimed by the purged app", host) |
| - } |
| - } |
| - for _, host := range []string{app + "." + fx.sqid + ".oncarlos.test", "blog.example"} { |
| - if !claimHeld(t, fx.rel, host) { |
| - t.Errorf("%s was released; the purge must not touch it", host) |
| - } |
| - } |
| if markerOf(t, fx, app) != nil { |
| - t.Fatal("the marker is still there") |
| + t.Fatal("the marker is still there: the purge did not finish") |
| } |
| - marker := slices.Index(h.deletes, release.AppTombstoneKey(fx.sqid, app)) |
| - for _, host := range []string{"shop.example", "www.shop.example"} { |
| - if i := slices.Index(h.deletes, domains.ClaimKey(host)); i < 0 || i > marker { |
| - t.Fatalf("%s released at delete %d, the marker at %d: want the claim first (%v)", host, i, marker, h.deletes) |
| - } |
| + if lifeOf(t, fx, app) != nil { |
| + t.Fatal("the row is still there: the purge did not finish") |
| } |
| + wantClaimsKept(t, fx.rel, fx.sqid, app, "shop.example", "www.shop.example") |
| } |
| t.Run("the purge door", func(t *testing.T) { |
| fx, c, csrf := trashPageFixture(t) |
| - h := setup(t, fx, "kass") |
| + setup(t, fx, "kass") |
| status, _, body := postGated(t, fx, c, fx.u("/trash/delete"), url.Values{"csrf": {csrf}, "app": {"kass"}, "confirm": {"kass"}}) |
| if status != http.StatusSeeOther { |
| t.Fatalf("purge = %d:\n%s", status, body) |
| } |
| - check(t, fx, h, "kass") |
| + check(t, fx, "kass") |
| }) |
| t.Run("the hourly trash sweep", func(t *testing.T) { |
| fx := newConsoleFixture(t) |
| - old := time.Now().Add(-31 * 24 * time.Hour) |
| - trashKass(t, fx, "paul@keymail.dev", old) |
| - h := setup(t, fx, "kass") |
| + trashKass(t, fx, "paul@keymail.dev", time.Now().Add(-31*24*time.Hour)) |
| + setup(t, fx, "kass") |
| fx.srv.trashSweep(ctx, time.Now()) |
| - check(t, fx, h, "kass") |
| - if lifeOf(t, fx, "kass") != nil { |
| - t.Fatal("the sweep kept the row") |
| - } |
| + check(t, fx, "kass") |
| }) |
| t.Run("the expiry pass", func(t *testing.T) { |
| - fx := newConsoleFixture(t) |
| - now := time.Now().Truncate(time.Second) |
| - trashedTemp(t, fx, "tmp-a", now.Add(-72*time.Hour)) |
| - h := setup(t, fx, "tmp-a") |
| - fx.srv.expiryPass(ctx, now) |
| - check(t, fx, h, "tmp-a") |
| - if lifeOf(t, fx, "tmp-a") != nil { |
| - t.Fatal("the pass kept the row") |
| - } |
| - }) |
| - t.Run("a purge its guards refuse releases nothing", func(t *testing.T) { |
| fx := newConsoleFixture(t) |
| now := time.Now().Truncate(time.Second) |
| trashedTemp(t, fx, "tmp-a", now.Add(-72*time.Hour)) |
| setup(t, fx, "tmp-a") |
| - // Restored and trashed again by hand: the decision was about the |
| - // old trash, so the purge refuses on the marker's clock. |
| - release.RestoreApp(ctx, fx.rel, fx.sqid, "tmp-a") |
| - release.TrashApp(ctx, fx.rel, fx.sqid, "tmp-a", "paul@keymail.dev", now.Add(-time.Hour)) |
| - rows, _ := fx.st.PurgeDueApps(now) |
| - for _, r := range rows { |
| - fx.srv.purgeOne(ctx, r, now, always(true)) |
| - } |
| - for _, host := range []string{"shop.example", "www.shop.example"} { |
| - if !claimHeld(t, fx.rel, host) { |
| - t.Errorf("%s was released by a purge that was refused", host) |
| - } |
| - } |
| - }) |
| -} |
| - |
| -// agedMods reports every listed object an hour older than it is, so the |
| -// claim cache keeps what it reads (it refuses stamps inside modSettle). |
| -type agedMods struct{ release.Store } |
| - |
| -func (a agedMods) ListMod(ctx context.Context, prefix string) ([]release.KeyMod, error) { |
| - km, err := a.Store.(release.ModLister).ListMod(ctx, prefix) |
| - for i := range km { |
| - km[i].Mod = km[i].Mod.Add(-time.Hour) |
| - } |
| - return km, err |
| -} |
| - |
| -// An unread claim never stops a purge, whatever account the listing last |
| -// knew for it: it is skipped with one log line naming its key, and the app's |
| -// readable claims are released. Both shapes: a body never read (no account |
| -// known), and a claim of this app the cache read before it turned malformed |
| -// (the first listing after still knows its account). |
| -func TestPurgeSkipsUnreadClaimOfUnknownAccount(t *testing.T) { |
| - ctx := context.Background() |
| - captureLog := func(t *testing.T) *bytes.Buffer { |
| - t.Helper() |
| - var logged bytes.Buffer |
| - log.SetOutput(&logged) |
| - t.Cleanup(func() { log.SetOutput(os.Stderr) }) |
| - return &logged |
| - } |
| - t.Run("never read", func(t *testing.T) { |
| - l := purgeClaimsWorld(t) |
| - odd := domains.ClaimKey("odd.example") |
| - if _, err := l.fx.rel.Put(ctx, odd, []byte("{not json"), ""); err != nil { |
| - t.Fatal(err) |
| - } |
| - logged := captureLog(t) |
| - if err := purgeCore(t, l.fx.srv, onCtx(t, l.fx.srv), time.Time{}); err != nil { |
| - t.Fatalf("purge = %v, want it to finish past the unread claim", err) |
| - } |
| - log.SetOutput(os.Stderr) |
| - wantShopClaimsReleased(t, l.fx.rel) |
| - if tomb, err := release.ReadAppTombstone(ctx, l.fx.rel, "bab", ltApp); err != nil || tomb != nil { |
| - t.Fatalf("marker = %+v %v, want gone", tomb, err) |
| - } |
| - if !strings.Contains(logged.String(), "skipping the unread claim "+odd) { |
| - t.Fatalf("the log does not name the unread key %s:\n%s", odd, logged.String()) |
| - } |
| - if raw, _, err := l.fx.rel.Get(ctx, odd); err != nil || string(raw) != "{not json" { |
| - t.Fatalf("the unread claim = %q %v, want it left as it was", raw, err) |
| - } |
| + fx.srv.expiryPass(ctx, now) |
| + check(t, fx, "tmp-a") |
| }) |
| - t.Run("read before, then malformed", func(t *testing.T) { |
| - fx := newConsoleFixture(t) |
| - fx.srv.cfg.AppsDomain = "oncarlos.test" |
| - now := time.Now().Truncate(time.Second) |
| - trashedTemp(t, fx, "tmp-a", now.Add(-72*time.Hour)) |
| - putPurgeClaim(t, fx.rel, fx.sqid, "tmp-a", "shop.example", false) |
| - putPurgeClaim(t, fx.rel, fx.sqid, "tmp-a", "cached.example", false) |
| - fx.srv.cfg.Releases = agedMods{Store: fx.rel} |
| - cached := domains.ClaimKey("cached.example") |
| - // prime caches cached.example's good body, then breaks it. |
| - prime := func() { |
| + t.Run("demo retirement", func(t *testing.T) { |
| + s, d, _, _ := demoPublishFixture(t) |
| + putPurgeClaim(t, s.cfg.Releases, d.AccountSqid, d.App, "shop.example", false) |
| + putPurgeClaim(t, s.cfg.Releases, d.AccountSqid, d.App, "www.shop.example", false) |
| + now := time.Now() |
| + retire := func(at time.Time) { |
| t.Helper() |
| - if err := fx.rel.Delete(ctx, cached); err != nil { |
| - t.Fatal(err) |
| - } |
| - putPurgeClaim(t, fx.rel, fx.sqid, "tmp-a", "cached.example", false) |
| - if claims, _, err := fx.srv.claims.ListWithUnread(ctx, fx.srv.cfg.Releases); err != nil || !slices.ContainsFunc(claims, func(c domains.Claim) bool { return c.Host == "cached.example" }) { |
| - t.Fatalf("priming listing = %v %v, want cached.example read", claims, err) |
| - } |
| - if err := fx.rel.Delete(ctx, cached); err != nil { |
| + unlock := s.lockApp(d.AccountSqid, d.App) |
| + err := s.retireDemoLocked(t.Context(), d, at, "operator") |
| + unlock() |
| + if err != nil { |
| t.Fatal(err) |
| } |
| - if _, err := fx.rel.Put(ctx, cached, []byte("{not json"), ""); err != nil { |
| - t.Fatal(err) |
| - } |
| - } |
| - // The shape under test: the first listing after the break still |
| - // names the account it last read. |
| - prime() |
| - _, unread, err := fx.srv.claims.ListWithUnread(ctx, fx.srv.cfg.Releases) |
| - if err != nil || !slices.Contains(unread, domains.UnreadClaim{Host: "cached.example", Account: fx.sqid}) { |
| - t.Fatalf("unread = %+v %v, want cached.example known as %s's", unread, err, fx.sqid) |
| } |
| - prime() |
| - logged := captureLog(t) |
| - fx.srv.expiryPass(ctx, now) |
| - log.SetOutput(os.Stderr) |
| - if claimHeld(t, fx.rel, "shop.example") { |
| - t.Error("shop.example is still claimed by the purged app") |
| + retire(now) |
| + r, err := s.demoRetirement(t.Context(), d.ID) |
| + if err != nil { |
| + t.Fatal(err) |
| } |
| - if markerOf(t, fx, "tmp-a") != nil || lifeOf(t, fx, "tmp-a") != nil { |
| - t.Fatal("the purge stopped at the unread claim: marker or row left") |
| + if err = s.completeDemoRetirement(t.Context(), d.Fleet+"/"+d.AssignedBox, r.Wire); err != nil { |
| + t.Fatal(err) |
| } |
| - if !strings.Contains(logged.String(), "skipping the unread claim "+cached) { |
| - t.Fatalf("the log does not name the unread key %s:\n%s", cached, logged.String()) |
| + retire(now.Add(time.Second)) |
| + if got, err := s.store.demoByID(t.Context(), d.ID); err != nil || got.PurgedAt == 0 { |
| + t.Fatalf("demo %+v %v: want it purged", got, err) |
| } |
| + wantClaimsKept(t, s.cfg.Releases, d.AccountSqid, d.App, "shop.example", "www.shop.example") |
| }) |
| } |
diff --git a/internal/console/ownership.go b/internal/console/ownership.go| index 34088e2a8..3904c25e3 100644 |
| --- a/internal/console/ownership.go |
| +++ b/internal/console/ownership.go |
| @@ -585,9 +585,7 @@ func (s *Server) handlePurgeApp(w http.ResponseWriter, r *http.Request) { |
| // Admitted on: every lifetime of the app is retired first, under |
| // the app lock this door holds (lifetimes_purge.go). |
| purgeErr = s.purgeAppWithLifetimes(r.Context(), acct.Sqid, app, time.Time{}, time.Now()) |
| - } else if purgeErr = s.releaseAppDomainClaimsGuarded(r.Context(), acct.Sqid, app, time.Time{}, time.Now()); purgeErr == nil { |
| - // The app's custom-domain claims went first; a failed release |
| - // purges nothing, and pressing the button again retries. |
| + } else { |
| purgeErr = release.PurgeApp(r.Context(), s.cfg.Releases, s.cfg.ReleasePub, acct.Sqid, app, time.Now()) |
| } |
| if err := purgeErr; err != nil { |