carlos / platform Public

docs: plan 2a review round 3 fixes

Rotation never reaps the delivered fleet key; a publishing state under
the launch deadline replaces the unbounded ready.json retry. Review
closed after round 3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 8c4ed4ffc73c09c4eaecaf019140b0f866f2c1d8 parent 036844d
1 file changed, +44 −31
  • docs/superpowers/plans/2026-11-01-managed-fleets-2a-core.md +44 −31

CI passed — run details

diff --git a/docs/superpowers/plans/2026-11-01-managed-fleets-2a-core.md b/docs/superpowers/plans/2026-11-01-managed-fleets-2a-core.md
index 8752b2650..78b1b7fa9 100644
--- a/docs/superpowers/plans/2026-11-01-managed-fleets-2a-core.md
+++ b/docs/superpowers/plans/2026-11-01-managed-fleets-2a-core.md
@@ -177,12 +177,12 @@ type Provisioner interface {
```
`State` values: `pending`, `running`, `stopping`, `stopped`, `shutting-down`, `terminated`.
-In `fleetstore`: `type Credentials []byte`, `type FleetStorage struct { Bucket, Region string }`.
-`type Provisioner interface { EnsureFleetStorage(ctx context.Context, fleet, region string) (FleetStorage, error); FleetCredentials(ctx context.Context, fleet string) (Credentials, error); RotateFleetCredentials(ctx context.Context, fleet string) (Credentials, error) }`.
+In `fleetstore`: `type Credentials struct { ID string; Secret []byte }`, `type FleetStorage struct { Bucket, Region string }`.
+`type Provisioner interface { EnsureFleetStorage(ctx context.Context, fleet, region string) (FleetStorage, error); FleetCredentials(ctx context.Context, fleet string) (Credentials, error); RotateFleetCredentials(ctx context.Context, fleet, keep string) (Credentials, error) }`.
FleetCredentials does not promise recoverable secret bytes; console delivery uses its sealed copy.
-RotateFleetCredentials mints a new key (secret revealed once) and reaps all but the newest two.
-If no sealed copy exists, the console mints through RotateFleetCredentials, seals, persists, then uses it.
-Empty credentials are valid for a future profile adapter; no profile or IAM type enters either interface.
+RotateFleetCredentials mints a new key (secret revealed once), never reaps `keep`, and reaps other keys down to at most two live keys including `keep`. If the two live keys are `keep` and an unsealed orphan, reap the orphan before minting. ID is non-secret; Secret contains the opaque secret bytes.
+If no sealed copy exists, the console passes the persisted delivered_key_id as `keep` to RotateFleetCredentials, seals Secret and persists ID, then uses it; `keep` is empty before any delivery.
+A zero-value Credentials with empty ID and Secret is valid for a future profile adapter; no profile or IAM type enters either interface.
Both fake constructors are `NewFake() *Fake`; methods implement the respective interface.
Compute fake faults are configured before a test starts; all runtime state/counters use its mutex.
Expose `SetState(cloudID string, state State)` and `Calls() map[string]int` on the compute fake.
@@ -204,13 +204,15 @@ TestFakeNthCapacityFailure: third launch rejected, first two retained, no third
TestFleetStorageFake: same fleet/region => same bucket; distinct fleets isolated;
opaque credentials not present in storage metadata; empty credentials supported.
TestFleetStorageFakeRotation: each minted secret is revealed once; FleetCredentials cannot recover it;
- rotations retain at most the newest two live keys per fleet and never affect another fleet;
+ rotations retain at most two live keys per fleet, always preserve keep, reap an unsealed orphan first, and never affect another fleet;
many enrolments reuse the console-sealed current key without provider minting.
+TestFleetCredentialsDoubleLostRotation: deliver one key, then lose two consecutive rotations before sealing;
+ pass delivered_key_id as keep both times; the delivered key remains live and at most two keys are live.
TestManagedCoreImports: direct imports in compute and fleetstore (all files, tests included) and in
internal/console/managed*.go contain no AWS SDK (github.com/aws/...); a new managed*.go file is covered automatically.
```
-- [ ] **Step 2: Run `GOFLAGS=-buildvcs=false go test ./internal/compute ./internal/fleetstore ./internal/console -run 'TestFake|TestFleetStorageFake|TestManagedCoreImports' -count=1`; expect FAIL.**
+- [ ] **Step 2: Run `GOFLAGS=-buildvcs=false go test ./internal/compute ./internal/fleetstore ./internal/console -run 'TestFake|TestFleetStorageFake|TestFleetCredentialsDoubleLostRotation|TestManagedCoreImports' -count=1`; expect FAIL.**
- [ ] **Step 3: Implement contracts, fakes and the narrow adapter extraction.**
Keep identity matching exact; a different deployment never matches discovery.
@@ -293,7 +295,7 @@ Document both system subcommands in this task's merge.
**Interfaces (new):**
- `type managedOp struct { ID, RequestID, Account, Fleet, Kind, State, CreatedBy, Error string; Requested int; CreatedAt, UpdatedAt time.Time }`.
-- `type managedBox struct { Fleet, Label, OpID, Account, Region, Size, ClientToken, CloudID, State, LastError, EnrolHash string; Launch compute.LaunchSpec; Checks map[string]managedCheck; EnrolExpires, CreatedAt, UpdatedAt time.Time; ReadyDrainPending bool; LaunchStartedAt, TerminateAttemptedAt, TerminateSentAt, NextCleanupAt, LastHeartbeatAt time.Time; EnrolDrainStart int64; ConfigGeneration uint64; Storage fleetstore.FleetStorage }`.
+- `type managedBox struct { Fleet, Label, OpID, Account, Region, Size, ClientToken, CloudID, State, LastError, EnrolHash string; Launch compute.LaunchSpec; Checks map[string]managedCheck; EnrolExpires, CreatedAt, UpdatedAt time.Time; DrainClearCompleted bool; LaunchStartedAt, TerminateAttemptedAt, TerminateSentAt, NextCleanupAt, LastHeartbeatAt time.Time; EnrolDrainStart int64; ConfigGeneration uint64; Storage fleetstore.FleetStorage }`.
- `type managedRequest struct { RequestID, Account, Fleet, Kind, Region, Size, CreatedBy string; Boxes int }`.
- `func (s *Store) ReserveManaged(ctx context.Context, req managedRequest, cfg managedConfig, now time.Time, enrolHash func(clientToken string) (string, error)) (managedOp, []managedBox, bool, error)`; bool means returned existing op. Check request ID and open op before validating/resolving cfg; resolve per allocated label inside this transaction.
- `func (s *Store) ManagedWork(ctx context.Context) ([]managedOp, []managedBox, error)`.
@@ -304,9 +306,9 @@ Document both system subcommands in this task's merge.
Create the controller's tables plus `managed_ops.request_id TEXT NOT NULL` with UNIQUE(account, request_id), persisted requested region/size and `preparation_started_at`; include the partial unique index on `managed_ops(fleet) WHERE state='open'`.
`launch` contains the frozen LaunchSpec with `UserData` empty; no enrolment plaintext or unsealed credentials enter SQL. Store the current fleet credential in a fleet-scoped sealed BLOB (Task 5), never in launch metadata.
-Persist additional immutable launch timing metadata in that JSON envelope: `launch_started_at` and `config_generation`; persist `ready_drain_pending` for recovery of ready-object publication and drain clear, plus immutable `ready_at` and `ready_object_written`, `enrol_drain_start` (Unix nanoseconds), `terminate_attempted_at` and `terminate_sent_at` bound to the exact cloud ID, `next_cleanup_at` and `last_heartbeat_at` as well; leave the public compute type unchanged.
+Persist additional immutable launch timing metadata in that JSON envelope: `launch_started_at` and `config_generation`; persist the `publishing` state for ready-object recovery, immutable `ready_at`, and `drain_clear_completed` for conditional drain-clear recovery, plus `enrol_drain_start` (Unix nanoseconds), `terminate_attempted_at` and `terminate_sent_at` bound to the exact cloud ID, `next_cleanup_at` and `last_heartbeat_at` as well; leave the public compute type unchanged.
`managed_ops.state` stays `open|done|failed`; `done-with-failures` is the response's derived outcome, not a fourth SQL state.
-`managed_boxes` states are exactly `reserved|launching|booting|enrolled|ready|failed|terminating|terminated`.
+`managed_boxes` states are exactly `reserved|launching|booting|enrolled|publishing|ready|failed|terminating|terminated`.
Keep first error separately from subsequent cleanup detail in the structured checks/error rendering so cleanup does not erase cause.
Reserve under one pinned SQL connection using `BEGIN IMMEDIATE`, count and insert, then commit.
@@ -383,10 +385,10 @@ Prepare storage idempotently, persist its bucket/region, admit history, update t
Add on a fleet whose preparation failed re-runs preparation before reserving new boxes, with a durably recorded start for that new attempt and the same 30-minute deadline; retries/restarts never reset that start. No reservation or launch precedes its success.
Add uses the existing bucket when one was persisted; otherwise recover preparation to establish it. Recheck provider output against the persisted bucket/region; refuse drift, never overwrite another owner.
Persist preparation_started_at before the first provider call; at 30 minutes fail the op and its unlaunched reservations without launching. Proven never-dispatched reservations become terminated and release quota.
-If no sealed credential exists, call RotateFleetCredentials, seal and persist the one-time secret before use. Reuse the persisted copy on ordinary retries and enrolments.
-Reuse `openConnectorSeal`, `connectorSeal.Seal/Open` (`internal/console/alertseal.go:39,104,114`): AES-GCM, external 0600 key, ciphertext only in SQL. If created=true or Open fails for a fleet credential, call RotateFleetCredentials and reseal/persist before use; unreadable/invalid key files still refuse safely.
+Persist fleet-scoped non-secret `delivered_key_id` independently of the sealed credential, so losing the seal key cannot lose the key ID boxes use. Persist it before sending any enrolment response; never advance it for a rotation lost before sealing or delivery. If no sealed credential exists, call RotateFleetCredentials(ctx, fleet, delivered_key_id), seal Secret and persist ID before use. Reuse the persisted copy on ordinary retries and enrolments.
+Reuse `openConnectorSeal`, `connectorSeal.Seal/Open` (`internal/console/alertseal.go:39,104,114`): AES-GCM, external 0600 key, only ciphertext for Secret in SQL, with non-secret ID alongside it. If created=true or Open fails for a fleet credential, call RotateFleetCredentials(ctx, fleet, delivered_key_id) and reseal/persist before use; unreadable/invalid key files still refuse safely.
A lost seal key also changes Task 4’s HKDF enrolment key: outstanding launches fail its hash comparison, never relaunch with changed UserData.
-A crash before sealing may require another rotation; the provider retains at most two live keys. No per-enrolment mint or bucket deletion in 2a.
+A crash before sealing may require another rotation; every retry preserves delivered_key_id and reaps an unsealed orphan first, retaining at most two live keys including the delivered key. No per-enrolment mint or bucket deletion in 2a.
On active history, CAS-union `fleet:<name>` into Examined and `bucket:<bucket>` into its FleetTargets.
For a nonempty label, also union `box:fleet/<fleet>/<label>` before its registry row becomes active.
@@ -418,7 +420,7 @@ TestManagedPrepareNameRace: BYO and managed race same name => one owner;
rejected reservation deletes only its just-created empty row, never a row with boxes/ops.
TestManagedPreparationDeadline: persisted start +30m => failed op, zero launches, visible owned show;
restart does not reset deadline; cross-account show still identical 404.
-TestManagedFleetCredentials: preparation retries mint once; SQL contains only sealed bytes;
+TestManagedFleetCredentials: preparation retries mint once; SQL contains only sealed secret bytes and non-secret key IDs;
restart opens same credential; many boxes receive same current key without minting.
TestManagedSealKeyLost: created=true or fleet credential Open failure => rotate, reseal, persist before use;
at most two live keys; replacement seal key changes HKDF output, outstanding launch hash mismatch => no Launch.
@@ -473,16 +475,16 @@ Pending stays launching; running becomes booting; stopped/stopping/shutting-down
A found cloud instance with mismatched identity/region is never adopted or terminated.
A restart before dispatch rebuilds byte-identical UserData, including the derived token, and retries with the same ClientToken; no remint or lost-transient uncertainty state.
-Every provisioning state has a persisted deadline: reserved preparation uses 30 minutes; launching/booting/enrolled use 20 minutes from launch_started_at. Retries never reset either anchor.
-On failure persist cause before Terminate. Under lockFleet, revoke any enrolled box’s tunnel token with SetFleetBoxToken using a valid 64-lowercase-hex hash of a fresh discarded random token; keep its registry row for cleanup. Retry revocation after a crash/error before cleanup proceeds. Checked seam: `internal/registry/fleets.go:509,524` at b7802fd8 validates the hash and bumps rev. Automatic termination of a not-ready box rests on the joining invariant: without console-written ready.json it owns no records and runs no instances. LabelledAt is not a termination proof. Ready rows, including pending ready publication/drain recovery, never enter failed-provisioning cleanup.
+Every provisioning state has a persisted deadline: reserved preparation uses 30 minutes; launching/booting/enrolled/publishing use 20 minutes from launch_started_at. Retries never reset either anchor.
+On failure persist cause before Terminate. Under lockFleet, revoke any enrolled box’s tunnel token with SetFleetBoxToken using a valid 64-lowercase-hex hash of a fresh discarded random token; keep its registry row for cleanup. Retry revocation after a crash/error before cleanup proceeds. Checked seam: `internal/registry/fleets.go:509,524` at b7802fd8 validates the hash and bumps rev. Automatic termination of a not-ready box rests on the joining invariant: without console-written ready.json it owns no records and runs no instances. LabelledAt is not a termination proof. Publishing reaches failed at that deadline or on a mismatched existing ready object, then follows normal token revocation, idempotent object deletion and termination cleanup while the box is still joining. Ready rows, including drain-clear recovery, never enter failed-provisioning cleanup.
Transition to terminating and persist terminate_attempted_at bound to the exact cloud ID before calling `Terminate(..., want Identity)`. Persist terminate_sent_at only after acceptance.
Confirm termination by Find reporting terminated, or NotFound/complete Find absence for that exact cloud ID after its persisted attempt, including a lost Terminate response. A successful Terminate response alone never frees quota.
Identity mismatch records a safe error, stops fast retries and schedules hourly retry with persisted next_cleanup_at; quota stays held and show reports the reason.
Failed/terminating cleanup uses hourly back-off after the op closes; each attempt is bounded and retains quota until termination is established. Cleanup has no forced quota-release deadline.
Ready boxes are never cleanup targets merely because a sibling failed.
-One finishing rule: close an op when every box is ready with ready_drain_pending cleared, terminated, or in cleanup (failed/terminating). All ready => done; some ready => done with failures; none ready => failed.
+One finishing rule: close an op when every box is ready with drain_clear_completed recorded, terminated, or in cleanup (failed/terminating). All ready => done; some ready => done with failures; none ready => failed.
A closed op no longer blocks add; unresolved cleanup still counts against quota and is discovered on restart. Detach only after established termination.
-Failure and cleanup never write ready.json. Delete any ready object idempotently after established termination and before detach (also required of 2d removal); retry deletion failures before detach. This avoids leaving an obsolete authorization object; deleting it does not stop an already-ready box.
+Failure and cleanup never write ready.json. For failed publishing, revoke the token, delete the ready object idempotently, then terminate; retry deletion failures before proceeding. For other cleanup, delete any ready object idempotently after established termination and before detach (also required of 2d removal); retry deletion failures before detach. This avoids leaving an obsolete authorization object; deleting it does not stop an already-ready box.
**Census/review:** Launch and termination authority, worker registration, registry detach and timing need independent review. Include newly changed root command envelopes and record-write witnesses in the census proposal.
@@ -502,8 +504,9 @@ TestManagedIdentityCleanup: mismatched tags => no termination/detach, quota reta
TestManagedAcceptedTerminateAbsent: persisted attempt for exact ID, lost Terminate response, then NotFound => terminated;
crash before dispatch resumes cleanup; absence without an attempt or for a different ID never releases quota.
TestManagedFailedEnrolledCleanup: failed joining box never gets ready.json and runs no instances;
- old tunnel token fails authentication after failure/restart; registry row retained with unusable hash;
- cleanup uses the joining invariant, not LabelledAt; ready/pending-ready siblings never terminate;
+ old tunnel token refuses new connections after failure/restart; an existing tunnel lasts until termination;
+ registry row retained with unusable hash;
+ cleanup uses the joining invariant, not LabelledAt; ready siblings, including drain-clear recovery, never terminate;
termination precedes idempotent ready-object deletion and detach; deletion failure retries without detach.
TestManagedPartialFailure: ready siblings untouched; failed Nth launch reported;
op closes with ready/cleanup siblings; new add allowed subject to held quota; cleanup continues hourly.
@@ -560,7 +563,7 @@ Within fleet lock: recheck token and box state, verify the empty-directory asser
Do not admit a bucket/box history target for rejected nonempty data.
The SQL token claim is conditional on unused/hash/state and ensures only one process can win; a process mutex alone is not the replay guard.
A credential-fetch failure after the claim keeps the token consumed and fails the box into cleanup.
-Credentials come from the current sealed fleet record after the claim wins; each successful response delivers the same current fleet credential. No per-enrolment mint; plaintext never enters SQL, logs or views.
+Credentials come from the current sealed fleet record after the claim wins; each successful response delivers the same current fleet credential, with non-secret ID and opaque Secret. Under the fleet lock, persist delivered_key_id = Credentials.ID before sending the response, so later rotations preserve that key even if the response is lost. No per-enrolment mint; secret bytes never enter SQL unsealed, logs or views.
The fleet history write precedes any active registry insertion.
Because console DB and registry are separate stores, this is a recoverable sequence, not a fictional cross-DB transaction.
On restart, claimed-but-not-enrolled fails into cleanup; never complete a trade or replay its response. A crash after enrolled but before response eventually hits the readiness deadline.
@@ -625,17 +628,17 @@ Rootfs uses `boxRootfsReady` on that same fresh report.
Owner check uses FleetOwnerKey and `fleetOwnerRecorded`; it proves the owner record, not that the box consumed it.
Make one owner GET per box at the moment the other five checks would permit readiness; never memoize owner evidence.
Storage/router default to pending in production. Test fakes may pass them independently; a connected heartbeat is not a router probe or bucket proof.
-Only all six current passes transition enrolled to ready. Under lockFleet persist ready with ready_drain_pending, immutable ready_at and ready_object_written=false. Write `fleets/<fleet>/boxes/<label>/ready.json` to the deployment store with exactly `{"fleet","label","ready_at","op"}` (reservation identity, persisted ready timestamp and operation ID), then persist ready_object_written=true BEFORE ClearFleetBoxDraining with the persisted enrol_drain_start. Clear the pending flag only after the conditional drain attempt completes. A failed publication leaves the drain and pending state intact; it never enters failure cleanup.
-Use release.Store.Put with create-only semantics; after conflict or an ambiguous write, GET and require the exact persisted object before proceeding. A mismatch retains pending state and reports an invariant error, never overwrites or clears the drain. Restart retries this sequence, including a crash after the PUT but before its SQL acknowledgement. Never regenerate ready_at on retry.
+Only all six current passes transition enrolled to publishing. Under lockFleet persist publishing and immutable ready_at. Write `fleets/<fleet>/boxes/<label>/ready.json` to the deployment store with exactly `{"fleet","label","ready_at","op"}` (reservation identity, persisted ready timestamp and operation ID). Write and verify the exact object before persisting ready; only then call ClearFleetBoxDraining with the persisted enrol_drain_start and record drain_clear_completed after the conditional attempt completes.
+Use release.Store.Put with create-only semantics and GET to verify the exact persisted object, including after conflict or an ambiguous write. Restart in publishing re-verifies the object; never regenerate ready_at. Publishing remains under the 20-minute launch deadline: persistent publication failure at the deadline or a mismatched existing object transitions to failed and normal cleanup (revoke token, delete object idempotently, terminate), safe because the box is still joining. Restart in ready with its enrolment drain still set re-clears it conditionally; ready never returns to failed provisioning.
Announce successful publication through s.bumpSerial; recovery may repeat the announcement. A lost bump is covered by 2b's joining-only 60-second backstop. The ready object is the authorization; the serial is only a wakeup.
Checked at b7802fd8: `internal/release/store.go:44–55` defines create-only Put and idempotent Delete; `internal/console/serialbump.go:32` announces writes. `internal/edge/storedoor.go:530–543` already grants aclRead for the authenticated box's own fleet prefix, including this key; no read-ACL expansion is needed.
A mismatched drain start is preserved, never cleared; a zero/already-cleared mark is an idempotent completion. Record completion of the conditional attempt so recovery cannot clear a later member drain.
-ManagedWork includes ready_drain_pending rows; recover only these, never clear arbitrary ready-row drains. Before accepting a member drain under lockFleet, finish any pending ready-object publication and drain clear so crash recovery cannot undo that member drain.
+ManagedWork includes publishing rows and ready rows whose drain_clear_completed is false; recover only these, never clear arbitrary ready-row drains. Before accepting a member drain under lockFleet, finish and record the ready row’s conditional drain clear so crash recovery cannot undo that member drain. Publishing boxes remain joining and refuse member drains.
Include the registry clear method in Tasks 7–8 file changes, remote dispatch/interface and census review.
Controller ruling: while an operation is open, the worker reads each enrolled-not-ready box's own heartbeat object directly
(one GET per such box every 60 seconds, using persisted last_heartbeat_at) and the verified stable pointer at most once per due readiness pass. This is bounded by open
-operations, not steady state, so §6 holds: once a box is ready or terminal the worker stops heartbeat reads; pending ready-object recovery may still verify its object. An idle
+operations, not steady state, so §6 holds: once a box is ready or terminal the worker stops heartbeat reads; publishing recovery verifies its object until ready or failed. An idle
worker reads nothing. No observation cache, no publication from page views or the relabel worker.
Labels are fleet-scoped by the key path, so identical labels in different fleets cannot match.
After a box reaches ready and its op settles, the worker stops describing it; ordinary existing health paths continue.
@@ -646,7 +649,7 @@ After a box reaches ready and its op settles, the worker stops describing it; or
```text
TestManagedReadinessSixChecks: five passes plus one pending => enrolled;
- all six pass => ready; persisted JSON contains all six keys.
+ all six pass => publishing; verified ready.json => ready; persisted JSON contains all six keys.
TestManagedReadinessTracksStableRoll: heartbeat=v0.33.0, stable=v0.34.0 => pending;
fresh heartbeat=v0.34.0 => pass; bad signature/missing stable => pending.
TestManagedReadinessStaleOrPartial: stale/missing/partial/wrong-fleet report => not ready;
@@ -656,18 +659,21 @@ TestManagedReadinessDefaults: production extras absent => storage/router_probe p
EC2 running plus Tunnel=connected cannot pass those checks.
TestManagedReadinessBudget: at most one heartbeat GET per enrolled box per 60s, including restart;
at most one stable pointer GET per due pass; zero LISTs; one owner GET per box about to turn ready;
- ready/terminal boxes => zero heartbeat/owner reads; count pending ready-object recovery GETs separately; no owner memo.
+ ready/terminal boxes => zero heartbeat/owner reads; count publishing recovery GETs separately; no owner memo.
TestManagedJoiningPlacement: no ready.json until all six checks pass, even with a fresh heartbeat;
joining drain excludes labelled placements only; failed boxes never receive ready.json;
all six pass => exact ready.json written before drain clear, then labelled placement succeeds.
-TestManagedReadinessDrainRecovery: crash after ready before PUT, after PUT before SQL acknowledgement,
- and after acknowledgement before drain clear => restart publishes/verifies the same object before clearing;
- PUT failure or mismatched object leaves drain/pending state; ready_at/op stay stable across retries;
+TestManagedReadinessDrainRecovery: crash in publishing before PUT, after PUT before ready is persisted,
+ and after ready before drain clear => restart re-verifies publishing or re-clears ready conditionally;
+ PUT failure stays publishing until the deadline; ready_at/op stay stable across retries;
a different draining_since survives conditional clear; no cleanup of ready box;
joining member drain => 409 without mutation; later member drain survives recovery and repeated readiness passes.
+TestManagedPublishDeadline: persistent PUT failure => publishing until the 20-minute launch deadline, then failed;
+ op closes; token revoked, object deleted idempotently, termination attempted; quota held until terminated;
+ restart preserves deadline; mismatched existing object => failed with the same cleanup, never overwritten or ready.
```
-- [ ] **Step 2: Run `GOFLAGS=-buildvcs=false go test ./internal/console -run 'TestManagedReadiness|TestManagedJoiningPlacement' -count=1`; expect FAIL.**
+- [ ] **Step 2: Run `GOFLAGS=-buildvcs=false go test ./internal/console -run 'TestManagedReadiness|TestManagedJoiningPlacement|TestManagedPublishDeadline' -count=1`; expect FAIL.**
- [ ] **Step 3: Implement readiness evaluation and the ready/drain transition.**
Persist changes only when the check result changes, avoiding repeated SQLite progress writes with identical content.
@@ -928,3 +934,10 @@ Round 2: controller-supplied review; apply Paul’s P1 ruling and the P2/P3 disp
- P3-1 — Termination evidence: persist exact-ID attempt before dispatch; subsequent exact-ID NotFound establishes termination.
- P3-2 — Preparation recovery: add re-runs failed preparation before reserving, with the same persisted deadline rules.
Newly cited ready-object store, store-door read/write ACL, serial announcement/pass and ownsRecord seams rechecked at main b7802fd8. This edit applies fix3-brief.md; no tests run or review round reopened.
+
+Round 3: controller-supplied findings and fix4-brief.md rulings applied locally; no further review round.
+- P2-1 — Delivered-key preservation: persist non-secret delivered_key_id, carry ID and Secret in Credentials, and pass keep to every rotation; reap unsealed orphans without reaping the delivered key. TestFleetCredentialsDoubleLostRotation covers two consecutive losses before sealing.
+- P2-2 — Bounded publication: enrolled → publishing → ready; write and verify before ready and conditional drain clear. Publishing retains the 20-minute launch deadline; deadline or object mismatch fails into normal cleanup with quota held until termination. TestManagedPublishDeadline covers both failures and restart recovery.
+- P3 — Token revocation refuses new connections; an existing tunnel lasts until termination.
+
+Review closed after round 3 (three-round limit); remaining P3s none open.