carlos / platform Public

notes #658 Task 1: fix round 1 (N2 superseded void, minor citations)

Add the N2 slot-superseded void to the outcome table and record the
ruling that restoreProof requires kind normal, state committed and
restorable. Drop the claim-console delete door from the lifetimes-off
row, add sidecars swept by the lifetimes-on purge, name the rootfs
first-release cancel, and cite DeleteAccount's app check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev b361f4e157293d1215a259772fee1d7a5962bf99 parent bbfacc8
1 file changed, +14 −8
  • docs/superpowers/notes/instance-restore-658-task1.md +14 −8
diff --git a/docs/superpowers/notes/instance-restore-658-task1.md b/docs/superpowers/notes/instance-restore-658-task1.md
index 2e08ddb8a..2bd7315f0 100644
--- a/docs/superpowers/notes/instance-restore-658-task1.md
+++ b/docs/superpowers/notes/instance-restore-658-task1.md
@@ -36,7 +36,7 @@ store_gate.go:241 only lists the table for the claim SQL gate
| Writer | Where | What it writes | Callers |
|---|---|---|---|
| `BeginRetirement` | lifetimes_store.go:208 | INSERT, kind normal / orphan / cleanup, state pending, `cancels` always "" | lifetimes_retire.go:173 (normal), :198 (cleanup); lifetimes_create.go:524 (orphan) |
-| `BeginCancellingRetirement` | lifetimes_store.go:228 | INSERT of an **orphan** row plus void of the allocation, in one tx | lifetimes_create.go:526, only reached from lifetimes_recovery.go:208 (recovery cancelling an allocation whose app lifetime is gone) |
+| `BeginCancellingRetirement` | lifetimes_store.go:228 | INSERT of an **orphan** row plus void of the allocation, in one tx | lifetimes_create.go:526, only reached from lifetimes_recovery.go:208 (recovery cancelling an allocation whose app lifetime is gone, or a binary allocation whose app's first release is rootfs, lifetimes_recovery.go:200-204) |
| `ConvertRetirementKind` | lifetimes_store.go:261 | UPDATE normal to cleanup **and replaces `record_etag`** | lifetimes_retire.go:298 only |
| `SetRetirementState` | lifetimes_store.go:270 | UPDATE state | lifetimes_retire.go:308 (void), :331 (refused); `settleRetirement` lifetimes_create.go:556 (void or committed) |
@@ -53,6 +53,7 @@ row that ends committed with its own tombstone. Its outcomes, against §5:
| another incarnation: fence, void | :306-316 | not restorable |
| same incarnation, other ETag: fence, refused | :328-339 | not restorable |
| successor slot: void | :264-265 | not restorable |
+| N2 slot superseded: void (`retireSlotStep` → `settleRetirement(.., lifetimeVoid, ..)` when `retireSlotLocked` reports `slotSuperseded`; reached from :291 and from :303, right after N1 landed) | :349-351 | not restorable |
Orphan rows (`orphanStepsLocked`, lifetimes_create.go:537) and cleanup rows
never become restorable under §5.
@@ -98,10 +99,11 @@ restore that should not happen. That is §4's other items, not §5.
| Migration quarantine (corrupt body, no slot) | lifetimes_migrate.go:233-246 | none (row in `record_migrations`, superseded) |
| Lifetimes-off delete door | apiinstanceimport.go:1111 `release.DeleteIfMatch` | none |
| Lifetimes-off seed finish | seedfinish.go:145 | none |
-| Lifetimes-off detach / rollback / undo / claim-console delete door | hostclaimops.go:33 → provision/retirement.go:64-68 → `DeleteRecord` provision/provision.go:2947 | none |
+| Lifetimes-off detach / rollback / undo | hostclaimops.go:33 → provision/retirement.go:64-68 → `DeleteRecord` provision/provision.go:2947 | none |
| Lifetimes-off purges | ownership.go:607 `release.PurgeApp`; expirypass.go:251 and lifetimes_purge.go:248 `PurgeAppIfTrashedAt`; demo_expiry.go:337 `PurgeAppExcept` | none |
| Claims on: every instance removal | hostclaimops.go:21-23 → `retireClaimHostRecord` claim_retire.go:33; claim purge claim_purge.go; hostops | none (claims-on consoles write no lifetime rows: lifetimes_recovery.go:30-32) |
| Sidecar delete | apisidecars.go:549 → `retireHostRecord` with Family "sidecar" | none (sidecar record key, not an instance record) |
+| Sidecar records swept by the lifetimes-on purge | lifetimes_purge.go:94-96: `PurgeAppExcept` keeps only instance record keys (`provision.IsInstanceRecordKeyOf`) and, for demos, the marker, so the app's sidecar records go with the rest of the prefix | none |
Not removers, checked: app trash writes only the marker (release/trash.go:44-51,
`claimRawTrashApp`); trash restore deletes only the marker
@@ -109,7 +111,10 @@ Not removers, checked: app trash writes only the marker (release/trash.go:44-51,
(demo_claim_transfer.go:879, `keep = provision.IsRecordKey`);
`purgeAppWithLifetimes`'s final sweep keeps instance record keys
(lifetimes_purge.go:94-96); account deletion refuses an account that still
-has apps (ownership.go:752), and the console never deletes `accounts` rows.
+has apps (`Store.DeleteAccount`, ownership.go:829-833: `SELECT COUNT(*) FROM
+apps WHERE account_id = ?`, then "this account still holds %d app(s)"), and it
+only marks the `accounts` row with `deleted_at`, never removes it
+(ownership.go:805-815), so the console never deletes `accounts` rows.
### 1.4 Verdict for Step 4
@@ -121,11 +126,12 @@ writes only an orphan, cleanup, void or refused row. **Task 4 is not blocked.**
1. **"Restorable" must mean `kind = normal AND state = committed AND
restorable`.** Once N1 has landed, the same row can still turn into a
- cleanup (:294-301, which also replaces `record_etag`), void (:306, :264) or
- refused (:328) if another writer replaces the tombstone before N2/N3.
- Either clear `restorable` in `ConvertRetirementKind` and in the void/refused
- branches, or have `restoreProof` require all three fields. The second is
- simpler and safe on its own.
+ cleanup (:294-301, which also replaces `record_etag`), void (:306, :264,
+ and N2's superseded void at :351) or refused (:328) if another writer
+ replaces the tombstone or takes the slot before N2/N3. **Controller's
+ ruling:** `restoreProof` requires `kind = normal AND state = committed AND
+ restorable` on the newest retirement. No branch needs to clear the flag on
+ convert, void or refused.
2. **Persist `restorable` before N2, and treat a failed write as pending.**
The lost-response proof (:302) can only be made while the tombstone is
still there. After N3 deletes it, recovery takes the :266 branch, which