carlos / platform Public

census and note: H3-M6 round 2 re-pins; box owner binding design

Root-read overlay sec-h3-m6-leftover-host: seededRestore's new refusal
and the unattributedLocalData helper (agent, Lstat only), envelope
internal/activator re-pinned. Record-write census: the Phase 1 move door
re-pinned (an earlier refusal, no new write).

The note docs/superpowers/notes/2026-11-30-h3-m6-box-owner-binding.md
sets out the box-side owner stamp the console rules cannot replace.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 86c9582c7808d88ac611497d7b8335ac5b2b4b86 parent 6d0ca27
6 files changed, +140 −1
  • docs/superpowers/notes/2026-11-30-h3-m6-box-owner-binding.md +79 −0
  • docs/superpowers/notes/census-proposal-sec-h3-m6-leftover-host.md +23 −0
  • internal/provision/h3m6_leftover_census_test.go +28 −0
  • internal/provision/plan9_b8_census_test.go +1 −1
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-sec-h3-m6-leftover-host.tsv +8 −0
diff --git a/docs/superpowers/notes/2026-11-30-h3-m6-box-owner-binding.md b/docs/superpowers/notes/2026-11-30-h3-m6-box-owner-binding.md
new file mode 100644
index 000000000..7802d3425
--- /dev/null
+++ b/docs/superpowers/notes/2026-11-30-h3-m6-box-owner-binding.md
@@ -0,0 +1,79 @@
+# H3-M6: binding a host's data to its owner on the box
+
+Status: design note for a decision, not built. The console closes the member
+routes; this covers what it cannot.
+
+## The gap
+
+A box treats data as belonging to a host by its name alone. A replica at
+`instances/<host>`, staging at `moves/<host>/`, and a local database at the
+row's path all carry only the hostname. When a record is deleted, its data is
+kept on purpose. When a new record later takes the same host, whatever app or
+account it belongs to, it gets that data:
+
+- `restorePlainStaging` returns any local database as a warm cache, then
+ restores the host's prefix if there is no local database.
+- A move of an instance that never woke stages nothing, so the target restores
+ its own prefix (activator `TestH3M6MoveOfANeverWokenHostLandsOnTheTargetsLeftover`).
+- Someone who can write to the record bucket can publish a record for any host
+ without going through the console's refusals. The box then restores that
+ host's data for them. Lease ownership names a box and process, not an
+ account or app.
+
+The console's rules only stop a member, and cost a blanket 409 wherever the
+history is not active.
+
+## What the stamp binds
+
+Every data location gets one owner stamp, written once by the box that first
+creates data there:
+
+- `RecordKey(account, app, host)`, the record's identity.
+- The lifetime: the record's incarnation (`hostclaim.Incarnation`, from
+ account, app, host and created_at), so a deleted and re-created record with
+ the same key is a different owner. A restore names the lifetime it brings
+ back (`restoreProof`).
+- Where it lives: `instances/<host>/owner.json` beside the replica (and inside
+ each generation for HA), `moves/<host>/owner.json` copied with the staging,
+ and `<db>.owner` beside a local database, next to the `.seed` and `.assigned`
+ markers.
+
+A record-bucket writer must not be able to forge the stamp, so it lives in
+the data bucket and is signed with the box identity (`boxid`) or the secrets
+key.
+
+## Where the box checks it
+
+Missing or mismatched means refuse, and nothing is ever deleted:
+
+1. In `restorePlainStaging`, before a local database counts as a warm cache,
+ and before restoring the prefix.
+2. When a warm cache is returned on any path, the seed fallback's own-replica
+ restore included.
+3. In seed placement (`seededRestore`), in place of the refusal on unattributed
+ data that this branch adds.
+4. When a move lands (legacy promotion, offline and Phase 1 landings): the
+ staged stamp and any target-prefix stamp must name the landing record.
+
+An unstamped location is pre-rollout data: adopted by its live record in step
+2, refused after that.
+
+## Rollout order
+
+1. Boxes write stamps for every live record's locations, and check nothing yet.
+ Each box reports how many stamps it wrote and how many it is missing.
+2. A one-off pass stamps every live record's data, then lists the data left by
+ deleted records. That data stays unstamped and so becomes unclaimable.
+3. Boxes enforce the stamps, region by region. Dev goes first.
+4. The console lifts its blanket refusals (below).
+
+## What it would let us lift
+
+- The out-of-sight 409 on creates and moves (round 1 and round 2), on every
+ console, whatever its history mode. This includes claim and Phase 1 consoles,
+ which cannot activate the history.
+- The refusal of pooled and no-bucket creates proposed in round 2. This branch
+ has not built it: see the round-2 report.
+- An app re-creating its own deleted host: the stamp's lifetime chain gives the
+ provenance that a hostname mark cannot.
+- The in-region leftover check would stay only as a fast early answer.
diff --git a/docs/superpowers/notes/census-proposal-sec-h3-m6-leftover-host.md b/docs/superpowers/notes/census-proposal-sec-h3-m6-leftover-host.md
new file mode 100644
index 000000000..e143a897f
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-sec-h3-m6-leftover-host.md
@@ -0,0 +1,23 @@
+# Census approval: sec-h3-m6-leftover-host
+
+Ruling `census-ruling-sec-h3-m6-leftover-host`. The independent reviewer approves or rejects every change below, 1 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `internal/activator/seedplace.go` `ExecBackend.seededRestore` | sites | +registry:Assigned | H3-M6 round 2: on an unlabelled row with no own replica, after the placed check and before the purge, asks unattributedLocalData (Lstat of the database, WAL, SHM and both litestream meta dirs at the row's path, beside instancefs; symlinks are not data and are not followed) and refuses the wake (seedOverUnattributedData) when any is present, instead of purging it. +registry:Assigned is the new rt.Assigned == "" guard. The agent as carlos, not root; it refuses more and deletes less; every path comes from the registry row. |
+
+Envelopes re-pinned: `internal/activator`.
+
+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/activator/seedplace.go` `ExecBackend.seededRestore`: legacy, task accepted-legacy. Basis: 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.
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- new `internal/activator/seedplace.go:unattributedLocalData`: reads +file:Lstat; written legacy, accepted-legacy, frozen
+
+Seal: `0fdff597ef83fb9966e07c70b4283001eb97f7dfa71a83a19bde92382192eb6b` → `94f1ad1843a06f443e004c3066489a6f230a2fdc3a39be254696a3c539f8f97e`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-sec-h3-m6-leftover-host.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/provision/h3m6_leftover_census_test.go b/internal/provision/h3m6_leftover_census_test.go
new file mode 100644
index 000000000..abe972395
--- /dev/null
+++ b/internal/provision/h3m6_leftover_census_test.go
@@ -0,0 +1,28 @@
+package provision
+
+// Hunt H3-M6 round 2 re-pins one console writer on the existing chain.
+// Class and key sites stay unchanged. handleAPIInstanceMoveRequest
+// (Phase 1 branch) now asks moveLeftoverRefusal, a read of the held
+// hostname-history mode, right after the "already in" refusal and before
+// any policy read, claim CAS or SetRecordMove: it can only refuse earlier,
+// and writes nothing new.
+func h3m6LeftoverWriteCensusInventory() []censusEntry {
+ entries := append([]censusEntry(nil), publicShareWriteCensusInventory()...)
+ for _, r := range []censusEntry{
+ {"internal/console/apiinstancemove.go", "Server.handleAPIInstanceMoveRequest", "record-writer", "key:SetRecordMove,lit:instances", "819068ea4344a42474287466278cdf8b264713e6c2164ed1cb80f6859c9282c2"},
+ } {
+ found := false
+ for i, e := range entries {
+ if e.File == r.File && e.Unit == r.Unit {
+ if e.Class != r.Class || e.Kinds != r.Kinds {
+ panic("h3-m6 re-pin changes class or kinds: " + r.File + ":" + r.Unit)
+ }
+ entries[i], found = r, true
+ }
+ }
+ if !found {
+ panic("h3-m6 re-pin of an unlisted unit: " + r.File + ":" + r.Unit)
+ }
+ }
+ return entries
+}
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go
index b3bb922b0..61258b885 100644
--- a/internal/provision/plan9_b8_census_test.go
+++ b/internal/provision/plan9_b8_census_test.go
@@ -366,7 +366,7 @@ func TestPlan9B8RecordWriteCensus(t *testing.T) {
if len(got) < 100 {
t.Fatalf("census found only %d units under %s; the walk is broken", len(got), root)
}
- inventory := publicShareWriteCensusInventory()
+ inventory := h3m6LeftoverWriteCensusInventory()
problems := append(censusDiff(inventory, got), censusPolicy(inventory)...)
if len(problems) > 0 {
t.Fatalf("record-write census rejected %d site(s); update the explicit inventory only after reviewing the source:\n %s", len(problems), strings.Join(problems, "\n "))
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 6e51bfc67..eaa7f362e 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -312,3 +312,4 @@ plan14-root-reads-moved-at-floor-v0-44-1.tsv ed1957bc7d18714e39984e757b73b8c590f
plan14-root-reads-gvisor-slice2-explicit-mode.tsv ed1957bc7d18714e39984e757b73b8c590f1a2a924ca35e20e9041fc09f2ca78
plan14-root-reads-public-share.tsv ed1957bc7d18714e39984e757b73b8c590f1a2a924ca35e20e9041fc09f2ca78
plan14-root-reads-gvisor-slice3-containment.tsv 0fdff597ef83fb9966e07c70b4283001eb97f7dfa71a83a19bde92382192eb6b
+plan14-root-reads-sec-h3-m6-leftover-host.tsv 94f1ad1843a06f443e004c3066489a6f230a2fdc3a39be254696a3c539f8f97e
diff --git a/internal/provision/testdata/plan14-root-reads-sec-h3-m6-leftover-host.tsv b/internal/provision/testdata/plan14-root-reads-sec-h3-m6-leftover-host.tsv
new file mode 100644
index 000000000..ae912c52b
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-sec-h3-m6-leftover-host.tsv
@@ -0,0 +1,8 @@
+# Census overlay sec-h3-m6-leftover-host, written by census-propose (#369). census-ruling-sec-h3-m6-leftover-host, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-sec-h3-m6-leftover-host.md.
+# 0 body, 1 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 1 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+@legacy 24d42c5aaa9513627fea5630d8c41c4662467afa67cb94bbaf7bee2a0e33b75b internal/activator/seedplace.go unattributedLocalData legacy accepted-legacy accepted-legacy;rev3=census-ruling-sec-h3-m6-leftover-host;basis=New helper (H3-M6 round 2): os.Lstat of five fixed names under the row's instance directory (dir, base from pathsFor(rt).dbPath); never opens, reads or follows anything; returns the first non-symlink entry's name, or an error, which refuses the wake. Agent, not root. file:Lstat@202 98cc77399380f84a2df63ce21bb68abbdb3aec99b01302d35ceee4d3baa09c32
+@legacy f17353a0c2ab09c7737bcf9dae6b9d2dd88066c5ac1beb795c16b460da525982 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.;rev3=census-ruling-sec-h3-m6-leftover-host;basis=H3-M6 round 2: on an unlabelled row with no own replica, after the placed check and before the purge, asks unattributedLocalData (Lstat of the database, WAL, SHM and both litestream meta dirs at the row's path, beside instancefs; symlinks are not data and are not followed) and refuses the wake (seedOverUnattributedData) when any is present, instead of purging it. +registry:Assigned is the new rt.Assigned == "" guard. The agent as carlos, not root; it refuses more and deletes less; every path comes from the registry row. registry:Assigned@7187,registry:Assigned@7758,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@8304,whole:Route@8798,whole:Route@8957 dd36b56ff577046ed4b63f1eb06be6a13e690be05830e2fcd27feede7a401111
+internal/activator/seedplace.go unattributedLocalData legacy accepted-legacy accepted-legacy;rev3=census-ruling-sec-h3-m6-leftover-host;basis=New helper (H3-M6 round 2): os.Lstat of five fixed names under the row's instance directory (dir, base from pathsFor(rt).dbPath); never opens, reads or follows anything; returns the first non-symlink entry's name, or an error, which refuses the wake. Agent, not root. file:Lstat@202 98cc77399380f84a2df63ce21bb68abbdb3aec99b01302d35ceee4d3baa09c32
+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.;rev3=census-ruling-sec-h3-m6-leftover-host;basis=H3-M6 round 2: on an unlabelled row with no own replica, after the placed check and before the purge, asks unattributedLocalData (Lstat of the database, WAL, SHM and both litestream meta dirs at the row's path, beside instancefs; symlinks are not data and are not followed) and refuses the wake (seedOverUnattributedData) when any is present, instead of purging it. +registry:Assigned is the new rt.Assigned == "" guard. The agent as carlos, not root; it refuses more and deletes less; every path comes from the registry row. registry:Assigned@7187,registry:Assigned@7758,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@8304,whole:Route@8798,whole:Route@8957 dd36b56ff577046ed4b63f1eb06be6a13e690be05830e2fcd27feede7a401111
+@coverage internal/activator fde9468032229f0a0ff929ee18f35d911fd30bbe9d1953b5353a5024a7b0f6c4