carlos / platform Public

slice 2: start-rule guard and claim

CI's TestEveryFreshBootPathConsultsTheRule failed on 957edfd10:
fleetSeedReplicaRefusal reached seedPlacedAt outside the start rule.
The guard was right. Finding this seed's own placement at the row's
path is a decision to keep a local copy, not a read-only probe, so it
now runs in seededRestore under the start rule, as the keep further
down does: settleSeedObligation and reconcileAssignment first, so a
labelled row's copy that is not kept under its current assignment is
set aside before it can count as proof, and the kept copy then passes
startAllowed in the restore. No exemption is added.
fleetSeedReplicaRefusal is replaced by fleetSeedNotOwn, which only
builds the refusal.

The guard's anchor names restorePlainStaging, where the plain
restore's sink now is; restorePlain is its wrapper. Its rules are
unchanged.

Census: seededRestore's claim says marker plus database through
seedPlacedAt (Codex P3). Re-proposed: its read sites go from
+whole:Route x2 to x4, the two start-rule calls.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 911d5d1f3a94c72ddb4a7745ab5ffa2ce679a7aa parent 957edfd
8 files changed, +73 −33
  • docs/superpowers/notes/census-fleet-seeded-create-2-claims.tsv +1 −1
  • docs/superpowers/notes/census-proposal-fleet-seeded-create-2.md +2 −2
  • internal/activator/seedfleet.go +14 −21
  • internal/activator/seedfleet_linux_test.go +32 −0
  • internal/activator/seedplace.go +16 −3
  • internal/activator/startrule_test.go +4 −2
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-fleet-seeded-create-2.tsv +3 −3

CI passed — run details

diff --git a/docs/superpowers/notes/census-fleet-seeded-create-2-claims.tsv b/docs/superpowers/notes/census-fleet-seeded-create-2-claims.tsv
index 28be76eca..a2bb9375d 100644
--- a/docs/superpowers/notes/census-fleet-seeded-create-2-claims.tsv
+++ b/docs/superpowers/notes/census-fleet-seeded-create-2-claims.tsv
@@ -7,7 +7,7 @@ internal/host/claimreport.go:claimReport Calls fillSeedsFloorProbe(p) first, ahe
internal/host/seedwiring.go:storeSeedObjects.Open Signature gains two ignored leading parameters (acct, app) to satisfy activator.SeedObjects; a region box still streams seeds/<host>/<id>/snapshot.db from its own data bucket after seeds.Check. No read changed.
internal/provision/seedreconcile.go:seedAction The ready-seed mint question goes through seedMintRefusal(rec, cfg, nested): the same nested() layout read, now also refusing a file seed on a customer fleet whose box cannot report (fleetRollbackArmed). Only more refusals; a nested-only mint, as before for every seed. No read added.
internal/status/snapshot.go:CollectBox Copies Probes.SeedsFloor into BoxMetrics.SeedsFloor and counts it in the metrics gate; a pure copy of a value the agent filled, the same 28 read sites, no read added.
-internal/activator/seedplace.go:ExecBackend.seededRestore Fleet file seeds: (1) refuses a flat layout for every seed (paths.layout != LayoutNested, nested only); (2) on a fleet file seed not yet placed lists moves/<host>/ through b.Mirror.List (fleetSeedStagingRefusal) before the replica question, and refuses if anything is staged or the listing fails; (3) when the host has a replica, reads the <db>.seed marker (ReadSeedMarker, a nofollow read of the marker beside the database) and restores only if it names this seed; (4) restores with staging promotion off; (5) reports a coded failure through reportSeedFailure; (6) purges via purgeSeedTarget's held-descriptor PurgeProven. The route reads (+whole:Route x2) are passing rt on to placeSeed and PurgeSeedLocalFor. The agent as carlos, not root; every path it names comes from the registry row, not from a tenant.
+internal/activator/seedplace.go:ExecBackend.seededRestore Fleet file seeds: (1) refuses a flat layout for every seed (paths.layout != LayoutNested, nested only); (2) on a fleet file seed not yet placed lists moves/<host>/ through b.Mirror.List (fleetSeedStagingRefusal) before the replica question, and refuses if anything is staged or the listing fails; (3) when the host has a replica, accepts it as this seed's only when this seed's own placement is still at the row's path: the marker naming this seed together with the database, both read through seedPlacedAt (instancefs, no symlink followed). A marker alone, another seed's, or either unreadable refuses (copy-exists) and nothing is restored. That probe runs under the start rule, after settleSeedObligation and reconcileAssignment (a labelled row's copy not kept under its assignment is set aside first), and the kept copy then passes startAllowed in the restore; (4) restores with staging promotion off; (5) reports a coded failure through reportSeedFailure; (6) purges via purgeSeedTarget's held-descriptor PurgeProven. The route reads (+whole:Route x4) are rt passed on: to placeSeed, to reportSeedFailure, and to the two start-rule calls before the own-placement probe (settleSeedObligation, reconcileAssignment), both of which it already made further down for every seed. The agent as carlos, not root; every path it names comes from the registry row, not from a tenant.
internal/activator/backend_exec.go:ExecBackend.restorePlain Now a one-line wrapper in the same file: restorePlainStaging(ctx, rt, true). Its body moved, whole, to restorePlainStaging below it (an extraction, not a deletion: nothing it checked is gone). Reads only rt (whole:Route), passing it on; no read of its own. Every caller but a fleet file seed's retry still reaches the same body with the staging fallback on.
internal/activator/backend_exec.go:ExecBackend.restorePlainStaging The body of the former restorePlain, with one parameter: staging. With false (a fleet file seed's retry alone) the promoteStagedReplica call is skipped, so nothing under moves/<host>/ is read or promoted. With true it is byte-for-byte the former path. It passes b.pathsFor(rt).layout to reconcileSeedMarker. The reads are the former restorePlain's (os.Stat of the database and the route fields), now under this name.
internal/activator/seedfleet.go:ExecBackend.reportSeedFailure Reads the route's account, app and host to hand to b.OnSeedFailed, only for a fleet file seed whose error carries a code (mismatch, not-a-database, copy-exists); no filesystem read. The report is best effort and logged; it writes no record (the door does).
diff --git a/docs/superpowers/notes/census-proposal-fleet-seeded-create-2.md b/docs/superpowers/notes/census-proposal-fleet-seeded-create-2.md
index 8e1a46589..977f64dee 100644
--- a/docs/superpowers/notes/census-proposal-fleet-seeded-create-2.md
+++ b/docs/superpowers/notes/census-proposal-fleet-seeded-create-2.md
@@ -14,7 +14,7 @@ Ruling `census-ruling-fleet-seeded-create-2`. The independent reviewer approves
| `internal/provision/seedreconcile.go` `seedAction` | body | unchanged (9) | The ready-seed mint question goes through seedMintRefusal(rec, cfg, nested): the same nested() layout read, now also refusing a file seed on a customer fleet whose box cannot report (fleetRollbackArmed). Only more refusals; a nested-only mint, as before for every seed. No read added. |
| `internal/status/snapshot.go` `CollectBox` | body | unchanged (28) | Copies Probes.SeedsFloor into BoxMetrics.SeedsFloor and counts it in the metrics gate; a pure copy of a value the agent filled, the same 28 read sites, no read added. |
| `internal/activator/backend_exec.go` `ExecBackend.restorePlain` | sites | -file:Stat, -registry:Host, -whole:Route ×10 | Now a one-line wrapper in the same file: restorePlainStaging(ctx, rt, true). Its body moved, whole, to restorePlainStaging below it (an extraction, not a deletion: nothing it checked is gone). Reads only rt (whole:Route), passing it on; no read of its own. Every caller but a fleet file seed's retry still reaches the same body with the staging fallback on. |
-| `internal/activator/seedplace.go` `ExecBackend.seededRestore` | sites | +whole:Route ×2 | Fleet file seeds: (1) refuses a flat layout for every seed (paths.layout != LayoutNested, nested only); (2) on a fleet file seed not yet placed lists moves/<host>/ through b.Mirror.List (fleetSeedStagingRefusal) before the replica question, and refuses if anything is staged or the listing fails; (3) when the host has a replica, reads the <db>.seed marker (ReadSeedMarker, a nofollow read of the marker beside the database) and restores only if it names this seed; (4) restores with staging promotion off; (5) reports a coded failure through reportSeedFailure; (6) purges via purgeSeedTarget's held-descriptor PurgeProven. The route reads (+whole:Route x2) are passing rt on to placeSeed and PurgeSeedLocalFor. The agent as carlos, not root; every path it names comes from the registry row, not from a tenant. |
+| `internal/activator/seedplace.go` `ExecBackend.seededRestore` | sites | +whole:Route ×4 | Fleet file seeds: (1) refuses a flat layout for every seed (paths.layout != LayoutNested, nested only); (2) on a fleet file seed not yet placed lists moves/<host>/ through b.Mirror.List (fleetSeedStagingRefusal) before the replica question, and refuses if anything is staged or the listing fails; (3) when the host has a replica, accepts it as this seed's only when this seed's own placement is still at the row's path: the marker naming this seed together with the database, both read through seedPlacedAt (instancefs, no symlink followed). A marker alone, another seed's, or either unreadable refuses (copy-exists) and nothing is restored. That probe runs under the start rule, after settleSeedObligation and reconcileAssignment (a labelled row's copy not kept under its assignment is set aside first), and the kept copy then passes startAllowed in the restore; (4) restores with staging promotion off; (5) reports a coded failure through reportSeedFailure; (6) purges via purgeSeedTarget's held-descriptor PurgeProven. The route reads (+whole:Route x4) are rt passed on: to placeSeed, to reportSeedFailure, and to the two start-rule calls before the own-placement probe (settleSeedObligation, reconcileAssignment), both of which it already made further down for every seed. The agent as carlos, not root; every path it names comes from the registry row, not from a tenant. |
Envelopes re-pinned: `internal/activator`, `internal/edge`, `internal/host`, `internal/instancefs`, `internal/lease`, `internal/provision`, `internal/seeds`, `internal/status`.
@@ -50,6 +50,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- reads `internal/activator/seedplace.go:ExecBackend.fetchSeed`: +registry:Account, +registry:App, +registry:Host; keeps legacy, task accepted-legacy
- reads `internal/host/seedwiring.go:wireSeedPlacement`: -registry:DBPath, +whole:Route; keeps legacy, task accepted-legacy
-Seal: `5ce0990b80e0447439484d36a7a87af70708aa5ce113491aecc09d87167277f0` → `2e93b15609a094377beb6f17c865ba4407fcde9730755e91af0a3c9fba42d855`.
+Seal: `5ce0990b80e0447439484d36a7a87af70708aa5ce113491aecc09d87167277f0` → `8a0a9cca336d3e695b79990a9aeda17f5ee8d74908752944f7dcd129918c80fc`.
Overlay: `internal/provision/testdata/plan14-root-reads-fleet-seeded-create-2.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/activator/seedfleet.go b/internal/activator/seedfleet.go
index a7354c7b2..45c9c76ca 100644
--- a/internal/activator/seedfleet.go
+++ b/internal/activator/seedfleet.go
@@ -72,28 +72,21 @@ func (b *ExecBackend) fleetSeedStagingRefusal(ctx context.Context, host string)
return nil
}
-// fleetSeedReplicaRefusal is the admission rule for a host that has a
-// replica: nil only when this seed's own earlier placement is still at
-// dbPath, which is the database there together with the <db>.seed marker
-// naming id (seedPlacedAt). Both, because the marker is written before the
-// database is renamed into place: a marker alone is a placement that never
-// finished, which uploaded nothing, so a replica beside it is not this
-// seed's. No marker, another seed's, a marker with no database, or either
-// one unreadable does not prove the replica is this seed's: reported,
-// FS-40, and nothing is restored.
-func fleetSeedReplicaRefusal(host, id, dbPath string) error {
- dir, base, err := splitDBPath(dbPath)
- if err != nil {
- return seedCopyExists(host, err)
- }
- placed, err := seedPlacedAt(dir, base, id)
- if err != nil {
- return seedCopyExists(host, fmt.Errorf("the seed's placement at %s cannot be read: %w", dbPath, err))
+// fleetSeedNotOwn is the refusal for a host that has a replica this seed
+// cannot be shown to have made. The admission rule is seededRestore's, run
+// there under the start rule: the replica is this seed's only when its own
+// earlier placement is still at dbPath, which is the database there
+// together with the <db>.seed marker naming the seed (seedPlacedAt). Both,
+// because the marker is written before the database is renamed into place:
+// a marker alone is a placement that never finished, which uploaded
+// nothing, so a replica beside it is not this seed's. No marker, another
+// seed's, a marker with no database, or either one unreadable (cause) does
+// not prove it: reported, FS-40, and nothing is restored.
+func fleetSeedNotOwn(host, dbPath string, cause error) error {
+ if cause != nil {
+ return seedCopyExists(host, fmt.Errorf("the seed's placement at %s cannot be read: %w", dbPath, cause))
}
- if !placed {
- return seedCopyExists(host, fmt.Errorf("the host has a replica, and %s is not this seed's placed database with its marker", dbPath))
- }
- return nil
+ return seedCopyExists(host, fmt.Errorf("the host has a replica, and %s is not this seed's placed database with its marker", dbPath))
}
// reportSeedFailure tells the console of a failure no retry can fix, for a
diff --git a/internal/activator/seedfleet_linux_test.go b/internal/activator/seedfleet_linux_test.go
index 36971665a..2deebb931 100644
--- a/internal/activator/seedfleet_linux_test.go
+++ b/internal/activator/seedfleet_linux_test.go
@@ -364,6 +364,38 @@ func TestFleetFileSeedReplicaWithMarkerRestoresAndReportsPlaced(t *testing.T) {
}
}
+// The proof of a seed's own placement is taken under the start rule: on a
+// labelled row, a copy that is not kept under the row's current assignment
+// is set aside (never deleted) before it can count. With the proof gone the
+// replica is refused, and nothing is restored.
+func TestFleetFileSeedOwnPlacementIsJudgedUnderTheStartRule(t *testing.T) {
+ r := fleetFileSeedRig(t, false)
+ r.ownReplica(t, true)
+ r.writePlaced(t)
+ r.rt.Assigned = assignB
+ writeAssignedMarker(t, r.rt.DBPath, assignA) // kept under another assignment
+ fresh, err := r.b.Restore(context.Background(), r.rt)
+ requireRefusal(t, fresh, err, "a copy of data already exists")
+ if r.restored != 0 || !reflect.DeepEqual(r.failed, []string{provision.SeedCodeCopyExists}) {
+ t.Fatalf("restored %d, failed %q; want nothing restored and one copy-exists", r.restored, r.failed)
+ }
+ if _, err := os.Lstat(r.rt.DBPath); !os.IsNotExist(err) {
+ t.Fatalf("the copy under the old assignment is still at the row's path: %v", err)
+ }
+ if names := supersededEntries(t, r.b, r.rt.Host); len(names) != 1 {
+ t.Fatalf("set-aside entries %q; want the copy moved aside, not deleted", names)
+ }
+ // Kept under the current assignment, it is this seed's own placement.
+ k := fleetFileSeedRig(t, false)
+ k.ownReplica(t, true)
+ k.writePlaced(t)
+ k.rt.Assigned = assignA
+ writeAssignedMarker(t, k.rt.DBPath, assignA)
+ if fresh, err := k.b.Restore(context.Background(), k.rt); err != nil || fresh || len(k.failed) != 0 {
+ t.Fatalf("kept copy: fresh %v, %v, failed %q", fresh, err, k.failed)
+ }
+}
+
// R3-2: a matching marker does not bound what a restore would read while
// anything is staged, so a retry with staged objects is refused before the
// replica question is even asked. Nothing is promoted, nothing restored.
diff --git a/internal/activator/seedplace.go b/internal/activator/seedplace.go
index 95056688d..0781dadca 100644
--- a/internal/activator/seedplace.go
+++ b/internal/activator/seedplace.go
@@ -214,12 +214,25 @@ func (b *ExecBackend) seededRestore(ctx context.Context, rt registry.Route, src
return fail(fmt.Errorf("seed fallback for %s: cannot tell whether it has a replica of its own: %w", host, err))
}
if has {
- // On a fleet the replica is this seed's only with its marker to
- // prove it (R2-2). Without, nothing is restored.
+ // On a fleet the replica is this seed's only when this seed's own
+ // placement, the database with its marker, is still at the row's
+ // path (R2-2, fleetSeedNotOwn). Without, nothing is restored.
+ //
+ // That is a decision to keep a local copy, so it is made under the
+ // start rule like the one further down: an earlier seed command's
+ // obligation is answered first, and a labelled row's copy that is
+ // not kept under its current assignment is set aside before it can
+ // count as proof. restoreOwn then asks startAllowed for the copy.
if fleet {
- if err := fleetSeedReplicaRefusal(host, src.ID, paths.dbPath); err != nil {
+ if err := b.settleSeedObligation(ctx, rt, paths.dbPath); err != nil {
return fail(err)
}
+ if err := b.reconcileAssignment(rt, paths.dbPath); err != nil {
+ return fail(err)
+ }
+ if placed, err := seedPlacedAt(dir, base, src.ID); err != nil || !placed {
+ return fail(fleetSeedNotOwn(host, paths.dbPath, err))
+ }
}
if _, err := restoreOwn(); err != nil {
return false, err
diff --git a/internal/activator/startrule_test.go b/internal/activator/startrule_test.go
index 6bcad88ff..20cb0362e 100644
--- a/internal/activator/startrule_test.go
+++ b/internal/activator/startrule_test.go
@@ -961,8 +961,10 @@ func TestEveryFreshBootPathConsultsTheRule(t *testing.T) {
}
}
}
- // The guard must be looking at the real call sites.
- for _, name := range []string{"restorePlain", "seededRestore"} {
+ // The guard must be looking at the real call sites. The plain restore's
+ // body is restorePlainStaging (restorePlain is its one-line wrapper,
+ // staging on), so that is where its sink is.
+ for _, name := range []string{"restorePlainStaging", "seededRestore"} {
if _, ok := sinkFuncs[name]; !ok {
t.Fatalf("the guard found no fresh-boot sink in %s: the sink names moved (%v)", name, sinkFuncs)
}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 6c1441e9c..0af9c5c7a 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -266,4 +266,4 @@ plan14-root-reads-replica-wake-gap-ch.tsv 6c3e03c493dbca78fc128355f071caa2b2d5f2
plan14-root-reads-plan-domains-2a.tsv 89f2b0e097f2de04bcef403f0b4aaa7a56a17dc7d0000a87993f033e268fc2fa
plan14-root-reads-edge-held-cap.tsv f06c832e5595b5a0c256639131d094a94da4505d0e64586813c357cb7eea8f33
plan14-root-reads-fleet-seeded-create-1.tsv 5ce0990b80e0447439484d36a7a87af70708aa5ce113491aecc09d87167277f0
-plan14-root-reads-fleet-seeded-create-2.tsv 2e93b15609a094377beb6f17c865ba4407fcde9730755e91af0a3c9fba42d855
+plan14-root-reads-fleet-seeded-create-2.tsv 8a0a9cca336d3e695b79990a9aeda17f5ee8d74908752944f7dcd129918c80fc
diff --git a/internal/provision/testdata/plan14-root-reads-fleet-seeded-create-2.tsv b/internal/provision/testdata/plan14-root-reads-fleet-seeded-create-2.tsv
index edc280f77..d7515b8f1 100644
--- a/internal/provision/testdata/plan14-root-reads-fleet-seeded-create-2.tsv
+++ b/internal/provision/testdata/plan14-root-reads-fleet-seeded-create-2.tsv
@@ -21,7 +21,7 @@
@legacy e64451f8f6fc7dc141d462b46f5ab381ddddc59106089895c370f0ab8898402d internal/activator/seedplace.go ExecBackend.fetchSeed legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): copies seeds/<host>/<id>/snapshot.db into the instance's own directory, checking length and sha256 against the row as it writes;rev3=census-ruling-fleet-seeded-create-2;basis=Takes the route and opens the snapshot with rt.Account, rt.App, rt.Host (a fleet reader's key needs them). Adds only the account and app route fields to the read set; the object read, length and sha256 limits are unchanged. file:Open@161,file:Stat@582,registry:Account@179,registry:App@191,registry:Host@141 08cc1b9a9c4f298c04ba898dcf653a9c7898f785247daf2116c9aa71f8f6563a
@legacy ad5249a5662af0dff51ad72ea6c95b2f86a48af1ef5da202e4cbd6f31e3b28b4 internal/host/seedwiring.go wireSeedPlacement legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): hands the seed callback the box's lifetime judge (seedBox.Judge); read sites unchanged, offsets moved;rev3=census-ruling-agent-start-demo-3;basis=Install the pre-wake demo-claim seed admission check beside existing seed placement hooks. Census read-site delta: unchanged (1).;rev3=census-ruling-fleet-seeded-create-2;basis=On a fleet box (CARLOS_FLEET resolves) it sets eb.CustomerFleet, whether or not the door wires, so the fleet placement rules hold on a box that lost its door (which then has no seed reader and places nothing); with the door it arms the door client and armFleetSeeds. Reads the fleet identity and CARLOS_TUNNEL_URL/TOKEN from the environment through Getenv. The RemoveLocal hook now calls eb.PurgeSeedLocalFor(rt), where the DBPath read went. whole:Route@1664 051932a248eca11196782309c154433a2e7a74c11f11fe1c28411466aab8c127
@legacy 2fc27e5e12fa77277eaa91ac2f84285ab890e2ba8af8476afe8988dbc8928a23 internal/activator/backend_exec.go ExecBackend.restorePlain legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): body of the frozen ExecBackend.Restore, which is now its dispatcher, with the seed marker reconciled before the warm-cache check; same staging fallback and replica restore;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: first asks haRestore(ctx, rt) (+whole:Route x2: rt to haRestore and to restoreHA); an HA host restores through restoreHA (hawake.go, a new unit) and never through the warm cache or the staging fallback; an error there fails the restore; a non-HA host takes the unchanged path;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 3, rule 6 start rule): the +whole:Route sites are calls taking rt: reconcileAssignment before the seed-marker check (a labelled row's copy not kept under rt.Assigned is moved into <DataDir>/.superseded/<host>/, never deleted), startAllowed on the warm-cache, restored and fresh paths (a labelled row may refuse with ErrNothingToRestore), and establishAssignment after a restore and before a fresh boot (writes the <db>.assigned marker). Task 6a's record clear after a restore is removed. An unlabelled row (Assigned "") takes none of these. Agent, not root; it refuses more, never less.;rev3=census-ruling-ha-generations;basis=storage generations: an HA host's restore is dispatched to restoreHAWake (generations-aware) instead of restoreHA directly; Task 7: promoteStagedReplica refuses a host with head.json before promotion; read sites unchanged;rev3=census-ruling-fleet-seeded-create-2;basis=Now a one-line wrapper in the same file: restorePlainStaging(ctx, rt, true). Its body moved, whole, to restorePlainStaging below it (an extraction, not a deletion: nothing it checked is gone). Reads only rt (whole:Route), passing it on; no read of its own. Every caller but a fleet file seed's retry still reaches the same body with the staging fallback on. whole:Route@126 916c071c395df4780429c0607431c8a2ac8dc6736aa8f309d6546a0802b5693a
-@legacy 61f88208af68f896efae42b2f7092bafb7c7182768a2658467f7ab29b1388473 internal/activator/seedplace.go ExecBackend.seededRestore legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the seed fallback on the plain restore path: the host's own replica if it has one, else the file an earlier wake placed, else the snapshot; never reports fresh; every file through instancefs; fetches no snapshot under the claim flag;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 3, start rule): reconcileAssignment after settleSeedObligation; startAllowed before keeping a placed seed and before placing one; on a labelled row (rt.Assigned set) a local copy still at the path is set aside (localCopyNames, supersede) before the placement's purge; establishAssignment after placement. +registry:Assigned and +whole:Route are these calls. Unlabelled rows unchanged. Agent, not root; it refuses more and deletes less.;rev3=census-ruling-agent-start-demo-3;basis=Refuse unfinished claim seeds and check the current operation-bound destination record under its lease before wake. Census read-site delta: +whole:Route.;rev3=census-ruling-fleet-seeded-create-2;basis=Fleet file seeds: (1) refuses a flat layout for every seed (paths.layout != LayoutNested, nested only); (2) on a fleet file seed not yet placed lists moves/<host>/ through b.Mirror.List (fleetSeedStagingRefusal) before the replica question, and refuses if anything is staged or the listing fails; (3) when the host has a replica, reads the <db>.seed marker (ReadSeedMarker, a nofollow read of the marker beside the database) and restores only if it names this seed; (4) restores with staging promotion off; (5) reports a coded failure through reportSeedFailure; (6) purges via purgeSeedTarget's held-descriptor PurgeProven. The route reads (+whole:Route x2) are passing rt on to placeSeed and PurgeSeedLocalFor. The agent as carlos, not root; every path it names comes from the registry row, not from a tenant. registry:Assigned@6277,registry:Host@121,whole:Route@1105,whole:Route@1868,whole:Route@2056,whole:Route@2826,whole:Route@342,whole:Route@4555,whole:Route@5144,whole:Route@5427,whole:Route@5772,whole:Route@6823,whole:Route@7317,whole:Route@7476 619dfd08446999d0740a069891d04653ae2a2472862a80bca52b0222a781d229
+@legacy 9293458a1ff628f426f58fbb140e9b546c54ff86a0cb8d790185975aa72fd1c7 internal/activator/seedplace.go ExecBackend.seededRestore legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the seed fallback on the plain restore path: the host's own replica if it has one, else the file an earlier wake placed, else the snapshot; never reports fresh; every file through instancefs; fetches no snapshot under the claim flag;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 3, start rule): reconcileAssignment after settleSeedObligation; startAllowed before keeping a placed seed and before placing one; on a labelled row (rt.Assigned set) a local copy still at the path is set aside (localCopyNames, supersede) before the placement's purge; establishAssignment after placement. +registry:Assigned and +whole:Route are these calls. Unlabelled rows unchanged. Agent, not root; it refuses more and deletes less.;rev3=census-ruling-agent-start-demo-3;basis=Refuse unfinished claim seeds and check the current operation-bound destination record under its lease before wake. Census read-site delta: +whole:Route.;rev3=census-ruling-fleet-seeded-create-2;basis=Fleet file seeds: (1) refuses a flat layout for every seed (paths.layout != LayoutNested, nested only); (2) on a fleet file seed not yet placed lists moves/<host>/ through b.Mirror.List (fleetSeedStagingRefusal) before the replica question, and refuses if anything is staged or the listing fails; (3) when the host has a replica, accepts it as this seed's only when this seed's own placement is still at the row's path: the marker naming this seed together with the database, both read through seedPlacedAt (instancefs, no symlink followed). A marker alone, another seed's, or either unreadable refuses (copy-exists) and nothing is restored. That probe runs under the start rule, after settleSeedObligation and reconcileAssignment (a labelled row's copy not kept under its assignment is set aside first), and the kept copy then passes startAllowed in the restore; (4) restores with staging promotion off; (5) reports a coded failure through reportSeedFailure; (6) purges via purgeSeedTarget's held-descriptor PurgeProven. The route reads (+whole:Route x4) are rt passed on: to placeSeed, to reportSeedFailure, and to the two start-rule calls before the own-placement probe (settleSeedObligation, reconcileAssignment), both of which it already made further down for every seed. The agent as carlos, not root; every path it names comes from the registry row, not from a tenant. registry:Assigned@6940,registry:Host@121,whole:Route@1105,whole:Route@1868,whole:Route@2056,whole:Route@2826,whole:Route@342,whole:Route@4830,whole:Route@4923,whole:Route@5218,whole:Route@5807,whole:Route@6090,whole:Route@6435,whole:Route@7486,whole:Route@7980,whole:Route@8139 856eddb5a454191e82f47164b8de84280549804cec7a35f0b1db6caca8ec2b4a
internal/activator/hawake.go ExecBackend.haRestorePrelude legacy accepted-legacy accepted-legacy;rev3=census-ruling-ha-generations;basis=new (Task 5): the containment, seed-obligation and seed-marker checks restoreHA already ran, factored out for both restore paths; same reads;rev3=census-ruling-fleet-seeded-create-2;basis=Passes the instance's layout (p.layout, from the path set this backend already computed) as a new third argument to reconcileSeedMarker; no read added, and the reads are the same four. The agent as carlos, not root. whole:Route@112,whole:Route@183,whole:Route@226,whole:Route@298 ae0690ce5183fba14432d9cda1c1863f62f2b54a39c4c7381befe85a17b548c8
internal/activator/seedplace.go reconcileSeedMarker legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): on the plain restore path, removes a database whose marker names a seed that is not the row's own, before it can count as a warm cache;rev3=census-ruling-fleet-seeded-create-2;basis=Takes the layout as a parameter and passes layout==LayoutNested to purgeSeedTarget, so the old-style .seed-sd_*.tmp names are removed only from a nested directory. Its own reads (the marker, the directory) are unchanged; the purge it calls now goes through instancefs.PurgeProven. The agent as carlos, not root. registry:Host@297,registry:Host@624,registry:Host@767,registry:SeedSource@340 a6c700aea3515a6bbbe1a276932d24c3d010239fbbbfb5b963cf6370664da357
internal/activator/seedplace.go type SeedObjects legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): declaration only; Open is the interface's method name, not a file open;rev3=census-ruling-fleet-seeded-create-2;basis=Declaration only: Open gains the account and app (acct, app, host, id), which a customer-fleet reader needs to build apps/<acct>/<app>/seeds/<host>/<id>/snapshot.db; a region reader ignores them. Open is the interface's method name, not a file open. No read. file:Open@30 5977483bf8747b733b5ce3f38c45ec03789d6f18fcacd1735dca1d578514ff59
@@ -43,12 +43,12 @@ internal/provision/seedfleet.go rollbackFleetFileSeed legacy accepted-legacy acc
internal/activator/seedplace.go ExecBackend.fetchSeed legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): copies seeds/<host>/<id>/snapshot.db into the instance's own directory, checking length and sha256 against the row as it writes;rev3=census-ruling-fleet-seeded-create-2;basis=Takes the route and opens the snapshot with rt.Account, rt.App, rt.Host (a fleet reader's key needs them). Adds only the account and app route fields to the read set; the object read, length and sha256 limits are unchanged. file:Open@161,file:Stat@582,registry:Account@179,registry:App@191,registry:Host@141 08cc1b9a9c4f298c04ba898dcf653a9c7898f785247daf2116c9aa71f8f6563a
internal/host/seedwiring.go wireSeedPlacement legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): hands the seed callback the box's lifetime judge (seedBox.Judge); read sites unchanged, offsets moved;rev3=census-ruling-agent-start-demo-3;basis=Install the pre-wake demo-claim seed admission check beside existing seed placement hooks. Census read-site delta: unchanged (1).;rev3=census-ruling-fleet-seeded-create-2;basis=On a fleet box (CARLOS_FLEET resolves) it sets eb.CustomerFleet, whether or not the door wires, so the fleet placement rules hold on a box that lost its door (which then has no seed reader and places nothing); with the door it arms the door client and armFleetSeeds. Reads the fleet identity and CARLOS_TUNNEL_URL/TOKEN from the environment through Getenv. The RemoveLocal hook now calls eb.PurgeSeedLocalFor(rt), where the DBPath read went. whole:Route@1664 051932a248eca11196782309c154433a2e7a74c11f11fe1c28411466aab8c127
internal/activator/backend_exec.go ExecBackend.restorePlain legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): body of the frozen ExecBackend.Restore, which is now its dispatcher, with the seed marker reconciled before the warm-cache check; same staging fallback and replica restore;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: first asks haRestore(ctx, rt) (+whole:Route x2: rt to haRestore and to restoreHA); an HA host restores through restoreHA (hawake.go, a new unit) and never through the warm cache or the staging fallback; an error there fails the restore; a non-HA host takes the unchanged path;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 3, rule 6 start rule): the +whole:Route sites are calls taking rt: reconcileAssignment before the seed-marker check (a labelled row's copy not kept under rt.Assigned is moved into <DataDir>/.superseded/<host>/, never deleted), startAllowed on the warm-cache, restored and fresh paths (a labelled row may refuse with ErrNothingToRestore), and establishAssignment after a restore and before a fresh boot (writes the <db>.assigned marker). Task 6a's record clear after a restore is removed. An unlabelled row (Assigned "") takes none of these. Agent, not root; it refuses more, never less.;rev3=census-ruling-ha-generations;basis=storage generations: an HA host's restore is dispatched to restoreHAWake (generations-aware) instead of restoreHA directly; Task 7: promoteStagedReplica refuses a host with head.json before promotion; read sites unchanged;rev3=census-ruling-fleet-seeded-create-2;basis=Now a one-line wrapper in the same file: restorePlainStaging(ctx, rt, true). Its body moved, whole, to restorePlainStaging below it (an extraction, not a deletion: nothing it checked is gone). Reads only rt (whole:Route), passing it on; no read of its own. Every caller but a fleet file seed's retry still reaches the same body with the staging fallback on. whole:Route@126 916c071c395df4780429c0607431c8a2ac8dc6736aa8f309d6546a0802b5693a
-internal/activator/seedplace.go ExecBackend.seededRestore legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the seed fallback on the plain restore path: the host's own replica if it has one, else the file an earlier wake placed, else the snapshot; never reports fresh; every file through instancefs; fetches no snapshot under the claim flag;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 3, start rule): reconcileAssignment after settleSeedObligation; startAllowed before keeping a placed seed and before placing one; on a labelled row (rt.Assigned set) a local copy still at the path is set aside (localCopyNames, supersede) before the placement's purge; establishAssignment after placement. +registry:Assigned and +whole:Route are these calls. Unlabelled rows unchanged. Agent, not root; it refuses more and deletes less.;rev3=census-ruling-agent-start-demo-3;basis=Refuse unfinished claim seeds and check the current operation-bound destination record under its lease before wake. Census read-site delta: +whole:Route.;rev3=census-ruling-fleet-seeded-create-2;basis=Fleet file seeds: (1) refuses a flat layout for every seed (paths.layout != LayoutNested, nested only); (2) on a fleet file seed not yet placed lists moves/<host>/ through b.Mirror.List (fleetSeedStagingRefusal) before the replica question, and refuses if anything is staged or the listing fails; (3) when the host has a replica, reads the <db>.seed marker (ReadSeedMarker, a nofollow read of the marker beside the database) and restores only if it names this seed; (4) restores with staging promotion off; (5) reports a coded failure through reportSeedFailure; (6) purges via purgeSeedTarget's held-descriptor PurgeProven. The route reads (+whole:Route x2) are passing rt on to placeSeed and PurgeSeedLocalFor. The agent as carlos, not root; every path it names comes from the registry row, not from a tenant. registry:Assigned@6277,registry:Host@121,whole:Route@1105,whole:Route@1868,whole:Route@2056,whole:Route@2826,whole:Route@342,whole:Route@4555,whole:Route@5144,whole:Route@5427,whole:Route@5772,whole:Route@6823,whole:Route@7317,whole:Route@7476 619dfd08446999d0740a069891d04653ae2a2472862a80bca52b0222a781d229
+internal/activator/seedplace.go ExecBackend.seededRestore legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the seed fallback on the plain restore path: the host's own replica if it has one, else the file an earlier wake placed, else the snapshot; never reports fresh; every file through instancefs; fetches no snapshot under the claim flag;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 3, start rule): reconcileAssignment after settleSeedObligation; startAllowed before keeping a placed seed and before placing one; on a labelled row (rt.Assigned set) a local copy still at the path is set aside (localCopyNames, supersede) before the placement's purge; establishAssignment after placement. +registry:Assigned and +whole:Route are these calls. Unlabelled rows unchanged. Agent, not root; it refuses more and deletes less.;rev3=census-ruling-agent-start-demo-3;basis=Refuse unfinished claim seeds and check the current operation-bound destination record under its lease before wake. Census read-site delta: +whole:Route.;rev3=census-ruling-fleet-seeded-create-2;basis=Fleet file seeds: (1) refuses a flat layout for every seed (paths.layout != LayoutNested, nested only); (2) on a fleet file seed not yet placed lists moves/<host>/ through b.Mirror.List (fleetSeedStagingRefusal) before the replica question, and refuses if anything is staged or the listing fails; (3) when the host has a replica, accepts it as this seed's only when this seed's own placement is still at the row's path: the marker naming this seed together with the database, both read through seedPlacedAt (instancefs, no symlink followed). A marker alone, another seed's, or either unreadable refuses (copy-exists) and nothing is restored. That probe runs under the start rule, after settleSeedObligation and reconcileAssignment (a labelled row's copy not kept under its assignment is set aside first), and the kept copy then passes startAllowed in the restore; (4) restores with staging promotion off; (5) reports a coded failure through reportSeedFailure; (6) purges via purgeSeedTarget's held-descriptor PurgeProven. The route reads (+whole:Route x4) are rt passed on: to placeSeed, to reportSeedFailure, and to the two start-rule calls before the own-placement probe (settleSeedObligation, reconcileAssignment), both of which it already made further down for every seed. The agent as carlos, not root; every path it names comes from the registry row, not from a tenant. registry:Assigned@6940,registry:Host@121,whole:Route@1105,whole:Route@1868,whole:Route@2056,whole:Route@2826,whole:Route@342,whole:Route@4830,whole:Route@4923,whole:Route@5218,whole:Route@5807,whole:Route@6090,whole:Route@6435,whole:Route@7486,whole:Route@7980,whole:Route@8139 856eddb5a454191e82f47164b8de84280549804cec7a35f0b1db6caca8ec2b4a
@remove internal/activator/seedplace.go PurgeSeedLocal
@removed internal/activator/seedplace.go PurgeSeedLocal H3 census-ruling-fleet-seeded-create-2;basis=Now PurgeSeedLocal(dataDir, dbPath, layout): resolves the directory beneath dataDir (or its parent when outside) and calls instancefs.PurgeProven with provision.SeedLocalName(base, nested); the former Lstat and purgeSeedTarget reads are inside PurgeProven, so the unit reads nothing itself now. Absent directory is still done; a path that was replaced is ErrNotProven.
@remove internal/activator/seedplace.go purgeSeedTarget
@removed internal/activator/seedplace.go purgeSeedTarget H3 census-ruling-fleet-seeded-create-2;basis=Now purgeSeedTarget(dir, base, legacyTemps): one call to instancefs.PurgeProven(dir, ".", SeedLocalName(base, legacyTemps)) in place of os.ReadDir plus RemoveAllBeneath. The directory is opened once, no symlink followed, and held; so the unit reads nothing itself. Matches only this database's names and, for a nested directory, the old .seed-sd_ temps.
-@coverage internal/activator b1c873cba97d495771d8dd9efc2770e664300b0ee5b816e5428b31e702a8ee00
+@coverage internal/activator a198a58bcb7ef31a9f1e2e3b00bfaf17b3775deadfe2968db5fb5597a9d399bd
@coverage internal/edge 727e9ed36fefd795dff2e170cfa214af78b21ee1df2d390ee34337c94ebb49aa
@coverage internal/host 6bc00f3cdafec5ebc9040e07fd74a401c46e2c008130051cdfb696b4e0da6ecc
@coverage internal/instancefs e505af631611b9e1c9c7c368f988db28b0c5fa9e524043342d1a158853f42cc5