carlos / platform Public

feat: fence stateless release commands by coordination

Run stateless release commands through the existing command stop and proof machinery under coordinator authority. Persist releasing before exec, require proof and a valid safety deadline before success, and recover durable results without repeating uncertain commands.

Add the existing-record observation seam for Task 2e, execution-level fencing tests, three mutation witnesses, and the updated census proposal. Preserve stateful release callers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 9def7a79f39278747086b56ae965a761bbcf86d3 parent 6f6a3a2
9 files changed, +559 −8
  • docs/superpowers/notes/census-proposal-stateless-replicas-1.md +8 −2
  • internal/activator/activator.go +8 −0
  • internal/activator/coordinator.go +3 −0
  • internal/activator/coordinator_test.go +26 −2
  • internal/activator/rootfsrelease.go +9 −0
  • internal/activator/statelessrelease.go +175 −0
  • internal/activator/statelessrelease_test.go +319 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-stateless-replicas-1.tsv +10 −3

Intent

Human

<task-notification> <task-id>baxqhjwhx</task-id> <tool-use-id>toolu_01L34un2dvUBQgMxSTY4EQvi</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/412bbef6-9468-4e8d-b9fe-5343bad21de8/tasks/baxqhjwhx.output</output-file> <status>completed</status> <summary>Background command "Wait for Task 2c implementer" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>bm1xu80ke</task-id> <tool-use-id>toolu_01Jhe2JfRKj7ey5gjp69UvZt</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/412bbef6-9468-4e8d-b9fe-5343bad21de8/tasks/bm1xu80ke.output</output-file> <status>completed</status> <summary>Background command "Wait for Task 2d implementer" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 9.51 g CO₂e (1,113,418 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on stateless-replicas-1-runtime, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/notes/census-proposal-stateless-replicas-1.md b/docs/superpowers/notes/census-proposal-stateless-replicas-1.md
index 1ad3b372a..bfeab242b 100644
--- a/docs/superpowers/notes/census-proposal-stateless-replicas-1.md
+++ b/docs/superpowers/notes/census-proposal-stateless-replicas-1.md
@@ -1,11 +1,13 @@
# Census approval: stateless-replicas-1
-Ruling `census-ruling-stateless-replicas-1`. The independent reviewer approves or rejects every change below, 1 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+Ruling `census-ruling-stateless-replicas-1`. The independent reviewer approves or rejects every change below, 3 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
| unit | change | read sites | what changed |
|---|---|---|---|
| `cli.go` `runShip` | body | unchanged (2) | Carry --stateless into binary/API and rootfs ship options; same two read sites, no new read. |
+| `internal/activator/activator.go` `type Service` | body | unchanged (0) | Add coordinator, existing-record observation callback and per-host preparation locks; no read in the declaration. |
| `ship_check.go` `rootfsCheck.runArgs` | body | unchanged (2) | Stateless local checks mount only the run volume and omit the database mount; same probe read, no new read. |
+| `internal/activator/rootfsrelease.go` `Service.runRelease` | sites | -registry:Host, -whole:Route ×10 | Delegate unchanged stateful admission and stop/proof behavior to runReleaseAdmitted with no durable admission hook; reads moved to that method. |
Envelopes re-pinned: `.`, `internal/activator`, `internal/host`, `internal/provision`, `internal/release`, `internal/replicas`.
@@ -14,12 +16,16 @@ Review: a model from the other family than the author reads the branch's diff ag
Recorded dispositions, which each change must still satisfy:
- `cli.go` `runShip`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-rootfs-apps-1;basis=rootfs Plan 1 Task 9: takes --rootfs, --processes, --hibernate, --jit and --check and hands a rootfs ship to runShipRootfs (ship_rootfs.go) before the binary path; the --notes-file ReadFile moved into shipNoteText (its own row, the same read of the file the person named) and the direct-mode version mint into mintDirectVersion; one read site fewer, none added; Task 12: the --hibernate flag help is RFS-1-C32's new text, the same reads;rev3=census-ruling-edge-asset-cache-1;basis=takes --assets (repeatable), checks the folders with checkShipAssets (release.ValidAssetPaths; refused on a static site) before the mode split, carries them into the API meta (sess.shipAssets) and the direct-mode manifest (shipAssetsBlock), and passes them to runShipRootfs (rootfsShipOpts.assets), which runs the same check and carries them the same two ways; after a direct-mode ship has stored a release declaring folders, directShipAssetGens runs the console ship door's backfill (provision.MintMissingAssetGens: lists the app's record keys and gives each record without an asset generation one, a CAS write in the deployment bucket as the person running the CLI) and fails naming any record it could not mint; read sites unchanged (2), none added;rev3=census-ruling-rootfs-apps-4;basis=adds the repeatable --env flag and refuses it before anything else unless --check is given (shipEnvRefusal, parseShipCheckEnv); the parsed values go into rootfsShipOpts.checkEnv. --env values reach the check's local container runtime as -e argv only, never root, never a box. No read added; read sites unchanged (2).
+- `internal/activator/activator.go` `type Service`: authority, task B,C,D,F,J4. Basis: rev3=PROPOSED-seed; existing activator lifecycle and due-wake state plus owned seed exclusion and incarnation-keyed diagnostics; normal refusal and preparation ordering remain authoritative; PROPOSED-plans-2-box-limits adds the idleFor hook field, which only narrows idle windows;rev3=census-ruling-plans-4c-box-throttle;basis=gains the maxRunFor hook field beside idleFor (plans 4c). No read added.;rev3=census-ruling-plans-4d-lapse;basis=gains the disabledFor hook field beside maxRunFor (plans 4d). No read added.;rev3=census-ruling-remote-instance-metrics;basis=gains tenancySeq, hostTenants and hostMixed, in-memory fields for Tenancies; no read added;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more field, markers (markerRetry: an atomic running flag and the last log time) for retryOwedMarkers; no read added; merge of origin/main d7ae1d76: main's fields are kept as main has them (census-ruling-remote-instance-metrics: tenancySeq, hostTenants, hostMixed); this branch's change is the same as above;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: new fields for rootfs admission (rootfsArmed, rootfsSwept), the per-host gate ask and refusal memo, and residency state (lister, backoff, start ceiling, cursor, test seam); no read;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: one new field, releaseOps (host to the in-memory release record, under a.mu); no read;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: one new field, leaseNow (a clock seam for a worker start's headroom against the lease deadline, nil is the real clock); no read;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2: gains the holder cache and its single-flight state; no read;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): one field, Fleet (activator.FleetWake: the box's fleet state, not on a fleet by default, on a fleet with a known label and a record reader, or on a fleet with an invalid identity), set by the agent before Start and read only by routeCurrentUnderLease. No read in the declaration. Agent, not root.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a fix round 1: one field, drainBudget (time.Duration), which New copies from residentDrainBudget and a rootfs entry's lease watch reads in its place, so a test's change of the package var never races a watch goroutine; declaration only, reads nothing; merge of origin/main 6f1f6ca6: main's one field, Fleet (activator.FleetWake), is kept as main has it (census-ruling-managed-fleets-1b); this branch's change is the same as above
- `ship_check.go` `rootfsCheck.runArgs`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-1;basis=root-input (J4, as main's db.go units); the carlos CLI on a person's machine, as the person (no box unit): new (rootfs Plan 1), builds the docker or podman run argv for one check container; the scanner matches the word Command, here a field of release.Process (a process's argv), not os/exec; reads no file; decides nothing for root;rev3=census-ruling-rootfs-check-volumes;basis=R2 P1: the data and run volume mounts (-v) now carry :nocopy through rootfsCheck.volumeMount, so Docker and Podman never fill an empty check volume from the image directory at the mount point (which would reset the prepared owner and mode); same volumes, same paths, same probe mount, nothing else in the argv changed. Runs on the person's machine as the person; no box unit; no read added.
+- `internal/activator/rootfsrelease.go` `Service.runRelease`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R, R1: new; the one place a release command runs. Refuses while any record of the host is open; skips the row's good build (releaseRan); reads the declared processes (declaredProcesses: the existing staged-manifest read) and refuses on a read error, never treating it as no release; runs only when releaseDue; needs a lease watch and a ReleaseBackend; its gate is the caller's plus the lease's Err and its safety deadline more than releaseStopLead (cmdStopBound, 2 min) away; creates the record under a.mu after releaseAdmitLocked; publishes the generations file and the build state (recordBuild) before anything runs; times out at the manifest's timeout_sec (default, capped at runs.MaxTimeout); ReleaseEnv; a supervisor stops the unit ahead of the lease's safety deadline; StartRelease under the exec gate; polls the unit (root's existing cmd status); stops and settles it (the existing cmd hold's stop, cmdStopBound); only a non-zero exit, a signal or the timeout with the unit proven gone is the build's failure (*ReleaseError); registry:Host sites are the record key and log lines;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 9: newCmdHold takes the hold's role; a release command's hold is instancectl.RoleCmd, the unit it runs in; nothing else changed, no read added
New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+- new `internal/activator/rootfsrelease.go:Service.runReleaseAdmitted`: reads +registry:Host, +whole:Route ×11; written legacy, accepted-legacy, frozen
+- new `internal/activator/statelessrelease.go:Service.PrepareStatelessRelease`: reads +registry:Account, +registry:App, +registry:GoodDemand, +registry:GoodDigest, +registry:GoodVersion, +registry:Host ×7, +whole:Route ×5; written legacy, accepted-legacy, frozen
- new `internal/replicas/coordinator.go:ChangeCoordinator`: reads +file:Read; written legacy, accepted-legacy, frozen
-Seal: `5f805400717bad7726bd9d62744b8103a40eb5f5823b0ab7c960a5c0965cb3bc` → `09734aa86f42e64d772722a19bb0a6aed7519e7cccfb7b18320b5855b0b4bb11`.
+Seal: `5f805400717bad7726bd9d62744b8103a40eb5f5823b0ab7c960a5c0965cb3bc` → `1dea183001853f9cb251290ef442f1a7aa8675360615b7c3b68cdc2a156fc44e`.
Overlay: `internal/provision/testdata/plan14-root-reads-stateless-replicas-1.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/activator/activator.go b/internal/activator/activator.go
index ec98f5ae3..3c3dbb888 100644
--- a/internal/activator/activator.go
+++ b/internal/activator/activator.go
@@ -80,6 +80,7 @@ import (
"github.com/carlosframework/platform/internal/provision"
"github.com/carlosframework/platform/internal/registry"
"github.com/carlosframework/platform/internal/release"
+ "github.com/carlosframework/platform/internal/replicas"
)
// SidecarHeader marks every request a co-spawned sidecar makes to its own
@@ -1242,6 +1243,13 @@ var errShuttingDown = errors.New("activator: the agent is shutting down")
// edge.Cache and edge.ListenControl; serve calls edge.MarkAnswered), and the
// seam back is the interface the edge declares for itself.
type Service struct {
+ // Set these before use. ObserveReplicaRelease reuses the wake/rollout
+ // record observation and supplies the canonical manifest digest, not
+ // the staged artifact digest. Missing observations refuse execution.
+ Coordinator CoordinatorClient
+ ObserveReplicaRelease func(context.Context, registry.Route) (replicas.Identity, replicas.Build, *replicas.Deploy, error)
+ replicaReleaseLocks sync.Map
+
// Startup gates admission while the agent recovers installations. Set before publication.
Startup <-chan struct{}
// startupSeenAt is when serve first found Startup closed (unix nanos,
diff --git a/internal/activator/coordinator.go b/internal/activator/coordinator.go
index 6108529fd..76e954ad1 100644
--- a/internal/activator/coordinator.go
+++ b/internal/activator/coordinator.go
@@ -143,6 +143,9 @@ func (c *CoordinationClient) Acquire(ctx context.Context, id replicas.Identity)
func (c *CoordinationClient) ReleaseState(ctx context.Context, id replicas.Identity, change replicas.ReleaseChange) (replicas.Deploy, error) {
c.mu.Lock()
a := c.held[id]
+ if change.Term == "" && a != nil {
+ change.Term = a.term
+ }
if c.closed || a == nil || a.errLocked() != nil || a.term != change.Term || c.release == nil {
c.mu.Unlock()
return replicas.Deploy{}, replicas.ErrFenced
diff --git a/internal/activator/coordinator_test.go b/internal/activator/coordinator_test.go
index ae4cb5a49..684cc9c3d 100644
--- a/internal/activator/coordinator_test.go
+++ b/internal/activator/coordinator_test.go
@@ -46,7 +46,7 @@ func TestCoordinatorTermFencesLateResults(t *testing.T) {
t.Fatal("old authority remained live")
}
_, lateRenewErr := exchange(ctx, id, replicas.CoordinatorChange{Op: "renew", Term: oldTerm, Box: "box", BootID: "boot"})
- webStops, workerStops := 0, 0
+ webStops, workerStops := replicaTermExecution(t)
if oldTerm == newTerm || lateSuccessErr == nil || lateRenewErr == nil {
t.Fatal("expired term remained authoritative")
}
@@ -164,7 +164,7 @@ func TestCoordinatorRenewalCannotBridgeExpiredSafety(t *testing.T) {
}
}
-func TestReplicaReleaseLostSuccessReply(t *testing.T) {
+func TestReplicaReleaseLostSuccessReplyClient(t *testing.T) {
ctx := context.Background()
calls := 0
id := replicas.Identity{Incarnation: "life"}
@@ -238,3 +238,27 @@ func TestCoordinatorReleaseStateRejectsLateResults(t *testing.T) {
t.Fatalf("late success: %v", err)
}
}
+
+func TestCoordinatorReleaseStateFillsOnlyOmittedTerm(t *testing.T) {
+ c := NewCoordinatorClient("box", "boot", func(context.Context, replicas.Identity, replicas.CoordinatorChange) (replicas.CoordinatorReply, error) {
+ return replicas.CoordinatorReply{Lease: replicas.Coordinator{Term: "current", Box: "box", BootID: "boot"}, RemainingMS: replicas.CoordinatorTTL.Milliseconds()}, nil
+ }, func(_ context.Context, id replicas.Identity, change replicas.ReleaseChange) (replicas.Deploy, error) {
+ if change.Term != "current" {
+ t.Fatal("omitted term was not filled")
+ }
+ return replicas.Deploy{ID: change.ID, Term: change.Term, Phase: "pending", Target: change.Target, Incarnation: id.Incarnation}, nil
+ })
+ ctx := context.Background()
+ id := replicas.Identity{Incarnation: "life"}
+ if _, err := c.Acquire(ctx, id); err != nil {
+ t.Fatal(err)
+ }
+ change := replicas.ReleaseChange{Op: "begin", ID: "deploy", Target: replicas.Build{Version: "v2", Digest: "canonical"}}
+ if _, err := c.ReleaseState(ctx, id, change); err != nil {
+ t.Fatal(err)
+ }
+ change.Term = "stale"
+ if _, err := c.ReleaseState(ctx, id, change); err == nil {
+ t.Fatal("explicit stale term was replaced")
+ }
+}
diff --git a/internal/activator/rootfsrelease.go b/internal/activator/rootfsrelease.go
index 73293aaaa..737b80520 100644
--- a/internal/activator/rootfsrelease.go
+++ b/internal/activator/rootfsrelease.go
@@ -366,6 +366,10 @@ func (a *Service) releaseAppLog(rt registry.Route) io.Writer {
// gone. Never call it with a.mu held.
func (a *Service) runRelease(ctx context.Context, e *actEntry, rt registry.Route, id release.StagedIdentity,
held leaseWatch, gate func() error) (executed bool, err error) {
+ return a.runReleaseAdmitted(ctx, e, rt, id, held, gate, nil)
+}
+
+func (a *Service) runReleaseAdmitted(ctx context.Context, e *actEntry, rt registry.Route, id release.StagedIdentity, held leaseWatch, gate func() error, beforeExec func() error) (executed bool, err error) {
host := rt.Host
// INV-R4: one release per host, whatever state the last one is in.
a.mu.Lock()
@@ -460,6 +464,11 @@ func (a *Service) runRelease(ctx context.Context, e *actEntry, rt registry.Route
if err := a.recordBuild(ctx, host, id.Version); err != nil {
return refuse(err, true)
}
+ if beforeExec != nil {
+ if err := beforeExec(); err != nil {
+ return refuse(err, true)
+ }
+ }
emitEvent(a.Logs, rt, "info", fmt.Sprintf(rolloutwords.EventReleaseStarted, id.Version))
limit := releaseTimeout(procs[release.ProcessRelease])
tctx, tcancel := context.WithTimeout(rctx, limit)
diff --git a/internal/activator/statelessrelease.go b/internal/activator/statelessrelease.go
new file mode 100644
index 000000000..1d6efdaef
--- /dev/null
+++ b/internal/activator/statelessrelease.go
@@ -0,0 +1,175 @@
+package activator
+
+import (
+ "context"
+ "errors"
+ "sync"
+ "time"
+
+ "github.com/carlosframework/platform/internal/registry"
+ "github.com/carlosframework/platform/internal/release"
+ "github.com/carlosframework/platform/internal/replicas"
+)
+
+func (a *Service) PrepareStatelessRelease(ctx context.Context, rt registry.Route, id release.StagedIdentity, deployID string) error {
+ ctx, end := a.attemptCtx(ctx)
+ defer end()
+ lock, _ := a.replicaReleaseLocks.LoadOrStore(rt.Host, &sync.Mutex{})
+ mu := lock.(*sync.Mutex)
+ if !mu.TryLock() {
+ return errSwapBusy
+ }
+ defer mu.Unlock()
+ if a.ObserveReplicaRelease == nil || deployID == "" {
+ return replicas.ErrFenced
+ }
+ identity, target, old, err := a.ObserveReplicaRelease(ctx, rt)
+ if err != nil {
+ return err
+ }
+ if identity.Account != rt.Account || identity.App != rt.App || identity.Host != rt.Host || identity.Incarnation == "" || target.Version != id.Version || target.Digest == "" {
+ return replicas.ErrFenced
+ }
+ matches := func(d *replicas.Deploy) bool {
+ return d != nil && d.ID == deployID && d.Incarnation == identity.Incarnation && d.Target == target
+ }
+ if old != nil && old.ID == deployID {
+ if !matches(old) {
+ return replicas.ErrFenced
+ }
+ if old.Phase == "released" {
+ return nil
+ }
+ if old.Phase == "unknown" {
+ return ErrReplicaReleaseUnknown
+ }
+ if old.Phase == "failed" {
+ return errReleaseNotPassed
+ }
+ }
+ if a.releaseOpen(rt.Host) {
+ return ErrReplicaReleaseUnknown
+ }
+ if a.Coordinator == nil {
+ return replicas.ErrFenced
+ }
+ held, err := a.Coordinator.Acquire(ctx, identity)
+ if err != nil {
+ return err
+ }
+ if held == nil {
+ return replicas.ErrFenced
+ }
+ // Keep coordination with the client; its existing tick renews it, and
+ // an unproven command must retain its stop obligation through expiry.
+ valid := func() error {
+ until, err := held.SafeUntil()
+ if err != nil || held.Err() != nil || !time.Now().Before(until) {
+ return replicas.ErrFenced
+ }
+ return ctx.Err()
+ }
+ if err := valid(); err != nil {
+ return err
+ }
+ until, _ := held.SafeUntil()
+ ctx, cancel := context.WithDeadline(ctx, until)
+ defer cancel()
+ revision := uint64(0)
+ if old != nil {
+ revision = old.Revision
+ }
+ term := ""
+ change := func(op string) (replicas.Deploy, error) {
+ d, err := a.Coordinator.ReleaseState(ctx, identity, replicas.ReleaseChange{Op: op, ID: deployID, Target: target, Revision: revision, Term: term})
+ if err == nil {
+ revision = d.Revision
+ term = d.Term
+ }
+ return d, err
+ }
+ if old != nil && old.Phase == "releasing" {
+ // A releasing observation is never permission to execute, even when
+ // this client still holds its term after a lost begin/exec response.
+ closed, closeErr := a.Coordinator.ReleaseState(ctx, identity, replicas.ReleaseChange{Op: "unknown", ID: old.ID, Target: old.Target, Revision: old.Revision})
+ if closeErr != nil || old.ID == deployID {
+ return ErrReplicaReleaseUnknown
+ }
+ revision = closed.Revision
+ }
+ if old != nil && old.ID == deployID {
+ return ErrReplicaReleaseUnknown
+ }
+ if _, err := change("begin"); err != nil {
+ return ErrReplicaReleaseUnknown
+ }
+ // Only this path discards stateful good-build inference. The durable
+ // deploy ID, canonical target and lifetime decide whether work is due.
+ rt.GoodVersion, rt.GoodDigest, rt.GoodDemand = "", "", ""
+ a.mu.Lock()
+ e := a.entries[rt.Host]
+ owner := e
+ if e == nil {
+ e = &actEntry{host: rt.Host, route: rt}
+ }
+ a.mu.Unlock()
+ gate := func() error {
+ if err := valid(); err != nil {
+ return err
+ }
+ a.mu.Lock()
+ defer a.mu.Unlock()
+ if a.shuttingDown {
+ return errShuttingDown
+ }
+ if a.fences[rt.Host] != 0 || e.retired {
+ return ErrFenced
+ }
+ if a.entries[rt.Host] != owner {
+ return errSwapSuperseded
+ }
+ return nil
+ }
+ releasing := false
+ run := func() (bool, error) {
+ if !rt.Rootfs() {
+ if err := release.VerifyStaged(id); err != nil {
+ return false, err
+ }
+ return false, gate()
+ }
+ return a.runReleaseAdmitted(ctx, e, rt, id, watchOf(held), gate, func() error {
+ if _, err := change("releasing"); err != nil {
+ return ErrReplicaReleaseUnknown
+ }
+ releasing = true
+ return nil
+ })
+ }
+ _, runErr := run()
+ phase := "released"
+ if runErr != nil {
+ phase = "unknown"
+ var failed *ReleaseError
+ if errors.As(runErr, &failed) || (!releasing && !errors.Is(runErr, ErrReplicaReleaseUnknown)) {
+ phase = "failed"
+ }
+ }
+ if valid() != nil {
+ return ErrReplicaReleaseUnknown
+ }
+ _, err = change(phase)
+ if err != nil {
+ // Only reread durable evidence; never repeat command execution to
+ // recover a reply lost after the success was committed.
+ observedID, observedTarget, d, observeErr := a.ObserveReplicaRelease(ctx, rt)
+ if phase == "released" && observeErr == nil && observedID == identity && observedTarget == target && matches(d) && d.Term == term && d.Phase == "released" {
+ return nil
+ }
+ return ErrReplicaReleaseUnknown
+ }
+ if phase == "unknown" {
+ return ErrReplicaReleaseUnknown
+ }
+ return runErr
+}
diff --git a/internal/activator/statelessrelease_test.go b/internal/activator/statelessrelease_test.go
new file mode 100644
index 000000000..c98616b07
--- /dev/null
+++ b/internal/activator/statelessrelease_test.go
@@ -0,0 +1,319 @@
+package activator
+
+import (
+ "context"
+ "errors"
+ "sync"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/registry"
+ "github.com/carlosframework/platform/internal/replicas"
+)
+
+type replicaReleaseStore struct {
+ mu sync.Mutex
+ d *replicas.Deploy
+ held *ownedLease
+ acquires int
+ lostReply bool
+}
+
+func (s *replicaReleaseStore) Acquire(context.Context, replicas.Identity) (replicas.Authority, error) {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+ s.acquires++
+ return s.held, nil
+}
+func (s *replicaReleaseStore) ReleaseState(_ context.Context, id replicas.Identity, c replicas.ReleaseChange) (replicas.Deploy, error) {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+ if s.held.Err() != nil {
+ return replicas.Deploy{}, replicas.ErrFenced
+ }
+ if c.Term == "" {
+ c.Term = "term"
+ }
+ if s.d != nil && s.d.Phase == "released" && c.Op == "released" && s.d.ID == c.ID {
+ return *s.d, nil
+ }
+ rev := uint64(0)
+ if s.d != nil {
+ rev = s.d.Revision
+ }
+ if c.Revision != rev {
+ return replicas.Deploy{}, replicas.ErrFenced
+ }
+ phase := c.Op
+ if phase == "begin" {
+ phase = "pending"
+ }
+ d := replicas.Deploy{ID: c.ID, Target: c.Target, Incarnation: id.Incarnation, Term: c.Term, Phase: phase, Revision: rev + 1}
+ s.d = &d
+ if c.Op == "released" && s.lostReply {
+ s.lostReply = false
+ return replicas.Deploy{}, context.DeadlineExceeded
+ }
+ return d, nil
+}
+func (s *replicaReleaseStore) snapshot() *replicas.Deploy {
+ s.mu.Lock()
+ defer s.mu.Unlock()
+ if s.d == nil {
+ return nil
+ }
+ d := *s.d
+ return &d
+}
+func replicaReleaseRig(t *testing.T) (*releaseRig, *replicaReleaseStore) {
+ t.Helper()
+ r := newReleaseRig(t)
+ s := &replicaReleaseStore{held: newOwnedLease(time.Now().Add(time.Hour), false)}
+ r.a.Coordinator = s
+ r.a.ObserveReplicaRelease = func(context.Context, registry.Route) (replicas.Identity, replicas.Build, *replicas.Deploy, error) {
+ return replicas.Identity{Account: r.rt.Account, App: r.rt.App, Host: r.rt.Host, Incarnation: "life"}, replicas.Build{Version: r.id.Version, Digest: "canonical-manifest"}, s.snapshot(), nil
+ }
+ return r, s
+}
+func prepareReplica(r *releaseRig, id string) <-chan error {
+ ch := make(chan error, 1)
+ go func() { ch <- r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, id) }()
+ return ch
+}
+func replicaResult(t *testing.T, ch <-chan error) error {
+ t.Helper()
+ select {
+ case err := <-ch:
+ return err
+ case <-time.After(3 * time.Second):
+ t.Fatal("release did not stop")
+ return nil
+ }
+}
+func TestReplicaReleaseUnknownStopsDeploy(t *testing.T) {
+ r, s := replicaReleaseRig(t)
+ r.b.onStart = func() {
+ if d := s.snapshot(); d == nil || d.Phase != "releasing" {
+ t.Error("releasing was not persisted before exec")
+ }
+ }
+ done := prepareReplica(r, "deploy-1")
+ r.waitStarted(t)
+ s.held.lose(replicas.ErrFenced)
+ if err := replicaResult(t, done); !errors.Is(err, ErrReplicaReleaseUnknown) {
+ t.Fatalf("loss: %v", err)
+ }
+ if len(r.b.unit.stopTimes()) == 0 {
+ t.Fatal("lost command was not stopped")
+ }
+ if r.e.route.Version != "v1" {
+ t.Fatal("unknown authorized target")
+ }
+ s.held = newOwnedLease(time.Now().Add(time.Hour), false)
+ for i := 0; i < 3; i++ {
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy-1"); !errors.Is(err, ErrReplicaReleaseUnknown) {
+ t.Fatalf("retry: %v", err)
+ }
+ }
+ restarted := newReleaseRig(t)
+ restarted.a.Coordinator = s
+ restarted.a.ObserveReplicaRelease = r.a.ObserveReplicaRelease
+ if err := restarted.a.PrepareStatelessRelease(context.Background(), restarted.rt, restarted.id, "deploy-1"); !errors.Is(err, ErrReplicaReleaseUnknown) || restarted.b.startCount() != 0 {
+ t.Fatal("restart reran unknown deploy")
+ }
+ if s.snapshot().Phase != "unknown" || r.b.startCount() != 1 {
+ t.Fatal("dead term reran")
+ }
+ r.b.unit = newReleaseUnit()
+ r.b.started = make(chan struct{})
+ r.b.unit.done("1", "0", "success")
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy-2"); err != nil {
+ t.Fatal(err)
+ }
+ if r.b.startCount() != 2 || s.snapshot().Phase != "released" {
+ t.Fatal("explicit deploy did not run")
+ }
+}
+func TestReplicaReleaseLostSuccessReply(t *testing.T) {
+ r, s := replicaReleaseRig(t)
+ s.lostReply = true
+ r.b.unit.done("1", "0", "success")
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy"); err != nil {
+ t.Fatal(err)
+ }
+ acquired := s.acquires
+ r.a.Coordinator = nil
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy"); err != nil {
+ t.Fatal(err)
+ }
+ if r.b.startCount() != 1 || s.acquires != acquired {
+ t.Fatal("durable success reacquired or reran")
+ }
+}
+func TestReplicaReleaseProofBeforeSuccess(t *testing.T) {
+ r, s := replicaReleaseRig(t)
+ r.b.unit.settle = func(int) error { return ErrStillRunning }
+ r.b.unit.done("1", "0", "success")
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy"); !errors.Is(err, ErrReplicaReleaseUnknown) {
+ t.Fatalf("unproven: %v", err)
+ }
+ if s.snapshot().Phase == "released" || !r.a.releaseOpen(r.rt.Host) {
+ t.Fatal("unproven command authorized target or dropped obligation")
+ }
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "next"); err == nil || r.b.startCount() != 1 {
+ t.Fatal("fresh deploy crossed obligation")
+ }
+ r.b.unit.settle = nil
+ if err := r.a.settleRelease(r.record()); err != nil {
+ t.Fatal(err)
+ }
+}
+
+func replicaTermExecution(t *testing.T) (int, int) {
+ t.Helper()
+ r, _ := replicaReleaseRig(t)
+ web, worker := &fakeProc{}, &fakeProc{}
+ r.e.proc = web
+ r.e.rootfsWorkers = map[string]*rootfsWorker{"jobs": {name: "jobs", proc: worker}}
+ var clockMu sync.Mutex
+ now := time.Now()
+ clock := func() time.Time { clockMu.Lock(); defer clockMu.Unlock(); return now }
+ var leaseMu sync.Mutex
+ var lease *replicas.Coordinator
+ exchange := func(_ context.Context, _ replicas.Identity, c replicas.CoordinatorChange) (replicas.CoordinatorReply, error) {
+ leaseMu.Lock()
+ defer leaseMu.Unlock()
+ next, err := replicas.ChangeCoordinator(lease, c, clock())
+ if err != nil {
+ return replicas.CoordinatorReply{}, err
+ }
+ lease = &next
+ return replicas.CoordinatorReply{Lease: next, RemainingMS: replicas.CoordinatorTTL.Milliseconds()}, nil
+ }
+ var d *replicas.Deploy
+ identity := replicas.Identity{Account: r.rt.Account, App: r.rt.App, Host: r.rt.Host, Incarnation: "life"}
+ target := replicas.Build{Version: r.id.Version, Digest: "canonical"}
+ publish := func(_ context.Context, _ replicas.Identity, c replicas.ReleaseChange) (replicas.Deploy, error) {
+ leaseMu.Lock()
+ defer leaseMu.Unlock()
+ if err := replicas.CheckAuthority(lease, c.Term, "box", "boot", clock()); err != nil {
+ return replicas.Deploy{}, err
+ }
+ phase := c.Op
+ if phase == "begin" {
+ phase = "pending"
+ }
+ next := replicas.Deploy{ID: c.ID, Target: c.Target, Incarnation: identity.Incarnation, Term: c.Term, Phase: phase, Revision: c.Revision + 1}
+ d = &next
+ return next, nil
+ }
+ a := NewCoordinatorClient("box", "boot", exchange, publish)
+ a.now = clock
+ b := NewCoordinatorClient("box", "boot", exchange, publish)
+ b.now = clock
+ r.a.Coordinator = a
+ r.a.ObserveReplicaRelease = func(context.Context, registry.Route) (replicas.Identity, replicas.Build, *replicas.Deploy, error) {
+ return identity, target, d, nil
+ }
+ r.b.unit.done("1", "0", "success")
+ r.b.unit.settle = func(int) error {
+ oldTerm := d.Term
+ clockMu.Lock()
+ now = now.Add(replicas.CoordinatorTTL + time.Second)
+ clockMu.Unlock()
+ if _, err := b.Acquire(context.Background(), identity); err != nil {
+ t.Fatal(err)
+ }
+ _, lateSuccessErr := a.ReleaseState(context.Background(), identity, replicas.ReleaseChange{Op: "released", Term: oldTerm, ID: "deploy", Target: target})
+ _, lateRenewErr := exchange(context.Background(), identity, replicas.CoordinatorChange{Op: "renew", Term: oldTerm, Box: "box", BootID: "boot"})
+ if lateSuccessErr == nil || lateRenewErr == nil {
+ t.Error("expired term remained authoritative during execution")
+ }
+ return nil
+ }
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy"); !errors.Is(err, ErrReplicaReleaseUnknown) {
+ t.Fatalf("late execution success: %v", err)
+ }
+ if d.Phase == "released" || len(r.b.unit.stopTimes()) == 0 {
+ t.Fatal("late success published or release not stopped")
+ }
+ web.mu.Lock()
+ webStops := web.stopAttempts
+ web.mu.Unlock()
+ worker.mu.Lock()
+ workerStops := worker.stopAttempts
+ worker.mu.Unlock()
+ return webStops, workerStops
+}
+
+func TestReplicaReleaseCommandlessAndGoodBuild(t *testing.T) {
+ for _, commandless := range []bool{true, false} {
+ t.Run(map[bool]string{true: "commandless", false: "good-build-is-not-evidence"}[commandless], func(t *testing.T) {
+ r, s := replicaReleaseRig(t)
+ r.rt.GoodVersion, r.rt.GoodDigest = r.id.Version, r.id.Digest
+ if commandless {
+ delete(r.b.procs, "release")
+ } else {
+ r.b.unit.done("1", "0", "success")
+ }
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy"); err != nil {
+ t.Fatal(err)
+ }
+ want := 1
+ if commandless {
+ want = 0
+ }
+ if r.b.startCount() != want || s.snapshot().Phase != "released" {
+ t.Fatal("incorrect command admission")
+ }
+ })
+ }
+}
+
+func TestReplicaReleaseBinaryCommandless(t *testing.T) {
+ r, s := replicaReleaseRig(t)
+ r.rt.Runtime = ""
+ r.id = stagedID(t, t.TempDir(), "v2")
+ r.b.procsErr = errors.New("binary must not read rootfs processes")
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy"); err != nil {
+ t.Fatal(err)
+ }
+ if r.b.startCount() != 0 || s.snapshot().Phase != "released" {
+ t.Fatal("binary release was not commandless")
+ }
+}
+
+func TestReplicaReleaseFailureAndObservation(t *testing.T) {
+ t.Run("failed", func(t *testing.T) {
+ r, s := replicaReleaseRig(t)
+ r.b.unit.done("1", "7", "exit-code")
+ var failed *ReleaseError
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy"); !errors.As(err, &failed) {
+ t.Fatalf("failed exit: %v", err)
+ }
+ if s.snapshot().Phase != "failed" {
+ t.Fatal("failed exit did not persist")
+ }
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy"); err == nil || r.b.startCount() != 1 {
+ t.Fatal("failed ID reran")
+ }
+ })
+ t.Run("missing", func(t *testing.T) {
+ r, s := replicaReleaseRig(t)
+ r.a.ObserveReplicaRelease = nil
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy"); err == nil || s.acquires != 0 || r.b.startCount() != 0 {
+ t.Fatal("missing observation ran")
+ }
+ })
+ t.Run("deadline-during-proof", func(t *testing.T) {
+ r, s := replicaReleaseRig(t)
+ r.b.unit.done("1", "0", "success")
+ r.b.unit.settle = func(int) error { s.held.setUntil(time.Now().Add(-time.Second)); return nil }
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy"); !errors.Is(err, ErrReplicaReleaseUnknown) {
+ t.Fatalf("late proof: %v", err)
+ }
+ if s.snapshot().Phase == "released" {
+ t.Fatal("expired proof published")
+ }
+ })
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 4ade7b3df..38291f8c0 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -56,4 +56,4 @@ plan14-root-reads-fix-set-aside-exdev.tsv f9d3016cc6803338f9db19311f3f598e20c37c
plan14-root-reads-durability-3a-escrow.tsv 03a92257beb9b8aac421559e247d191bd69f28a0b26243397a1344a90d59fc2a
plan14-root-reads-rootfs-default-home.tsv 7a0a3da3d6fe7e3c77abb22676db000af2a276c3d13ccae0f038190f51287ed5
plan14-root-reads-probe-burst-limit.tsv 5f805400717bad7726bd9d62744b8103a40eb5f5823b0ab7c960a5c0965cb3bc
-plan14-root-reads-stateless-replicas-1.tsv 09734aa86f42e64d772722a19bb0a6aed7519e7cccfb7b18320b5855b0b4bb11
+plan14-root-reads-stateless-replicas-1.tsv 1dea183001853f9cb251290ef442f1a7aa8675360615b7c3b68cdc2a156fc44e
diff --git a/internal/provision/testdata/plan14-root-reads-stateless-replicas-1.tsv b/internal/provision/testdata/plan14-root-reads-stateless-replicas-1.tsv
index 3fb8df7b7..ec258ba7d 100644
--- a/internal/provision/testdata/plan14-root-reads-stateless-replicas-1.tsv
+++ b/internal/provision/testdata/plan14-root-reads-stateless-replicas-1.tsv
@@ -1,14 +1,21 @@
# Census overlay stateless-replicas-1, written by census-propose (#369). census-ruling-stateless-replicas-1, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-stateless-replicas-1.md.
-# 2 body, 0 sites, 6 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
-# 1 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+# 3 body, 1 sites, 6 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 3 new dispositions: 0 reads re-frozen at their disposition with the claim, 3 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
@legacy 8532ad0b6523e01bb6548e7a0ff565615b99e39a8921c338db522812368899a3 cli.go runShip legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-rootfs-apps-1;basis=rootfs Plan 1 Task 9: takes --rootfs, --processes, --hibernate, --jit and --check and hands a rootfs ship to runShipRootfs (ship_rootfs.go) before the binary path; the --notes-file ReadFile moved into shipNoteText (its own row, the same read of the file the person named) and the direct-mode version mint into mintDirectVersion; one read site fewer, none added; Task 12: the --hibernate flag help is RFS-1-C32's new text, the same reads;rev3=census-ruling-edge-asset-cache-1;basis=takes --assets (repeatable), checks the folders with checkShipAssets (release.ValidAssetPaths; refused on a static site) before the mode split, carries them into the API meta (sess.shipAssets) and the direct-mode manifest (shipAssetsBlock), and passes them to runShipRootfs (rootfsShipOpts.assets), which runs the same check and carries them the same two ways; after a direct-mode ship has stored a release declaring folders, directShipAssetGens runs the console ship door's backfill (provision.MintMissingAssetGens: lists the app's record keys and gives each record without an asset generation one, a CAS write in the deployment bucket as the person running the CLI) and fails naming any record it could not mint; read sites unchanged (2), none added;rev3=census-ruling-rootfs-apps-4;basis=adds the repeatable --env flag and refuses it before anything else unless --check is given (shipEnvRefusal, parseShipCheckEnv); the parsed values go into rootfsShipOpts.checkEnv. --env values reach the check's local container runtime as -e argv only, never root, never a box. No read added; read sites unchanged (2).;rev3=census-ruling-stateless-replicas-1;basis=Carry --stateless into binary/API and rootfs ship options; same two read sites, no new read. file:ReadFile@7899,file:ReadFile@8123 d6f244d2c3bcae95eb8ec0fa7e57c52e9b50c7e9e2e00dda85f930b643731a51
@legacy 1e4efb560a06cb532c8d4caf719ff375c27a03a5651b26c59d81f271c70da628 ship_check.go rootfsCheck.runArgs legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-1;basis=root-input (J4, as main's db.go units); the carlos CLI on a person's machine, as the person (no box unit): new (rootfs Plan 1), builds the docker or podman run argv for one check container; the scanner matches the word Command, here a field of release.Process (a process's argv), not os/exec; reads no file; decides nothing for root;rev3=census-ruling-rootfs-check-volumes;basis=R2 P1: the data and run volume mounts (-v) now carry :nocopy through rootfsCheck.volumeMount, so Docker and Podman never fill an empty check volume from the image directory at the mount point (which would reset the prepared owner and mode); same volumes, same paths, same probe mount, nothing else in the argv changed. Runs on the person's machine as the person; no box unit; no read added.;rev3=census-ruling-stateless-replicas-1;basis=Stateless local checks mount only the run volume and omit the database mount; same probe read, no new read. file:Command@887,file:Command@971 e684fd3273527a209460ed81e5bcd472a4282f46830fe580e5f07f0b0d876684
+@legacy bf907111a6526f31ed49ab718b90896b8f33a48ba63f26f47f3889a521e82bb9 internal/activator/rootfsrelease.go Service.runReleaseAdmitted legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Extract existing runner unchanged except optional pre-exec durable release transition after local admission and before any command; same staged process reads, stop/proof and exec gates, no new filesystem path. registry:Host@216,whole:Route@3085,whole:Route@3314,whole:Route@3802,whole:Route@3831,whole:Route@5879,whole:Route@621,whole:Route@6347,whole:Route@6624,whole:Route@7054,whole:Route@849,whole:Route@934 de8d9d6b31ac2b8cf2c34aaca32ecfbdd2c8966f75def906e3baef5bb409d109
+@legacy 33d992eb35addcdfb9c8049f082f7aa9559443e33ce3008e819db38b50b6bf36 internal/activator/statelessrelease.go Service.PrepareStatelessRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Read durable deploy evidence and canonical target via existing-record observation seam; use coordinator authority only for this path, persist releasing before exec and require proof plus SafeUntil before success; commandless binary verifies staged artifact separately; no new store polling or direct typed record writer callsite. registry:Account@544,registry:App@574,registry:GoodDemand@3040,registry:GoodDigest@3025,registry:GoodVersion@3009,registry:Host@1170,registry:Host@224,registry:Host@3096,registry:Host@3154,registry:Host@3370,registry:Host@3438,registry:Host@601,whole:Route@3163,whole:Route@3170,whole:Route@3722,whole:Route@4435,whole:Route@483 f0ace93030a592f4182099d5c7ca2d91eea88d2b521e5a039135977382e58c95
@legacy 1861ee20fec27c99526b8095d2b82598367595db4fcdbf2bc47ba40a269ec37f internal/replicas/coordinator.go ChangeCoordinator legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Generate a fresh 128-bit coordinator term using crypto/rand.Read; no file path or process input added. file:Read@472 e50ce5a352b3022a1ee6375fbfee315a5d2fcaeb4f4a25f4e33a5a10e3000a67
+@legacy e022f83d4f2fe0524efad7d2e7acc9cc44a0510f14016131edc162dc02242142 internal/activator/rootfsrelease.go Service.runRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R, R1: new; the one place a release command runs. Refuses while any record of the host is open; skips the row's good build (releaseRan); reads the declared processes (declaredProcesses: the existing staged-manifest read) and refuses on a read error, never treating it as no release; runs only when releaseDue; needs a lease watch and a ReleaseBackend; its gate is the caller's plus the lease's Err and its safety deadline more than releaseStopLead (cmdStopBound, 2 min) away; creates the record under a.mu after releaseAdmitLocked; publishes the generations file and the build state (recordBuild) before anything runs; times out at the manifest's timeout_sec (default, capped at runs.MaxTimeout); ReleaseEnv; a supervisor stops the unit ahead of the lease's safety deadline; StartRelease under the exec gate; polls the unit (root's existing cmd status); stops and settles it (the existing cmd hold's stop, cmdStopBound); only a non-zero exit, a signal or the timeout with the unit proven gone is the build's failure (*ReleaseError); registry:Host sites are the record key and log lines;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 9: newCmdHold takes the hold's role; a release command's hold is instancectl.RoleCmd, the unit it runs in; nothing else changed, no read added;rev3=census-ruling-stateless-replicas-1;basis=Delegate unchanged stateful admission and stop/proof behavior to runReleaseAdmitted with no durable admission hook; reads moved to that method. whole:Route@212 45130d20bc0a8f9dcc30908479ce0189e39ee9e68d44e95a9aa6b8e84e0bc20f
cli.go runShip legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-rootfs-apps-1;basis=rootfs Plan 1 Task 9: takes --rootfs, --processes, --hibernate, --jit and --check and hands a rootfs ship to runShipRootfs (ship_rootfs.go) before the binary path; the --notes-file ReadFile moved into shipNoteText (its own row, the same read of the file the person named) and the direct-mode version mint into mintDirectVersion; one read site fewer, none added; Task 12: the --hibernate flag help is RFS-1-C32's new text, the same reads;rev3=census-ruling-edge-asset-cache-1;basis=takes --assets (repeatable), checks the folders with checkShipAssets (release.ValidAssetPaths; refused on a static site) before the mode split, carries them into the API meta (sess.shipAssets) and the direct-mode manifest (shipAssetsBlock), and passes them to runShipRootfs (rootfsShipOpts.assets), which runs the same check and carries them the same two ways; after a direct-mode ship has stored a release declaring folders, directShipAssetGens runs the console ship door's backfill (provision.MintMissingAssetGens: lists the app's record keys and gives each record without an asset generation one, a CAS write in the deployment bucket as the person running the CLI) and fails naming any record it could not mint; read sites unchanged (2), none added;rev3=census-ruling-rootfs-apps-4;basis=adds the repeatable --env flag and refuses it before anything else unless --check is given (shipEnvRefusal, parseShipCheckEnv); the parsed values go into rootfsShipOpts.checkEnv. --env values reach the check's local container runtime as -e argv only, never root, never a box. No read added; read sites unchanged (2).;rev3=census-ruling-stateless-replicas-1;basis=Carry --stateless into binary/API and rootfs ship options; same two read sites, no new read. file:ReadFile@7899,file:ReadFile@8123 d6f244d2c3bcae95eb8ec0fa7e57c52e9b50c7e9e2e00dda85f930b643731a51
+internal/activator/activator.go type Service authority B,C,D,F,J4 rev3=PROPOSED-seed; existing activator lifecycle and due-wake state plus owned seed exclusion and incarnation-keyed diagnostics; normal refusal and preparation ordering remain authoritative; PROPOSED-plans-2-box-limits adds the idleFor hook field, which only narrows idle windows;rev3=census-ruling-plans-4c-box-throttle;basis=gains the maxRunFor hook field beside idleFor (plans 4c). No read added.;rev3=census-ruling-plans-4d-lapse;basis=gains the disabledFor hook field beside maxRunFor (plans 4d). No read added.;rev3=census-ruling-remote-instance-metrics;basis=gains tenancySeq, hostTenants and hostMixed, in-memory fields for Tenancies; no read added;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more field, markers (markerRetry: an atomic running flag and the last log time) for retryOwedMarkers; no read added; merge of origin/main d7ae1d76: main's fields are kept as main has them (census-ruling-remote-instance-metrics: tenancySeq, hostTenants, hostMixed); this branch's change is the same as above;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: new fields for rootfs admission (rootfsArmed, rootfsSwept), the per-host gate ask and refusal memo, and residency state (lister, backoff, start ceiling, cursor, test seam); no read;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: one new field, releaseOps (host to the in-memory release record, under a.mu); no read;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: one new field, leaseNow (a clock seam for a worker start's headroom against the lease deadline, nil is the real clock); no read;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2: gains the holder cache and its single-flight state; no read;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): one field, Fleet (activator.FleetWake: the box's fleet state, not on a fleet by default, on a fleet with a known label and a record reader, or on a fleet with an invalid identity), set by the agent before Start and read only by routeCurrentUnderLease. No read in the declaration. Agent, not root.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a fix round 1: one field, drainBudget (time.Duration), which New copies from residentDrainBudget and a rootfs entry's lease watch reads in its place, so a test's change of the package var never races a watch goroutine; declaration only, reads nothing; merge of origin/main 6f1f6ca6: main's one field, Fleet (activator.FleetWake), is kept as main has it (census-ruling-managed-fleets-1b); this branch's change is the same as above;rev3=census-ruling-stateless-replicas-1;basis=Add coordinator, existing-record observation callback and per-host preparation locks; no read in the declaration. d79460f7b2128cc601a9d9149fcc0ce0baed0f4555e7d073848f099b197ea39e
ship_check.go rootfsCheck.runArgs legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-1;basis=root-input (J4, as main's db.go units); the carlos CLI on a person's machine, as the person (no box unit): new (rootfs Plan 1), builds the docker or podman run argv for one check container; the scanner matches the word Command, here a field of release.Process (a process's argv), not os/exec; reads no file; decides nothing for root;rev3=census-ruling-rootfs-check-volumes;basis=R2 P1: the data and run volume mounts (-v) now carry :nocopy through rootfsCheck.volumeMount, so Docker and Podman never fill an empty check volume from the image directory at the mount point (which would reset the prepared owner and mode); same volumes, same paths, same probe mount, nothing else in the argv changed. Runs on the person's machine as the person; no box unit; no read added.;rev3=census-ruling-stateless-replicas-1;basis=Stateless local checks mount only the run volume and omit the database mount; same probe read, no new read. file:Command@887,file:Command@971 e684fd3273527a209460ed81e5bcd472a4282f46830fe580e5f07f0b0d876684
+internal/activator/rootfsrelease.go Service.runReleaseAdmitted legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Extract existing runner unchanged except optional pre-exec durable release transition after local admission and before any command; same staged process reads, stop/proof and exec gates, no new filesystem path. registry:Host@216,whole:Route@3085,whole:Route@3314,whole:Route@3802,whole:Route@3831,whole:Route@5879,whole:Route@621,whole:Route@6347,whole:Route@6624,whole:Route@7054,whole:Route@849,whole:Route@934 de8d9d6b31ac2b8cf2c34aaca32ecfbdd2c8966f75def906e3baef5bb409d109
+internal/activator/statelessrelease.go Service.PrepareStatelessRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Read durable deploy evidence and canonical target via existing-record observation seam; use coordinator authority only for this path, persist releasing before exec and require proof plus SafeUntil before success; commandless binary verifies staged artifact separately; no new store polling or direct typed record writer callsite. registry:Account@544,registry:App@574,registry:GoodDemand@3040,registry:GoodDigest@3025,registry:GoodVersion@3009,registry:Host@1170,registry:Host@224,registry:Host@3096,registry:Host@3154,registry:Host@3370,registry:Host@3438,registry:Host@601,whole:Route@3163,whole:Route@3170,whole:Route@3722,whole:Route@4435,whole:Route@483 f0ace93030a592f4182099d5c7ca2d91eea88d2b521e5a039135977382e58c95
internal/replicas/coordinator.go ChangeCoordinator legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Generate a fresh 128-bit coordinator term using crypto/rand.Read; no file path or process input added. file:Read@472 e50ce5a352b3022a1ee6375fbfee315a5d2fcaeb4f4a25f4e33a5a10e3000a67
+internal/activator/rootfsrelease.go Service.runRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R, R1: new; the one place a release command runs. Refuses while any record of the host is open; skips the row's good build (releaseRan); reads the declared processes (declaredProcesses: the existing staged-manifest read) and refuses on a read error, never treating it as no release; runs only when releaseDue; needs a lease watch and a ReleaseBackend; its gate is the caller's plus the lease's Err and its safety deadline more than releaseStopLead (cmdStopBound, 2 min) away; creates the record under a.mu after releaseAdmitLocked; publishes the generations file and the build state (recordBuild) before anything runs; times out at the manifest's timeout_sec (default, capped at runs.MaxTimeout); ReleaseEnv; a supervisor stops the unit ahead of the lease's safety deadline; StartRelease under the exec gate; polls the unit (root's existing cmd status); stops and settles it (the existing cmd hold's stop, cmdStopBound); only a non-zero exit, a signal or the timeout with the unit proven gone is the build's failure (*ReleaseError); registry:Host sites are the record key and log lines;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 9: newCmdHold takes the hold's role; a release command's hold is instancectl.RoleCmd, the unit it runs in; nothing else changed, no read added;rev3=census-ruling-stateless-replicas-1;basis=Delegate unchanged stateful admission and stop/proof behavior to runReleaseAdmitted with no durable admission hook; reads moved to that method. whole:Route@212 45130d20bc0a8f9dcc30908479ce0189e39ee9e68d44e95a9aa6b8e84e0bc20f
@coverage . d8abf32baa39f05d1e9d4e9b8a24e7113c58f42f8735e7a62e217eb39e7a4bf7
-@coverage internal/activator 421955bd35939b1be1ce73742194c7f49545152f1ca9e8a7bf6051be78d02b09
+@coverage internal/activator 59ad9cf8c9e85110d977ffccc916ae27046e5b49ffaec41f1510d30d61707417
@coverage internal/host 3739b405de9e625ae361d664dca7c61508b2d789cde71e4b33f6bf880d555b0f
@coverage internal/provision 974d05f290939ef4e4eb8af398b230b1df780357c3077988a35054ce52109626
@coverage internal/release 261fde7e6e53d2b4d944df966be3f00208d4d7153aed2d19148cbfd403af9d52