host: an offline target reverts whatever its pools say now (#413)
Astra round 2, P2: the pool gate on the target role also blocked offline-reverting, so a target that landed and then restarted with CARLOS_POOLS that no longer admit the record never ran its revert, and abort could clear the move with the landed files left in place. Pool admission now gates the landing and the open only; in reverting every box in the target region runs offlineTargetRevert, whose own checks (the row held by this move, or this box's report for it) decide whether it has anything to put back. TestOfflineMoveE2E gains "aborted after the target left the shared pool": land, switch uk-box to cohort1, restart, abort, tick through the production passes; the files are parked and the row and timers gone. It fails with the revert gated by pools. Census re-proposed (internal/ host); MV-O194 stays pending until Luna's approval.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+75
−7
docs/superpowers/notes/census-proposal-offline-move-pool-target-413.md+2 −2internal/host/movesoffline.go+10 −1internal/host/movesoffline_e2e_test.go+59 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-offline-move-pool-target-413.tsv+3 −3
CI cancelled — superseded by a newer push — run details
diff --git a/docs/superpowers/notes/census-proposal-offline-move-pool-target-413.md b/docs/superpowers/notes/census-proposal-offline-move-pool-target-413.md| index fc46da2d2..e4f74e70e 100644 |
| --- a/docs/superpowers/notes/census-proposal-offline-move-pool-target-413.md |
| +++ b/docs/superpowers/notes/census-proposal-offline-move-pool-target-413.md |
| @@ -4,7 +4,7 @@ Ruling `census-ruling-offline-move-pool-target-413`. The independent reviewer ap |
| | unit | change | read sites | what changed | |
| |---|---|---|---| |
| -| `internal/host/movespass.go` `armOffline` | body | unchanged (1) | sets moveCfg.OfflinePools from CARLOS_POOLS through provision.ParseBoxPools (an env string the agent already reads for reconcile; no file read), so offlineTargetHere keeps a box whose pools do not admit the record out of the offline target role (amadan #413); no read added | |
| +| `internal/host/movespass.go` `armOffline` | body | unchanged (1) | sets moveCfg.OfflinePools from CARLOS_POOLS through provision.ParseBoxPools (an env string the agent already reads for reconcile; no file read), so offlineTargetHere keeps a box whose pools do not admit the record out of the offline landing and open (amadan #413); no read added | |
| Envelopes re-pinned: `internal/host`. |
| @@ -14,6 +14,6 @@ Recorded dispositions, which each change must still satisfy: |
| - `internal/host/movespass.go` `armOffline`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=root-route (J1, as main's moves units); the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): census-ruling-moves-offline's body, which also arms moveCfg.ReleaseHoldSeq (releaseHeldSeq over the registry, touching the stage-requested marker after a release that landed); closes over the registry and reads nothing itself; self-serve moves 1 Task 7 |
| -Seal: `3f43afa4b0c18ad678a952b48b511e74e849992cd629b9aa1442bbe0055d5631` → `022a33f457a0684b499f118b8d475bd4aa3c0f04395727c3e8c090863daaff89`. |
| +Seal: `3f43afa4b0c18ad678a952b48b511e74e849992cd629b9aa1442bbe0055d5631` → `56acafa04ef8540fa9a50c1bed6242fbb5152fc9b45943da6a9b6ac5ccdacb6e`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-offline-move-pool-target-413.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/host/movesoffline.go b/internal/host/movesoffline.go| index 28e01b56d..6a82cb4bc 100644 |
| --- a/internal/host/movesoffline.go |
| +++ b/internal/host/movesoffline.go |
| @@ -421,7 +421,8 @@ func (w *movesWorker) offlineRound(ctx context.Context, s release.Store, rec pro |
| } |
| here := cfg.parkRegion() |
| source := here != "" && regionname.PlacementMatches(cfg.ParkHomeRegion, m.From, here) |
| - target := here != "" && regionname.PlacementMatches(cfg.ParkHomeRegion, m.To, here) && cfg.offlineTargetHere(rec) |
| + target := here != "" && regionname.PlacementMatches(cfg.ParkHomeRegion, m.To, here) && |
| + (m.State == provision.OfflineReverting || cfg.offlineTargetHere(rec)) |
| sealer := cfg.Box != "" && cfg.Box == m.Sealer |
| if !cfg.OfflineCapable { |
| if source || target || sealer { |
| @@ -456,6 +457,14 @@ func (w *movesWorker) offlineRound(ctx context.Context, s release.Store, rec pro |
| // target report and lands nothing. The console counts a target report only |
| // from a box its edges file says can hold the row, so this is the box's own |
| // half of the same rule, and it reads nothing from the record but the pool. |
| +// |
| +// It gates the landing and the open only, never the revert (Astra round 2): |
| +// a box that landed this move and then lost the pool (a restart with other |
| +// CARLOS_POOLS) still holds the row and the files it extracted, and only |
| +// offlineTargetRevert parks them and deletes the row. The revert's own |
| +// checks (the row held by this move, or this box's own report for it) |
| +// decide whether a box has anything to put back; one that never took part |
| +// does nothing. |
| func (c moveCfg) offlineTargetHere(rec provision.Record) bool { |
| return c.OfflinePools.Serves(rec.Pool) |
| } |
diff --git a/internal/host/movesoffline_e2e_test.go b/internal/host/movesoffline_e2e_test.go| index edd1f6b9b..709336744 100644 |
| --- a/internal/host/movesoffline_e2e_test.go |
| +++ b/internal/host/movesoffline_e2e_test.go |
| @@ -1108,6 +1108,9 @@ func TestOfflineMoveE2E(t *testing.T) { |
| // produced it. |
| t.Run("done, through a lifetime", func(t *testing.T) { offlineMoveDone(t, landOpts{lifetime: true}) }) |
| t.Run("aborted from landed, through a lifetime", offlineMoveAbortedFromLanded) |
| + // Astra round 2 on amadan #413: the target landed, then restarted |
| + // serving only a named pool; the abort still puts back what it landed. |
| + t.Run("aborted after the target left the shared pool", offlineMoveAbortedAfterThePoolChanged) |
| t.Run("a release skips a record that moved on", offlineReleaseSkipsAMovedRecord) |
| // Task 7 fix round 1: a claims-on box (no judge) releases through |
| // today's ReleaseHold, whatever incarnation its held rows carry. |
| @@ -1680,6 +1683,62 @@ func offlineMoveAbortedFromLanded(t *testing.T) { |
| } |
| } |
| +// The target lands (files, env, config, a held row with its timers), then |
| +// restarts with CARLOS_POOLS=cohort1, so its pools no longer admit the |
| +// record. The abort runs through the production dispatch (the boxes' ticks: |
| +// reconcile, the edges file, movesPass): the target still parks what it |
| +// extracted and deletes its held row and timers before the move clears. |
| +// Pool admission gates a landing, never the revert of one. |
| +func offlineMoveAbortedAfterThePoolChanged(t *testing.T) { |
| + w := newE2EWorld(t, landOpts{}) |
| + w.begin() |
| + w.seal() |
| + w.flipAndLand() |
| + uk := w.uk |
| + if rt := uk.row(offHost); rt == nil || rt.HoldOp != w.id { |
| + t.Fatalf("fixture: uk-box's row %+v, want held by the move", rt) |
| + } |
| + if tm, err := uk.reg.TimersFor(offHost); err != nil || len(tm) == 0 { |
| + t.Fatalf("fixture: uk-box landed no timers (%v)", err) |
| + } |
| + for _, name := range []string{offHost + ".env", offHost + ".config.env"} { |
| + if !lexists(filepath.Join(uk.dd, name)) { |
| + t.Fatalf("fixture: uk-box did not land %s", name) |
| + } |
| + } |
| + |
| + uk.env["CARLOS_POOLS"] = "cohort1" |
| + w.restart() |
| + if uk.w.cfg.offlineTargetHere(w.wd.record()) { |
| + t.Fatal("fixture: uk-box's pools still admit the record after the restart") |
| + } |
| + |
| + w.accept("abort", "", provision.OfflineReverting) |
| + w.until("the revert", nextIs("finish")) |
| + if r := w.wd.reportFor(w.id, moves.OfflineRoleTarget, "uk-box"); r.Phase != moves.OfflinePhaseReverted { |
| + t.Fatalf("uk-box's report is %s before finish, want reverted", r.Phase) |
| + } |
| + w.finish("aborted") |
| + w.tickAll() |
| + if rt := uk.row(offHost); rt != nil { |
| + t.Fatalf("uk-box has a row after the abort: %+v", rt) |
| + } |
| + if tm, err := uk.reg.TimersFor(offHost); err != nil || len(tm) != 0 { |
| + t.Fatalf("uk-box keeps timers %v after the abort (%v)", tm, err) |
| + } |
| + for _, name := range []string{offHost, offHost + ".env", offHost + ".config.env"} { |
| + if lexists(filepath.Join(uk.dd, name)) { |
| + t.Errorf("uk-box keeps %s in place after the abort", name) |
| + } |
| + } |
| + parked := w.parkedTarget() |
| + for _, name := range []string{offHost + ".env", offHost + ".config.env"} { |
| + if !parked[name] { |
| + t.Errorf("uk-box parked %v, want %s among them", parked, name) |
| + } |
| + } |
| +} |
| + |
| // The target's open releases from the record it observes under the locks, |
| // through armOffline's releaser: a record that moved on between the pass's |
| // listing and the release is not released for, and the row stays held. |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 1e432b26a..8ca8aed10 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -208,4 +208,4 @@ plan14-root-reads-instance-gomemlimit-991.tsv 19c9f395547d998f4b5e87e89c0dfa3b5f |
| plan14-root-reads-ppv2-operator-copy.tsv 19c9f395547d998f4b5e87e89c0dfa3b5f012d177a87eb5010a8c4defac305dc |
| plan14-root-reads-same-box-edge-fence.tsv 76c986ad534d23071100a9a573ffb38afc60b26c8942baf218436bf6a3ff03b3 |
| plan14-root-reads-g6-fence.tsv 3f43afa4b0c18ad678a952b48b511e74e849992cd629b9aa1442bbe0055d5631 |
| -plan14-root-reads-offline-move-pool-target-413.tsv 022a33f457a0684b499f118b8d475bd4aa3c0f04395727c3e8c090863daaff89 |
| +plan14-root-reads-offline-move-pool-target-413.tsv 56acafa04ef8540fa9a50c1bed6242fbb5152fc9b45943da6a9b6ac5ccdacb6e |
diff --git a/internal/provision/testdata/plan14-root-reads-offline-move-pool-target-413.tsv b/internal/provision/testdata/plan14-root-reads-offline-move-pool-target-413.tsv| index 7d475494f..431922add 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-offline-move-pool-target-413.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-offline-move-pool-target-413.tsv |
| @@ -1,5 +1,5 @@ |
| # Census overlay offline-move-pool-target-413, written by census-propose (#369). census-ruling-offline-move-pool-target-413, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-offline-move-pool-target-413.md. |
| # 1 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| -@legacy 1c7bd4ba117b1b09a161422e9344a24460fddd7418477fdca993d513254791b3 internal/host/movespass.go armOffline legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=root-route (J1, as main's moves units); the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): census-ruling-moves-offline's body, which also arms moveCfg.ReleaseHoldSeq (releaseHeldSeq over the registry, touching the stage-requested marker after a release that landed); closes over the registry and reads nothing itself; self-serve moves 1 Task 7;rev3=census-ruling-offline-move-pool-target-413;basis=sets moveCfg.OfflinePools from CARLOS_POOLS through provision.ParseBoxPools (an env string the agent already reads for reconcile; no file read), so offlineTargetHere keeps a box whose pools do not admit the record out of the offline target role (amadan #413); no read added whole:Route@2258 9a021c1f9794e1e55b785db0117059bb5e1d0775286d914ce155b7eb01b259dd |
| -internal/host/movespass.go armOffline legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=root-route (J1, as main's moves units); the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): census-ruling-moves-offline's body, which also arms moveCfg.ReleaseHoldSeq (releaseHeldSeq over the registry, touching the stage-requested marker after a release that landed); closes over the registry and reads nothing itself; self-serve moves 1 Task 7;rev3=census-ruling-offline-move-pool-target-413;basis=sets moveCfg.OfflinePools from CARLOS_POOLS through provision.ParseBoxPools (an env string the agent already reads for reconcile; no file read), so offlineTargetHere keeps a box whose pools do not admit the record out of the offline target role (amadan #413); no read added whole:Route@2258 9a021c1f9794e1e55b785db0117059bb5e1d0775286d914ce155b7eb01b259dd |
| -@coverage internal/host d61aeb158451d6f59b0f702c4fc36304a79fe83473a2dbced957542ef7deece6 |
| +@legacy 93f2459d88690caf745e04221a00d94b6a617bc793de2229f658091adc823ba7 internal/host/movespass.go armOffline legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=root-route (J1, as main's moves units); the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): census-ruling-moves-offline's body, which also arms moveCfg.ReleaseHoldSeq (releaseHeldSeq over the registry, touching the stage-requested marker after a release that landed); closes over the registry and reads nothing itself; self-serve moves 1 Task 7;rev3=census-ruling-offline-move-pool-target-413;basis=sets moveCfg.OfflinePools from CARLOS_POOLS through provision.ParseBoxPools (an env string the agent already reads for reconcile; no file read), so offlineTargetHere keeps a box whose pools do not admit the record out of the offline landing and open (amadan #413); no read added whole:Route@2258 9a021c1f9794e1e55b785db0117059bb5e1d0775286d914ce155b7eb01b259dd |
| +internal/host/movespass.go armOffline legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=root-route (J1, as main's moves units); the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): census-ruling-moves-offline's body, which also arms moveCfg.ReleaseHoldSeq (releaseHeldSeq over the registry, touching the stage-requested marker after a release that landed); closes over the registry and reads nothing itself; self-serve moves 1 Task 7;rev3=census-ruling-offline-move-pool-target-413;basis=sets moveCfg.OfflinePools from CARLOS_POOLS through provision.ParseBoxPools (an env string the agent already reads for reconcile; no file read), so offlineTargetHere keeps a box whose pools do not admit the record out of the offline landing and open (amadan #413); no read added whole:Route@2258 9a021c1f9794e1e55b785db0117059bb5e1d0775286d914ce155b7eb01b259dd |
| +@coverage internal/host e170581a8a2a548d858fbc33ada4c11aa71456184dae1f3da266714f42c1c439 |