carlos / platform Public

spec: #1139 revision 3, cut (a): hold the hostname until cleanup is proved

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 2b535c92ab1661213ef4349c12c6a819f9732a3d parent f6a3f64
1 file changed, +85 −18
  • docs/superpowers/specs/2026-11-20-fleet-seeded-create-design.md +85 −18
diff --git a/docs/superpowers/specs/2026-11-20-fleet-seeded-create-design.md b/docs/superpowers/specs/2026-11-20-fleet-seeded-create-design.md
index 3f7fac2fa..cb0918658 100644
--- a/docs/superpowers/specs/2026-11-20-fleet-seeded-create-design.md
+++ b/docs/superpowers/specs/2026-11-20-fleet-seeded-create-design.md
@@ -210,21 +210,61 @@ cannot fix either. The box reports `failed` with the reason; the console
moves the seed `ready` → `aborted` with `Reason` set (`SeedFail`). The
member sees the reason in `instances list`, as for a refused import.
-**Abandonment reaches `rolled-back` through the door.** A seed is
-`aborted` by `SeedFail`, by the console's deadline sweep (a `file` seed in
-`reserving` for more than an hour, as `--from`), or by the member
-(`instances delete` before placement). For an `aborted` file seed on a
-fleet, the owning box's reconcile runs the existing local rollback
-(purge the marker, temp files and any local database, §3.5 item 0), and
-only then reports `rolledback`. The console then deletes the snapshot and
-finishes the record, freeing the hostname. Local cleanup always
-completes before the hostname is released.
-
-**No box owns it.** If the fleet has no active box (or several and no
-label), nothing places or rolls back. The sweep's existing one-hour and
-seven-day bounds still abort the seed; the console then finishes an
-`aborted` file seed that no box has placed itself, since no box holds
-anything for it (the record never left `ready` on any box).
+**The invariant (cut (a), Paul 2026-11-20, after round 2).** On a fleet,
+a `file` seed's hostname is released only when its owning box has proved
+that nothing of the seed is left: no local file and no replica. Nothing
+else releases it: no console shortcut, no sweep, no timeout. When cleanup
+cannot be proved, the record stays `aborted` and holds the hostname until
+the proof can be made. It is enforced in one place, the box's rollback of
+an aborted file seed, and the door's `rolledback` operation is the only
+way it is reported.
+
+**Abandonment.** A seed is `aborted` by `SeedFail`, by the console's
+deadline sweep (a `file` seed in `reserving` for more than an hour, as
+`--from`), or by the member (`instances delete` before placement). For an
+`aborted` file seed on a fleet, the owning box's reconcile:
+
+1. fences and stops the host, as the existing rollback does
+ (`provision/seedreconcile.go:315`);
+2. purges the marker, temp files and any local database (§3.5 item 0);
+3. lists the host's replica prefix in the fleet's bucket, strictly
+ (`hasOwnReplica`'s listing, still under the fence). A listing that
+ fails proves nothing;
+4. reports `rolledback` only if step 2 completed and step 3 found no
+ replica object. Otherwise it reports nothing, logs why, and the seed
+ stays `aborted`. The next reconcile pass tries again.
+
+The console then deletes the snapshot and finishes the record, freeing the
+hostname.
+
+**A replica that is left holds the hostname.** This is the case round 2
+found: a box uploads the seed's replica, its `placed` report is lost, and
+the seed is aborted before a later wake records it. The box does not
+delete the replica. The hostname stays held, and `instances list` shows
+the seed as aborted with the reason "a copy of its data is still in the
+fleet's storage". The fleet owner removes the host's replica prefix from
+their own bucket (they own it; the platform cannot write it). The next
+reconcile pass finds no replica and reports `rolledback`. Building a fenced
+fleet-side delete was option (c) and is not part of this design.
+
+**No box owns it.** With no active box (or several and no label), nothing
+places or rolls back, and the seed stays where it is. A `reserving` seed
+is aborted by the sweep after an hour, as `--from`; a `ready` seed has no
+deadline. Either way the hostname is held until a box owns the record and
+proves cleanup. There is no console-side finish for a fleet `file` seed.
+
+**Admission: a fresh seed never takes over a replica it did not make.**
+Placement today reads any replica under the host's prefix as this host's
+own and restores it without fetching (`activator/seedplace.go:173`). For a
+`file` seed on a fleet that is accepted only with proof that this seed
+made it: the seed marker beside the database names this seed's `id`. The
+marker is written before the database is renamed into place
+(`seedplace.go:443`), so it is there before any replica upload. A replica
+without that proof (another seed's leftover, a lost local disk, a replica
+made out of band) refuses placement: the box reports `failed` with the
+reason "a copy of data already exists for this hostname", the seed goes to
+`aborted`, and the rule above holds the hostname until the fleet owner
+removes the copy. Uncertainty refuses; it never restores.
### 3.7 What does not change
@@ -239,8 +279,9 @@ anything for it (the record never left `ready` on any box).
- Bytes pass through the console only; nothing a request supplies picks a
bucket or key (the seeds spec ruling 2).
- The deployment bucket holds the account's database for the time between
- upload and placement. The snapshot is deleted on `placed`, and the sweep
- bounds an abandoned one. This matches what import already does for
+ upload and placement. The snapshot is deleted on `placed` or on
+ `rolledback`. An abandoned fleet seed whose cleanup cannot be proved keeps
+ its snapshot as well as its hostname until it can (§3.6). This matches what import already does for
region apps.
- The new door trusts only an authenticated fleet identity for the fleet
the record is placed on, and acts only on the seed `id` the record
@@ -259,7 +300,8 @@ anything for it (the record never left `ready` on any box).
changes nothing; `placed` deletes the snapshot once.
- Box: a fleet box reads the snapshot through a fake store door, places
it, and reports `placed` to a fake console door; a failed check reports
- `refused` and never starts an empty database.
+ `failed`, the seed goes to `aborted`, and no empty database is ever
+ started.
- Flat: two seeds placing at once in one shared directory both succeed;
an earlier seed's leftover temp file is purged.
- Failure: a corrupted snapshot reports `failed`, the seed goes to
@@ -267,6 +309,18 @@ anything for it (the record never left `ready` on any box).
finished, the hostname is free.
- Abandonment: an upload that never finishes is aborted by the sweep and
finished; a member's delete before placement does the same.
+- Interrupted placement, then recreate (deterministic): the replica
+ uploads, the `placed` report fails, the member deletes. Rollback purges
+ locally, finds the replica, does not report, and the hostname stays held.
+ Once the fake fleet bucket's prefix is emptied, the next pass reports
+ `rolledback` and the record finishes. A second seed at that hostname then
+ places its own snapshot, never the first seed's data.
+- Admission: a fleet `file` seed whose host already has a replica and no
+ marker naming its `id` reports `failed` and restores nothing; with the
+ marker it restores and reports `placed`.
+- Listing failure: a rollback whose replica listing fails reports nothing.
+- No owner: an aborted fleet `file` seed with no owning box is never
+ finished by the console or the sweep.
- Readiness: a fleet with one box missing the new heartbeat fields, or
below the protocol, refuses with the box named.
- Lifecycle: table rows for `file` in `SeedReady`, `Unfinished`,
@@ -307,3 +361,16 @@ Findings: `CODEX-FINDINGS-fleet-seeded-create-R1.md`.
| R1-4 P2 readiness evidence, protocol | Accepted: heartbeat fields, fleet readiness, store-door read of the floor, new protocol, floor advance, §3.4 and §6 |
| R1-5 P2 lifecycle consumers | Accepted: §3.2 list and table tests |
| R1-6 P2 docs, parity, UX | Accepted: §7 |
+
+## 9. Round 2 dispositions
+
+Findings: `CODEX-FINDINGS-fleet-seeded-create-R2.md`. Both P1s are in the
+abandonment family (round 1's R1-2 was the first), so stopping rule 2
+applied. Paul chose cut (a) on 2026-11-20: hold the hostname when cleanup
+cannot be proved.
+
+| Finding | Disposition |
+|---|---|
+| R2-1 P1 no-owner shortcut | Cut (a): shortcut removed; no console-side finish; seven-day claim corrected (a `ready` seed has no deadline), §3.6 |
+| R2-2 P1 leftover replica replaces a new seed | Cut (a): `rolledback` only after a strict empty listing; a left replica holds the hostname for the fleet owner to remove; admission requires the marker naming this seed, §3.6; deterministic interrupt-and-recreate test, §5 |
+| R2-3 P3 `refused` in §5 | Fixed |