| index f5ed6c1a9..0837c6a0d 100644 |
| --- a/docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md |
| +++ b/docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md |
| @@ -1,252 +1,165 @@ |
| -# Managed fleets 1b: each instance runs on one named box Implementation Plan |
| +# Managed fleets 1b: each instance runs on one named box Implementation Plan (rev 2) |
| |
| > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| |
| -**Goal:** On a fleet with two or more boxes, each instance runs on exactly one box the console chose, traffic goes straight to it, a lost or detached box's instances move to the survivors, and no box ever boots a stale local copy (#470). |
| +**Goal:** On a fleet with two or more boxes, each instance runs on exactly one box the console chose, traffic goes straight to it, a lost or drained box's instances move to the survivors, and no box boots a stale local copy or loses unreplicated writes (#470). |
| |
| -**Architecture:** The console stamps the chosen box's label and an assignment time on the instance record. A fleet box mints only records labelled for it (or unlabelled ones, today's behaviour). The hub's forward row carries the label as `FleetBox` from the first write. A console worker labels existing records once a fleet is ready for it and relabels records off detached or silent boxes. A box notes the assignment time beside each local database and discards the copy when the record's assignment changed. |
| +**Architecture:** The console stamps the chosen box's label and an assignment time on the instance record, conditional on the record's placement and label at the time. A fleet box mints only records labelled for it (or unlabelled ones, as today). The hub's forward row carries the label as its authoritative box; the edge never falls back to another box for a labelled row. A console worker labels existing records to the box already serving them, moves records off silent boxes, and drives two-step drains. A box sets a stale local copy aside (never deletes it) and restores, or refuses to start when there is nothing to restore. |
| |
| -**Tech Stack:** Go. `internal/provision` (record, reconcile, forward phase), `internal/registry` (route columns), `internal/console` (create doors, worker, detach door, rootfs admission), `internal/activator` (restore), `internal/host` (wiring). |
| +**Tech Stack:** Go. `internal/provision`, `internal/registry`, `internal/edge`, `internal/console`, `internal/activator`, `internal/host`, `cmd/console`. |
| |
| -**Spec:** `docs/superpowers/specs/2026-10-28-managed-fleets-design.md` §4 Phase 1, "1b addendum", rules 1-10 (approved by Paul 2026-10-30; rule 6 is his option 1). Code map: main 65fd8060 (1a merged). 1a's spec: `docs/superpowers/specs/2026-10-29-fleet-public-routes-design.md`. |
| +**Spec:** `docs/superpowers/specs/2026-10-28-managed-fleets-design.md` §4 Phase 1, "1b addendum", rules 1-10 (approved by Paul 2026-10-30; rule 6 his option 1; rule 8 his "gate and alert"; rules 5 and 10 revised after plan review R1). Code: main 65fd8060 (1a merged). Review history: round 1 `docs/superpowers/plans/CODEX-FINDINGS-MANAGED-FLEETS-1B-PLAN-R1.md` (7 P1, 4 P2), dispositions at the end of this plan. |
| |
| ## Global Constraints |
| |
| -- Unlabelled records behave exactly as on main: every box of the fleet mints them. Single-box fleets never get labels. |
| -- The console labels a fleet's records only when the fleet has two or more active boxes and every active box's heartbeat reports a version at or above `release.FleetBoxLabelFloor` (`"v0.33.0"`; the release that ships this must be v0.33.0 or later). Below that, nothing is labelled and nothing changes. |
| -- A label is always written with its assignment time, together; a relabel is conditional on the label it replaces. |
| -- The lease stays the one-writer guarantee. Nothing here takes or releases a lease differently. |
| -- Lost-box threshold: no fresh heartbeat for `lease.LeaseTTL + 5*time.Minute` (20 minutes today). |
| -- No new per-box bucket polling (memory "S3 requests cost money"). The console worker runs every 5 minutes and reads only fleets with two or more active boxes. |
| -- Member-facing strings (the detach refusal) go through a Luna copy pass before merge; diagnostics and log lines do not. |
| -- Local tests: touched packages with `-run`; activator tests with `TMPDIR=/tmp/k`; Go builds in a worktree with `GOFLAGS=-buildvcs=false`; CI runs the full suite. Darwin and windows must cross-compile. |
| -- Neutral names in code, tests and copy (`shop`, `example.com`, fleet `pi`, boxes `pi-1`, `pi-2`). |
| +- Unlabelled records behave exactly as on main. Single-box fleets and fleets with sidecars are never labelled. |
| +- **Activation gate** (`release.FleetBoxLabelFloor = "v0.33.0"`; the release that ships this must be v0.33.0 or later): the console labels a fleet only when (a) the fleet has two or more active boxes, (b) the fleet has no sidecar records, (c) every box in the deployment, platform and fleet, reports a version at or above the floor in its heartbeat (the same complete box listing `carlos system status` reads; an incomplete listing counts as not met), and (d) the console's own version is at or above it. |
| +- **Alert:** once a fleet has labels, a box in it reporting a version below the floor pauses all relabelling for that fleet and raises an alert (an ERROR log line naming fleet, box and version, plus `LABELS PAUSED` in `carlos fleets ls`), until every box is back at or above the floor. |
| +- Every label write is a conditional update: the record's region, current label and `CreatedAt` must equal what the decision read, rechecked inside every retry of the update. |
| +- A stale local copy is set aside, never deleted. A box that set a copy aside and finds no replica refuses to start that instance. |
| +- The lease stays the one-writer guarantee. Lease take and release are unchanged. |
| +- Lost box: no fresh heartbeat for `lease.LeaseTTL + 5*time.Minute` (20 minutes). |
| +- **Request budget** (asserted by store-call counting tests in Tasks 2 and 6): an idle worker pass costs, per labelled fleet, one heartbeat LIST plus one GET per box, then one LIST per placed app; zero record GETs and zero PUTs when nothing is unlabelled, lost or draining. A create on a labelled fleet adds one heartbeat read (memoised per request) and one inventory per fleet (one LIST per placed app). First labelling of a fleet reads each record once and each binding object once, then one PUT per record. A move or drain reads one inventory per pass and writes one PUT per moved record; load counts update in memory after each write. |
| +- Member-facing strings (drain and detach refusals, the sidecar refusal, the paused state) get a Luna copy pass before merge; log lines do not. |
| +- Local tests: touched packages with `-run`; activator and host e2e tests with `TMPDIR=/tmp/k` (Unix socket path length, memory "Gate tmp exec wrapper"); Go builds in a worktree with `GOFLAGS=-buildvcs=false`; CI runs the full suite. Darwin and windows must cross-compile. |
| +- Neutral names (`shop`, `example.com`, fleet `pi`, boxes `pi-1`, `pi-2`). |
| |
| ## Review Focus |
| |
| -1. **Two creates at once on the same fleet** both counting the same load and picking the same box. Expect: they serialise on the fleet and land on different boxes when loads tie. Test in Task 2. |
| -2. **A box comes back after its records were relabelled away** (it was partitioned, not dead). Expect: it drops those rows and never serves them; the new box waits out the lease if the old one still renews. Test in Tasks 3 and 7. |
| -3. **A, then B, then A** for one instance. Expect: A restores on its second turn and serves B's writes. Test in Tasks 4 and 7. |
| -4. **A mixed-version fleet** (one box below the floor). Expect: no labels are written, every record keeps today's behaviour. Test in Task 2 and Task 6. |
| -5. **Detaching the only ready box** while it runs instances. Expect: refused, naming the apps; nothing relabelled. Test in Task 6. |
| +1. **A box partitioned from the console but still renewing its lease** while its records move. Expect: the destination waits out the lease; the source drops the rows when it next reads the record; no writes are lost (the source's copy is set aside on any later return). Task 7. |
| +2. **First labelling of a running fleet.** Expect: every record is labelled to the box already serving it; nothing moves; each box sets its copy aside once and restores the same data. Tasks 4, 6, 7. |
| +3. **A rollback of one box below the floor after labelling.** Expect: relabelling pauses with an alert; nothing else changes. Task 6. |
| +4. **Drain with one record that has nowhere to go.** Expect: the drain refuses up front, naming the app, and relabels nothing. Task 6. |
| +5. **A placement change racing a relabel.** Expect: the relabel loses (`ErrFleetBoxMoved`) and the record stays unlabelled in its new fleet. Tasks 1 and 6. |
| |
| --- |
| |
| ### Task 1: The record carries a box and an assignment time |
| |
| -**Files:** |
| -- Modify: `internal/provision/provision.go` (Record, `SetRecordRegion` at :1023) |
| -- Create: `internal/provision/fleetbox.go` |
| -- Test: `internal/provision/fleetbox_test.go`; census overlay beside `internal/provision/fleet_public_routes_census_test.go` |
| +**Files:** Modify `internal/provision/provision.go` (Record; `SetRecordRegion` :1023); create `internal/provision/fleetbox.go`; test `internal/provision/fleetbox_test.go`; census `internal/provision/plan9_b8_census_test.go` (name table :52-76, the inventory the test selects :369) and a new overlay layered on `fleetPublicRoutesWriteCensusInventory`. |
| |
| -**Interfaces:** |
| -- Produces: `Record.FleetBox string` (`json:"fleet_box,omitempty"`), `Record.FleetBoxAt string` (`json:"fleet_box_at,omitempty"`, RFC 3339 nanoseconds, UTC); `func SetRecordFleetBox(ctx context.Context, s release.Store, acct, app, host, wantLabel, label string, at time.Time) error` (writes both fields only if the record's current label equals `wantLabel`; `ErrFleetBoxMoved` otherwise); `var ErrFleetBoxMoved = errors.New(...)`. |
| +**Interfaces (produces):** |
| +- `Record.FleetBox string` (`json:"fleet_box,omitempty"`), `Record.FleetBoxAt string` (`json:"fleet_box_at,omitempty"`, RFC 3339 nanoseconds, UTC). |
| +- `type FleetBoxExpect struct { Region, Label string; CreatedAt time.Time }`. |
| +- `func SetRecordFleetBox(ctx context.Context, s release.Store, acct, app, host string, want FleetBoxExpect, label string, at time.Time) error` writes both fields when the current record's Region, FleetBox and CreatedAt equal `want`, rechecked inside each retry of the update; else `ErrFleetBoxMoved`. |
| +- `SetRecordRegion` clears both fields when the region changes. |
| |
| -- [ ] **Step 1: Write the failing tests** |
| +- [ ] **Step 1: Write the failing tests.** `TestRecordFleetBoxRoundTrip`; `TestSetRecordFleetBoxIsConditional` (label, then a stale `want` loses); `TestSetRecordFleetBoxLosesToAPlacementChange` (region changed between read and write: `ErrFleetBoxMoved`, record unlabelled); `TestSetRecordFleetBoxLosesToARecreate` (same host recreated with a new `CreatedAt`); `TestSetRecordRegionClearsTheBox`. |
| +- [ ] **Step 2: Run them to see them fail.** `go test ./internal/provision/ -run 'RecordFleetBox|SetRecordFleetBox|SetRecordRegionClears'` → FAIL. |
| +- [ ] **Step 3: Implement** through the record's update scaffold (the path `SetRecordRegion` uses, `provision.go:1093-1139`), the expectation checked inside the mutation. |
| +- [ ] **Step 4: Census.** Add `SetRecordFleetBox` to the typed-writer name table, extend the rejection witnesses, add the overlay and switch the test's selected inventory to it. `go test ./internal/provision/ -run 'RecordFleetBox|SetRecordFleetBox|SetRecordRegion|TestPlan9B8RecordWriteCensus'` → PASS. |
| +- [ ] **Step 5: Commit.** |
| |
| -`TestRecordFleetBoxRoundTrip`: a record with `FleetBox:"pi-2", FleetBoxAt:"2026-10-30T18:00:00Z"` survives `CreateRecord` then a read; a record without them marshals with neither key. |
| -`TestSetRecordFleetBoxIsConditional`: from label `""` to `pi-1` succeeds; a second call wanting `""` returns `ErrFleetBoxMoved` and leaves `pi-1`; wanting `pi-1` to `pi-2` succeeds and updates `FleetBoxAt`. |
| -`TestSetRecordRegionClearsTheBox`: `SetRecordRegion` to another region clears both fields; to the same region keeps them. |
| +### Task 2: The console labels at create, behind the activation gate (rules 1, 7, 8, 10) |
| |
| -- [ ] **Step 2: Run them to see them fail** |
| +**Files:** create `internal/console/fleetbox.go`; modify `internal/console/apiinstances.go` (before the record create, ~:2264), `internal/console/apisidecars.go` (the create door), `internal/console/rootfs.go:189-244`, `internal/release/layoutintent.go` (the floor), the store (`AppsPlacedOn`); tests `internal/console/fleetbox_test.go`, `rootfs_test.go`, `apisidecars_test.go`. |
| |
| -Run: `go test ./internal/provision/ -run 'TestRecordFleetBox|TestSetRecordFleetBox|TestSetRecordRegionClearsTheBox'` |
| -Expected: FAIL (unknown fields, undefined function). |
| +**Interfaces (produces):** |
| +- `const release.FleetBoxLabelFloor = "v0.33.0"`. |
| +- `type fleetView struct { Boxes []fleetBoxView; Active, HasSidecars, DeploymentCurrent bool; Load map[string]int }`; `type fleetBoxView struct { Label string; Fresh, Draining, RootfsReady, AtRootfsFloor, AtLabelFloor bool; LastSeen time.Time }`. |
| +- `func (s *Server) loadFleetView(ctx context.Context, fleet string) (fleetView, error)`: one heartbeat listing, one deployment-wide box listing for (c), one inventory (`AppsPlacedOn` plus `provision.ListRecordsCompleteJudged` per app) for `Load` and `HasSidecars`. An incomplete or truncated listing leaves `Active` false. |
| +- `func (v fleetView) labelActive() bool`: the Global Constraints gate. |
| +- `func (v fleetView) chooseDestination(rootfs bool, exclude string) string`: among boxes that are fresh, not draining, at the label floor (and rootfs-ready at the rootfs floor for a rootfs record), the lowest load, ties by label; "" when none. Independent of whether other boxes are fresh. |
| +- `func (s *Server) lockFleet(fleet string) (unlock func())`: one mutex per fleet, held from `loadFleetView` through the record create. |
| +- Store `AppsPlacedOn(ctx context.Context, placement string) ([]AppRef, error)`. |
| +- Copy: `msgSidecarNeedsSingleBoxFleet(fleet string) string`. |
| |
| -- [ ] **Step 3: Implement** |
| +- [ ] **Step 1: Write the failing tests.** `TestCreateOnASingleBoxFleetLeavesNoLabel`; `TestCreateLabelsTheLeastLoadedReadyBox`; `TestCreateSkipsStaleDrainingAndDetachedBoxes`; `TestGateNeedsEveryDeploymentBoxCurrent` (a platform box below the floor: no label); `TestGateClosedForAFleetWithSidecars`; `TestGateClosedOnAnIncompleteListing`; `TestConcurrentCreatesSpreadAcrossBoxes`; `TestSidecarCreateRefusedOnAMultiBoxFleet` (and allowed on a single-box fleet); `TestRootfsAdmissionFollowsTheChosenBox`; `TestCreateOnALabelledFleetCostsOneInventory` (store-call counter: one LIST per placed app, zero record PUTs beyond the create). Existing `rootfs_test.go` and `TestAPIInstanceCreateInheritsFleetPlacement` still pass. |
| +- [ ] **Step 2: Run them to see them fail.** `go test ./internal/console/ -run 'FleetBox|LeastLoaded|SkipsStale|Gate|ConcurrentCreatesSpread|SidecarCreateRefused|RootfsAdmissionFollows|CostsOneInventory'` → FAIL. |
| +- [ ] **Step 3: Implement.** Freshness and readiness reuse `status.BoxStale`, `boxRootfsReady`, `boxAtRootfsFloor` and the join at `rootfs.go:212-238`. The create door stamps the label only when `labelActive()`; a rootfs create on an active fleet with no rootfs-ready destination is refused with today's rootfs refusal. |
| +- [ ] **Step 4: Run them to see them pass,** plus `-run 'Rootfs|FleetPlacement|Sidecar'` → PASS. |
| +- [ ] **Step 5: Commit.** |
| |
| -Fields beside `Runtime` with a comment naming 1b rules 1 and 6. `SetRecordFleetBox` goes through the record's existing update path (the one `SetRecordRegion` uses), so `RecordSeq` advances. Every record writer decodes and re-marshals the whole record, so the fields survive writers built with this change; older console or platform-box binaries would drop them, which is why Task 2's floor gates labelling on every box being current. |
| +### Task 3: A fleet box mints only its own records (rules 2, 9) |
| |
| -- [ ] **Step 4: Run them to see them pass, then the record-write census** |
| +**Files:** modify `internal/provision/reconcile.go` (`ReconcileConfig`; `inScope` callers :1253, :2182, :2263), `internal/provision/seedreconcile.go:177`, `internal/registry` (Route `Assigned`, column `fleet_assigned`, migration), `internal/host/agent.go:3504` (`provisionTickConfig`); tests in `internal/provision/reconcile_test.go`, `reconcile_lifetime_test.go`, `internal/registry`, `internal/host/host_test.go`. |
| |
| -Run: `go test ./internal/provision/ -run 'TestRecordFleetBox|TestSetRecordFleetBox|TestSetRecordRegion|TestPlan9B8RecordWriteCensus'` |
| -Expected: the three new tests PASS; the census FAILs naming `SetRecordFleetBox` and `SetRecordRegion`. Add an overlay inventory layered on `fleetPublicRoutesWriteCensusInventory` re-pinning them, then PASS. |
| +**Interfaces (produces):** `ReconcileConfig.FleetBox string` (from `resolveFleetIdentity`); `func (cfg ReconcileConfig) ownsRecord(rec Record) bool` (true off a fleet, for an unlabelled record, or when the label is `cfg.FleetBox`); `registry.Route.Assigned string`, minted from `rec.FleetBoxAt` on the box's own row and rewritten when it changes. |
| |
| -- [ ] **Step 5: Commit** |
| +- [ ] **Step 1: Write the failing tests.** `TestFleetBoxMintsOnlyItsOwnRecords`; `TestRelabelledRowIsRemovedNotKept` (lifetimes on and off; copy `TestOutOfScopeValidRecordFollowsTodaysRemoval`); `TestRelabelledSeedIsNotAdopted`; `TestMintedRowCarriesTheAssignment`; `TestProvisionTickConfigCarriesTheFleetBox`. |
| +- [ ] **Step 2: Run them to see them fail.** `go test ./internal/provision/ ./internal/registry/ ./internal/host/ -run 'FleetBoxMints|RelabelledRow|RelabelledSeed|MintedRowCarries|ProvisionTickConfigCarries'` → FAIL. |
| +- [ ] **Step 3: Implement.** `ownsRecord` is checked at every place `inScope` admits a record or keeps a row on a fleet box. A removed row retires its instance through `RetireExcept`; workers are stopped by `StopRetired`'s worker path (`activator.go:5642-5657`): add `TestRetiredRowStopsItsWorkers` if no existing test covers a rootfs entry with workers. |
| +- [ ] **Step 4: Run them to see them pass,** plus `-run 'Reconcile|Seed|Retire'` → PASS. |
| +- [ ] **Step 5: Commit.** |
| |
| -### Task 2: The console picks the box at create (rules 1, 7, 8, 10) |
| +### Task 4: Set a stale copy aside, restore, or refuse (rule 6, #470) |
| |
| -**Files:** |
| -- Create: `internal/console/fleetbox.go` |
| -- Modify: `internal/console/apiinstances.go` (before the record is created, ~:2264), the sidecar create door (`apisidecars.go`), `internal/console/rootfs.go:189-244`, `internal/release/layoutintent.go` (the floor), the store (an apps-on-fleet query) |
| -- Test: `internal/console/fleetbox_test.go`, `internal/console/rootfs_test.go` |
| +**Files:** modify `internal/activator/backend_exec.go` (`restorePlain`, beside `reconcileSeedMarker` at :879); test `internal/activator/activator_test.go` beside `TestExecBackendRestoreWarmCacheIsNotFresh` (:5774). |
| |
| -**Interfaces:** |
| -- Consumes: Task 1's fields. |
| -- Produces: `const release.FleetBoxLabelFloor = "v0.33.0"`; `func (s *Server) fleetLabelReady(ctx context.Context, fleet string) (boxes []fleetBoxView, ready bool, err error)` (two or more active boxes, every one fresh and at or above the floor); `type fleetBoxView struct { Label string; Fresh, RootfsReady, AtRootfsFloor bool }`; `func (s *Server) chooseFleetBox(ctx context.Context, fleet string, rootfs bool, exclude string) (label string, err error)` ("" = leave unlabelled); `func (s *Server) fleetBoxLoad(ctx context.Context, fleet string) (map[string]int, error)` (labelled records per box); `func (s *Server) lockFleet(fleet string) func()` (per-fleet mutex, held from the choice through the record create); store `AppsPlacedOn(ctx context.Context, placement string) ([]AppRef, error)`. |
| +**Interfaces (produces):** `func (b *ExecBackend) reconcileAssignment(rt registry.Route, dbPath string) (setAside string, err error)`; marker `dbPath + ".assigned"` holding `rt.Assigned`, written atomically (temp file and rename); set-aside directory `<data dir>/.superseded/<host>/<unix nanos>/` holding the database and its litestream sidecar state (the files `reconcileSeedMarker` would remove); `var ErrNothingToRestore` whose message names the set-aside path. |
| |
| -- [ ] **Step 1: Write the failing tests** |
| +- [ ] **Step 1: Write the failing tests.** `TestAssignmentChangeSetsTheCopyAside` (marker `T1`, route `T2`: the files move to `.superseded`, nothing is deleted, the restore runs, the marker reads `T2`); `TestSameAssignmentKeepsTheWarmCopy`; `TestUnassignedRouteIgnoresTheMarker`; `TestMissingMarkerSetsAside`; `TestNothingToRestoreRefuses` (a copy set aside and no replica: the wake fails with `ErrNothingToRestore`, no fresh boot); `TestNewInstanceBootsFresh` (assigned route, no local copy, nothing set aside, no replica: fresh boot, marker written); `TestFailedRestoreLeavesNoMarker` (the next wake tries again; the set-aside copy is still there); `TestUnreplicatedTailSurvives` (bytes written after the last replication are present in the set-aside copy). |
| +- [ ] **Step 2: Run them to see them fail.** `TMPDIR=/tmp/k go test ./internal/activator/ -run 'AssignmentChange|SameAssignment|UnassignedRoute|MissingMarker|NothingToRestore|NewInstanceBootsFresh|FailedRestoreLeaves|UnreplicatedTail'` → FAIL. |
| +- [ ] **Step 3: Implement.** Called before the warm-cache check. HA routes keep `restoreHA`, unchanged. The marker is written only after a successful restore, a kept matching copy, or a fresh boot of a new instance. |
| +- [ ] **Step 4: Run them to see them pass,** plus `-run 'Assignment|Marker|WarmCache|Seed|Restore'` → PASS. |
| +- [ ] **Step 5: Commit.** |
| |
| -`TestCreateOnASingleBoxFleetLeavesNoLabel`, `TestCreateLabelsTheLeastLoadedReadyBox` (boxes `pi-1` with two labelled records, `pi-2` with none: the new record names `pi-2` with a non-zero `FleetBoxAt`; ties go to the lower label), `TestCreateSkipsStaleAndDetachedBoxes`, `TestMixedVersionFleetLeavesNoLabel` (one box below the floor: no label), `TestConcurrentCreatesSpreadAcrossBoxes` (two creates in parallel on a fleet of two empty boxes end on different boxes), `TestSidecarCreateLabelsToo`. Rootfs: `TestRootfsAdmissionFollowsTheChosenBox` (labelled: admitted when the chosen box is rootfs-ready even if another box is not; refused when the chosen box is not), and the existing `rootfs_test.go` cases still pass for an unlabelled fleet. Copy `TestAPIInstanceCreateInheritsFleetPlacement`'s setup. |
| +### Task 5: The forward row's box is authoritative when labelled (rule 3) |
| |
| -- [ ] **Step 2: Run them to see them fail** |
| +**Files:** modify `internal/provision/forward.go` (`forwardRowFor` :25, `forwardCurrent` :43), `internal/registry/forward.go` (`putForwardSQL` :260-285, `PutForward` :297, `SetFleetBoxIf` :29, `forwardShape` :93), `internal/edge/edge.go` (`fleetChannelFor` :3223, `fleetProxy`); tests in `internal/provision/forward_test.go`, `internal/registry/forward_test.go`, `fleetbox_if_test.go`, `internal/edge/fleet_route_test.go`. |
| |
| -Run: `go test ./internal/console/ -run 'FleetBox|LeastLoaded|MixedVersion|ConcurrentCreatesSpread|SidecarCreateLabels|RootfsAdmissionFollows'` |
| -Expected: FAIL (undefined). |
| +**Interfaces (produces):** `registry.Route.FleetLabel string` (column `fleet_label`, forward rows only); `PutForward` writes `fleet_label`, and `fleet_box = fleet_label` when the label is set; `SetFleetBoxIf` changes nothing on a row with a label; `func fleetChannelFor(fleet, boxLabel string, authoritative bool, hub *TunnelHub) string` (no fallback when `authoritative`). |
| |
| -- [ ] **Step 3: Implement** |
| +- [ ] **Step 1: Write the failing tests.** `TestForwardRowCarriesTheLabel`; `TestQuietPassWritesNothingForABoundUnlabelledRow` (write counter over three passes: zero writes after the first); `TestPutForwardWritesTheLabelAsFleetBox`; `TestBindingDoesNotOverrideALabel`; `TestBindingStillBindsUnlabelledRows`; `TestLabelledForwardDoesNotFallBack` (row labelled `pi-2`, only `pi-1` connected: 503 with `Retry-After`); `TestUnlabelledForwardStillFallsBack`. Update `TestForwardShapeClassesEveryField`. |
| +- [ ] **Step 2: Run them to see them fail.** `go test ./internal/provision/ ./internal/registry/ ./internal/edge/ -run 'ForwardRowCarries|QuietPass|PutForwardWritesTheLabel|BindingDoesNotOverride|BindingStillBinds|LabelledForward|UnlabelledForward|ForwardShape'` → FAIL. |
| +- [ ] **Step 3: Implement.** `forwardCurrent` compares `FleetLabel`, and compares `FleetBox` only when the wanted row has a label. |
| +- [ ] **Step 4: Run them to see them pass,** plus `-run 'Forward|FleetRoute|FleetBox'` → PASS. |
| +- [ ] **Step 5: Commit.** |
| |
| -Freshness and readiness reuse `status.BoxStale`, `boxRootfsReady` and `boxAtRootfsFloor` and the active-box join at `rootfs.go:212-238`. Load counts labelled records per box over `AppsPlacedOn` plus `provision.ListRecordsCompleteJudged`. A rootfs create chooses among rootfs-ready boxes at the rootfs floor. The admission check in `rootfsReadyRefusal` uses the chosen box when a label was chosen and keeps today's fleet-wide rule otherwise. |
| +### Task 6: The relabel worker, two-step drain, pause and alert (rules 2, 4, 5, 8) |
| |
| -- [ ] **Step 4: Run them to see them pass** |
| +**Files:** create `internal/console/fleetrelabel.go`; modify `internal/console/claim_workers.go`, `cmd/console/main.go`, `internal/console/testdata/claim-routes.txt`, `internal/console/fleets.go` (new drain door; detach doors :544, :1455), `internal/registry/fleets.go` (`draining` column on `fleet_boxes`; `FleetChannelAuth` still admits a draining active box), `fleets.go` at the repo root (the CLI: `carlos fleets drain`, `LABELS PAUSED` in `fleets ls`); tests `internal/console/fleetrelabel_test.go`, `cmd/console/claimworkers_started_test.go`, `internal/registry` fleet tests, `cli_test.go` patterns for the CLI. |
| |
| -Run: the Step 2 command plus `-run 'Rootfs|FleetPlacement'`. Expected: PASS. |
| +**Interfaces (produces):** worker `FleetRelabel` every 5 minutes, started like `StartRunSweep`; `func (s *Server) fleetRelabelPass(ctx context.Context) error`; `func (s *Server) relabelFleet(ctx context.Context, fleet string, v fleetView) (moved int, err error)`; `func (s *Server) drainBox(ctx context.Context, fleet, label string) (stuck []string, err error)`; `func (s *Server) boxEmpty(ctx context.Context, fleet, label string) (bool, error)` (its heartbeat reports no instance of the fleet and no record names it); `const fleetBoxLostAfter = lease.LeaseTTL + 5*time.Minute`; copy `msgDrainStrandsApps(fleet, label string, apps []string) string`, `msgDetachNotDrained(fleet, label string) string`. |
| |
| -- [ ] **Step 5: Commit** |
| +Per fleet, per pass: if a labelled fleet has a box below the floor, log the alert and skip it (paused). Else if `labelActive()`: label each unlabelled record to the box its binding names (`fleets/<f>/bindings/<host>.json`) when that box is a valid destination, otherwise `chooseDestination`; move each record whose box is lost to `chooseDestination(rootfs, lost)`; move each record of a draining box likewise. All writes use `SetRecordFleetBox` with the expectation read in this pass; `ErrFleetBoxMoved` is skipped until the next pass. Truncated or skipped records make the pass write nothing for that fleet. |
| |
| -### Task 3: A fleet box mints only its own records (rules 2, 9, 10) |
| - |
| -**Files:** |
| -- Modify: `internal/provision/reconcile.go` (`ReconcileConfig`, :1253, :2182, :2263), `internal/provision/seedreconcile.go:177`, `internal/provision/sidecar_reconcile.go`, `internal/registry` (Route `Assigned` column), `internal/host/agent.go:3504` (`provisionTickConfig`) |
| -- Test: `internal/provision/reconcile_test.go`, `reconcile_lifetime_test.go`, `internal/host/host_test.go` |
| - |
| -**Interfaces:** |
| -- Consumes: Task 1's fields. |
| -- Produces: `ReconcileConfig.FleetBox string` (this box's label, from `resolveFleetIdentity`); `func (cfg ReconcileConfig) ownsRecord(rec Record) bool` (true when the box is not on a fleet, the record has no label, or the label equals `cfg.FleetBox`); `registry.Route.Assigned string` (column `fleet_assigned`, migration), minted from `rec.FleetBoxAt` on the box's own row. |
| - |
| -- [ ] **Step 1: Write the failing tests** |
| - |
| -`TestFleetBoxMintsOnlyItsOwnRecords` (two records labelled `pi-1` and `pi-2` and one unlabelled: box `pi-1` mints the first and third), `TestRelabelledRowIsRemovedNotKept` (a minted row whose record now names `pi-2` is removed by the removal phase on `pi-1`, lifetimes on and off, copying `TestOutOfScopeValidRecordFollowsTodaysRemoval`), `TestSidecarFollowsItsLabel`, `TestMintedRowCarriesTheAssignment` (`Route.Assigned` equals the record's `FleetBoxAt`, and a changed `FleetBoxAt` rewrites the row), `TestProvisionTickConfigCarriesTheFleetBox` (beside `TestProvisionTickConfig`). |
| - |
| -- [ ] **Step 2: Run them to see them fail** |
| - |
| -Run: `go test ./internal/provision/ ./internal/host/ -run 'FleetBoxMints|RelabelledRow|SidecarFollows|MintedRowCarries|ProvisionTickConfigCarries'` |
| -Expected: FAIL. |
| - |
| -- [ ] **Step 3: Implement** |
| - |
| -`ownsRecord` sits beside `inScope` and is checked wherever `inScope` admits a record or keeps a row on a fleet box (the scan, the row filter, the removal phase, seeds, sidecars). A row removed this way stops its instance through the existing `RetireExcept` path. |
| - |
| -- [ ] **Step 4: Run them to see them pass** |
| - |
| -Run: `go test ./internal/provision/ -run 'Reconcile|FleetBox|Sidecar|Seed'` and the host test. Expected: PASS. |
| - |
| -- [ ] **Step 5: Commit** |
| - |
| -### Task 4: No stale local copy (rule 6, #470) |
| - |
| -**Files:** |
| -- Modify: `internal/activator/backend_exec.go` (`restorePlain`, beside `reconcileSeedMarker` at :879) |
| -- Test: `internal/activator/activator_test.go` beside `TestExecBackendRestoreWarmCacheIsNotFresh` (:5774) |
| - |
| -**Interfaces:** |
| -- Consumes: `registry.Route.Assigned` (Task 3). |
| -- Produces: `func reconcileAssignmentMarker(rt registry.Route, dbPath string) error`; marker file `dbPath + ".assigned"` holding `rt.Assigned`. |
| - |
| -- [ ] **Step 1: Write the failing tests** |
| - |
| -`TestAssignmentChangePurgesTheWarmCopy` (a local db with marker `T1`, route `Assigned` `T2`: the db and its litestream sidecar state are removed before the warm-cache check, so `restorePlain` restores; the marker then reads `T2`), `TestSameAssignmentKeepsTheWarmCopy` (marker equals `Assigned`: warm cache kept, no restore), `TestUnassignedRouteIgnoresTheMarker` (`Assigned` empty: today's behaviour, marker untouched), `TestMissingMarkerWithAssignmentPurges` (a db with no marker under an assigned route counts as stale). |
| - |
| -- [ ] **Step 2: Run them to see them fail** |
| - |
| -Run: `TMPDIR=/tmp/k go test ./internal/activator/ -run 'AssignmentChange|SameAssignment|UnassignedRoute|MissingMarker'` |
| -Expected: FAIL. |
| - |
| -- [ ] **Step 3: Implement** |
| - |
| -Mirror `reconcileSeedMarker`'s purge (the same files it removes). Write the marker only after a successful restore or when keeping a matching copy, so a failed restore leaves no marker and the next wake purges again. HA routes keep their own rules (`restoreHA`), unchanged. |
| - |
| -- [ ] **Step 4: Run them to see them pass** |
| - |
| -Run: `TMPDIR=/tmp/k go test ./internal/activator/ -run 'Assignment|Marker|WarmCache|Seed'`. Expected: PASS. |
| - |
| -- [ ] **Step 5: Commit** |
| - |
| -### Task 5: The forward row knows the box from the start (rule 3) |
| - |
| -**Files:** |
| -- Modify: `internal/provision/forward.go` (`forwardRowFor` :25, `forwardCurrent` :43), `internal/registry/forward.go` (`putForwardSQL` :260-285, `PutForward` :297, `SetFleetBoxIf` :29), the forward shape table (`forwardShape`, :93) |
| -- Test: `internal/registry/forward_test.go`, `internal/registry/fleetbox_if_test.go`, `internal/provision/forward_test.go` |
| - |
| -**Interfaces:** |
| -- Produces: forward rows carry `FleetBox = rec.FleetBox`; registry column `fleet_label` (the record's label) on forward rows; `PutForward` writes `fleet_box` from a non-empty label; `SetFleetBoxIf` changes nothing on a row whose `fleet_label` is set. |
| - |
| -- [ ] **Step 1: Write the failing tests** |
| - |
| -`TestForwardRowCarriesTheLabel` (provision: a labelled record mints `FleetBox:"pi-2"`; a relabel to `pi-1` rewrites it; an unlabelled record leaves `FleetBox` to the bindings as today), `TestPutForwardWritesTheLabelAsFleetBox`, `TestBindingDoesNotOverrideALabel` (registry: `SetFleetBoxIf` on a labelled row returns false and leaves `fleet_box`), `TestBindingStillBindsUnlabelledRows` (today's behaviour). Update `TestForwardShapeClassesEveryField` for the new column. |
| - |
| -- [ ] **Step 2: Run them to see them fail** |
| - |
| -Run: `go test ./internal/provision/ ./internal/registry/ -run 'ForwardRowCarries|PutForwardWritesTheLabel|BindingDoesNotOverride|BindingStillBinds|ForwardShape'` |
| -Expected: FAIL. |
| - |
| -- [ ] **Step 3: Implement** |
| - |
| -`forwardCurrent` compares `FleetBox` so a relabel rewrites the row and a quiet pass writes nothing. `fleetChannelFor`'s fallback (`internal/edge/edge.go:3223`) stays: it still serves unlabelled rows and a labelled box that is briefly disconnected answers 503 rather than reaching a box that does not hold the host. Add a test for that in `internal/edge` (`TestLabelledForwardDoesNotFallBack`): a labelled row whose box is disconnected answers 503 with `Retry-After`. |
| - |
| -- [ ] **Step 4: Run them to see them pass** |
| - |
| -Run: the Step 2 command plus `go test ./internal/edge/ -run 'LabelledForward|FleetRoute'`. Expected: PASS. |
| - |
| -- [ ] **Step 5: Commit** |
| - |
| -### Task 6: Label existing records, move a lost box's records, drain on detach (rules 2, 4, 5) |
| - |
| -**Files:** |
| -- Create: `internal/console/fleetrelabel.go` |
| -- Modify: `internal/console/claim_workers.go`, `cmd/console/main.go`, `internal/console/testdata/claim-routes.txt`, `internal/console/fleets.go` (`handleAPIFleetDetachBox` :544, `handleFleetDetachBoxPage` :1455) |
| -- Test: `internal/console/fleetrelabel_test.go`, `cmd/console/claimworkers_started_test.go` |
| - |
| -**Interfaces:** |
| -- Consumes: Tasks 1-2. |
| -- Produces: `func (s *Server) fleetRelabelPass(ctx context.Context) error`; worker name `FleetRelabel`, every 5 minutes, started like `StartRunSweep`; `func (s *Server) relabelOff(ctx context.Context, fleet, label string) (moved int, stuck []string, err error)`; `const fleetBoxLostAfter = lease.LeaseTTL + 5*time.Minute`; refusal copy `msgDetachStrandsApps(fleet, label string, apps []string) string`. |
| - |
| -- [ ] **Step 1: Write the failing tests** |
| - |
| -`TestRelabelPassLabelsAReadyFleet` (two current boxes, three unlabelled records: all labelled, spread 2-1), `TestRelabelPassLeavesAMixedFleetAlone`, `TestRelabelPassMovesALostBoxsRecords` (box `pi-1` silent for 21 minutes: its records go to `pi-2` with a newer `FleetBoxAt`; silent for 19: nothing moves), `TestRelabelLosesToAConcurrentRelabel` (`ErrFleetBoxMoved` is skipped, not retried in the same pass), `TestDetachRelabelsFirst` (detach `pi-1`: its records move to `pi-2`, then the box is detached), `TestDetachRefusesWhenNothingCanTakeThem` (only box ready: 409 with `msgDetachStrandsApps`, nothing relabelled, box still active), `TestEveryRegisteredClaimWorkerIsStarted` passes with `FleetRelabel`. |
| - |
| -- [ ] **Step 2: Run them to see them fail** |
| - |
| -Run: `go test ./internal/console/ ./cmd/console/ -run 'RelabelPass|RelabelLoses|DetachRelabels|DetachRefuses|ClaimWorker'` |
| -Expected: FAIL. |
| - |
| -- [ ] **Step 3: Implement** |
| - |
| -Each pass reads only fleets with two or more active boxes, under `lockFleet`. Relabelling uses `chooseFleetBox(..., exclude)` and `SetRecordFleetBox` wanting the old label. Log one line per moved record (host, from, to, reason). The detach doors call `relabelOff` before `SetFleetBoxStatus`. Run the refusal string through Luna with the plan's other copy before merge. |
| - |
| -- [ ] **Step 4: Run them to see them pass** |
| - |
| -Run: the Step 2 command. Expected: PASS. |
| - |
| -- [ ] **Step 5: Commit** |
| +- [ ] **Step 1: Write the failing tests.** `TestFirstLabellingFollowsBindings` (three running records, bindings on `pi-1`, `pi-1`, `pi-2`: labelled the same; nothing moves); `TestRelabelPassLeavesAnUngatedFleetAlone`; `TestLostBoxMovesToTheSurvivor` (two-box fleet, `pi-1` silent 21 minutes: all its records to `pi-2`; 19 minutes: nothing); `TestRelabelLosesToAPlacementChange`; `TestBelowFloorBoxPausesAndAlerts`; `TestDrainMovesEverythingOrNothing` (one record with no destination: refused naming the app, nothing written); `TestDrainingBoxKeepsFleetAccess` (`FleetChannelAuth` still lists it); `TestDetachRefusedUntilDrainedAndEmpty`; `TestIdlePassCostsTheBudget` (store-call counter for an idle labelled fleet: per the Global Constraints); `TestEveryRegisteredClaimWorkerIsStarted` with `FleetRelabel`; CLI tests for `carlos fleets drain` and the `LABELS PAUSED` column. |
| +- [ ] **Step 2: Run them to see them fail.** `go test ./internal/console/ ./internal/registry/ ./cmd/console/ . -run 'FirstLabelling|RelabelPass|LostBox|RelabelLoses|BelowFloor|Drain|Detach|IdlePass|ClaimWorker|FleetsDrain|LabelsPaused'` → FAIL. |
| +- [ ] **Step 3: Implement.** Log one line per moved record (host, from, to, reason). |
| +- [ ] **Step 4: Run them to see them pass.** Same command → PASS. |
| +- [ ] **Step 5: Commit.** |
| |
| ### Task 7: A real two-box fleet test |
| |
| -**Files:** |
| -- Create: `internal/host/fleettwobox_e2e_test.go` |
| -- Test helpers: build on `newE2EWorld` (`internal/host/movesoffline_e2e_test.go:215`: `leasetest.NewS3Server`, `CARLOS_S3_ENDPOINT`, real `ExecBackend` lease take and restore) |
| - |
| -**Interfaces:** |
| -- Consumes: everything above. |
| +**Files:** create `internal/host/fleettwobox_e2e_test.go` with its own fixture (borrowing from `newE2EWorld`, `internal/host/movesoffline_e2e_test.go:215`), plus the smallest production seams it needs. |
| |
| -- [ ] **Step 1: Write the test** |
| +**Fixture requirements:** one fake S3 (`leasetest.NewS3Server`) holding one shared fleet data bucket; two real `ExecBackend`s with their own data directories and their own lease identities (`pi-1`, `pi-2`). The lease's owner is process-global today (`internal/lease/self.go`), so add an injectable identity used when set, defaulting to `lease.CurrentSelf()` in production, and a test that production wiring still uses the default. A short lease TTL set by the fixture (seconds, not 15 minutes) for deterministic expiry. The console's `fleetRelabelPass` called directly with an injected clock. A "partitioned" box: its lease keeps renewing while its record reads fail. |
| |
| -`TestTwoBoxFleetEndToEnd_Real` with two box agents `pi-1`, `pi-2` on one fake S3, the console in process, a tiny native app writing a counter to its database: |
| -1. Two instances created: one lands on each box (labels, rows, forward rows). |
| -2. Each box mints only its own; each instance's lock owner names its box. |
| -3. Instance `a` on `pi-1`: write `1`. Stop `pi-1`'s agent and advance the console clock 21 minutes: the relabel pass moves `a` to `pi-2`; after the lease lapses `pi-2` restores and reads `1`; write `2`. |
| -4. Bring `pi-1` back: it drops `a`'s row and does not serve it. |
| -5. Relabel `a` back to `pi-1` (detach `pi-2`): `pi-1` purges its stale copy, restores and reads `2`, not `1`. |
| +- [ ] **Step 1: Write the test** `TestTwoBoxFleetEndToEnd_Real`: (1) two instances land one per box, with forward rows naming them; (2) each box mints only its own and each lock names its box; (3) `a` on `pi-1` writes `1`; `pi-1` is partitioned: the relabel moves `a` to `pi-2`, which waits while `pi-1` renews; heal the partition: `pi-1` reads the relabel, drops the row, releases; `pi-2` restores, reads `1`, writes `2`; (4) drain `pi-2`: `a` moves to `pi-1`, which sets its old copy aside, restores and reads `2`; (5) a first-labelling run over a fleet started unlabelled moves nothing and loses nothing. |
| +- [ ] **Step 2: Run it.** `TMPDIR=/tmp/k go test ./internal/host/ -run TestTwoBoxFleetEndToEnd_Real -v` → PASS. A failure is fixed in the code, not the test. |
| +- [ ] **Step 3: Commit.** |
| |
| -- [ ] **Step 2: Run it** |
| +### Task 8: Census, copy, review, merge |
| |
| -Run: `TMPDIR=/tmp/k go test ./internal/host/ -run TestTwoBoxFleetEndToEnd_Real -v` |
| -Expected: PASS. If it fails, fix the code, not the test (systematic debugging). |
| - |
| -- [ ] **Step 3: Commit** |
| - |
| -### Task 8: Census, review, merge |
| - |
| -- [ ] **Step 1:** `go test ./internal/provision/ -run TestPlan14RootReadCensus`; on failure follow AGENTS.md "The census" (`make census-card`, CLAIMS, `make census-propose NAME=<branch>`). The reviewer decides; record it on #280. |
| -- [ ] **Step 2:** Luna copy pass on `msgDetachStrandsApps` and any CLI help text; apply verbatim. |
| -- [ ] **Step 3:** Whole-branch Astra review from `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`, round 1 of 3, with this plan's Review Focus. Tasks 3, 4 and 6 touch production storage and the removal path, so the brief names them. |
| +- [ ] **Step 1:** `go test ./internal/provision/ -run TestPlan14RootReadCensus`; on failure, AGENTS.md "The census" (`make census-card`, CLAIMS, `make census-propose NAME=<branch>`); include the two new route columns and the `fleet_boxes.draining` column. The reviewer decides; record on #280. |
| +- [ ] **Step 2:** Luna copy pass on the drain, detach and sidecar refusals, the `LABELS PAUSED` state and the drain help text; apply verbatim. |
| +- [ ] **Step 3:** Whole-branch Astra review from `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`, round 1 of 3, with this plan's Review Focus; name Tasks 3, 4 and 6 as production storage and removal. |
| - [ ] **Step 4:** CI green on the tip; merge with `amadan branch merge carlos/platform <branch> -squash` on Paul's go. |
| |
| ### Task 9: Prove it on dev |
| |
| -Live action, needs Paul's go with the scoped plan: account dev (kass), eu-west-1, one extra t4g.small fleet box `box-2` added to r10r with `carlos fleets add-box` and bootstrapped like box-1, for about two hours, then detached and terminated. Cost: about $0.05. |
| +Live action, needs Paul's go with the scoped plan: account dev (kass), eu-west-1, one extra t4g.small fleet box `box-2` added to r10r and bootstrapped like box-1, for about two hours, then drained, detached and terminated. Cost about $0.05. |
| + |
| +- [ ] **Step 1:** After v0.33.0 or later is on every dev box and the dev console, add `box-2`; within one pass, `shop` and `railsdemo` are labelled to `box-1` (their binding) and nothing moves. |
| +- [ ] **Step 2:** Create a throwaway app on r10r: it lands on `box-2`; its public URL serves from it. |
| +- [ ] **Step 3:** `carlos fleets drain r10r box-2`: the app moves to `box-1` and serves; detach then succeeds; terminate `box-2`. |
| +- [ ] **Step 4:** Post results on #457; close #470. |
| + |
| +--- |
| |
| -- [ ] **Step 1:** After the release carrying this (v0.33.0 or later) is on dev, add `box-2`; wait for both boxes current; within one relabel pass, `shop` and `railsdemo` carry labels, spread one per box. |
| -- [ ] **Step 2:** Create a throwaway app on r10r: it lands on the less loaded box; its public URL serves from that box (edge log on the hub names the box). |
| -- [ ] **Step 3:** Detach `box-2`: its instances move to `box-1` and serve within the lease window; then terminate `box-2`. |
| -- [ ] **Step 4:** Post results on #457 and close #470. |
| +## Round 1 dispositions (`CODEX-FINDINGS-MANAGED-FLEETS-1B-PLAN-R1.md`) |
| + |
| +| # | Sev | Finding | Disposition | |
| +|---|---|---|---| |
| +| 1 | P1 | Purge can destroy the only surviving writes | Accepted. Task 4 sets aside, never deletes; refuses on no replica; fresh boot only for a new instance; marker written atomically after success; tests for tail, absent replica, failed restore. First labelling follows bindings (Task 6) so it moves nothing. | |
| +| 2 | P1 | Floor misses hub, writers and later boxes | Accepted with Paul's ruling "gate and alert" (spec rule 8): the gate covers every deployment box and the console; a below-floor box in a labelled fleet pauses relabelling and alerts. Fail-closed region encoding was offered and declined. | |
| +| 3 | P1 | Detach revokes before drain | Accepted: two-step drain (spec rule 5); draining boxes keep fleet access; detach refused until drained and empty (Task 6). | |
| +| 4 | P1 | Freshness gate blocks lost-box failover | Accepted: activation (`labelActive`) separated from destination choice (`chooseDestination`), which needs only one eligible survivor (Tasks 2, 6). | |
| +| 5 | P1 | `fleetChannelFor` falls back past the label | Accepted: `authoritative` parameter; labelled rows never fall back (Task 5). | |
| +| 6 | P1 | Sidecars unimplemented; worker shutdown unproven | Sidecars: cut (spec rule 10); fleets with sidecars are not labelled and new sidecars are refused on multi-box fleets (Task 2). Workers: Task 3 names `StopRetired`'s worker path and adds a test if none covers it. | |
| +| 7 | P1 | Old-label-only CAS can label across fleets | Accepted: `FleetBoxExpect{Region, Label, CreatedAt}` checked inside every retry (Task 1); race tests in Tasks 1 and 6. | |
| +| 8 | P2 | Unconditional `FleetBox` compare rewrites forever | Accepted: compare `FleetLabel`, and `FleetBox` only when labelled; write-counter test (Task 5). | |
| +| 9 | P2 | Task 7 harness needs extensions | Accepted: shared bucket, per-box lease identity seam, short TTL, injected clock, partition (Task 7). Declined: disk-backed test roots for activator/host e2e; they need `/tmp/k` for the Unix socket path limit (memory "Gate tmp exec wrapper"). | |
| +| 10 | P2 | Request budgets and counting tests | Accepted: budgets in Global Constraints; counting tests in Tasks 2 and 6; one inventory per pass; incomplete listings write nothing. | |
| +| 11 | P2 | Census name table and selected inventory | Accepted: Task 1 Step 4; Task 8 Step 1 adds the new columns. | |