carlos / platform Public

activator: Task 4 review fixes (Fable, two P3s)

P3: POST /v1/mail admits at most two messages per control socket into
the agent at once, the body read included; the next is 429 RATE with
Retry-After 1, and another socket is not held up
(TestMailVerbBoundsInFlightPerSocket).

P3: the agent's mail switch cache opens the deploy store itself and, if
that fails at agent start, retries at most once a minute with an
error-level line each time, instead of leaving every app unswitched for
the agent's life (TestMailSwitchCacheRetriesTheStore).

Census: claims updated, overlay re-proposed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev f471d3e67f0acb89ace4045e8be9c9f031eb5506 parent a1e9de6
10 files changed, +174 −26
  • docs/superpowers/notes/census-claims-platform-mail-submission.tsv +2 −2
  • docs/superpowers/notes/census-proposal-platform-mail-submission.md +2 −2
  • internal/host/agent.go +9 −10
  • internal/host/mailswitch.go +51 −6
  • internal/host/mailswitch_test.go +39 −0
  • internal/mailsubmit/proto.go +5 −0
  • internal/mailsubmit/verb.go +10 −0
  • internal/mailsubmit/verb_test.go +50 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv +5 −5

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/notes/census-claims-platform-mail-submission.tsv b/docs/superpowers/notes/census-claims-platform-mail-submission.tsv
index 9dbd1b252..42fe13fa6 100644
--- a/docs/superpowers/notes/census-claims-platform-mail-submission.tsv
+++ b/docs/superpowers/notes/census-claims-platform-mail-submission.tsv
@@ -36,9 +36,9 @@ internal/activator/backend_exec.go:ExecBackend.spawnChildFrom Task 4: the inline
internal/activator/prepare.go:ExecBackend.listenControl Task 4: the same replacement as spawnChildFrom, with gen as the write fence's generation, so the nested and rootfs listener mounts exactly what the flat one does. Agent, not root.
internal/activator/backend_exec.go:ExecBackend.agentOwnedVars Task 4: also decides CARLOS_MAIL through mailSubmits: set to "submit" only when the control socket bound, the verb is mounted, the app sender's switch is on and the route is Provisioned; stripped otherwise, a tenant-supplied value from fileEnv included. agentOwnedNames and moves.AgentOwnedVars gain it as a pinned pair. Only narrows what a tenant's files can set. Agent, not root.
internal/activator/backend_exec.go:ExecBackend.mailSubmits Task 4, new: the CARLOS_MAIL rule. Reads rt.App, rt.Host, rt.Provisioned and RouteAccount(rt) from the agent's own registry row, and asks b.MailSwitch (the agent's cache of the console-written app sender record, internal/host/mailswitch.go: one bounded Get of apps/<acct>/<app>/email/senders/app.json through the agent's deploy store). Logs once per host at error level for an unprovisioned route of a switched app. Agent, not root; no file read.
-internal/mailsubmit/verb.go:Mount Task 4, new: POST /v1/mail on an instance's control socket. The bearer by the existing verbs' rule (empty or unreadable token refuses everything; SHA-256 constant-time compare); MaxBytesReader(14 MiB), the JSON envelope, base64 raw of at most 10 MiB, 1 to 50 non-empty recipients, a non-empty from, else 400 BAD_REQUEST. Stamps account, app and host from the route the socket was bound for, never from the body, and forwards; a transport error or an answer outside 200/400/403/429/503 is 503 MAILER_UNAVAILABLE. Runs in the agent, as carlos; the body is a tenant's and is only decoded and forwarded, never used to name a path, route or account.
+internal/mailsubmit/verb.go:Mount Task 4, new: POST /v1/mail on an instance's control socket. The bearer by the existing verbs' rule (empty or unreadable token refuses everything; SHA-256 constant-time compare); MaxBytesReader(14 MiB), the JSON envelope, base64 raw of at most 10 MiB, 1 to 50 non-empty recipients, a non-empty from, else 400 BAD_REQUEST; at most 2 messages per socket in the agent at once, the next 429 RATE (review round 1, Task 4 P3). Stamps account, app and host from the route the socket was bound for, never from the body, and forwards; a transport error or an answer outside 200/400/403/429/503 is 503 MAILER_UNAVAILABLE. Runs in the agent, as carlos; the body is a tenant's and is only decoded and forwarded, never used to name a path, route or account.
internal/mailsubmit/forward.go:SocketForwarder.Send Task 4, new: the agent's client to the mailer: one HTTP POST of /v1/send over a fresh dial of the constant /run/carlos-mailer/mailer.sock, 60 s timeout, answer read to at most 64 KiB and decoded. Runs in the agent, as carlos. The socket's directory is root's; the mailer at the other end is a separate uid.
-internal/host/agent.go:runAgent Task 4: sets eb.Mail = mailsubmit.SocketForwarder{} on every box and, when a deploy store opens, eb.MailSwitch to a new mailSwitchCache's On, armed for the serial-move refresh (armedMailSwitch). One more openDeployStore call, as the fleet and coordinator wiring beside it already make. Agent, not root.
+internal/host/agent.go:runAgent Task 4: sets eb.Mail = mailsubmit.SocketForwarder{} on every box, and eb.MailSwitch to a mailSwitchCache's On that opens the deploy store itself through openDeployStore, retried at most once a minute with an error line until it opens (review round 1, Task 4 P3), armed for the serial-move refresh (armedMailSwitch). Agent, not root.
internal/host/agent.go:fastTick Task 4: on a serial move, after the schedule leg, starts the armed mail switch cache's Refresh on its own goroutine (each read bounded at 2 s, overlapping refreshes skipped). It re-reads the app sender records already cached, through the agent's deploy store. Agent, not root; the tick waits on nothing new.
#
# Task 5 (the mailer's send: policy, hygiene, rate, per-box cap, SES).
diff --git a/docs/superpowers/notes/census-proposal-platform-mail-submission.md b/docs/superpowers/notes/census-proposal-platform-mail-submission.md
index e1c7b2b73..6751dbaf5 100644
--- a/docs/superpowers/notes/census-proposal-platform-mail-submission.md
+++ b/docs/superpowers/notes/census-proposal-platform-mail-submission.md
@@ -6,7 +6,7 @@ Ruling `census-ruling-platform-mail-submission`. The independent reviewer approv
|---|---|---|---|
| `internal/host/agent.go` `fastTick` | body | unchanged (1) | Task 4: on a serial move, after the schedule leg, starts the armed mail switch cache's Refresh on its own goroutine (each read bounded at 2 s, overlapping refreshes skipped). It re-reads the app sender records already cached, through the agent's deploy store. Agent, not root; the tick waits on nothing new. |
| `internal/host/agent.go` `provisionTickConfig` | body | unchanged (2) | Task 5: its region, pools and fleet label now come from BoxScopeFromEnv, which is the same three reads moved out unchanged (CARLOS_REGION trimmed, provision.ParseBoxPools(CARLOS_POOLS), and resolveFleetIdentity's label only when its fleet is the one the region places the box on), so the box-local mailer resolves "on this box" by the agent's rule. The ReconcileConfig it returns is field for field what it was. Agent, not root. |
-| `internal/host/agent.go` `runAgent` | body | unchanged (6) | Task 4: sets eb.Mail = mailsubmit.SocketForwarder{} on every box and, when a deploy store opens, eb.MailSwitch to a new mailSwitchCache's On, armed for the serial-move refresh (armedMailSwitch). One more openDeployStore call, as the fleet and coordinator wiring beside it already make. Agent, not root. |
+| `internal/host/agent.go` `runAgent` | body | unchanged (6) | Task 4: sets eb.Mail = mailsubmit.SocketForwarder{} on every box, and eb.MailSwitch to a mailSwitchCache's On that opens the deploy store itself through openDeployStore, retried at most once a minute with an error line until it opens (review round 1, Task 4 P3), armed for the serial-move refresh (armedMailSwitch). Agent, not root. |
| `internal/host/agent.go` `statusLoop` | body | unchanged (6) | Task 3 (plan gap G6 (b)): the status tick also fills Probes.MailerArmed from mailerArmed(mailwire.MailerSocket, 2s): a stat of /run/carlos-mailer/mailer.sock and, only when it is a socket, GET /v1/health on it. The agent (carlos-edge.service, user carlos), not root; reported in the private BoxMetrics block only. The same six sites; no store request, no read of /etc/carlos-mailer (which uid carlos cannot traverse). |
| `internal/host/bootstrap.go` `bootstrapWithGroup` | body | unchanged (3) | Task 3: the sysusers.d/carlos.conf it writes is now the constant sysusersConf, which adds "u carlos-mailer - \"CARLOS mailer\" - /usr/sbin/nologin" ahead of the existing "g carlos-sockets -" line, so the tmpfiles line naming group carlos-mailer resolves on a box whose confs arrive by a staged-tree refresh. Constant text, no input; no read added. |
| `internal/host/bootstrap.go` `const tmpfilesConf` | body | unchanged (7) | Task 3: two constant lines, "d /run/carlos-mailer 0750 root carlos -" (the mailer's socket directory, beside /run/carlos-control and shaped like it) and "d /etc/carlos-mailer 0750 root carlos-mailer -" (the key directory, which uid carlos cannot traverse). Root creates two root-owned directories; no file inside either is created, owned or seeded (the key is the operator's, by hand). No input; no read added. |
@@ -72,6 +72,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/mailsubmit/forward.go:SocketForwarder.Send`: reads +file:ReadAll; written legacy, accepted-legacy, frozen
- new `internal/mailsubmit/verb.go:Mount`: reads +registry:App, +registry:Host, +whole:Route; written legacy, accepted-legacy, frozen
-Seal: `07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063` → `4d48de4cb1d474a299bab67233af408adc5f9e0b32e2beeb0ac1500edd2d3353`.
+Seal: `07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063` → `48a56f8c1dabee1185118dfba64782556ebd0e57189273ec3e5ea343234e16da`.
Overlay: `internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/host/agent.go b/internal/host/agent.go
index 0552659b1..d6653d637 100644
--- a/internal/host/agent.go
+++ b/internal/host/agent.go
@@ -553,17 +553,16 @@ func runAgent(args []string, buildClaims ClaimFactory) {
// POST /v1/mail on every control socket (platform mail submission
// design, decision 1), forwarded to the box-local mailer, and the
// per-app switch that decides CARLOS_MAIL (decision 11), read from
- // the app sender record and refreshed on every serial move. With no
- // deploy store the switch reads off for every app: the verb is
- // still there, and the mailer refuses an unswitched app itself.
+ // the app sender record and refreshed on every serial move. While
+ // there is no deploy store the switch reads off for every app: the
+ // verb is still there, and the mailer refuses an unswitched app.
+ // A store that does not open now is retried, at most once a
+ // minute, with an error line each time, rather than leaving every
+ // app unswitched for the agent's life.
eb.Mail = mailsubmit.SocketForwarder{}
- if store, err := openDeployStore(context.Background()); err == nil {
- cache := newMailSwitchCache(store)
- eb.MailSwitch = cache.On
- armedMailSwitch.Store(cache)
- } else {
- log.Printf("agent: mail switch: no deploy store (%v); every app reads as not switched", err)
- }
+ mailSwitch := newMailSwitchCacheOpening(openDeployStore)
+ eb.MailSwitch = mailSwitch.On
+ armedMailSwitch.Store(mailSwitch)
// Region HA P1a: the lifetime index the reconcile passes fill, the
// registry and files store an HA restore reads, the startup sweep's
// proof, and the obligation store, opened before the Service
diff --git a/internal/host/mailswitch.go b/internal/host/mailswitch.go
index 3f0431b3a..763f933c0 100644
--- a/internal/host/mailswitch.go
+++ b/internal/host/mailswitch.go
@@ -33,9 +33,16 @@ const mailSwitchLogEvery = time.Minute
// flip reaches the next spawn within seconds. The activator asks On when it
// composes CARLOS_MAIL (agentOwnedVars).
type mailSwitchCache struct {
- store release.Store
- now func() time.Time
- logf func(string, ...any)
+ // open opens the deploy store; a cache built with one keeps trying it,
+ // at most once a mailSwitchReopenEvery, until it succeeds (review
+ // round 1, Task 4 P3: a store that failed to open at agent start used
+ // to leave every app unswitched for the agent's life).
+ open func(context.Context) (release.Store, error)
+ openMu sync.Mutex
+ openedAt time.Time // the last attempt
+ store release.Store
+ now func() time.Time
+ logf func(string, ...any)
mu sync.Mutex
entries map[mailSwitchKey]mailSwitchEntry
@@ -58,6 +65,44 @@ func newMailSwitchCache(s release.Store) *mailSwitchCache {
entries: map[mailSwitchKey]mailSwitchEntry{}, logged: map[mailSwitchKey]time.Time{}}
}
+// mailSwitchReopenEvery is the least time between two attempts to open the
+// deploy store.
+const mailSwitchReopenEvery = time.Minute
+
+// newMailSwitchCacheOpening is a cache that opens its store itself, now and
+// again on later use until it succeeds. Until then every app reads as not
+// switched, and each failed attempt is logged at error level.
+func newMailSwitchCacheOpening(open func(context.Context) (release.Store, error)) *mailSwitchCache {
+ c := newMailSwitchCache(nil)
+ c.open = open
+ c.storeNow()
+ return c
+}
+
+// storeNow is the cache's store, opening it if it has none and the last
+// attempt is old enough.
+func (c *mailSwitchCache) storeNow() release.Store {
+ c.openMu.Lock()
+ defer c.openMu.Unlock()
+ if c.store != nil || c.open == nil {
+ return c.store
+ }
+ now := c.now()
+ if !c.openedAt.IsZero() && now.Sub(c.openedAt) < mailSwitchReopenEvery {
+ return nil
+ }
+ c.openedAt = now
+ ctx, cancel := context.WithTimeout(context.Background(), mailSwitchReadTimeout)
+ defer cancel()
+ s, err := c.open(ctx)
+ if err != nil {
+ c.logf("agent: ERROR: mail switch: no deploy store (%v); every app reads as not switched until it opens, retried every %v", err, mailSwitchReopenEvery)
+ return nil
+ }
+ c.store = s
+ return s
+}
+
// armedMailSwitch is the agent's cache, for the serial-bump refresh in
// fastTick. Nil until runAgent arms one.
var armedMailSwitch atomic.Pointer[mailSwitchCache]
@@ -70,7 +115,7 @@ var armedMailSwitch atomic.Pointer[mailSwitchCache]
// neither channel, and the app refuses at boot (decision 11's loud
// failure).
func (c *mailSwitchCache) On(acct, app string) bool {
- if c == nil || c.store == nil {
+ if c == nil || c.storeNow() == nil {
return false
}
k := mailSwitchKey{acct, app}
@@ -89,7 +134,7 @@ func (c *mailSwitchCache) On(acct, app string) bool {
// on its own goroutine; a refresh still running when the next move comes
// is not doubled.
func (c *mailSwitchCache) Refresh(ctx context.Context) {
- if c == nil || c.store == nil || !c.refreshing.CompareAndSwap(false, true) {
+ if c == nil || c.storeNow() == nil || !c.refreshing.CompareAndSwap(false, true) {
return
}
defer c.refreshing.Store(false)
@@ -110,7 +155,7 @@ func (c *mailSwitchCache) Refresh(ctx context.Context) {
// absent record is off. A failed read or an undecodable body keeps the last
// good answer (or false), marked as an error so On asks again later.
func (c *mailSwitchCache) read(ctx context.Context, k mailSwitchKey) mailSwitchEntry {
- body, etag, err := c.store.Get(ctx, mailwire.SenderKey(k.acct, k.app, mailwire.SenderAppID))
+ body, etag, err := c.storeNow().Get(ctx, mailwire.SenderKey(k.acct, k.app, mailwire.SenderAppID))
now := c.now()
var e mailSwitchEntry
switch {
diff --git a/internal/host/mailswitch_test.go b/internal/host/mailswitch_test.go
index d7cb23061..9db058f59 100644
--- a/internal/host/mailswitch_test.go
+++ b/internal/host/mailswitch_test.go
@@ -131,6 +131,45 @@ func TestMailSwitchCache(t *testing.T) {
}
}
+// A deploy store that does not open at agent start is retried, at most
+// once a minute, with an error line per attempt, and the switch is read
+// once it opens (review round 1, Task 4 P3).
+func TestMailSwitchCacheRetriesTheStore(t *testing.T) {
+ st := &switchStore{objs: map[string]string{}, etags: map[string]string{}}
+ st.set("abcxyz", "docs", true, `"e1"`)
+ clock := time.Unix(1_700_000_000, 0)
+ var logs []string
+ opens := 0
+ fail := true
+ open := func(context.Context) (release.Store, error) {
+ opens++
+ if fail {
+ return nil, errors.New("no credentials yet")
+ }
+ return st, nil
+ }
+ c := &mailSwitchCache{open: open, now: func() time.Time { return clock },
+ logf: func(f string, a ...any) { logs = append(logs, fmt.Sprintf(f, a...)) },
+ entries: map[mailSwitchKey]mailSwitchEntry{}, logged: map[mailSwitchKey]time.Time{}}
+ if c.On("abcxyz", "docs") || opens != 1 || len(logs) != 1 || !strings.Contains(logs[0], "ERROR") {
+ t.Fatalf("first attempt: opens %d logs %q", opens, logs)
+ }
+ c.On("abcxyz", "docs")
+ c.Refresh(context.Background())
+ if opens != 1 {
+ t.Fatalf("retried inside the minute: %d opens", opens)
+ }
+ fail = false
+ clock = clock.Add(mailSwitchReopenEvery)
+ if !c.On("abcxyz", "docs") || opens != 2 {
+ t.Fatalf("after the store opens: opens %d", opens)
+ }
+ c.On("abcxyz", "docs")
+ if opens != 2 {
+ t.Fatal("an open store was opened again")
+ }
+}
+
// The mailer side never reaches internal/mail (plan round 1 P3): the
// mailer, the verb, the wire package and the agent are all in the root
// binary, and internal/mail's IAM and SES walks must stay out of it and
diff --git a/internal/mailsubmit/proto.go b/internal/mailsubmit/proto.go
index 0c978317a..e1e449b0d 100644
--- a/internal/mailsubmit/proto.go
+++ b/internal/mailsubmit/proto.go
@@ -61,6 +61,11 @@ const (
MaxRaw = 10 << 20
MaxRecipients = 50
MaxBody = 14 << 20
+ // MaxInFlightPerSocket is how many messages one control socket may have
+ // in the agent at once (review round 1, Task 4 P3): each holds up to
+ // MaxBody in memory, and one instance must not tie up the agent. The
+ // next is answered 429 RATE with Retry-After 1.
+ MaxInFlightPerSocket = 2
)
// MailerSocket is the mailer's socket.
diff --git a/internal/mailsubmit/verb.go b/internal/mailsubmit/verb.go
index fa965873d..772bc946a 100644
--- a/internal/mailsubmit/verb.go
+++ b/internal/mailsubmit/verb.go
@@ -34,6 +34,7 @@ var passThrough = map[int]bool{
// everything.
func Mount(mux *http.ServeMux, rt registry.Route, tokenReader func() (string, error), fwd Forwarder) {
account, app, host := release.RouteAccount(rt), rt.App, rt.Host
+ inflight := make(chan struct{}, MaxInFlightPerSocket)
mux.HandleFunc("POST /v1/mail", func(w http.ResponseWriter, r *http.Request) {
// 1. The bearer, by the existing verbs' rule (instanceupdates,
// schedule): an empty or unreadable token is 401 whatever the
@@ -49,6 +50,15 @@ func Mount(mux *http.ServeMux, rt registry.Route, tokenReader func() (string, er
http.Error(w, "unauthorized", http.StatusUnauthorized)
return
}
+ // At most MaxInFlightPerSocket messages from this socket at once,
+ // the body read included.
+ select {
+ case inflight <- struct{}{}:
+ defer func() { <-inflight }()
+ default:
+ answer(w, http.StatusTooManyRequests, Answer{Code: CodeRate}, "1")
+ return
+ }
// 2. The envelope's shape and size.
env, raw, ok := readEnvelope(w, r)
if !ok {
diff --git a/internal/mailsubmit/verb_test.go b/internal/mailsubmit/verb_test.go
index 1e014073a..147164cf2 100644
--- a/internal/mailsubmit/verb_test.go
+++ b/internal/mailsubmit/verb_test.go
@@ -10,6 +10,7 @@ import (
"strings"
"sync"
"testing"
+ "time"
"github.com/carlosframework/platform/internal/registry"
"github.com/carlosframework/platform/internal/release"
@@ -261,3 +262,52 @@ func TestMailVerbIsPostOnly(t *testing.T) {
t.Fatalf("GET = %d", w.Code)
}
}
+
+// blockingForwarder holds every send until released.
+type blockingForwarder struct {
+ started chan struct{}
+ release chan struct{}
+}
+
+func (b *blockingForwarder) Send(context.Context, SendRequest) (int, Answer, string, error) {
+ b.started <- struct{}{}
+ <-b.release
+ return 200, Answer{MessageID: "m"}, "", nil
+}
+
+// One control socket has at most MaxInFlightPerSocket messages in the
+// agent at once; the next is 429 RATE, Retry-After 1, and is not forwarded.
+// Another socket is not held up by it.
+func TestMailVerbBoundsInFlightPerSocket(t *testing.T) {
+ fwd := &blockingForwarder{started: make(chan struct{}, 8), release: make(chan struct{})}
+ m := mux(t, routeA, staticToken("tok"), fwd)
+ body := envelope("a@docs.example.com", []string{"x@example.org"}, goodRaw)
+ var wg sync.WaitGroup
+ for i := 0; i < MaxInFlightPerSocket; i++ {
+ wg.Add(1)
+ go func() { defer wg.Done(); post(m, "tok", body) }()
+ <-fwd.started
+ }
+ over := make(chan *httptest.ResponseRecorder, 1)
+ go func() { over <- post(m, "tok", body) }()
+ var w *httptest.ResponseRecorder
+ select {
+ case w = <-over:
+ case <-time.After(3 * time.Second):
+ close(fwd.release)
+ t.Fatal("a send over the bound was forwarded and is waiting on the mailer")
+ }
+ if w.Code != http.StatusTooManyRequests || code(t, w) != CodeRate || w.Header().Get("Retry-After") != "1" {
+ t.Fatalf("over the bound: %d %s %q", w.Code, w.Body, w.Header().Get("Retry-After"))
+ }
+ other := &blockingForwarder{started: make(chan struct{}, 1), release: make(chan struct{})}
+ close(other.release)
+ if w := post(mux(t, registry.Route{Host: "b.example.com", Account: "abcxyz", App: "docs"}, staticToken("tok"), other), "tok", body); w.Code != 200 {
+ t.Fatalf("another socket was held up: %d", w.Code)
+ }
+ close(fwd.release)
+ wg.Wait()
+ if w := post(m, "tok", body); w.Code != 200 {
+ t.Fatalf("after the in-flight sends finished: %d", w.Code)
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 57f8c9e3f..fae0d9942 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -204,4 +204,4 @@ plan14-root-reads-static-site-geo-962.tsv 5e8a72175700a3e60c1e283b133c1ee25e36f2
plan14-root-reads-member-backups-drill-nodb.tsv 07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063
plan14-root-reads-spread-every-schedule-ticks.tsv 07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063
plan14-root-reads-member-backups-2b.tsv 07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063
-plan14-root-reads-platform-mail-submission.tsv 4d48de4cb1d474a299bab67233af408adc5f9e0b32e2beeb0ac1500edd2d3353
+plan14-root-reads-platform-mail-submission.tsv 48a56f8c1dabee1185118dfba64782556ebd0e57189273ec3e5ea343234e16da
diff --git a/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv b/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv
index c9d78011a..d1f2d3278 100644
--- a/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv
+++ b/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv
@@ -29,13 +29,13 @@
@legacy 09ddb6ec28ddc32798b2afd4909d661e9da73e8a6cf48c6b8a73f9fa00bb0cba internal/mailer/keys.go KeyFile.Changed legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 5, new: a stat of the same constant key path, compared with the loaded file's mtime, size and inode, so a rotation reloads with no restart. carlos-mailer only. file:Stat@47 1e4714c15a0cde077167358d786eaa3b33d6a9f3330a5d282dbba59beb1a3299
@legacy c577b1c36d95d7616e46d796828771d5e9a7d2b7229d0c6b3353c3ec4c313bf7 internal/mailer/keys.go loadKeys legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 5, new: reads /etc/carlos-mailer/keys (a constant path) as carlos-mailer: refuses anything but a regular 0640 file owned by root and group carlos-mailer, more than two keys, or a malformed line; errors never carry a secret. Root never reads it. The file is written by the operator by hand, in a 0750 root:carlos-mailer directory uid carlos cannot traverse. file:Open@68,file:ReadFrom@488,file:Stat@154 c86150ed82395d1051892825ea4893a289e2eda699372974c4373845794d707d
@legacy 92d90fe8f4ae11810f6e85c8df7ceb2a4024c8da10e42c8788ee154f5b8a60ce internal/mailsubmit/forward.go SocketForwarder.Send legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 4, new: the agent's client to the mailer: one HTTP POST of /v1/send over a fresh dial of the constant /run/carlos-mailer/mailer.sock, 60 s timeout, answer read to at most 64 KiB and decoded. Runs in the agent, as carlos. The socket's directory is root's; the mailer at the other end is a separate uid. file:ReadAll@885 b1c14436f42f60c4157ad0dffb1b998931a58b3a2ebf545578ff6d2e243dcd58
-@legacy dcfde0fc6cf86e118ad58646b43a41481c115f7eae91a5bb137f4d00e079d607 internal/mailsubmit/verb.go Mount legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 4, new: POST /v1/mail on an instance's control socket. The bearer by the existing verbs' rule (empty or unreadable token refuses everything; SHA-256 constant-time compare); MaxBytesReader(14 MiB), the JSON envelope, base64 raw of at most 10 MiB, 1 to 50 non-empty recipients, a non-empty from, else 400 BAD_REQUEST. Stamps account, app and host from the route the socket was bound for, never from the body, and forwards; a transport error or an answer outside 200/400/403/429/503 is 503 MAILER_UNAVAILABLE. Runs in the agent, as carlos; the body is a tenant's and is only decoded and forwarded, never used to name a path, route or account. registry:App@152,registry:Host@160,whole:Route@147 170951db97d14dc471251211b1526d2a640a0c7aba3f5eec1e6c12bc0ae81d2c
+@legacy 22a67d4320a618752b7f0430b8b8e51c0e4e0bc2b5f8a08d5bf22ed2c109700d internal/mailsubmit/verb.go Mount legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 4, new: POST /v1/mail on an instance's control socket. The bearer by the existing verbs' rule (empty or unreadable token refuses everything; SHA-256 constant-time compare); MaxBytesReader(14 MiB), the JSON envelope, base64 raw of at most 10 MiB, 1 to 50 non-empty recipients, a non-empty from, else 400 BAD_REQUEST; at most 2 messages per socket in the agent at once, the next 429 RATE (review round 1, Task 4 P3). Stamps account, app and host from the route the socket was bound for, never from the body, and forwards; a transport error or an answer outside 200/400/403/429/503 is 503 MAILER_UNAVAILABLE. Runs in the agent, as carlos; the body is a tenant's and is only decoded and forwarded, never used to name a path, route or account. registry:App@152,registry:Host@160,whole:Route@147 d981dffe0b5bd91fb4255b761b5434e22de62a37f8224d0c125906874648d7ae
@legacy 9d438dcdbaabed1854fa668aa67b6b86f60ede58d5d3d2ba3c3dcb410a9f1976 internal/activator/backend_exec.go ExecBackend.agentOwnedVars legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-platform-mail-submission;basis=Task 4: also decides CARLOS_MAIL through mailSubmits: set to "submit" only when the control socket bound, the verb is mounted, the app sender's switch is on and the route is Provisioned; stripped otherwise, a tenant-supplied value from fileEnv included. agentOwnedNames and moves.AgentOwnedVars gain it as a pinned pair. Only narrows what a tenant's files can set. Agent, not root. registry:Host@1209,whole:Route@1171,whole:Route@631 7cc1bcb0b415ee478350a0519799542e0b1e5419c94121519c6e1b349d613c10
@legacy efaa7c1113d4186ab422cb6350f2a53d99468bb7e8d5e71bf22b1f11612a7687 internal/activator/backend_exec.go ExecBackend.spawnChildFrom legacy accepted-legacy accepted-legacy;rev3=census-ruling-zddr3;basis=Census ruling zddr3: changed legacy row (comment-only change describing the shim placement); the same class as the accepted-legacy Manager.startIn and placementLive under fix1-merge-review (existing agent delegated-cgroup management remains legacy); no root decision; no registry, /data, release or claim reads. Boundary: the agent's own delegated cgroup subtree (including its scratch probe child), /proc/self, and pipes to and from its own parent, running as carlos.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos (the flat start body): the same change as seedChild: ensureAdminTokenFor(ctx, rt, paths) for the token (the same flat path), the key's producer carrying the HA mint decision, and launchEnvLayer(ctx, rt) for the env and key layer the replica gate reads; a non-HA host's token, key and env are produced and read as before; +whole:Route; only adds refusals for HA hosts;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-edge-page-cache-1;basis=the control listener is now built with the whole route (edge.ListenControl(controlSocket, rt, ...)), the +whole:Route site; it computes the launch inputs once from the build it execs by path (a staged exe's caller-named build, or the gate-resolved pinned version; "" for an unpinned live link) and fileEnv it already read, keeps them on the childProc, and for a live-link spawn publishes them to the in-memory cache (NoteProcessInputs) beside the existing purge; no new file read;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: retain main build parameter, pinned live identity, launchInputs from captured build/environment, and current-process input publication. edge.ListenControl now receives the whole Route as main requires (+whole:Route); no new filesystem or storage input. Branch sandboxLaunch remains before preparation and spawn; existing direct primitive gate unchanged.;rev3=census-ruling-security-review-mitigations;basis=Enforce the unchanged never-served resident refusal once at the shared flat/foreign primary binary spawn sink, before placement, live-link/token/env/control preparation or execution. Covers plain, generation and staged Service wakes; existing served/explicit-flat exemptions and other gates retained. No new filesystem/store source.;rev3=census-ruling-platform-mail-submission;basis=Task 4: the inline mount (Timers, UpdatesReader) is replaced by b.controlMount(rt, tokenReader, n): the same verbs under the same conditions, plus the mail verb when b.Mail is set. The three rt.Host reads move into controlMount; the route is passed whole. Agent, not root; nothing else changes. file:Command@11030,registry:Host@12313,registry:Host@12674,registry:Host@12768,registry:Host@258,registry:Host@4236,registry:Stateless@10961,whole:Route@10853,whole:Route@11002,whole:Route@11410,whole:Route@13065,whole:Route@13157,whole:Route@1527,whole:Route@189,whole:Route@1944,whole:Route@2305,whole:Route@287,whole:Route@4091,whole:Route@4119,whole:Route@4430,whole:Route@476,whole:Route@6501,whole:Route@8766 dacd2d37b38491f11ba1be34795d5fe40915aa044d6732ccf2bae467c733f80e
@legacy fa76f66ed1ce2b9e9b96dd442f08e32b99d090fa72055b83bb9c2fa35a4907db internal/activator/prepare.go ExecBackend.listenControl legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-edge-page-cache-1;basis=passes the whole route to edge.ListenControl instead of rt.Host (the -registry:Host +whole:Route change); nothing else;rev3=census-ruling-platform-mail-submission;basis=Task 4: the same replacement as spawnChildFrom, with gen as the write fence's generation, so the nested and rootfs listener mounts exactly what the flat one does. Agent, not root. registry:Host@508,whole:Route@361,whole:Route@389 f6534861cdbeef80dbcfaf6b07df685e4ac2f2a86650db54f174871526a50aff
internal/host/agent.go fastTick legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=PROPOSED-s3-change-index;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=observes the change index before any pass (observeIndex), runs the backstop's requested full pass and a scoped pass for moved app scopes (indexTick), and arms the canary pointer gate on the sweep (canaryPointerGate) only on a tick whose own index observation succeeded; read site unchanged, offset moved;rev3=census-ruling-stateless-replicas-1;basis=Call coordinator Tick on the existing tick before convergence; client renews held terms only at the pinned interval. Existing registry read unchanged. Final review I3: signal the owned renewal worker instead of waiting for its sequential console HTTP calls. Existing convergence and record read unchanged.;rev3=census-ruling-region-ha-p3a;basis=Run the optional desired-role reader on the existing tick after observing the armed change index; no new root path or timer, nil reader is unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: signals the owned replica worker on the existing tick; coalesced asynchronous execution, no timer or bucket scan added. merge of origin/main 7920cccf: Retain main box-role reader pass on the existing tick alongside the replica worker signal; merge-only body change, unchanged read sites.;rev3=census-ruling-restart-new-box-gap;basis=calls the optional restartGain hook (restartGainSeed) once per existing tick before the serial read; no new root path, timer or read kind; nil hook is unchanged;rev3=census-ruling-agent-start-demo-3;basis=Refresh moved notices through the shared watch before normal convergence; no new per-box poll. Census read-site delta: unchanged (1).;rev3=census-ruling-stateless-replicas-4-task1;basis=Signals the owned replica swap worker (armedReplicaDeploy.tick) beside the placement worker on the existing tick; coalesced background pass, no timer, no bucket read. Its transitions go through the console's authenticated /deploy.;rev3=census-ruling-platform-mail-submission;basis=Task 4: on a serial move, after the schedule leg, starts the armed mail switch cache's Refresh on its own goroutine (each read bounded at 2 s, overlapping refreshes skipped). It re-reads the app sender records already cached, through the agent's deploy store. Agent, not root; the tick waits on nothing new. registry:Host@5822 a1cd273f24047c63670f8c32c000a84f1a3861d058da38c5318551929f312390
internal/host/agent.go provisionTickConfig legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-ha-p1a-433;basis=the agent (carlos-edge.service, user carlos) and the edges file loop's eligibility: the same CARLOS_POOLS read, now parsed by provision.ParseBoxPools (internal/provision, envelope re-pinned), the one parser boxPools also uses. "@shared" (provision.SharedPoolToken, never a valid pool name) is the shared "" pool; other tokens are literal as before; empty elements and repeats dropped. No read added.;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 4, rule 2): sets ReconcileConfig.FleetBox to the box's own fleet label from resolveFleetIdentity(getenv), only when the identity resolves and region == PlacementTarget(identity.Fleet); otherwise it stays "" (the box admits only unlabelled records). The same environment the fleet loops already read; read sites unchanged (2). Agent config, not root.;rev3=census-ruling-platform-mail-submission;basis=Task 5: its region, pools and fleet label now come from BoxScopeFromEnv, which is the same three reads moved out unchanged (CARLOS_REGION trimmed, provision.ParseBoxPools(CARLOS_POOLS), and resolveFleetIdentity's label only when its fleet is the one the region places the box on), so the box-local mailer resolves "on this box" by the agent's rule. The ReconcileConfig it returns is field for field what it was. Agent, not root. data-literal@173,data-literal@214 cabe3cb9662118eb82ddbc77dbbdb80b6718494caea097c8ffb894ccc4903fe3
-internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: one more assignment beside eb.FilesStore: eb.EscrowKey = haEscrowKey(os.Getenv("CARLOS_SECRETS_KEY")), the agent's own environment parsed by appconfig.ParsePrivateKey as the moves pass parses it (unset or unparseable: a log line and nil, and HA publication refuses on the box). No path is opened or read, no read site added; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 4: one more goroutine beside configSyncLoop: go escrowLoop(agentCtx, reg, svc), the escrow sweep every 30 s over the same registry and Service. This body reads nothing new itself; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 5: one more call beside eb.EscrowKey: wireRawSecretPages(eb, PageOperator, metricsBoxLabel(os.Getenv, readMachineID())), which sets eb.OnRawSecret to page an operator (alerting.Page through PageOperator, LevelIncident) on its own goroutine with a 20 s timeout; metricsBoxLabel and readMachineID are the reads this body already makes for the moves refusal log; no new read site; the same six sites, offsets moved; B,C,D,F authority retained. Merge of origin/main 90c4d3aa: main's own later changes to this body are kept as main has them, under main's rulings; this branch's change is the same as above. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged.;rev3=census-ruling-probe-burst-limit;basis=two more sink wirings beside setAnalyticsSink: setProtectionSink(e.SetProtectionRecordOnly) and setAssetOwnersSource(e.AssetOwners), function values the telemetry pass calls; this body reads nothing new, the same six sites; authority B,C,D,F retained; no new root read or write kind;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority.;rev3=census-ruling-agent-start-demo-3;basis=Wire the claim activator and root snapshot client into the demo worker; pass moved readiness to status reporting. Census read-site delta: unchanged (9).;rev3=census-ruling-region-ha-g2-fixes;basis=Wire local pool evidence, live withdrawal activator, startup ingress scan and alias publication, and edge lookup; no new direct sites; new indirect record/claim reads use existing store/judge paths described in ingress helpers.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3: starts the existing record-view backstop loop with a departure-inventory listener (non-blocking, coalesced signal) even without an armed RecordView; it requests the existing full pass (backstopFullDue) there. Same nine read sites; no new read or authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Derive one signal-time deadline with a 90-second budget; cap departure stop and startup/seed/service shutdown joins by it. No read added.;rev3=census-ruling-static-sweep-periodic;basis=in the edge-ready callback, publishes e.LargestStaticTree in staticTreeSource for the disk alert line (diskAlertFrac in the metrics loop); in-memory wiring only, no read added; read sites unchanged (9);rev3=census-ruling-edge-page-cache-1;basis=wires the exec backend's CurrentInputs into the edge cache (wireCurrentInputs) and, in the ready hook after armEdgeAssetCache (whose returned store it now keeps), calls armEdgePageCache, which does nothing unless CARLOS_PAGE_CACHE=1; read sites unchanged (9); no read added;rev3=census-ruling-gvisor-demos;basis=Capture sandbox resolution and refusal once; log errors once; gate route admission and BeforeExec before process launch. No new root read. Task 5: pass the once-captured sandbox effective mode/config error into ExecBackend, UnitBackend and the immutable Client expectation. Same startup environment/registry reads; swapArming declines gVisor before placement. Task 8: arm read-only status projection with the existing Client.SandboxStatus callback. Agent status now queries the existing root /ready endpoint; no new root authority or guest-file input. Merge2 e8a1ddde: retain main wireCurrentInputs and armEdgePageCache through the existing asset-store ready hook alongside branch once-captured sandbox mode, wake gates and root status wiring. No new direct read; main page-cache helpers retain their own census overlays.;rev3=census-ruling-region-ha-held-build;basis=wires the drain state: svc.SetDrainingSource(boxDrain.IsDraining), svc.SetPeerDrainView(e.PeerDraining), e.SetPeerDrainedHook(svc.DropHoldersNaming); in-memory only; no read added; region HA held-requests Task 5: on group members, starts the drain driver over the activator, the edge and boxDrain, and serves its root-only drain socket; no read added beyond the socket's own Branch review r1: the drain state follows the root start fence on group members (the fence reader is the existing fenceLocation.read, a root-owned fixed path); e.SetPeerUndrainedHook(svc.AllowHoldersNaming) beside the drained hook (memory only); the drain socket serves only the agent's own user. No read added.;rev3=census-ruling-security-review-mitigations;basis=Wire the cached operator flat-layout choice into the exec backend's new-resident refusal; no read source added, existing authority retained.;rev3=census-ruling-w6-ingress-drain;basis=agent (user carlos), not root. Builds the ingress drain (newIngressDrain) with arming read at ask time from os.Getenv (CARLOS_REGION_HA, CARLOS_INGRESS_TARGET_GROUPS, both from the root-owned host.env), the fixed admission and lease.CurrentSelf (existing IMDS identity); its reader is awstg.Load, the box role's credentials calling ELB DescribeTargetHealth/DescribeTargetGroupAttributes (new AWS reads, by the agent). Wires admission.closeStartsForIngressDrain, the lbhealth drain condition, ingress.setEdge, and ingress.shutdownStarted in WithShutdownStarted. The drain socket (/run/carlos/.ha-drain/drain.sock, agent-user only, existing) is now also served on a fixed box with the drain configured (was group members only), routing /v1/ingress/* to the ingress drain and the group drain verbs to 404 there. armHADepartures now takes fixtureDepartureGetenv() and MakeQueue fixtureDepartureQueue(), which in a production (non-rootrunner) build are os.Getenv and nil, as before. Read sites unchanged (9).;rev3=census-ruling-stateless-replicas-4-task1;basis=Arms the fleet-only replica swap worker next to the placement worker: same console URL and fleet token as the existing replicaCoordinatorAPI, the existing activator Service; stops and joins at shutdown. No new read site, credential or bucket reader.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: sets deployWorker.step to the rollout scheduler answer for the record permit (replicaStepOf over armedRollout), an in-memory callback; no read site, credential or bucket reader added.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: the swap worker step is armedReplicaStep, the same lazy scheduler lookup as before as a named function; no read site added.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (01d6ca78, linked-deployments-slice1) starts linkLoop beside tunnelLoop; this branch keeps its replica coordinator wiring. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 2: wires the swap worker's drive (armedReplicaDrive, the armed rollout manager's DriveReplicaRelease); no read added;rev3=census-ruling-stateless-replicas-4-merge-main2;basis=Merge of main af871da0 (v0.34.49): both sides changed it. Main (178dcfe5, member-backups-2a) moves the inline duty-view closure into armDutyView/dutyView and starts verifyAssignLoop; its sites drop by registry:Host and whole:Route x2 as main recorded them. This branch keeps its replica coordinator, swap worker and drive wiring. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-drill3;basis=drill 3 R24: makes one in-memory channel, closes it (once) inside the edge's existing shutdown-started callback after ingress.shutdownStarted, and passes it to tunnelLoop, which drains only a fleet channel name; no read added, same six sites; touches no admission, lease, ingress drain, listener or file; the agent process, no root decision;rev3=census-ruling-edge-ppv2;basis=Agent (uid carlos), not root. memwatchLoop now gets edgeProxyCounters(&demoEdge) (in-process counters, no read). The drain socket's driver is newAgentDrainSocket(ingress, e, os.Getenv), which attaches the edge trust handler only when CARLOS_INGRESS_PROXY_SOURCES in the agent's environment (from the root-owned host.env) parses to a non-empty list; the socket is served when drainSocketServed: a group member or a configured ingress drain (both as before), or a box armed for PROXY protocol (new). The socket's path and agent-user-only permissions are unchanged. Read sites unchanged (6).;rev3=census-ruling-platform-mail-submission;basis=Task 4: sets eb.Mail = mailsubmit.SocketForwarder{} on every box and, when a deploy store opens, eb.MailSwitch to a new mailSwitchCache's On, armed for the serial-move refresh (armedMailSwitch). One more openDeployStore call, as the fleet and coordinator wiring beside it already make. Agent, not root. file:Exec@21141,file:Open@2191,file:Statfs@56665,registry:App@13287,whole:Route@13279,whole:Route@50143 8c29c4f2bb4562560e304a5ab66a3be6f8a354949819cb19a22d9005d06d5a39
+internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: one more assignment beside eb.FilesStore: eb.EscrowKey = haEscrowKey(os.Getenv("CARLOS_SECRETS_KEY")), the agent's own environment parsed by appconfig.ParsePrivateKey as the moves pass parses it (unset or unparseable: a log line and nil, and HA publication refuses on the box). No path is opened or read, no read site added; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 4: one more goroutine beside configSyncLoop: go escrowLoop(agentCtx, reg, svc), the escrow sweep every 30 s over the same registry and Service. This body reads nothing new itself; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 5: one more call beside eb.EscrowKey: wireRawSecretPages(eb, PageOperator, metricsBoxLabel(os.Getenv, readMachineID())), which sets eb.OnRawSecret to page an operator (alerting.Page through PageOperator, LevelIncident) on its own goroutine with a 20 s timeout; metricsBoxLabel and readMachineID are the reads this body already makes for the moves refusal log; no new read site; the same six sites, offsets moved; B,C,D,F authority retained. Merge of origin/main 90c4d3aa: main's own later changes to this body are kept as main has them, under main's rulings; this branch's change is the same as above. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged.;rev3=census-ruling-probe-burst-limit;basis=two more sink wirings beside setAnalyticsSink: setProtectionSink(e.SetProtectionRecordOnly) and setAssetOwnersSource(e.AssetOwners), function values the telemetry pass calls; this body reads nothing new, the same six sites; authority B,C,D,F retained; no new root read or write kind;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority.;rev3=census-ruling-agent-start-demo-3;basis=Wire the claim activator and root snapshot client into the demo worker; pass moved readiness to status reporting. Census read-site delta: unchanged (9).;rev3=census-ruling-region-ha-g2-fixes;basis=Wire local pool evidence, live withdrawal activator, startup ingress scan and alias publication, and edge lookup; no new direct sites; new indirect record/claim reads use existing store/judge paths described in ingress helpers.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3: starts the existing record-view backstop loop with a departure-inventory listener (non-blocking, coalesced signal) even without an armed RecordView; it requests the existing full pass (backstopFullDue) there. Same nine read sites; no new read or authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Derive one signal-time deadline with a 90-second budget; cap departure stop and startup/seed/service shutdown joins by it. No read added.;rev3=census-ruling-static-sweep-periodic;basis=in the edge-ready callback, publishes e.LargestStaticTree in staticTreeSource for the disk alert line (diskAlertFrac in the metrics loop); in-memory wiring only, no read added; read sites unchanged (9);rev3=census-ruling-edge-page-cache-1;basis=wires the exec backend's CurrentInputs into the edge cache (wireCurrentInputs) and, in the ready hook after armEdgeAssetCache (whose returned store it now keeps), calls armEdgePageCache, which does nothing unless CARLOS_PAGE_CACHE=1; read sites unchanged (9); no read added;rev3=census-ruling-gvisor-demos;basis=Capture sandbox resolution and refusal once; log errors once; gate route admission and BeforeExec before process launch. No new root read. Task 5: pass the once-captured sandbox effective mode/config error into ExecBackend, UnitBackend and the immutable Client expectation. Same startup environment/registry reads; swapArming declines gVisor before placement. Task 8: arm read-only status projection with the existing Client.SandboxStatus callback. Agent status now queries the existing root /ready endpoint; no new root authority or guest-file input. Merge2 e8a1ddde: retain main wireCurrentInputs and armEdgePageCache through the existing asset-store ready hook alongside branch once-captured sandbox mode, wake gates and root status wiring. No new direct read; main page-cache helpers retain their own census overlays.;rev3=census-ruling-region-ha-held-build;basis=wires the drain state: svc.SetDrainingSource(boxDrain.IsDraining), svc.SetPeerDrainView(e.PeerDraining), e.SetPeerDrainedHook(svc.DropHoldersNaming); in-memory only; no read added; region HA held-requests Task 5: on group members, starts the drain driver over the activator, the edge and boxDrain, and serves its root-only drain socket; no read added beyond the socket's own Branch review r1: the drain state follows the root start fence on group members (the fence reader is the existing fenceLocation.read, a root-owned fixed path); e.SetPeerUndrainedHook(svc.AllowHoldersNaming) beside the drained hook (memory only); the drain socket serves only the agent's own user. No read added.;rev3=census-ruling-security-review-mitigations;basis=Wire the cached operator flat-layout choice into the exec backend's new-resident refusal; no read source added, existing authority retained.;rev3=census-ruling-w6-ingress-drain;basis=agent (user carlos), not root. Builds the ingress drain (newIngressDrain) with arming read at ask time from os.Getenv (CARLOS_REGION_HA, CARLOS_INGRESS_TARGET_GROUPS, both from the root-owned host.env), the fixed admission and lease.CurrentSelf (existing IMDS identity); its reader is awstg.Load, the box role's credentials calling ELB DescribeTargetHealth/DescribeTargetGroupAttributes (new AWS reads, by the agent). Wires admission.closeStartsForIngressDrain, the lbhealth drain condition, ingress.setEdge, and ingress.shutdownStarted in WithShutdownStarted. The drain socket (/run/carlos/.ha-drain/drain.sock, agent-user only, existing) is now also served on a fixed box with the drain configured (was group members only), routing /v1/ingress/* to the ingress drain and the group drain verbs to 404 there. armHADepartures now takes fixtureDepartureGetenv() and MakeQueue fixtureDepartureQueue(), which in a production (non-rootrunner) build are os.Getenv and nil, as before. Read sites unchanged (9).;rev3=census-ruling-stateless-replicas-4-task1;basis=Arms the fleet-only replica swap worker next to the placement worker: same console URL and fleet token as the existing replicaCoordinatorAPI, the existing activator Service; stops and joins at shutdown. No new read site, credential or bucket reader.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: sets deployWorker.step to the rollout scheduler answer for the record permit (replicaStepOf over armedRollout), an in-memory callback; no read site, credential or bucket reader added.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: the swap worker step is armedReplicaStep, the same lazy scheduler lookup as before as a named function; no read site added.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (01d6ca78, linked-deployments-slice1) starts linkLoop beside tunnelLoop; this branch keeps its replica coordinator wiring. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 2: wires the swap worker's drive (armedReplicaDrive, the armed rollout manager's DriveReplicaRelease); no read added;rev3=census-ruling-stateless-replicas-4-merge-main2;basis=Merge of main af871da0 (v0.34.49): both sides changed it. Main (178dcfe5, member-backups-2a) moves the inline duty-view closure into armDutyView/dutyView and starts verifyAssignLoop; its sites drop by registry:Host and whole:Route x2 as main recorded them. This branch keeps its replica coordinator, swap worker and drive wiring. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-drill3;basis=drill 3 R24: makes one in-memory channel, closes it (once) inside the edge's existing shutdown-started callback after ingress.shutdownStarted, and passes it to tunnelLoop, which drains only a fleet channel name; no read added, same six sites; touches no admission, lease, ingress drain, listener or file; the agent process, no root decision;rev3=census-ruling-edge-ppv2;basis=Agent (uid carlos), not root. memwatchLoop now gets edgeProxyCounters(&demoEdge) (in-process counters, no read). The drain socket's driver is newAgentDrainSocket(ingress, e, os.Getenv), which attaches the edge trust handler only when CARLOS_INGRESS_PROXY_SOURCES in the agent's environment (from the root-owned host.env) parses to a non-empty list; the socket is served when drainSocketServed: a group member or a configured ingress drain (both as before), or a box armed for PROXY protocol (new). The socket's path and agent-user-only permissions are unchanged. Read sites unchanged (6).;rev3=census-ruling-platform-mail-submission;basis=Task 4: sets eb.Mail = mailsubmit.SocketForwarder{} on every box, and eb.MailSwitch to a mailSwitchCache's On that opens the deploy store itself through openDeployStore, retried at most once a minute with an error line until it opens (review round 1, Task 4 P3), armed for the serial-move refresh (armedMailSwitch). Agent, not root. file:Exec@21165,file:Open@2191,file:Statfs@56689,registry:App@13287,whole:Route@13279,whole:Route@50167 688d5b030321081e11232e7e94dda18197939734cb7197c122fdc58b2dad50e6
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-platform-mail-submission;basis=Task 3 (plan gap G6 (b)): the status tick also fills Probes.MailerArmed from mailerArmed(mailwire.MailerSocket, 2s): a stat of /run/carlos-mailer/mailer.sock and, only when it is a socket, GET /v1/health on it. The agent (carlos-edge.service, user carlos), not root; reported in the private BoxMetrics block only. The same six sites; no store request, no read of /etc/carlos-mailer (which uid carlos cannot traverse). whole:Route@10554,whole:Route@12628,whole:Route@12909,whole:Route@6583,whole:Route@6610,whole:Route@7918 4dd7407a53e445f78e63f160bee068d835b26d5d8fd3300d389ba5dbcab26d5a
internal/host/bootstrap.go bootstrapWithGroup legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Move bootstrapWith body here, retaining host.env, embedded unit reads and tmpfiles execution. Group live caller holds root mutation guard; skip automatic update/recovery units, preserve Restart=no/nftables drop-in and masks, and write separate root-owned /run/carlos-group-maintenance tmpfiles rule outside service ownership walk. No agent receipt read.;rev3=census-ruling-gvisor-demos;basis=Create the rootfs parent at 0700 and runtime root at 0755. Existing host.env/unit reads unchanged; workload templates remain unarmed.;rev3=census-ruling-platform-mail-submission;basis=Task 3: the sysusers.d/carlos.conf it writes is now the constant sysusersConf, which adds "u carlos-mailer - \"CARLOS mailer\" - /usr/sbin/nologin" ahead of the existing "g carlos-sockets -" line, so the tmpfiles line naming group carlos-mailer resolves on a box whose confs arrive by a staged-tree refresh. Constant text, no input; no read added. file:Command@12045,file:ReadFile@564,file:ReadFile@7111 62fa76ad0fa812a0effc7c6add43ddcf54313450c13f20fbb2fee9d004488588
internal/host/bootstrap.go const tmpfilesConf authority A,C,G,J4 root-input;kept=A,C,G;scope=protected-decision-only;rev3=census-ruling-platform-mail-submission;basis=Task 3: two constant lines, "d /run/carlos-mailer 0750 root carlos -" (the mailer's socket directory, beside /run/carlos-control and shaped like it) and "d /etc/carlos-mailer 0750 root carlos-mailer -" (the key directory, which uid carlos cannot traverse). Root creates two root-owned directories; no file inside either is created, owned or seeded (the key is the operator's, by hand). No input; no read added. data-literal@1237,data-literal@1309,data-literal@1927,data-literal@21,data-literal@2328,data-literal@311,data-literal@810 d9849c0d887ce4c8698d67dfc9cf136f5b9922300b058fda6186d2fd4b42411a
@@ -64,19 +64,19 @@ internal/mailer/counter.go OpenCounter legacy accepted-legacy accepted-legacy;re
internal/mailer/keys.go KeyFile.Changed legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 5, new: a stat of the same constant key path, compared with the loaded file's mtime, size and inode, so a rotation reloads with no restart. carlos-mailer only. file:Stat@47 1e4714c15a0cde077167358d786eaa3b33d6a9f3330a5d282dbba59beb1a3299
internal/mailer/keys.go loadKeys legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 5, new: reads /etc/carlos-mailer/keys (a constant path) as carlos-mailer: refuses anything but a regular 0640 file owned by root and group carlos-mailer, more than two keys, or a malformed line; errors never carry a secret. Root never reads it. The file is written by the operator by hand, in a 0750 root:carlos-mailer directory uid carlos cannot traverse. file:Open@68,file:ReadFrom@488,file:Stat@154 c86150ed82395d1051892825ea4893a289e2eda699372974c4373845794d707d
internal/mailsubmit/forward.go SocketForwarder.Send legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 4, new: the agent's client to the mailer: one HTTP POST of /v1/send over a fresh dial of the constant /run/carlos-mailer/mailer.sock, 60 s timeout, answer read to at most 64 KiB and decoded. Runs in the agent, as carlos. The socket's directory is root's; the mailer at the other end is a separate uid. file:ReadAll@885 b1c14436f42f60c4157ad0dffb1b998931a58b3a2ebf545578ff6d2e243dcd58
-internal/mailsubmit/verb.go Mount legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 4, new: POST /v1/mail on an instance's control socket. The bearer by the existing verbs' rule (empty or unreadable token refuses everything; SHA-256 constant-time compare); MaxBytesReader(14 MiB), the JSON envelope, base64 raw of at most 10 MiB, 1 to 50 non-empty recipients, a non-empty from, else 400 BAD_REQUEST. Stamps account, app and host from the route the socket was bound for, never from the body, and forwards; a transport error or an answer outside 200/400/403/429/503 is 503 MAILER_UNAVAILABLE. Runs in the agent, as carlos; the body is a tenant's and is only decoded and forwarded, never used to name a path, route or account. registry:App@152,registry:Host@160,whole:Route@147 170951db97d14dc471251211b1526d2a640a0c7aba3f5eec1e6c12bc0ae81d2c
+internal/mailsubmit/verb.go Mount legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 4, new: POST /v1/mail on an instance's control socket. The bearer by the existing verbs' rule (empty or unreadable token refuses everything; SHA-256 constant-time compare); MaxBytesReader(14 MiB), the JSON envelope, base64 raw of at most 10 MiB, 1 to 50 non-empty recipients, a non-empty from, else 400 BAD_REQUEST; at most 2 messages per socket in the agent at once, the next 429 RATE (review round 1, Task 4 P3). Stamps account, app and host from the route the socket was bound for, never from the body, and forwards; a transport error or an answer outside 200/400/403/429/503 is 503 MAILER_UNAVAILABLE. Runs in the agent, as carlos; the body is a tenant's and is only decoded and forwarded, never used to name a path, route or account. registry:App@152,registry:Host@160,whole:Route@147 d981dffe0b5bd91fb4255b761b5434e22de62a37f8224d0c125906874648d7ae
internal/activator/backend_exec.go ExecBackend.agentOwnedVars legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-platform-mail-submission;basis=Task 4: also decides CARLOS_MAIL through mailSubmits: set to "submit" only when the control socket bound, the verb is mounted, the app sender's switch is on and the route is Provisioned; stripped otherwise, a tenant-supplied value from fileEnv included. agentOwnedNames and moves.AgentOwnedVars gain it as a pinned pair. Only narrows what a tenant's files can set. Agent, not root. registry:Host@1209,whole:Route@1171,whole:Route@631 7cc1bcb0b415ee478350a0519799542e0b1e5419c94121519c6e1b349d613c10
internal/activator/backend_exec.go ExecBackend.spawnChildFrom legacy accepted-legacy accepted-legacy;rev3=census-ruling-zddr3;basis=Census ruling zddr3: changed legacy row (comment-only change describing the shim placement); the same class as the accepted-legacy Manager.startIn and placementLive under fix1-merge-review (existing agent delegated-cgroup management remains legacy); no root decision; no registry, /data, release or claim reads. Boundary: the agent's own delegated cgroup subtree (including its scratch probe child), /proc/self, and pipes to and from its own parent, running as carlos.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos (the flat start body): the same change as seedChild: ensureAdminTokenFor(ctx, rt, paths) for the token (the same flat path), the key's producer carrying the HA mint decision, and launchEnvLayer(ctx, rt) for the env and key layer the replica gate reads; a non-HA host's token, key and env are produced and read as before; +whole:Route; only adds refusals for HA hosts;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-edge-page-cache-1;basis=the control listener is now built with the whole route (edge.ListenControl(controlSocket, rt, ...)), the +whole:Route site; it computes the launch inputs once from the build it execs by path (a staged exe's caller-named build, or the gate-resolved pinned version; "" for an unpinned live link) and fileEnv it already read, keeps them on the childProc, and for a live-link spawn publishes them to the in-memory cache (NoteProcessInputs) beside the existing purge; no new file read;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: retain main build parameter, pinned live identity, launchInputs from captured build/environment, and current-process input publication. edge.ListenControl now receives the whole Route as main requires (+whole:Route); no new filesystem or storage input. Branch sandboxLaunch remains before preparation and spawn; existing direct primitive gate unchanged.;rev3=census-ruling-security-review-mitigations;basis=Enforce the unchanged never-served resident refusal once at the shared flat/foreign primary binary spawn sink, before placement, live-link/token/env/control preparation or execution. Covers plain, generation and staged Service wakes; existing served/explicit-flat exemptions and other gates retained. No new filesystem/store source.;rev3=census-ruling-platform-mail-submission;basis=Task 4: the inline mount (Timers, UpdatesReader) is replaced by b.controlMount(rt, tokenReader, n): the same verbs under the same conditions, plus the mail verb when b.Mail is set. The three rt.Host reads move into controlMount; the route is passed whole. Agent, not root; nothing else changes. file:Command@11030,registry:Host@12313,registry:Host@12674,registry:Host@12768,registry:Host@258,registry:Host@4236,registry:Stateless@10961,whole:Route@10853,whole:Route@11002,whole:Route@11410,whole:Route@13065,whole:Route@13157,whole:Route@1527,whole:Route@189,whole:Route@1944,whole:Route@2305,whole:Route@287,whole:Route@4091,whole:Route@4119,whole:Route@4430,whole:Route@476,whole:Route@6501,whole:Route@8766 dacd2d37b38491f11ba1be34795d5fe40915aa044d6732ccf2bae467c733f80e
internal/activator/prepare.go ExecBackend.listenControl legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-edge-page-cache-1;basis=passes the whole route to edge.ListenControl instead of rt.Host (the -registry:Host +whole:Route change); nothing else;rev3=census-ruling-platform-mail-submission;basis=Task 4: the same replacement as spawnChildFrom, with gen as the write fence's generation, so the nested and rootfs listener mounts exactly what the flat one does. Agent, not root. registry:Host@508,whole:Route@361,whole:Route@389 f6534861cdbeef80dbcfaf6b07df685e4ac2f2a86650db54f174871526a50aff
@coverage . 0fbf394b006de2e22e2236a2f0b29bfa959412ddb04068a7c67000d1021e1b06
@coverage internal/activator 2fe6860f1b7ef4f5644e17f59fe3cf75759ec2ffe597994c1478edd0512cbc38
-@coverage internal/host c0ad562284905411f38c76f5d8aefe76eada13927a4629884e46bff52ccf0b30
+@coverage internal/host 0a61b32acb9b181dcc50356db2370ebabe81a66e12096a07526764d0216c792e
@coverage internal/host/demo_units 3a34238356068c6176879f3ee189c81af8e08bfcc0246c5feba80d7169f7af6a
@coverage internal/host/units 691c24cbe981fb8961915598f2a8585d1ccf8368a8eb3b6a58f8c7a2834fe886
@coverage internal/hostenv 6c96c4abe8548fe3cf12d3a220de3e2917c3edfa5320b1662ea76bdf364d24b5
@coverage internal/instancectl 50d4d80f1f1a86bbed67676f4e439eb79a08bb546ea85ff01a3b433925b9d984
@coverage internal/mailer 985199bf5324887938514750668eaa8eb099b1b3be0734c7de77c7fddd4230b1
-@coverage internal/mailsubmit 56f6a85fb8ec114b259da26d7bbc7e5a605fc2013693f19012facc248e10b3d8
+@coverage internal/mailsubmit 519123e15891e0802427595306d8caca1fd7f4f861ae1a2ec70e1c10f012e263
@coverage internal/mailwire 58b9cbb8a003ed11feb1c0352c5c23992fe532da895471ec76045528ab12e077
@coverage internal/moves 9390702695d308a327f5572f4ff5967718141c5d385dff7671ff1e2c825ef407
@coverage internal/provision a7fca446b2464e9d0804272a46146013085cdec8fecb96a3508cc055295f31d3