offline move: stage and start refuse a stale live link or app dirs
#339 items 1 and 4. The target box's old live link for the host failed the landing's release item only at flip, and app directories beside the files directory failed the seal; both after start had taken the instance offline. Each box now reports both from its status loop (offlineMoveFacts, sharing the seal's stray rule via offlineFilesAt), and the stage and start doors refuse on them with nothing written. The landing and seal checks stay as backstops. Copy rows MV-O200 to MV-O203 are pending; census overlay offline-move-stage-refusals-339.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 files changed,
+457
−19
approved_moves_copy_test.go+4 −0docs/superpowers/notes/census-proposal-offline-move-stage-refusals-339.md+30 −0docs/superpowers/plans/2026-10-06-moves-phase1-copy.md+11 −0internal/console/apiinstancemove_offline.go+4 −0internal/console/apiinstancemove_offline_facts.go+45 −0internal/console/apiinstancemove_offline_stage_test.go+79 −0internal/console/apiinstancemove_offline_test.go+7 −1internal/host/agent.go+6 −0internal/host/movesoffline_e2e_test.go+111 −8internal/host/movesoffline_facts.go+116 −0internal/host/movesoffline_seal.go+23 −10internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-offline-move-stage-refusals-339.tsv+20 −0
diff --git a/approved_moves_copy_test.go b/approved_moves_copy_test.go| index af7993a5d..dc09e006f 100644 |
| --- a/approved_moves_copy_test.go |
| +++ b/approved_moves_copy_test.go |
| @@ -110,6 +110,9 @@ var movesCopyIDs = []string{ |
| "MV-O179", "MV-O180", "MV-O181", "MV-O182", "MV-O183", "MV-O184", "MV-O185", "MV-O186", "MV-O187", "MV-O188", "MV-O189", |
| "MV-O190", "MV-O191", "MV-O192", |
| "MV-O193", |
| + // #339: refused while the instance still serves, and status after an |
| + // abort from staging. |
| + "MV-O200", "MV-O201", "MV-O202", "MV-O203", |
| } |
| // copyRow is one row of the record. The File cell is the file the sentence is |
| @@ -1213,6 +1216,7 @@ var movesScanFiles = []string{ |
| "internal/host/movesrefusals.go", |
| "internal/console/movesrecovery.go", |
| "internal/console/apiinstancemove_offline.go", |
| + "internal/console/apiinstancemove_offline_facts.go", |
| "internal/console/claim_runtime.go", |
| "internal/alerting/alerting.go", |
| "internal/hostops/move_log_writer.go", |
diff --git a/docs/superpowers/notes/census-proposal-offline-move-stage-refusals-339.md b/docs/superpowers/notes/census-proposal-offline-move-stage-refusals-339.md| new file mode 100644 |
| index 000000000..44395df29 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-offline-move-stage-refusals-339.md |
| @@ -0,0 +1,30 @@ |
| +# Census approval: offline-move-stage-refusals-339 |
| + |
| +Ruling `census-ruling-offline-move-stage-refusals-339`. The independent reviewer approves or rejects every change below, 4 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `internal/status/snapshot.go` `CollectBox` | body | unchanged (28) | #339: copies Probes.OfflineMove into BoxMetrics.OfflineMove (json offline_move, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added. | |
| +| `internal/host/agent.go` `statusLoop` | sites | +whole:Route | #339: the agent (carlos-edge.service, user carlos): the status tick fills p.OfflineMove = offlineMoveFactsProbe(routes); the added whole:Route site is the tick's own registry list handed to that unit, which lists <opt>/live and each instance-kind row's instance directory (agent-readable, read only, nothing followed or changed); no store request added. | |
| +| `internal/host/movesoffline_seal.go` `movesWorker.offlineFilesOf` | sites | -file:ReadDir, -whole:Route | #339: the body moved to offlineFilesAt unchanged (nested ReadDir, flat FlatLeftovers); offlineFilesOf now passes its registry host listing as a closure. Sites moved, none added; the seal's refusal is unchanged. | |
| + |
| +Envelopes re-pinned: `.`, `internal/host`, `internal/status`. |
| + |
| +Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| + |
| +Recorded dispositions, which each change must still satisfy: |
| + |
| +- `internal/status/snapshot.go` `CollectBox`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added. |
| +- `internal/host/agent.go` `statusLoop`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change. |
| +- `internal/host/movesoffline_seal.go` `movesWorker.offlineFilesOf`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-moves-offline;basis=route-and-input (J1,J4, as main's sourceFinal.run); the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): new, reads the row and lists the nested instance directory for the files, env and config paths; an app entry beside the files directory refuses the seal |
| + |
| +New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff: |
| + |
| +- new `internal/host/movesoffline_facts.go:emptyDir`: reads +file:Lstat, +file:Open, +file:Readdirnames; written legacy, accepted-legacy, frozen |
| +- new `internal/host/movesoffline_facts.go:movesWorker.offlineMoveFacts`: reads +file:ReadDir, +registry:Host ×6, +registry:Kind, +whole:Route ×5; written legacy, accepted-legacy, frozen |
| +- new `internal/host/movesoffline_facts.go:offlineMoveFactsProbe`: reads +whole:Route; written legacy, accepted-legacy, frozen |
| +- new `internal/host/movesoffline_seal.go:offlineFilesAt`: reads +file:ReadDir, +whole:Route ×2; written legacy, accepted-legacy, frozen |
| + |
| +Seal: `3f43afa4b0c18ad678a952b48b511e74e849992cd629b9aa1442bbe0055d5631` → `71e5cd60dda695b6ce12a2ec95b0f9ca3c0ee98561f0333570a9ebb4668924ec`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-offline-move-stage-refusals-339.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/plans/2026-10-06-moves-phase1-copy.md b/docs/superpowers/plans/2026-10-06-moves-phase1-copy.md| index 28adb242c..c52484885 100644 |
| --- a/docs/superpowers/plans/2026-10-06-moves-phase1-copy.md |
| +++ b/docs/superpowers/plans/2026-10-06-moves-phase1-copy.md |
| @@ -718,3 +718,14 @@ Three more console door refusals for a staged move (`internal/console/apiinstanc |
| | MV-O191 | internal/console/apiinstancemove_offline.go | <to> publishes the same data bucket as <from>. a staged copy there would replace the serving one | approved | |
| | MV-O192 | internal/console/apiinstancemove_offline.go | <to> now publishes a different data bucket or region from what was recorded when <host> was staged. abort the move and stage it again | approved | |
| | MV-O193 | internal/console/seedmove.go (haMoveSentence; RHA-P1a-C1 approved verbatim; emitted at apiinstancemove.go:450,631 and apiinstancemove_offline.go:538) | %s has high availability turned on. offline moves into or out of it are not available yet | approved | |
| + |
| +## Offline move: refused while the instance still serves (#339) |
| + |
| +Two things failed an offline move only after `start` had taken the instance offline (amadan #339, items 1 and 4): a live link the target box still kept for the host from an earlier time it ran there, which fails the landing's `release` item at `flip` (MV-O177), and directories the instance keeps beside its files directory, which the seal refuses (MV-O76). Each box now reports both in its status report while the instance serves, and the `stage` and `start` doors refuse first (branch `offline-move-stage-refusals-339`). MV-O200 and MV-O201 are those door refusals (`internal/console/apiinstancemove_offline_facts.go`), lower case like the other door sentences. In MV-O200 `<box>` is the target box. In MV-O201 `<dirs>` are the entries' paths on the source box `<box>`, joined with ", ", each followed by " (empty)" when it is an empty directory. MV-O202 is what `carlos move offline status` says for a move aborted from staging (item 2), in place of MV-O8 and the manifest's items: nothing moved. It is followed by MV-O187 or MV-O188. MV-O203 is the CLI page's paragraph for the two refusals. The ids start at 200 so that another branch's rows from 194 do not collide. Pending a copy review. |
| + |
| +| id | file | text | status | |
| +|---|---|---|---| |
| +| MV-O200 | internal/console/apiinstancemove_offline_facts.go | <box> still holds a live link for <host> from when it last ran there. the move would fail at flip, after <host> is offline. see the offline move runbook | pending | |
| +| MV-O201 | internal/console/apiinstancemove_offline_facts.go | <host> keeps <dirs> beside its files directory on <box>, and this move can carry only the files directory. see the offline move runbook | pending | |
| +| MV-O202 | move.go | Nothing moved. The stage of <host> was abandoned, and <host> kept serving in <from>. | pending | |
| +| MV-O203 | docs/site/cli.md | `stage` and `start` refuse a move that would fail after the instance goes offline: when the box in the target region still holds a live link for the instance from an earlier time it ran there, or when the instance keeps directories beside its files directory, which the move cannot carry. Each refusal names the box and what it found. | pending | |
diff --git a/internal/console/apiinstancemove_offline.go b/internal/console/apiinstancemove_offline.go| index 862501c3b..a3746bea8 100644 |
| --- a/internal/console/apiinstancemove_offline.go |
| +++ b/internal/console/apiinstancemove_offline.go |
| @@ -572,6 +572,10 @@ func (s *Server) offlineBeginChecks(w http.ResponseWriter, r *http.Request, d of |
| writeRefusal(w, ref) |
| return "", offlineFleet{}, false |
| } |
| + if ref := offlineBoxFacts(fleet, host, rec.Region, to); ref != nil { |
| + writeRefusal(w, ref) |
| + return "", offlineFleet{}, false |
| + } |
| return to, fleet, true |
| } |
diff --git a/internal/console/apiinstancemove_offline_facts.go b/internal/console/apiinstancemove_offline_facts.go| new file mode 100644 |
| index 000000000..b800a6c8b |
| --- /dev/null |
| +++ b/internal/console/apiinstancemove_offline_facts.go |
| @@ -0,0 +1,45 @@ |
| +package console |
| + |
| +import ( |
| + "fmt" |
| + "net/http" |
| + "slices" |
| + "strings" |
| +) |
| + |
| +// offlineBoxFacts refuses a start or a stage that a box's own report says |
| +// would fail after the instance is offline (#339): a live link the target |
| +// box still holds for the host, which fails the landing's release item at |
| +// flip, and entries beside the instance's files directory on a source box, |
| +// which the seal refuses. Both are read from the boxes' status reports |
| +// (status.OfflineMoveFacts), which each box writes while the instance still |
| +// serves. A box whose report carries no facts says nothing, and the landing |
| +// and the seal keep their own refusals behind this one. offlineSelect has |
| +// already required exactly one target box. |
| +func offlineBoxFacts(f offlineFleet, host, from, to string) *offlineRefusal { |
| + for _, b := range f.boxesAt(to) { |
| + m := f.metrics[b.Box] |
| + if m == nil || m.OfflineMove == nil { |
| + continue |
| + } |
| + if slices.Contains(m.OfflineMove.StaleLiveLinks, host) { |
| + return &offlineRefusal{status: http.StatusConflict, msg: fmt.Sprintf("%s still holds a live link for %s from when it last ran there. the move would fail at flip, after %s is offline. see the offline move runbook", b.Box, host, host)} |
| + } |
| + } |
| + for _, b := range f.boxesAt(from) { |
| + m := f.metrics[b.Box] |
| + if m == nil || m.OfflineMove == nil || len(m.OfflineMove.AppDirs[host]) == 0 { |
| + continue |
| + } |
| + var dirs []string |
| + for _, d := range m.OfflineMove.AppDirs[host] { |
| + if d.Empty { |
| + dirs = append(dirs, d.Path+" (empty)") |
| + } else { |
| + dirs = append(dirs, d.Path) |
| + } |
| + } |
| + return &offlineRefusal{status: http.StatusConflict, msg: fmt.Sprintf("%s keeps %s beside its files directory on %s, and this move can carry only the files directory. see the offline move runbook", host, strings.Join(dirs, ", "), b.Box)} |
| + } |
| + return nil |
| +} |
diff --git a/internal/console/apiinstancemove_offline_stage_test.go b/internal/console/apiinstancemove_offline_stage_test.go| index a22255413..29a31e63b 100644 |
| --- a/internal/console/apiinstancemove_offline_stage_test.go |
| +++ b/internal/console/apiinstancemove_offline_stage_test.go |
| @@ -9,6 +9,7 @@ import ( |
| "github.com/carlosframework/platform/internal/moves" |
| "github.com/carlosframework/platform/internal/provision" |
| + "github.com/carlosframework/platform/internal/status" |
| ) |
| // The pre-copy door (offline-staging), in-process against the offline |
| @@ -323,3 +324,81 @@ func TestOfflineStagedMoveRefusesChangedCoordinates(t *testing.T) { |
| }) |
| } |
| } |
| + |
| +// ---- #339: refused while the instance still serves ---- |
| + |
| +func msgO200(box string) string { |
| + return box + " still holds a live link for " + offlineHost + " from when it last ran there. the move would fail at flip, after " + offlineHost + " is offline. see the offline move runbook" |
| +} |
| + |
| +func msgO201(dirs, box string) string { |
| + return offlineHost + " keeps " + dirs + " beside its files directory on " + box + ", and this move can carry only the files directory. see the offline move runbook" |
| +} |
| + |
| +// A target box that reports a live link for the host, left from an earlier |
| +// time the instance ran there, would fail the landing's release item at |
| +// flip, with the instance offline. Stage and start refuse it before |
| +// anything is written; a link that appears after the stage refuses the |
| +// start, and the move stays staging until it is gone. |
| +func TestOfflineStageAndStartRefuseAStaleLiveLinkOnTheTarget(t *testing.T) { |
| + stale := offlineBox{Box: "uk-box", Placement: "uk", Bucket: "data-uk", LiveLinks: []string{"other.shop.example.com", offlineHost}} |
| + w := newOfflineWorld(t, ieOff("ie-box"), stale) |
| + w.refused(http.MethodPost, "/stage", `{"region":"uk"}`, http.StatusConflict, msgO200("uk-box")) |
| + w.refused(http.MethodPost, "", `{"region":"uk"}`, http.StatusConflict, msgO200("uk-box")) |
| + if rec := w.record(); rec.Move != nil { |
| + t.Fatalf("a refused door wrote %+v", rec.Move) |
| + } |
| + if _, ok := w.lock(); ok { |
| + t.Fatal("a refused door took the lock") |
| + } |
| + |
| + // A link for another host refuses nothing. |
| + w2 := newOfflineWorld(t, ieOff("ie-box"), offlineBox{Box: "uk-box", Placement: "uk", Bucket: "data-uk", LiveLinks: []string{"other.shop.example.com"}}) |
| + w2.stage() |
| + |
| + // The link appears after the stage: start refuses, the move stays |
| + // staging, and once the box no longer reports it start goes ahead. |
| + w3 := newOfflineWorld(t, oneEach...) |
| + w3.stage() |
| + w3.fleet(stale) |
| + w3.refused(http.MethodPost, "", `{"region":"uk"}`, http.StatusConflict, msgO200("uk-box")) |
| + w3.refused(http.MethodPost, "/stage", `{"region":"uk"}`, http.StatusConflict, msgO200("uk-box")) |
| + if rec := w3.record(); rec.Move.State != provision.OfflineStaging { |
| + t.Fatalf("after a refused start the move is %s", rec.Move.State) |
| + } |
| + w3.fleet(ukOff("uk-box")) |
| + w3.ok("", `{"region":"uk"}`, provision.OfflineStopping) |
| +} |
| + |
| +// A source box that reports app directories beside the instance's files |
| +// directory would have the seal refuse them, with the instance offline. |
| +// Stage and start refuse first, naming the directories and saying which |
| +// are empty; the seal's own refusal stays as it was. |
| +func TestOfflineStageAndStartRefuseAppDirsBesideTheFiles(t *testing.T) { |
| + dirs := map[string][]status.AppDir{offlineHost: {{Path: "/data/.instances/i/blobs"}, {Path: "/data/.instances/i/documents", Empty: true}}} |
| + src := offlineBox{Box: "ie-b", Placement: "ie", Bucket: "data-ie", AppDirs: dirs} |
| + want := msgO201("/data/.instances/i/blobs, /data/.instances/i/documents (empty)", "ie-b") |
| + w := newOfflineWorld(t, ieOff("ie-a"), src, ukOff("uk-box")) |
| + w.refused(http.MethodPost, "/stage", `{"region":"uk"}`, http.StatusConflict, want) |
| + w.refused(http.MethodPost, "", `{"region":"uk"}`, http.StatusConflict, want) |
| + if rec := w.record(); rec.Move != nil { |
| + t.Fatalf("a refused door wrote %+v", rec.Move) |
| + } |
| + if _, ok := w.lock(); ok { |
| + t.Fatal("a refused door took the lock") |
| + } |
| + |
| + // Another host's directories refuse nothing. |
| + w2 := newOfflineWorld(t, offlineBox{Box: "ie-a", Placement: "ie", Bucket: "data-ie", |
| + AppDirs: map[string][]status.AppDir{"other.shop.example.com": {{Path: "/data/.instances/o/blobs"}}}}, ukOff("uk-box")) |
| + w2.stage() |
| + |
| + // The directories appear after the stage: start refuses. |
| + w3 := newOfflineWorld(t, ieOff("ie-a"), ieOff("ie-b"), ukOff("uk-box")) |
| + w3.stage() |
| + w3.fleet(src) |
| + w3.refused(http.MethodPost, "", `{"region":"uk"}`, http.StatusConflict, want) |
| + if rec := w3.record(); rec.Move.State != provision.OfflineStaging { |
| + t.Fatalf("after a refused start the move is %s", rec.Move.State) |
| + } |
| +} |
diff --git a/internal/console/apiinstancemove_offline_test.go b/internal/console/apiinstancemove_offline_test.go| index 7b6d0c144..eb953119b 100644 |
| --- a/internal/console/apiinstancemove_offline_test.go |
| +++ b/internal/console/apiinstancemove_offline_test.go |
| @@ -73,6 +73,11 @@ type offlineBox struct { |
| NoHibernation bool // hibernation_configured false |
| Hosts []string // hosts its edges file lists |
| FP string // secrets_key_fp; testKeyFP when empty |
| + // LiveLinks and AppDirs are the box's offline move facts (#339): the |
| + // hosts it keeps a stale live link for, and per host the entries beside |
| + // its files directory. |
| + LiveLinks []string |
| + AppDirs map[string][]status.AppDir |
| } |
| func ieOff(box string) offlineBox { return offlineBox{Box: box, Placement: "ie", Bucket: "data-ie"} } |
| @@ -166,7 +171,8 @@ func (w *offlineWorld) fleet(boxes ...offlineBox) { |
| offlinePut(w.t, w.fx.rel, edgesFilePrefix+b.Box+".json", body) |
| sb := status.Box{Label: b.Box, GeneratedAt: time.Now()} |
| if !b.NoMetrics { |
| - sb.Metrics = &status.BoxMetrics{HostClaimEnabled: b.ClaimsOn} |
| + sb.Metrics = &status.BoxMetrics{HostClaimEnabled: b.ClaimsOn, |
| + OfflineMove: &status.OfflineMoveFacts{StaleLiveLinks: b.LiveLinks, AppDirs: b.AppDirs}} |
| } |
| if err := status.WriteBox(context.Background(), w.fx.rel, sb); err != nil { |
| w.t.Fatal(err) |
diff --git a/internal/host/agent.go b/internal/host/agent.go| index 50a5c1d02..3e3f3e5b9 100644 |
| --- a/internal/host/agent.go |
| +++ b/internal/host/agent.go |
| @@ -5078,6 +5078,12 @@ func statusLoop(reg *registry.Registry, svc *activator.Service, buildStates func |
| // activator's memory: no store request, no root call. nil with no |
| // activator. Private Metrics only. |
| p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes) |
| + // What an offline move's stage and start doors read from this box |
| + // while its instances still serve (#339): stale live links and the |
| + // entries beside each instance's files directory. Directory |
| + // listings only; nil when the box cannot take part in an offline |
| + // move. Private Metrics only: hosts. |
| + p.OfflineMove = offlineMoveFactsProbe(routes) |
| // A fleet box (CARLOS_FLEET set) never gets here as a contender: it |
| // self-reports only, never attempting the election at all — no |
diff --git a/internal/host/movesoffline_e2e_test.go b/internal/host/movesoffline_e2e_test.go| index a663ec804..8a09f4bf1 100644 |
| --- a/internal/host/movesoffline_e2e_test.go |
| +++ b/internal/host/movesoffline_e2e_test.go |
| @@ -62,9 +62,10 @@ import ( |
| // and the restore; |
| // - the operator page (sealWorld.arm's Page records instead of writing |
| // the outbox), so the test can say no page fired; |
| -// - the box status snapshots, written once before the move as each box's |
| -// status loop would (status.WriteBox), because the console's fleet read |
| -// joins them and no status loop runs in a test; |
| +// - the box status snapshots, written before the move as each box's |
| +// status loop would (CollectBox with the box's offline move facts, then |
| +// status.WriteBox), because the console's fleet read joins them and no |
| +// status loop runs in a test; |
| // - the reconcile Layout intent (offBox.reconcile names flat or nested) |
| // instead of mintLayoutIntentWith, as T3 to T5's worlds do; |
| // - the source's config.env is rendered once by RenderHeld before the |
| @@ -379,17 +380,31 @@ func newE2EWorld(t *testing.T, opts landOpts) *e2eWorld { |
| // Both boxes published as their loops publish them, and their status |
| // snapshots. |
| w.tickAll() |
| - for _, b := range []*offBox{ie, lw.uk} { |
| - if err := status.WriteBox(ctx, rs, status.Box{Label: b.name, GeneratedAt: time.Now(), Metrics: &status.BoxMetrics{}}); err != nil { |
| - t.Fatal(err) |
| - } |
| - } |
| + w.reportStatus() |
| if !ie.lists(offHost) || lw.uk.lists(offHost) { |
| t.Fatal("fixture: ie-box must serve the host and uk-box must not") |
| } |
| return w |
| } |
| +// reportStatus writes each box's status snapshot as its status loop does: |
| +// CollectBox over the box's rows with the facts the loop's probe reads from |
| +// the box's worker (offlineMoveFacts, #339), under the box's name. |
| +func (w *e2eWorld) reportStatus() { |
| + w.t.Helper() |
| + for _, b := range []*offBox{w.ie, w.uk} { |
| + routes, err := b.reg.List() |
| + if err != nil { |
| + w.t.Fatal(err) |
| + } |
| + box := status.CollectBox(routes, status.Probes{OfflineMove: b.w.offlineMoveFacts(routes)}, time.Now()) |
| + box.Label = b.name |
| + if err := status.WriteBox(context.Background(), w.rs, box); err != nil { |
| + w.t.Fatal(err) |
| + } |
| + } |
| +} |
| + |
| // publish is one pass of edgesFileLoop on b: the identity it builds at arm |
| // from the box's own environment, the capability from the box's armed |
| // worker, through the production writer, with the box's lifetimes switch |
| @@ -1104,6 +1119,94 @@ func TestOfflineMoveE2E(t *testing.T) { |
| // minutes of belief in a report. |
| t.Run("doors back to back", func(t *testing.T) { offlineMoveDoorsApart(t, 0) }) |
| t.Run("doors three minutes apart", func(t *testing.T) { offlineMoveDoorsApart(t, 3*time.Minute) }) |
| + // #339: what failed a move only after the instance was offline is |
| + // refused by stage and start, from the boxes' own status reports. |
| + t.Run("stage and start refuse a stale live link on the target", offlineRefusesAStaleLiveLink) |
| + t.Run("stage and start refuse app directories beside the files", offlineRefusesAppDirs) |
| +} |
| + |
| +// requireRefused posts verb and wants a 409 with msg, no write to the |
| +// deployment store and the record byte for byte as it was. |
| +func (w *e2eWorld) requireRefused(verb, msg string) { |
| + w.t.Helper() |
| + mark, rec := w.rs.mark(), w.recordRaw() |
| + code, out := w.door(verb, `{"region":"uk"}`) |
| + var e struct { |
| + Error string `json:"error"` |
| + } |
| + _ = json.Unmarshal([]byte(out), &e) |
| + if code != http.StatusConflict || e.Error != msg { |
| + w.t.Fatalf("%s = %d %s\nwant 409 %q", verbName(verb), code, out, msg) |
| + } |
| + if writes := w.rs.since(mark); len(writes) != 0 { |
| + w.t.Fatalf("a refused %s wrote %v", verbName(verb), writes) |
| + } |
| + if !bytes.Equal(w.recordRaw(), rec) { |
| + w.t.Fatalf("a refused %s changed the record", verbName(verb)) |
| + } |
| +} |
| + |
| +// A return move to a box that still keeps the host's live link from the |
| +// last time it ran there (2026-10-21, #339 item 1): uk-box reports the link |
| +// in its status report, and stage and start refuse before anything is |
| +// written. Without the link stage goes ahead; a link that appears after the |
| +// stage refuses the start, with the instance still serving from ie-box. |
| +func offlineRefusesAStaleLiveLink(t *testing.T) { |
| + w := newE2EWorld(t, landOpts{}) |
| + old := w.stageLive("v0") |
| + w.reportStatus() |
| + msg := "uk-box still holds a live link for " + offHost + " from when it last ran there. the move would fail at flip, after " + offHost + " is offline. see the offline move runbook" |
| + w.requireRefused("stage", msg) |
| + w.requireRefused("", msg) |
| + if got, err := os.Readlink(release.LiveLink(w.uk.opt, offHost)); err != nil || got != old { |
| + t.Fatalf("the live link is %q (%v), want it left at %q", got, err, old) |
| + } |
| + |
| + if err := os.Remove(release.LiveLink(w.uk.opt, offHost)); err != nil { |
| + t.Fatal(err) |
| + } |
| + w.reportStatus() |
| + w.accept("stage", `{"region":"uk"}`, provision.OfflineStaging) |
| + w.stageLive("v0") |
| + w.reportStatus() |
| + w.requireRefused("", msg) |
| + if !w.ie.lists(offHost) { |
| + t.Fatal("ie-box stopped serving the host over a refused start") |
| + } |
| +} |
| + |
| +// An instance that keeps app directories beside its files directory |
| +// (2026-10-21, #339 item 4): ie-box reports them, and stage and start refuse |
| +// before anything is written, naming each and saying which is empty. Gone, |
| +// the move stages; back after the stage, the start refuses. |
| +func offlineRefusesAppDirs(t *testing.T) { |
| + w := newE2EWorld(t, landOpts{nested: true}) |
| + raw := filepath.Dir(w.srcFiles) |
| + documents, blobs := filepath.Join(raw, "documents"), filepath.Join(raw, "blobs") |
| + if err := os.Mkdir(documents, 0o755); err != nil { |
| + t.Fatal(err) |
| + } |
| + writeFile(t, filepath.Join(blobs, "b"), "blob") |
| + w.reportStatus() |
| + msg := offHost + " keeps " + blobs + ", " + documents + " (empty) beside its files directory on ie-box, and this move can carry only the files directory. see the offline move runbook" |
| + w.requireRefused("stage", msg) |
| + w.requireRefused("", msg) |
| + |
| + for _, p := range []string{documents, blobs} { |
| + if err := os.RemoveAll(p); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + w.reportStatus() |
| + w.accept("stage", `{"region":"uk"}`, provision.OfflineStaging) |
| + if err := os.Mkdir(documents, 0o755); err != nil { |
| + t.Fatal(err) |
| + } |
| + w.reportStatus() |
| + w.requireRefused("", offHost+" keeps "+documents+" (empty) beside its files directory on ie-box, and this move can carry only the files directory. see the offline move runbook") |
| + if !w.ie.lists(offHost) { |
| + t.Fatal("ie-box stopped serving the host over a refused start") |
| + } |
| } |
| // e2eLoops are what acts on the two boxes between door calls in production, |
diff --git a/internal/host/movesoffline_facts.go b/internal/host/movesoffline_facts.go| new file mode 100644 |
| index 000000000..efc2504c5 |
| --- /dev/null |
| +++ b/internal/host/movesoffline_facts.go |
| @@ -0,0 +1,116 @@ |
| +package host |
| + |
| +import ( |
| + "errors" |
| + "io" |
| + "log" |
| + "os" |
| + "path/filepath" |
| + "sort" |
| + |
| + "github.com/carlosframework/platform/internal/controlname" |
| + "github.com/carlosframework/platform/internal/registry" |
| + "github.com/carlosframework/platform/internal/release" |
| + "github.com/carlosframework/platform/internal/status" |
| +) |
| + |
| +// What a box tells an offline move's stage and start doors about its own |
| +// disk while every instance on it still serves (#339). Two things refused a |
| +// move only after the instance was offline: a target box's old live link |
| +// for the host (the landing's release item, at flip) and entries an |
| +// instance keeps beside its files directory (the seal). The box reports |
| +// both in its status report, and the doors refuse on them before anything |
| +// goes offline. The landing and the seal keep their own refusals. |
| +// |
| +// Everything here only lists directories and lstats names. Nothing is |
| +// followed, opened as a file or changed. |
| + |
| +// offlineMoveFactsProbe is the armed worker's facts over routes, for the |
| +// status loop; nil when no worker is armed or the box cannot take part in |
| +// an offline move. |
| +func offlineMoveFactsProbe(routes []registry.Route) *status.OfflineMoveFacts { |
| + return armedMovesWorker.Load().offlineMoveFacts(routes) |
| +} |
| + |
| +// offlineMoveFacts is this box's report, from routes (every row on the |
| +// box, as the status loop lists them): |
| +// |
| +// - StaleLiveLinks: every name in <opt>/live that is a hostname with no |
| +// row here. A box the instance once left keeps the link, root-owned, |
| +// naming the build it ran then (retirePaths leaves it), and the |
| +// landing fails its release item over any link that does not name the |
| +// sealed build (liveNotSealed). |
| +// - AppDirs: per instance-kind row, the entries beside its files |
| +// directory, by the seal's own rule (offlineFilesAt), each with whether |
| +// it is an empty directory. |
| +// |
| +// nil when the box cannot take part in an offline move, or when a listing |
| +// fails: a box that cannot say reports nothing, rather than a partial |
| +// answer a door would read as complete. |
| +func (w *movesWorker) offlineMoveFacts(routes []registry.Route) *status.OfflineMoveFacts { |
| + if w == nil || !w.cfg.OfflineCapable || w.cfg.Offline == nil { |
| + return nil |
| + } |
| + facts := &status.OfflineMoveFacts{} |
| + routed := map[string]bool{} |
| + hosts := make([]string, 0, len(routes)) |
| + for _, rt := range routes { |
| + routed[rt.Host] = true |
| + hosts = append(hosts, rt.Host) |
| + } |
| + optDir := w.cfg.OptDir |
| + if optDir == "" { |
| + optDir = release.OptDir() |
| + } |
| + liveDir := filepath.Dir(release.LiveLink(optDir, "host")) |
| + links, err := os.ReadDir(liveDir) |
| + if err != nil && !errors.Is(err, os.ErrNotExist) { |
| + log.Printf("moves: offline move facts: list %s: %v", liveDir, err) |
| + return nil |
| + } |
| + for _, e := range links { |
| + if name := e.Name(); controlname.ValidHostShape(name) && !routed[name] { |
| + facts.StaleLiveLinks = append(facts.StaleLiveLinks, name) |
| + } |
| + } |
| + sort.Strings(facts.StaleLiveLinks) |
| + boxHosts := func() ([]string, error) { return hosts, nil } |
| + for i := range routes { |
| + rt := routes[i] |
| + if rt.Kind != "instance" { |
| + continue |
| + } |
| + _, _, _, stray, err := offlineFilesAt(w.cfg.DataDir, rt.Host, &rt, boxHosts) |
| + if err != nil { |
| + log.Printf("moves: offline move facts: %s: %v", rt.Host, err) |
| + return nil |
| + } |
| + if len(stray) == 0 { |
| + continue |
| + } |
| + sort.Strings(stray) |
| + if facts.AppDirs == nil { |
| + facts.AppDirs = map[string][]status.AppDir{} |
| + } |
| + for _, p := range stray { |
| + facts.AppDirs[rt.Host] = append(facts.AppDirs[rt.Host], status.AppDir{Path: p, Empty: emptyDir(p)}) |
| + } |
| + } |
| + return facts |
| +} |
| + |
| +// emptyDir reports whether p is itself a directory (not a link to one) with |
| +// no entries. Anything it cannot tell is not empty. |
| +func emptyDir(p string) bool { |
| + fi, err := os.Lstat(p) |
| + if err != nil || !fi.IsDir() { |
| + return false |
| + } |
| + f, err := os.Open(p) |
| + if err != nil { |
| + return false |
| + } |
| + defer f.Close() |
| + _, err = f.Readdirnames(1) |
| + return errors.Is(err, io.EOF) |
| +} |
diff --git a/internal/host/movesoffline_seal.go b/internal/host/movesoffline_seal.go| index f98559c24..486b25d85 100644 |
| --- a/internal/host/movesoffline_seal.go |
| +++ b/internal/host/movesoffline_seal.go |
| @@ -670,7 +670,26 @@ func sameListing(source map[string]lease.MirrorObject, srcPrefix string, staged |
| // configPath is the rendered configuration beside the env file, which the |
| // effective instance key may come from. |
| func (w *movesWorker) offlineFilesOf(host string, rt *registry.Route) (files, envPath, configPath string, stray []string, err error) { |
| - dd := w.cfg.DataDir |
| + return offlineFilesAt(w.cfg.DataDir, host, rt, func() ([]string, error) { |
| + var hosts []string |
| + if w.cfg.Registry != nil { |
| + rows, err := w.cfg.Registry.List() |
| + if err != nil { |
| + return nil, err |
| + } |
| + for _, r := range rows { |
| + hosts = append(hosts, r.Host) |
| + } |
| + } |
| + return hosts, nil |
| + }) |
| +} |
| + |
| +// offlineFilesAt is offlineFilesOf under the data directory dd, with the |
| +// box's hosts (which a flat row's leftovers are judged against) read only |
| +// for a flat row. The seal and the box's offline move facts |
| +// (offlineMoveFacts, #339) judge stray entries by this one rule. |
| +func offlineFilesAt(dd, host string, rt *registry.Route, boxHosts func() ([]string, error)) (files, envPath, configPath string, stray []string, err error) { |
| platform := func(name string) bool { return layout.IsNestedPlatformName(host, name) } |
| if rt != nil && provision.NestedPaths(dd, *rt) { |
| raw := layout.RawInstanceDir(dd, host) |
| @@ -685,15 +704,9 @@ func (w *movesWorker) offlineFilesOf(host string, rt *registry.Route) (files, en |
| } |
| return filepath.Join(raw, host), filepath.Join(raw, host+".env"), filepath.Join(raw, host+".config.env"), stray, nil |
| } |
| - var hosts []string |
| - if w.cfg.Registry != nil { |
| - rows, err := w.cfg.Registry.List() |
| - if err != nil { |
| - return "", "", "", nil, err |
| - } |
| - for _, r := range rows { |
| - hosts = append(hosts, r.Host) |
| - } |
| + hosts, err := boxHosts() |
| + if err != nil { |
| + return "", "", "", nil, err |
| } |
| for _, p := range layout.FlatLeftovers(dd, host, hosts) { |
| if name := filepath.Base(p); !platform(name) && name != host { |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 6420219f5..20498510a 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -208,3 +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-stage-refusals-339.tsv 71e5cd60dda695b6ce12a2ec95b0f9ca3c0ee98561f0333570a9ebb4668924ec |
diff --git a/internal/provision/testdata/plan14-root-reads-offline-move-stage-refusals-339.tsv b/internal/provision/testdata/plan14-root-reads-offline-move-stage-refusals-339.tsv| new file mode 100644 |
| index 000000000..7ec1a8a85 |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-offline-move-stage-refusals-339.tsv |
| @@ -0,0 +1,20 @@ |
| +# Census overlay offline-move-stage-refusals-339, written by census-propose (#369). census-ruling-offline-move-stage-refusals-339, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-offline-move-stage-refusals-339.md. |
| +# 1 body, 2 sites, 3 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +# 4 new dispositions: 0 reads re-frozen at their disposition with the claim, 4 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other. |
| +@legacy 82364189d85f53dceebfa94131a75303ea4f8423ff2b8c8d19efccfe7cc9a329 internal/status/snapshot.go CollectBox legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: copies Probes.OfflineMove into BoxMetrics.OfflineMove (json offline_move, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added. registry:Alias@4543,registry:CertExpiresAt@3160,registry:CertExpiresAt@3396,registry:CertExpiresAt@4658,registry:DBPath@2495,registry:DBPath@2553,registry:DNSCheckedAt@3365,registry:DNSCheckedAt@4627,registry:DNSStatus@3139,registry:DNSStatus@3334,registry:DNSStatus@4597,registry:Hibernate@3853,registry:Host@2295,registry:Host@2437,registry:Host@2666,registry:Host@3280,registry:Host@3315,registry:Host@4578,registry:Kind@2473,registry:Kind@3807,registry:Platform@2152,registry:ServingVersion@2324,registry:ServingVersion@2447,registry:Socket@4066,registry:Version@2186,registry:Version@2305,whole:Route@1581,whole:RouteAlias@4440 32791b85240b09b4c70694b6cc07cddf1f657838f35072544ffe08e25c93be09 |
| +@legacy 5b7bdd41366d5dad04e2696d42f759df43dc8318d2deb83428d81b0fd711e0cc internal/host/movesoffline_facts.go emptyDir legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: Lstat (no link followed) then Open and Readdirnames(1) of a stray directory to report whether it is empty; agent only, read only. file:Lstat@43,file:Open@116,file:Readdirnames@189 0cba8242519951c3e589abe749242ea6773bbd2e3f8dc87478232fa2d660b5f7 |
| +@legacy 89655072de547e999bdac18d39be0951edecbeba592ef9de477523e5e3d743ea internal/host/movesoffline_facts.go movesWorker.offlineMoveFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: agent only (user carlos): ReadDir of <opt>/live (root-owned, 0755) reporting names that are hostnames with no route row; offlineFilesAt per instance-kind row reporting stray entries. Reports into the private status report; opens, runs or changes nothing; root never reads it. file:ReadDir@516,registry:Host@1082,registry:Host@1175,registry:Host@1393,registry:Host@1425,registry:Host@316,registry:Host@356,registry:Kind@987,whole:Route@1092,whole:Route@269,whole:Route@298,whole:Route@955,whole:Route@972 bd0863123815c36c4eda13707e611a196855321c89de760a94a53509c7cefef6 |
| +@legacy 288380d466e6d44ce0afb55257fbfed74a5a68296a03cdb1b37e2b33800e16c5 internal/host/movesoffline_facts.go offlineMoveFactsProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the armed moves worker's offlineMoveFacts over the status tick's routes; nil when none is armed or the box is not offline-capable. whole:Route@128 790159ee8c2d000c730596e5a9332d7f60f8597ddfa5be999f6c3b58f46d2f8a |
| +@legacy 05f889e3facb9e04ca3b6a15d567d4fe0f9f96d36112fa7731a9b02b42a393c3 internal/host/movesoffline_seal.go offlineFilesAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: offlineFilesOf's former body, verbatim but for the box hosts read through a closure; shared by the seal and offlineMoveFacts so both judge stray entries by one rule. file:ReadDir@350,whole:Route@248,whole:Route@288 ebadb82e4769301403b1bfc1e5f1000ac942e8e1cde754b934c2300a76cc36e4 |
| +@legacy a42863379cbad9a371d51de145bfcc6879e0a1d0fdd51bfccbea414a15069e7f internal/host/agent.go statusLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the agent (carlos-edge.service, user carlos): the status tick fills p.OfflineMove = offlineMoveFactsProbe(routes); the added whole:Route site is the tick's own registry list handed to that unit, which lists <opt>/live and each instance-kind row's instance directory (agent-readable, read only, nothing followed or changed); no store request added. whole:Route@10554,whole:Route@12368,whole:Route@12649,whole:Route@13007,whole:Route@6583,whole:Route@6610,whole:Route@7918 d31679b7894515917fe6fff0181b1e05d3507e042fc6952f557c8b3bed453783 |
| +@legacy 3617fe8e9b2dabb4797843b5b7126b4d2ce9016c48736f818d394a5c7a601333 internal/host/movesoffline_seal.go movesWorker.offlineFilesOf legacy accepted-legacy accepted-legacy;rev3=census-ruling-moves-offline;basis=route-and-input (J1,J4, as main's sourceFinal.run); the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): new, reads the row and lists the nested instance directory for the files, env and config paths; an app entry beside the files directory refuses the seal;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the body moved to offlineFilesAt unchanged (nested ReadDir, flat FlatLeftovers); offlineFilesOf now passes its registry host listing as a closure. Sites moved, none added; the seal's refusal is unchanged. registry:Host@396,whole:Route@179,whole:Route@363 03b96f80b08c934c6fe86e901e998c5277ea56ddbab6396bea183db555e85784 |
| +internal/status/snapshot.go CollectBox legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: copies Probes.OfflineMove into BoxMetrics.OfflineMove (json offline_move, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added. registry:Alias@4543,registry:CertExpiresAt@3160,registry:CertExpiresAt@3396,registry:CertExpiresAt@4658,registry:DBPath@2495,registry:DBPath@2553,registry:DNSCheckedAt@3365,registry:DNSCheckedAt@4627,registry:DNSStatus@3139,registry:DNSStatus@3334,registry:DNSStatus@4597,registry:Hibernate@3853,registry:Host@2295,registry:Host@2437,registry:Host@2666,registry:Host@3280,registry:Host@3315,registry:Host@4578,registry:Kind@2473,registry:Kind@3807,registry:Platform@2152,registry:ServingVersion@2324,registry:ServingVersion@2447,registry:Socket@4066,registry:Version@2186,registry:Version@2305,whole:Route@1581,whole:RouteAlias@4440 32791b85240b09b4c70694b6cc07cddf1f657838f35072544ffe08e25c93be09 |
| +internal/host/movesoffline_facts.go emptyDir legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: Lstat (no link followed) then Open and Readdirnames(1) of a stray directory to report whether it is empty; agent only, read only. file:Lstat@43,file:Open@116,file:Readdirnames@189 0cba8242519951c3e589abe749242ea6773bbd2e3f8dc87478232fa2d660b5f7 |
| +internal/host/movesoffline_facts.go movesWorker.offlineMoveFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: agent only (user carlos): ReadDir of <opt>/live (root-owned, 0755) reporting names that are hostnames with no route row; offlineFilesAt per instance-kind row reporting stray entries. Reports into the private status report; opens, runs or changes nothing; root never reads it. file:ReadDir@516,registry:Host@1082,registry:Host@1175,registry:Host@1393,registry:Host@1425,registry:Host@316,registry:Host@356,registry:Kind@987,whole:Route@1092,whole:Route@269,whole:Route@298,whole:Route@955,whole:Route@972 bd0863123815c36c4eda13707e611a196855321c89de760a94a53509c7cefef6 |
| +internal/host/movesoffline_facts.go offlineMoveFactsProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the armed moves worker's offlineMoveFacts over the status tick's routes; nil when none is armed or the box is not offline-capable. whole:Route@128 790159ee8c2d000c730596e5a9332d7f60f8597ddfa5be999f6c3b58f46d2f8a |
| +internal/host/movesoffline_seal.go offlineFilesAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: offlineFilesOf's former body, verbatim but for the box hosts read through a closure; shared by the seal and offlineMoveFacts so both judge stray entries by one rule. file:ReadDir@350,whole:Route@248,whole:Route@288 ebadb82e4769301403b1bfc1e5f1000ac942e8e1cde754b934c2300a76cc36e4 |
| +internal/host/agent.go statusLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the agent (carlos-edge.service, user carlos): the status tick fills p.OfflineMove = offlineMoveFactsProbe(routes); the added whole:Route site is the tick's own registry list handed to that unit, which lists <opt>/live and each instance-kind row's instance directory (agent-readable, read only, nothing followed or changed); no store request added. whole:Route@10554,whole:Route@12368,whole:Route@12649,whole:Route@13007,whole:Route@6583,whole:Route@6610,whole:Route@7918 d31679b7894515917fe6fff0181b1e05d3507e042fc6952f557c8b3bed453783 |
| +internal/host/movesoffline_seal.go movesWorker.offlineFilesOf legacy accepted-legacy accepted-legacy;rev3=census-ruling-moves-offline;basis=route-and-input (J1,J4, as main's sourceFinal.run); the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): new, reads the row and lists the nested instance directory for the files, env and config paths; an app entry beside the files directory refuses the seal;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the body moved to offlineFilesAt unchanged (nested ReadDir, flat FlatLeftovers); offlineFilesOf now passes its registry host listing as a closure. Sites moved, none added; the seal's refusal is unchanged. registry:Host@396,whole:Route@179,whole:Route@363 03b96f80b08c934c6fe86e901e998c5277ea56ddbab6396bea183db555e85784 |
| +@coverage . 3bbbac33b39ea2533731fafb1c1f1a2e21f206ab6a8784469905f1da29596e35 |
| +@coverage internal/host 87fab05c7a570d55a4084e62628018103638827b4e1801f79935ad1a0a474af7 |
| +@coverage internal/status 28a72a0af5cfdba86a4adf650de8587cb1afe3935caece4c0724890b6dfa6252 |