plan: #1139 plan round 3 fixes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+46
−2
docs/superpowers/plans/2026-11-20-fleet-seeded-create.md+16 −2docs/superpowers/plans/CODEX-FINDINGS-fleet-seeded-create-plan-R3.md+30 −0
CI passed — run details
diff --git a/docs/superpowers/plans/2026-11-20-fleet-seeded-create.md b/docs/superpowers/plans/2026-11-20-fleet-seeded-create.md| index 74cf972c4..4dcea3474 100644 |
| --- a/docs/superpowers/plans/2026-11-20-fleet-seeded-create.md |
| +++ b/docs/superpowers/plans/2026-11-20-fleet-seeded-create.md |
| @@ -20,6 +20,8 @@ Plan round 1 (`CODEX-FINDINGS-fleet-seeded-create-plan-R1.md`): NOT READY, 3 P1 |
| Plan round 2 (`CODEX-FINDINGS-fleet-seeded-create-plan-R2.md`): NOT READY, 2 P1, each in a family round 1 also hit, so stopping rule 2 applied. Paul chose (2026-11-20) "state the invariant, enforce it in one place, guard test" for both. R2-1: the rollback proves both local locations empty under the fence (Task 10 step 7.4, D5, `TestFleetFileSeedRollbackLayoutChangedHolds`). R2-2: `seedStorageRefusal` is the one storage prerequisite, shared by begin and upload (Task 16, `TestSeedStoragePrereqBeginMatchesUpload`). |
| +Plan round 3 (`CODEX-FINDINGS-fleet-seeded-create-plan-R3.md`): NOT READY, 1 P1 and 1 P2, both fixed here. R3-1: `seedFleetReady` refuses a claim-enabled console first (Task 16, `TestFileSeedFleetClaimConsoleRefuses`); the reviewer named this a refuse-up-front case matching the plan's declared scope. R3-2 (P2): `seedsFloorFields` takes the box identity and moves context (Task 11, two tests). A fourth round needs Paul's go. |
| + |
| Earlier: no plan review before round 1. The design's round history carries into every brief written from this plan (stopping rule 1). Three design rounds: R1 (6 findings), R2 (abandonment family, cut (a)), R3 (R3-1 exhaustive listing, R3-2 staging, R3-3 sweep). The plan review starts at round 1 and has the usual three-round budget. |
| ## Global Constraints |
| @@ -455,11 +457,16 @@ type SeedsFloorReport struct { |
| // internal/host |
| // seedsFloorFields is withSeedsFields' (and withRootSeedsFields') logic as |
| // one value, so the edges file and the heartbeat are filled by the same code. |
| -func seedsFloorFields(dataDir, optDir string) status.SeedsFloorReport |
| +// It takes the inputs those writers depend on (plan R3-2): the expected box |
| +// identity (withRootSeedsFields compares the projection's identity with |
| +// f.Box, rootseedsfloor.go:151) and the moves-floor context, filled first |
| +// exactly as edgesfile.go:1394 does today (withSeedsFields picks the root |
| +// path from it, seedsfloor.go:58). Never derived from an empty edgesFile. |
| +func seedsFloorFields(dataDir, optDir, box string, moves movesFloorContext) status.SeedsFloorReport |
| ``` |
| The design asks for three fields. The region rule the fleet check mirrors reads seven (`seedfloor.go:79-89`), so the heartbeat carries all seven (Decision D3). |
| -- [ ] **Step 1: Failing tests:** `TestSeedsFloorFieldsSameForEdgesFileAndHeartbeat` (both writers, over the same temp dirs, agree field by field, root guard armed and not); `TestCollectBoxCarriesSeedsFloor` (with and without the block, and the presence check unchanged); `TestStatusLoopSetsSeedsFloor` (a source check, in the style of the named-units plan's `TestAdoptRunsNamedUnitsStepBeforeConfigSync`). |
| +- [ ] **Step 1: Failing tests:** `TestSeedsFloorFieldsSameForEdgesFileAndHeartbeat` (both writers, over the same temp dirs, agree field by field, root guard armed and not); `TestSeedsFloorFieldsBoxIdentity` (a projection naming this box is accepted, one naming another box is quarantined, as today); `TestSeedsFloorFieldsRootMovesGuardWithoutSeedsProjection` (the root moves guard present and the seeds projection absent: the root path is chosen and reads not-ready, never the legacy path); `TestCollectBoxCarriesSeedsFloor` (with and without the block, and the presence check unchanged); `TestStatusLoopSetsSeedsFloor` (a source check, in the style of the named-units plan's `TestAdoptRunsNamedUnitsStepBeforeConfigSync`). |
| - [ ] **Step 2:** `go test ./internal/host -run 'TestSeedsFloorFields|TestStatusLoopSetsSeedsFloor' -count=1` and `go test ./internal/status -run TestCollectBoxCarriesSeedsFloor -count=1`. Expect FAIL. |
| - [ ] **Step 3:** Implement. Run step 2 again and `go test ./internal/host -run 'TestSeedsFloor|TestEdgesFile' -count=1`: PASS. |
| - [ ] **Step 4:** Commit: `status: the heartbeat carries the seeds floor`. |
| @@ -607,6 +614,12 @@ Under `withRecordLock`, `fleetSeedRecord` runs again, and then: |
| // (apiinstances.go:2545 vs :2569), so a file seed's record is created |
| // unlabelled, and the fleet must have exactly one active box (FS-21; |
| // Decision D8). Zero active boxes is FS-22. |
| +// First, before any fleet check (plan R3-1): a claim-enabled console |
| +// (s.cfg.HostClaim) returns seedClaimConsoleRefusal(), as the region path |
| +// does inside seedRegionReadyForEdges (seedfloor.go:43). Such a console |
| +// cannot sweep (seedsweep.go:67) or finish (seedfinish.go:61) a seed, so it |
| +// must never admit one. Begin and PUT both reach this through |
| +// seedFleetReady, so they agree. |
| func (s *Server) seedFleetReady(ctx context.Context, fleet string) *doorRefusal |
| ``` |
| - **Begin.** A fleet-placed record (`registry.FleetPlacement(c.placed)`) skips the region and data-bucket checks and calls `seedFleetReady`. The rest is as Task 5. A pool is still FS-20. |
| @@ -626,6 +639,7 @@ func (s *Server) seedFleetReady(ctx context.Context, fleet string) *doorRefusal |
| - [ ] **Step 1: Failing tests:** |
| - `TestFileSeedBeginFleetWritesDeploymentKey`: begin and upload. The record is `ready`, and the snapshot is at `apps/<sqid>/<app>/seeds/<host>/<id>/snapshot.db` in the deployment bucket. Nothing is in the data bucket. A region app is unchanged (Task 5's test still passes). |
| + - `TestFileSeedFleetClaimConsoleRefuses` (plan R3-1): a claim-enabled console and an otherwise-ready, claims-disabled one-box fleet. Begin and PUT both refuse with the claim sentence, and no record or snapshot is written. |
| - `TestSeedFleetReadyNamesBoxes`: one box missing `seeds_floor`, then one at protocol 3. Each is refused with the box named. `TestSeedFleetReadyStaleHeartbeat` is a 503. `TestSeedFleetReadyRefusesTwoActiveBoxes`, `TestSeedFleetReadyRefusesClaimControl`, `TestSeedFleetReadyAdmitsFlat`. |
| - `TestFromOnFleetStillRefuses` (kept). |
| - `TestSeedsPassDeletesAbortedFleetFileSnapshotKeepsRecord` (R3-3), `TestSeedsPassDeletesAbortedFleetFileSnapshotInTrashedApp` (plan R1-4), `TestSeedsPassAbortsStuckFleetFileReservation`, `TestSeedsPassDeletesOrphanFleetSnapshotAfterAnHour`, `TestSeedsPassFleetHalfRunsWithoutSeedData`. |
diff --git a/docs/superpowers/plans/CODEX-FINDINGS-fleet-seeded-create-plan-R3.md b/docs/superpowers/plans/CODEX-FINDINGS-fleet-seeded-create-plan-R3.md| new file mode 100644 |
| index 000000000..07a0eaa82 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CODEX-FINDINGS-fleet-seeded-create-plan-R3.md |
| @@ -0,0 +1,30 @@ |
| +- **R2-1, P1 — resolved:** Task 10 now requires fenced cleanup and verification of both local locations, with a layout-change guard test. |
| +- **R2-2, P1 — resolved:** Task 16 replaces the unconditional upload prerequisite with `seedStorageRefusal`, shared with begin and tested without regional storage. |
| + |
| +Reviewed the requested revision; HEAD adds only the round-3 brief. No files changed, subagents spawned, or tests run. |
| + |
| +1. **P1 — Task 16: the fleet readiness path omits the console’s claim-control refusal.** |
| + |
| + **Evidence:** The planned [`seedFleetReady`](docs/superpowers/plans/2026-11-20-fleet-seeded-create.md:595) checks the fleet boxes’ `HostClaimEnabled`, but not `s.cfg.HostClaim`. Begin and upload switch to that helper. The existing console refusal lives inside [`seedRegionReadyForEdges`](internal/console/seedfloor.go:43), which this fleet path bypasses. The earlier [`seedCommonRefusal`](internal/console/apiinstanceseed.go:94) checks request shape only. Meanwhile, [`finishSeed`](internal/console/seedfinish.go:61) explicitly refuses a claim-enabled console, and [`StartSeedsPass`](internal/console/seedsweep.go:67) disables sweeping there. |
| + |
| + **Failure scenario:** A claim-enabled console serves a one-box fleet whose box has claim control disabled and satisfies the new floor. The planned checks admit a fleet file seed. An abandoned upload receives no deadline cleanup; even a box’s successful `rolledback` report cannot finish the record. This contradicts the plan’s explicit exclusion of claim-enabled consoles. |
| + |
| + **Fix:** Make `seedFleetReady` return `seedClaimConsoleRefusal()` immediately when `s.cfg.HostClaim` is true, shared by begin and PUT. Add handler tests with a claim-enabled console and an otherwise-ready, claims-disabled fleet box, asserting refusal before record or snapshot writes. |
| + |
| + **Fault family:** Admission consistency — accepted seeds must have a supported completion and abandonment path. |
| + |
| +2. **P2 — Task 11: the shared heartbeat helper omits inputs required by the existing floor checks.** |
| + |
| + **Evidence:** The proposed [`seedsFloorFields(dataDir, optDir)`](docs/superpowers/plans/2026-11-20-fleet-seeded-create.md:456) is described as extracting the existing writers’ logic. That logic also depends on the expected box identity: [`withRootSeedsFields`](internal/host/rootseedsfloor.go:151) compares the projection’s identity with `f.Box`. It depends on previously populated moves-floor state too: [`withSeedsFields`](internal/host/seedsfloor.go:58) uses that state to select the root path. Today [`edgesfile.go`](internal/host/edgesfile.go:1394) deliberately fills moves fields first. |
| + |
| + **Failure scenario:** A literal extraction using a fresh, empty `edgesFile` quarantines a valid root projection because its box identity differs from the empty name. Omitting the moves context can also select the legacy path when the existing writer would select the root path. Field equality between two newly refactored writers alone would not prove preservation of either check. |
| + |
| + **Fix:** Specify the expected box identity as an input and explicitly populate or supply the moves-floor context before deriving the seeds report. Extend the tests with matching and mismatched box identities, plus a root moves guard present while the seeds projection is absent. |
| + |
| + **Fault family:** Readiness evidence — heartbeat extraction must preserve identity binding and fail-closed root-floor selection. |
| + |
| +No additional P3 findings. The planned two-prefix listings, staging prohibition, rollback dispatch, and two-protocol rollout otherwise cover the traced paths. |
| + |
| +There is one P1 cause: the fleet readiness split drops a console-level admission gate. Refusing claim-enabled consoles up front removes it and matches the already-declared scope; cutting fleet file seeds is unnecessary. This is the third round, so another review round requires Paul’s go. |
| + |
| +**NOT READY** |
| \ No newline at end of file |