carlos / platform Public

console remote instances: both app purges note their record deletions

Codex census review of f24f3316: the legacy app purge (ownership.go,
release.PurgeApp) and the claim purge's retire-hosts stage delete
records without noting the app. A purged app's canary pointers go with
it, but the note is cheap, so both now note it first, and the comments
name every deleting path. Census re-proposed (envelope only).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev a7134627c83196cc476b68cbcf2e95c3f0058bd6 parent f24f331
6 files changed, +16 −10
  • docs/superpowers/notes/console-remote-instances.md +2 −2
  • internal/console/claim_purge.go +3 −0
  • internal/console/hostclaimops.go +2 −1
  • internal/console/ownership.go +1 −0
  • internal/console/remoteinstances.go +7 −6
  • internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv +1 −1

CI failed — run details

diff --git a/docs/superpowers/notes/console-remote-instances.md b/docs/superpowers/notes/console-remote-instances.md
index 871172c36..429245ca2 100644
--- a/docs/superpowers/notes/console-remote-instances.md
+++ b/docs/superpowers/notes/console-remote-instances.md
@@ -270,8 +270,8 @@ conservative rule.
- no record was deleted in that time. The change index carries no
times, so deletions are dated by the console itself: every record
deletion the console makes (`retireHostRecord`, `retireClaimHostRecord`
- including claim recovery, the ordinary delete's `deleteRead`, and seed
- cleanup's `finishSeedOnce`) notes the app in memory before deleting
+ including claim recovery, the ordinary delete's `deleteRead`, seed
+ cleanup's `finishSeedOnce`, and both app purges) notes the app in memory before deleting
anything (a note that cannot fail to be
written, unlike the best-effort audit row). Memory does not survive a
restart, so a console refuses every retire for `channelSettle` after
diff --git a/internal/console/claim_purge.go b/internal/console/claim_purge.go
index f64d6a5e5..d96f44d56 100644
--- a/internal/console/claim_purge.go
+++ b/internal/console/claim_purge.go
@@ -314,6 +314,9 @@ func (p *ClaimPurgeCoordinator) Resume(ctx context.Context, account, app, id, ap
return err
case "torn-down":
if err = p.stage(ctx, h, "retire-hosts", func(ctx context.Context) error {
+ if p.Server != nil {
+ p.Server.noteRecordDeletion(account, app, time.Now()) // the canary-retire guard's evidence, first
+ }
return p.Controller.RetirePurgeHosts(ctx, account, app, id, appID)
}); err != nil {
return err
diff --git a/internal/console/hostclaimops.go b/internal/console/hostclaimops.go
index c5ba7b6de..4e33326d7 100644
--- a/internal/console/hostclaimops.go
+++ b/internal/console/hostclaimops.go
@@ -16,7 +16,8 @@ func (s *Server) retireHostRecord(ctx context.Context, ref provision.RetireRef)
// Before anything is deleted, and in memory, where it cannot fail: the
// canary-retire guard's evidence that this app lost a record just now
// (recentRecordDeletion). A delete that then fails costs at most a
- // retire held back for channelSettle.
+ // retire held back for channelSettle. Every other console path that
+ // deletes a record does the same.
s.noteRecordDeletion(ref.Account, ref.App, time.Now())
if s.cfg.HostClaim {
return s.retireClaimHostRecord(ctx, ref)
diff --git a/internal/console/ownership.go b/internal/console/ownership.go
index 4868954cf..41a153d9f 100644
--- a/internal/console/ownership.go
+++ b/internal/console/ownership.go
@@ -515,6 +515,7 @@ func (s *Server) handlePurgeApp(w http.ResponseWriter, r *http.Request) {
s.audit(acct, app, addr, "email-teardown", "tore down the email estate (credentials, IAM principal, domain claims) during permanent deletion")
}
}
+ s.noteRecordDeletion(acct.Sqid, app, time.Now()) // the canary-retire guard's evidence, first
if err := release.PurgeApp(r.Context(), s.cfg.Releases, s.cfg.ReleasePub, acct.Sqid, app, time.Now()); err != nil {
log.Printf("console: purge %s/%s: %v", acct.Sqid, app, err)
fail(purgeAdvice(err, app))
diff --git a/internal/console/remoteinstances.go b/internal/console/remoteinstances.go
index 42a23b6e9..9b1baeb2a 100644
--- a/internal/console/remoteinstances.go
+++ b/internal/console/remoteinstances.go
@@ -460,9 +460,11 @@ var errRetireUnsettled = errors.New("the app's instances have not settled")
// the last channelSettle, or is missing from the modification-time
// listing (deleted since it was read);
// - any was deleted in the last channelSettle (recentRecordDeletion):
-// every member deletion goes through retireHostRecord, which notes it
-// in memory before deleting, and the console refuses for channelSettle
-// after it starts; the audit log is read too;
+// every console path that deletes a record notes the app in memory
+// before deleting (noteRecordDeletion: retireHostRecord,
+// retireClaimHostRecord, deleteRead, finishSeedOnce, both app purges),
+// and the console refuses for channelSettle after it starts; the audit
+// log is read too;
// - the box reports cannot all be read; or
// - a fresh box report names this account and app for a host no record
// names: a route still up after its record was deleted, or a hand route
@@ -545,9 +547,8 @@ func (s *Server) noteRecordDeletion(acct, app string, at time.Time) {
}
// recentRecordDeletion is errRetireUnsettled when an instance or sidecar of
-// acct/app may have been deleted within channelSettle. Every member
-// deletion goes through retireHostRecord, which notes it in memory before
-// deleting; a console that started within channelSettle cannot vouch for
+// acct/app may have been deleted within channelSettle. Every console path
+// that deletes a record notes it in memory before deleting; a console that started within channelSettle cannot vouch for
// the time before it started, so it refuses until it has been up that
// long. The audit log is read as well, for a deletion another console
// process sharing this database made.
diff --git a/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv b/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv
index c46972ca4..b8dc7229b 100644
--- a/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv
+++ b/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv
@@ -21,5 +21,5 @@ internal/console/server.go Server.channelHosts legacy accepted-legacy accepted-l
internal/console/templates/app_overview.html external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Running tile does not claim Served when a route's state is unknown and reads the existing 'no data right now' when every instance's state is unknown; Web addresses tile reads 'no data right now' instead of 'DNS & certs OK' for a domain with no reading; display only. file:external@0 2a112ff768c300894881b858e61465841c87810ca7cb1d98a0fe2a54155a0ca1
internal/console/apiinstances.go Server.instanceHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Records with no local registry row get health only from a box report naming the record's own account and app (held down: Failed; transient, unidentified or unread: Can't tell right now), readings pinned to that box and bounded by each record's created_at. Builds registry.Route literals from the record; reads no registry for them. registry:Account@1987,registry:Account@2007,registry:App@1948,registry:App@1964,registry:Host@839,registry:Unit@2117,registry:Unit@2159,whole:Route@1151,whole:Route@2054,whole:Route@2075,whole:Route@2854,whole:Route@3646,whole:Route@4126,whole:Route@4179,whole:Route@4294,whole:Route@792,whole:Route@821,whole:Route@832,whole:Route@850 f2b042a95c77b07f0bcd1c11f099769a7ad3c1a230c521af71c6bf5cb7685897
internal/console/view.go Assemble legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Collects the set of local registry hosts (rt.Host) so a record host the registry has gets no remote row (its record's created_at bounds the local row's metrics history); adds rows from the account's records and tenant-named box reports when given a remote source. registry:App@1716,registry:App@1739,registry:App@2117,registry:App@2147,registry:Backing@2017,registry:Caps@1385,registry:Channel@960,registry:Environment@1942,registry:Hibernate@1859,registry:Host@1768,registry:Host@861,registry:Kind@1783,registry:Platform@1889,registry:Provisioned@2042,registry:Status@1800,registry:Unit@1999,registry:Version@1823,whole:Route@2092,whole:Route@2167,whole:Route@810,whole:Route@839,whole:Route@910 120ae8c042523f872fd1c19357b8bb830e4afe9da1e38ad202df2ada3ad52ada
-@coverage internal/console 59133e140798bb9e61b5e59ca443be92f6ffb5d39ee9a4bc2b27706e038974f6
+@coverage internal/console 8161c8308fdf9124483a5f62eaf0b4d39e45f7e9ff02a4fd3f9d712b2d6f885f
@coverage internal/console/templates 6e272e30e00be5785b3f364a947ea4ab86b2d96a0e8d21821b7812c45f0a636f