carlos / platform Public

feat: observe stateless release state from the wake's record read

Carry lifetime identity and replica coordination/deploy state from the existing judged record read. Return the stateless verdict and canonical manifest digest from one manifest GET, and wire the service observer to an attempt-local carrier that fails closed without evidence. Rollout deploy IDs and preparation call sites remain Task 2g.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev ac0c1ee23dcf083683714d65ee7d69e396c681df parent cfec491
12 files changed, +253 −26
  • docs/superpowers/notes/census-proposal-stateless-replicas-1.md +13 −2
  • internal/activator/activator.go +1 −2
  • internal/activator/hawake.go +1 −1
  • internal/activator/hawake_test.go +4 −4
  • internal/activator/replicaobservation.go +73 −0
  • internal/host/agent.go +6 −5
  • internal/host/hawake_wiring_test.go +2 −1
  • internal/host/replicacoordinator_test.go +121 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-stateless-replicas-1.tsv +15 −5
  • internal/release/stateless.go +13 −5
  • internal/release/stateless_test.go +3 −0

CI failed — run details

Intent

Attributed to this commit: 6.47 g CO₂e (788,063 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 f38c640d4..c89a4cbb4 100644
--- a/docs/superpowers/notes/census-proposal-stateless-replicas-1.md
+++ b/docs/superpowers/notes/census-proposal-stateless-replicas-1.md
@@ -1,11 +1,16 @@
# Census approval: stateless-replicas-1
-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).
+Ruling `census-ruling-stateless-replicas-1`. The independent reviewer approves or rejects every change below, 4 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
| unit | change | read sites | what changed |
|---|---|---|---|
| `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. |
+| `internal/activator/hawake.go` `ExecBackend.isHA` | body | unchanged (5) | Extract LifetimeEntry from the extended Config.Record result; existing HA classification and read/error gates unchanged. |
+| `internal/host/agent.go` `fastConvergeLoop` | body | unchanged (2) | Hand the service coordinator's Tick to the existing fast tick; no timer or new read site. |
+| `internal/host/agent.go` `fastTick` | body | unchanged (1) | Call coordinator Tick on the existing tick before convergence; client renews held terms only at the pinned interval. Existing registry read unchanged. |
+| `internal/host/agent.go` `haRecordFacts` | body | unchanged (3) | Return RecordFacts with lifetime identity, Coordinator and ReplicaDeploy from the same judged record object; same store and record reads, no extra GET. |
+| `internal/host/agent.go` `runAgent` | body | unchanged (6) | Construct coordination with existing fleet API credentials on fleet boxes, trusted deployment store otherwise; invalid fleet identity leaves it unarmed. Assign production observation callback, close after service shutdown with a five-second context. Existing read sites unchanged. |
| `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. |
@@ -17,15 +22,21 @@ 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
+- `internal/activator/hawake.go` `ExecBackend.isHA`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the one HA classification: a legacy route is not HA and reads nothing; else the lifetime index, and on a miss the record (Config.Record, the deployment store's console-written record via haRecordFacts); a failed read is an error; the row's sticky HA (+registry:HA) and the index's marks only add HA; +registry:Host x2, +whole:Route x2
+- `internal/host/agent.go` `fastConvergeLoop`: authority, task B3. Basis: rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): every pass context carries the box's lifetime judge (provision.WithLifetimes) and the reconcile config is boxProvisionConfig's; read sites unchanged, offsets moved; B3 authority retained;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 12: its pass config is now BoxProvisionConfig(reg, os.Getenv, judge, configure) (BoxProvisionConfig replaces boxProvisionConfig: the hub predicate hubArmed and, on the hub, ReconcileConfig.FleetOwners from hubFleetOwners); a call, no read site; read sites unchanged (2); B3 authority retained.
+- `internal/host/agent.go` `fastTick`: legacy, task accepted-legacy. Basis: 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
+- `internal/host/agent.go` `haRecordFacts`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new (region HA P1a), the agent as carlos: activator.Config.Record, the closure the HA classification calls on a lifetime index miss: opens the deployment store once (openDeployStore, kept under a mutex) and reads the host's record through judgedRecord(store, judge, release.RouteAccount(rt), rt.App, rt.Host) (CI fix: provision.ReadRecordJudged under the box's lifetime judge, which also GETs the host's incarnation slot control/host-incarnations/<host>.json from the same deployment store; a record the slot no longer vouches for, or a tombstone, reads as os.ErrNotExist; a nil judge, host claims on, is provision.GetRecord exactly), turned into a lifetime entry by provision.LifetimeEntryOf; the reads are the row it is handed (registry:App, registry:Host, whole:Route); the record is the console-written deployment record the reconcile passes already read; an open or read error is returned and the wake fails closed; root never calls it
+- `internal/host/agent.go` `runAgent`: authority, task B,C,D,F. Basis: 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
- `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/replicaobservation.go:ObservedReplicaRelease`: reads +registry:Account, +registry:App, +registry:Host; written legacy, accepted-legacy, frozen
- 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` → `8e7e5e02984c37e44814d7592d9b1c66b2940e336f786c4750fb36cdf337a26e`.
+Seal: `5f805400717bad7726bd9d62744b8103a40eb5f5823b0ab7c960a5c0965cb3bc` → `d82d22871085ce87f9f8a1dca9235211c76b5fd9b14759a9bccc88b67be784d8`.
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 3c3dbb888..dfc07aec8 100644
--- a/internal/activator/activator.go
+++ b/internal/activator/activator.go
@@ -77,7 +77,6 @@ import (
"github.com/carlosframework/platform/internal/hostwrite"
"github.com/carlosframework/platform/internal/instancectl"
"github.com/carlosframework/platform/internal/lease"
- "github.com/carlosframework/platform/internal/provision"
"github.com/carlosframework/platform/internal/registry"
"github.com/carlosframework/platform/internal/release"
"github.com/carlosframework/platform/internal/replicas"
@@ -112,7 +111,7 @@ type Config struct {
// miss, before the lease; an error fails the wake. The host wires it to
// a judged record read on the deployment store. Nil: no record source,
// and only the row and the index say a host is HA.
- Record func(ctx context.Context, rt registry.Route) (provision.LifetimeEntry, error)
+ Record func(ctx context.Context, rt registry.Route) (RecordFacts, error)
// Self is this box's lease identity, asked at each HA wake (so an
// instance id that arrives late is picked up), for the keep decision.
// Nil: lease.CurrentSelf, the identity every lock this box writes names.
diff --git a/internal/activator/hawake.go b/internal/activator/hawake.go
index 48e696eb2..e8cd0f22f 100644
--- a/internal/activator/hawake.go
+++ b/internal/activator/hawake.go
@@ -102,7 +102,7 @@ func (b *ExecBackend) isHA(ctx context.Context, rt registry.Route) (provision.Li
return provision.LifetimeEntry{}, false, fmt.Errorf("%s: read the instance record: %w", rt.Host, err)
}
got.HA = got.HA || e.HA
- e = got
+ e = got.LifetimeEntry
}
e.HA = e.HA || rt.HA
return e, e.HA, nil
diff --git a/internal/activator/hawake_test.go b/internal/activator/hawake_test.go
index 7e65ee392..98468785c 100644
--- a/internal/activator/hawake_test.go
+++ b/internal/activator/hawake_test.go
@@ -125,18 +125,18 @@ func haBackendEmptyIndex(t *testing.T, host string) (*ExecBackend, registry.Rout
}
h.mu.Unlock()
})
- b.Cfg.Record = func(_ context.Context, rt registry.Route) (provision.LifetimeEntry, error) {
+ b.Cfg.Record = func(_ context.Context, rt registry.Route) (RecordFacts, error) {
h.mu.Lock()
defer h.mu.Unlock()
h.gets++
if h.failRead {
- return provision.LifetimeEntry{}, errors.New("deployment store unavailable")
+ return RecordFacts{}, errors.New("deployment store unavailable")
}
rec, ok := h.records[rt.Host]
if !ok {
- return provision.LifetimeEntry{}, os.ErrNotExist
+ return RecordFacts{}, os.ErrNotExist
}
- return provision.LifetimeEntryOf(rec)
+ return RecordFactsOf(rec)
}
old := restoreReplica
restoreReplica = func(_ context.Context, dbPath, _, _, _ string) (bool, error) {
diff --git a/internal/activator/replicaobservation.go b/internal/activator/replicaobservation.go
new file mode 100644
index 000000000..2bad05af3
--- /dev/null
+++ b/internal/activator/replicaobservation.go
@@ -0,0 +1,73 @@
+package activator
+
+import (
+ "context"
+
+ "github.com/carlosframework/platform/internal/provision"
+ "github.com/carlosframework/platform/internal/registry"
+ "github.com/carlosframework/platform/internal/replicas"
+)
+
+// RecordFacts carries the lifetime and replica state from the same record read.
+// It is an observation, never coordinator authority.
+type RecordFacts struct {
+ provision.LifetimeEntry
+ Identity replicas.Identity
+ Coordinator *replicas.Coordinator
+ ReplicaDeploy *replicas.Deploy
+}
+
+func RecordFactsOf(rec provision.Record) (RecordFacts, error) {
+ entry, err := provision.LifetimeEntryOf(rec)
+ if err != nil {
+ return RecordFacts{}, err
+ }
+ return RecordFacts{LifetimeEntry: entry,
+ Identity: replicas.Identity{Account: rec.Account, App: rec.App, Host: rec.Host, Incarnation: entry.ID},
+ Coordinator: rec.Coordinator, ReplicaDeploy: rec.ReplicaDeploy}, nil
+}
+
+type replicaObservationKey struct{}
+type replicaObservation struct {
+ record RecordFacts
+ target replicas.Build
+ stateless bool
+}
+
+// WithReplicaReleaseObservation carries the wake/planner's existing record and
+// canonical manifest observations into PrepareStatelessRelease. Callers pass the
+// verdict and digest from release.CanonicalStatelessDigest; errors must refuse
+// preparation. No observation is retained between attempts or read from a store.
+func WithReplicaReleaseObservation(ctx context.Context, record RecordFacts, target replicas.Build, stateless bool) context.Context {
+ // Freeze the pointed-to record state for this attempt.
+ if record.Coordinator != nil {
+ c := *record.Coordinator
+ record.Coordinator = &c
+ }
+ if record.ReplicaDeploy != nil {
+ d := *record.ReplicaDeploy
+ record.ReplicaDeploy = &d
+ }
+ return context.WithValue(ctx, replicaObservationKey{}, replicaObservation{record, target, stateless})
+}
+
+// ObservedReplicaRelease is the production Service callback. An absent or
+// incomplete carrier refuses execution rather than performing another read.
+func ObservedReplicaRelease(ctx context.Context, rt registry.Route) (replicas.Identity, replicas.Build, *replicas.Deploy, error) {
+ o, ok := ctx.Value(replicaObservationKey{}).(replicaObservation)
+ id := o.record.Identity
+ if !ok || ctx.Err() != nil || !o.stateless || id.Account != rt.Account || id.App != rt.App || id.Host != rt.Host ||
+ id.Account == "" || id.App == "" || id.Host == "" || id.Incarnation == "" || id.Incarnation != o.record.ID ||
+ o.target.Version == "" || o.target.Digest == "" {
+ return replicas.Identity{}, replicas.Build{}, nil, replicas.ErrFenced
+ }
+ var deploy *replicas.Deploy
+ if o.record.ReplicaDeploy != nil {
+ d := *o.record.ReplicaDeploy
+ if d.Incarnation != id.Incarnation {
+ return replicas.Identity{}, replicas.Build{}, nil, replicas.ErrFenced
+ }
+ deploy = &d
+ }
+ return id, o.target, deploy, nil
+}
diff --git a/internal/host/agent.go b/internal/host/agent.go
index ee996fdaa..a64bccf11 100644
--- a/internal/host/agent.go
+++ b/internal/host/agent.go
@@ -600,6 +600,7 @@ func runAgent(args []string, buildClaims ClaimFactory) {
if coordinator != nil {
svc.Coordinator = coordinator
}
+ svc.ObserveReplicaRelease = activator.ObservedReplicaRelease
svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore)
if svc.Fleet.Mode == activator.FleetWakeUnknown {
log.Printf("agent: ERROR this box is on fleet %q but its fleet identity is invalid: %v. every instance assigned to a fleet box is refused until it is fixed and the agent restarted", svc.Fleet.Fleet, svc.Fleet.Err)
@@ -3699,26 +3700,26 @@ func wireRawSecretPages(eb *activator.ExecBackend, page func(ctx context.Context
// a stale lifetime never classifies a wake; a nil judge (host claims on) is
// provision.GetRecord exactly. The store is opened on first use and kept; a
// store that does not open is the read's error, and the wake fails closed.
-func haRecordFacts(open func(context.Context) (release.Store, error), judge *provision.LifetimeJudge) func(context.Context, registry.Route) (provision.LifetimeEntry, error) {
+func haRecordFacts(open func(context.Context) (release.Store, error), judge *provision.LifetimeJudge) func(context.Context, registry.Route) (activator.RecordFacts, error) {
var mu sync.Mutex
var store release.Store
- return func(ctx context.Context, rt registry.Route) (provision.LifetimeEntry, error) {
+ return func(ctx context.Context, rt registry.Route) (activator.RecordFacts, error) {
mu.Lock()
s := store
if s == nil {
var err error
if s, err = open(ctx); err != nil {
mu.Unlock()
- return provision.LifetimeEntry{}, fmt.Errorf("deployment store: %w", err)
+ return activator.RecordFacts{}, fmt.Errorf("deployment store: %w", err)
}
store = s
}
mu.Unlock()
rec, err := judgedRecord(ctx, s, judge, release.RouteAccount(rt), rt.App, rt.Host)
if err != nil {
- return provision.LifetimeEntry{}, err
+ return activator.RecordFacts{}, err
}
- return provision.LifetimeEntryOf(*rec)
+ return activator.RecordFactsOf(*rec)
}
}
diff --git a/internal/host/hawake_wiring_test.go b/internal/host/hawake_wiring_test.go
index 88bce6e96..4a4b34fd0 100644
--- a/internal/host/hawake_wiring_test.go
+++ b/internal/host/hawake_wiring_test.go
@@ -11,6 +11,7 @@ import (
"testing"
"time"
+ "github.com/carlosframework/platform/internal/activator"
"github.com/carlosframework/platform/internal/domains"
"github.com/carlosframework/platform/internal/lease/locktest"
"github.com/carlosframework/platform/internal/provision"
@@ -51,7 +52,7 @@ func testHARecordFactsReadsTheRecord(t *testing.T, judge *provision.LifetimeJudg
opens := 0
read := haRecordFacts(func(context.Context) (release.Store, error) { opens++; return s, nil }, judge)
got, err := read(ctx, registry.Route{Host: rec.Host, App: rec.App, Account: acct})
- want, _ := provision.LifetimeEntryOf(rec)
+ want, _ := activator.RecordFactsOf(rec)
if err != nil || got != want || !got.HA {
t.Fatalf("got %+v, %v; want %+v", got, err, want)
}
diff --git a/internal/host/replicacoordinator_test.go b/internal/host/replicacoordinator_test.go
index 8469f3a46..fd7860f35 100644
--- a/internal/host/replicacoordinator_test.go
+++ b/internal/host/replicacoordinator_test.go
@@ -4,6 +4,7 @@ import (
"context"
"crypto/sha256"
"encoding/hex"
+ "encoding/json"
"net/http/httptest"
"path/filepath"
"testing"
@@ -200,3 +201,123 @@ func TestCoordinatorAgentShutdown(t *testing.T) {
t.Fatal("closed coordinator acquired authority")
}
}
+
+func TestReplicaReleaseObservationUsesExistingReads(t *testing.T) {
+ ctx := context.Background()
+ s := &countingStore{Store: release.NewDirStore(t.TempDir())}
+ rec := provision.Record{Schema: 1, Account: "bab", App: "shop", Host: "shop.example.com", Channel: "stable", CreatedAt: time.Now()}
+ if err := provision.CreateRecord(ctx, s, rec); err != nil {
+ t.Fatal(err)
+ }
+ inc, err := provision.Incarnation(rec.Account, rec.App, rec.Host, rec.CreatedAt)
+ if err != nil {
+ t.Fatal(err)
+ }
+ // Store both fields on the existing record object, as the typed writers do.
+ rec.Coordinator = &replicas.Coordinator{Term: "term", Box: "box", BootID: "boot", ExpiresAt: time.Now().Add(time.Minute)}
+ rec.ReplicaDeploy = &replicas.Deploy{ID: "deploy", Incarnation: inc, Term: "term", Phase: "pending", Target: replicas.Build{Version: "v1", Digest: "canonical"}}
+ raw, err := json.Marshal(rec)
+ if err != nil {
+ t.Fatal(err)
+ }
+ key := provision.RecordKey(rec.Account, rec.App, rec.Host)
+ _, etag, err := s.Get(ctx, key)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, err := s.Put(ctx, key, raw, etag); err != nil {
+ t.Fatal(err)
+ }
+ binary := []byte("shop executable")
+ sum := sha256.Sum256(binary)
+ artifactDigest := hex.EncodeToString(sum[:])
+ manifest := release.Manifest{Schema: 1, App: rec.App, Version: "v1", Kind: "binary", Stateless: true,
+ Artifacts: map[string]release.Artifact{release.BoxPlatform(): {File: "shop", SHA256: artifactDigest}}}
+ manifestRaw, _ := json.Marshal(manifest)
+ manifestKey := release.ManifestKey(rec.Account, rec.App, "v1")
+ if _, err := s.Put(ctx, manifestKey, manifestRaw, ""); err != nil {
+ t.Fatal(err)
+ }
+ opt := t.TempDir()
+ if err := release.StageArtifact(opt, rec.Account, "v1", rec.App, binary); err != nil {
+ t.Fatal(err)
+ }
+ staged := release.StagedIdentity{Version: "v1", StagedPath: release.VersionPath(opt, rec.Account, "v1", rec.App), Digest: artifactDigest}
+ rt := registry.Route{Account: rec.Account, App: rec.App, Host: rec.Host}
+ read := haRecordFacts(func(context.Context) (release.Store, error) { return s, nil }, nil)
+ s.gets = nil
+ facts, err := read(ctx, rt)
+ if err != nil {
+ t.Fatal(err)
+ }
+ stateless, digest, err := release.CanonicalStatelessDigest(ctx, s, rec.Account, rec.App, staged)
+ if err != nil {
+ t.Fatal(err)
+ }
+ observed := activator.WithReplicaReleaseObservation(ctx, facts, replicas.Build{Version: staged.Version, Digest: digest}, stateless)
+ id, target, deploy, err := activator.ObservedReplicaRelease(observed, rt)
+ manifestSum := sha256.Sum256(manifestRaw)
+ if err != nil || id.Incarnation != inc || facts.Coordinator == nil || facts.Coordinator.Term != "term" || deploy == nil || deploy.ID != "deploy" || target.Digest != hex.EncodeToString(manifestSum[:]) || target.Digest == artifactDigest {
+ t.Fatalf("observation: %+v %+v %+v %v", id, target, deploy, err)
+ }
+ if len(s.gets) != 2 || s.gets[key] != 1 || s.gets[manifestKey] != 1 {
+ t.Fatalf("extra reads: %v", s.gets)
+ }
+ // Callers cannot mutate the attempt's snapshot through its input or output.
+ facts.ReplicaDeploy.ID = "changed"
+ deploy.ID = "changed again"
+ _, _, again, err := activator.ObservedReplicaRelease(observed, rt)
+ if err != nil || again.ID != "deploy" {
+ t.Fatal("observation was mutated")
+ }
+ for _, tc := range []struct {
+ name string
+ ctx context.Context
+ route registry.Route
+ }{
+ {"missing", ctx, rt},
+ {"stateful", activator.WithReplicaReleaseObservation(ctx, facts, target, false), rt},
+ {"missing record", activator.WithReplicaReleaseObservation(ctx, activator.RecordFacts{}, target, true), rt},
+ {"missing target", activator.WithReplicaReleaseObservation(ctx, facts, replicas.Build{}, true), rt},
+ {"wrong route", observed, registry.Route{Account: "other", App: rt.App, Host: rt.Host}},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ if _, _, _, err := activator.ObservedReplicaRelease(tc.ctx, tc.route); err == nil {
+ t.Fatal("incomplete observation admitted")
+ }
+ })
+ }
+ if _, err := read(ctx, registry.Route{Account: rt.Account, App: rt.App, Host: "missing.example.com"}); err == nil {
+ t.Fatal("missing record admitted")
+ }
+ if err := s.Delete(ctx, manifestKey); err != nil {
+ t.Fatal(err)
+ }
+ if yes, digest, err := release.CanonicalStatelessDigest(ctx, s, rt.Account, rt.App, staged); err == nil || yes || digest != "" {
+ t.Fatal("missing canonical manifest admitted")
+ }
+}
+
+func TestCoordinatorConstructorTrustedStore(t *testing.T) {
+ ctx := context.Background()
+ store := release.NewDirStore(t.TempDir())
+ rec := provision.Record{Schema: 1, Account: "acme", App: "shop", Host: "shop.example.com", Channel: "stable", CreatedAt: time.Now()}
+ if err := provision.CreateRecord(ctx, store, rec); err != nil {
+ t.Fatal(err)
+ }
+ inc, err := provision.Incarnation(rec.Account, rec.App, rec.Host, rec.CreatedAt)
+ if err != nil {
+ t.Fatal(err)
+ }
+ client := newCoordinatorClient(store, "", "", "box", "")
+ t.Cleanup(func() { closeReplicaCoordinator(client) })
+ id := replicas.Identity{Account: rec.Account, App: rec.App, Host: rec.Host, Incarnation: inc}
+ if _, err := client.Acquire(ctx, id); err != nil {
+ t.Fatal(err)
+ }
+ closeReplicaCoordinator(client)
+ got, err := provision.GetRecord(ctx, store, id.Account, id.App, id.Host)
+ if err != nil || got.Coordinator == nil || got.Coordinator.ExpiresAt.After(time.Now()) {
+ t.Fatalf("shutdown did not expire stored coordination: %+v %v", got, err)
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 6174107c4..db28f7963 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 8e7e5e02984c37e44814d7592d9b1c66b2940e336f786c4750fb36cdf337a26e
+plan14-root-reads-stateless-replicas-1.tsv d82d22871085ce87f9f8a1dca9235211c76b5fd9b14759a9bccc88b67be784d8
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 e83c40259..aa6233c2f 100644
--- a/internal/provision/testdata/plan14-root-reads-stateless-replicas-1.tsv
+++ b/internal/provision/testdata/plan14-root-reads-stateless-replicas-1.tsv
@@ -1,22 +1,32 @@
# 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.
-# 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.
+# 8 body, 1 sites, 6 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 4 new dispositions: 0 reads re-frozen at their disposition with the claim, 4 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
@legacy 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 6cdd33926c20f85e6eeb7e15d78d04842cb9d59acbd6cb3fdde202c361a08d3e internal/activator/hawake.go ExecBackend.isHA legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the one HA classification: a legacy route is not HA and reads nothing; else the lifetime index, and on a miss the record (Config.Record, the deployment store's console-written record via haRecordFacts); a failed read is an error; the row's sticky HA (+registry:HA) and the index's marks only add HA; +registry:Host x2, +whole:Route x2;rev3=census-ruling-stateless-replicas-1;basis=Extract LifetimeEntry from the extended Config.Record result; existing HA classification and read/error gates unchanged. registry:HA@573,registry:Host@280,registry:Host@486,whole:Route@126,whole:Route@373 8337ad81c8e8671acb44eacc642a1c43246a90d23ea69d35d1d7d7b58f2fcc89
+@legacy 33d60a8c0abaf72ce2a3f73d927dadd3c15f54beb0cb37e2f0753545b18d7f06 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. registry:Host@4776 717574378829734fb3461a7ec0a4e4e9089466745685d39008ad51b571ddf993
+@legacy f4edd209fd6fe7d50fd79c2f6ecf96bf255d5301f094ca86a5882acf5fe8ba20 internal/host/agent.go haRecordFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new (region HA P1a), the agent as carlos: activator.Config.Record, the closure the HA classification calls on a lifetime index miss: opens the deployment store once (openDeployStore, kept under a mutex) and reads the host's record through judgedRecord(store, judge, release.RouteAccount(rt), rt.App, rt.Host) (CI fix: provision.ReadRecordJudged under the box's lifetime judge, which also GETs the host's incarnation slot control/host-incarnations/<host>.json from the same deployment store; a record the slot no longer vouches for, or a tombstone, reads as os.ErrNotExist; a nil judge, host claims on, is provision.GetRecord exactly), turned into a lifetime entry by provision.LifetimeEntryOf; the reads are the row it is handed (registry:App, registry:Host, whole:Route); the record is the console-written deployment record the reconcile passes already read; an open or read error is returned and the wake fails closed; root never calls it;rev3=census-ruling-stateless-replicas-1;basis=Return RecordFacts with lifetime identity, Coordinator and ReplicaDeploy from the same judged record object; same store and record reads, no extra GET. registry:App@596,registry:Host@604,whole:Route@591 db6d777c93afde9836873ce72b6cbb62a55567eb3fb01f85f7e1e12274e0c66d
@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 6d1e960297f78cd109abb5310aef1af00618baf7f938c405e603d6e027ca7afa internal/activator/replicaobservation.go ObservedReplicaRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Read route Account, App and Host only to match the attempt-local observation carrier; refuse absent/stateful/incomplete/mismatched evidence, return copied deploy state and canonical target. No store or filesystem read, no authority granted. registry:Account@283,registry:App@307,registry:Host@328 17cf71ccf92a913a42bef47ea461888ab0045b2ed7acabc81648e55cca322bbb
@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 c1cd70888a4676cd1878a9668111499b21f73e270a26a85a8fcec47da9283da4 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; R11 lets the current term retake pending via the typed begin gate; R12 follows renewed SafeUntil through the existing command supervisor instead of a fixed initial context deadline; no new store polling or direct typed record writer callsite. registry:Account@544,registry:App@574,registry:GoodDemand@2971,registry:GoodDigest@2956,registry:GoodVersion@2940,registry:Host@1170,registry:Host@224,registry:Host@3027,registry:Host@3085,registry:Host@3301,registry:Host@3369,registry:Host@601,whole:Route@3094,whole:Route@3101,whole:Route@3653,whole:Route@4366,whole:Route@483 c18d125d320c4fdc5181c3977c1553af20268db59b4624e1a26deb459e55cf5b
@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
+internal/activator/hawake.go ExecBackend.isHA legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the one HA classification: a legacy route is not HA and reads nothing; else the lifetime index, and on a miss the record (Config.Record, the deployment store's console-written record via haRecordFacts); a failed read is an error; the row's sticky HA (+registry:HA) and the index's marks only add HA; +registry:Host x2, +whole:Route x2;rev3=census-ruling-stateless-replicas-1;basis=Extract LifetimeEntry from the extended Config.Record result; existing HA classification and read/error gates unchanged. registry:HA@573,registry:Host@280,registry:Host@486,whole:Route@126,whole:Route@373 8337ad81c8e8671acb44eacc642a1c43246a90d23ea69d35d1d7d7b58f2fcc89
+internal/host/agent.go fastConvergeLoop authority B3 rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): every pass context carries the box's lifetime judge (provision.WithLifetimes) and the reconcile config is boxProvisionConfig's; read sites unchanged, offsets moved; B3 authority retained;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 12: its pass config is now BoxProvisionConfig(reg, os.Getenv, judge, configure) (BoxProvisionConfig replaces boxProvisionConfig: the hub predicate hubArmed and, on the hub, ReconcileConfig.FleetOwners from hubFleetOwners); a call, no read site; read sites unchanged (2); B3 authority retained.;rev3=census-ruling-stateless-replicas-1;basis=Hand the service coordinator's Tick to the existing fast tick; no timer or new read site. whole:Route@7763,whole:Route@8326 4db357c078847187db9f23b2bd60aedd4af649af9795586bd8ea0ff54c9a37c4
+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. registry:Host@4776 717574378829734fb3461a7ec0a4e4e9089466745685d39008ad51b571ddf993
+internal/host/agent.go haRecordFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new (region HA P1a), the agent as carlos: activator.Config.Record, the closure the HA classification calls on a lifetime index miss: opens the deployment store once (openDeployStore, kept under a mutex) and reads the host's record through judgedRecord(store, judge, release.RouteAccount(rt), rt.App, rt.Host) (CI fix: provision.ReadRecordJudged under the box's lifetime judge, which also GETs the host's incarnation slot control/host-incarnations/<host>.json from the same deployment store; a record the slot no longer vouches for, or a tombstone, reads as os.ErrNotExist; a nil judge, host claims on, is provision.GetRecord exactly), turned into a lifetime entry by provision.LifetimeEntryOf; the reads are the row it is handed (registry:App, registry:Host, whole:Route); the record is the console-written deployment record the reconcile passes already read; an open or read error is returned and the wake fails closed; root never calls it;rev3=census-ruling-stateless-replicas-1;basis=Return RecordFacts with lifetime identity, Coordinator and ReplicaDeploy from the same judged record object; same store and record reads, no extra GET. registry:App@596,registry:Host@604,whole:Route@591 db6d777c93afde9836873ce72b6cbb62a55567eb3fb01f85f7e1e12274e0c66d
+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-stateless-replicas-1;basis=Construct coordination with existing fleet API credentials on fleet boxes, trusted deployment store otherwise; invalid fleet identity leaves it unarmed. Assign production observation callback, close after service shutdown with a five-second context. Existing read sites unchanged. file:Exec@17664,file:Open@1150,file:Statfs@45008,registry:App@11419,whole:Route@11411,whole:Route@28976 982510112e4bce377dddd0343847282cbc274e4e047fc01e67cd60ec139461e9
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/replicaobservation.go ObservedReplicaRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Read route Account, App and Host only to match the attempt-local observation carrier; refuse absent/stateful/incomplete/mismatched evidence, return copied deploy state and canonical target. No store or filesystem read, no authority granted. registry:Account@283,registry:App@307,registry:Host@328 17cf71ccf92a913a42bef47ea461888ab0045b2ed7acabc81648e55cca322bbb
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; R11 lets the current term retake pending via the typed begin gate; R12 follows renewed SafeUntil through the existing command supervisor instead of a fixed initial context deadline; no new store polling or direct typed record writer callsite. registry:Account@544,registry:App@574,registry:GoodDemand@2971,registry:GoodDigest@2956,registry:GoodVersion@2940,registry:Host@1170,registry:Host@224,registry:Host@3027,registry:Host@3085,registry:Host@3301,registry:Host@3369,registry:Host@601,whole:Route@3094,whole:Route@3101,whole:Route@3653,whole:Route@4366,whole:Route@483 c18d125d320c4fdc5181c3977c1553af20268db59b4624e1a26deb459e55cf5b
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 9aa9e1a39dcc62920eb1bea0af0e8080c712cd61d8aff8c4ed23baabfee68454
-@coverage internal/host 3739b405de9e625ae361d664dca7c61508b2d789cde71e4b33f6bf880d555b0f
+@coverage internal/activator 9bde3ea65b3fed0569a38d7624ac715460ab0bb67a5087525f6ba70ad5e01f52
+@coverage internal/host 7faa32b0b0c83991b60d2bdbb3aeae9d0b3e120f09da1f0cc58ed0b6de17d9c6
@coverage internal/provision 80abfa28c9854d534818202aab9b1b4c09adb5d943b49a51e9efd77152d9a1ae
-@coverage internal/release 261fde7e6e53d2b4d944df966be3f00208d4d7153aed2d19148cbfd403af9d52
+@coverage internal/release c1012571516227abff9612aba085e749489e8b8119c0b55444f53a15ed881fb1
@coverage internal/replicas 53b94eb040154539a0a977498b4b8bc1d53d82f67c1c6233667a0b823dd30d8a
diff --git a/internal/release/stateless.go b/internal/release/stateless.go
index d17e8959b..cf2a7dcdc 100644
--- a/internal/release/stateless.go
+++ b/internal/release/stateless.go
@@ -44,16 +44,24 @@ func CanonicalManifestDigest(ctx context.Context, s Store, acct, app, version st
// CanonicalStateless verifies both retained bytes and their canonical artifact
// before returning the storage declaration. Missing evidence is an error.
func CanonicalStateless(ctx context.Context, s Store, acct, app string, id StagedIdentity) (bool, error) {
+ stateless, _, err := CanonicalStatelessDigest(ctx, s, acct, app, id)
+ return stateless, err
+}
+
+// CanonicalStatelessDigest returns the declaration and digest from one
+// canonical manifest read. The digest identifies the manifest, not its artifact.
+func CanonicalStatelessDigest(ctx context.Context, s Store, acct, app string, id StagedIdentity) (bool, string, error) {
if err := VerifyStaged(id); err != nil {
- return false, err
+ return false, "", err
}
- m, _, err := GetManifestRaw(ctx, s, acct, app, id.Version)
+ m, raw, err := GetManifestRaw(ctx, s, acct, app, id.Version)
if err != nil {
- return false, err
+ return false, "", err
}
a, ok := m.BoxArtifact(adoptPlatform)
if !ok || !strings.EqualFold(a.SHA256, id.Digest) {
- return false, ErrStagedDigestMismatch
+ return false, "", ErrStagedDigestMismatch
}
- return m.Stateless, nil
+ sum := sha256.Sum256(raw)
+ return m.Stateless, hex.EncodeToString(sum[:]), nil
}
diff --git a/internal/release/stateless_test.go b/internal/release/stateless_test.go
index 2e9596627..cbdfa1a29 100644
--- a/internal/release/stateless_test.go
+++ b/internal/release/stateless_test.go
@@ -129,6 +129,9 @@ func TestCanonicalStatelessRefusesUnverifiedEvidence(t *testing.T) {
if yes, err := CanonicalStateless(ctx, tc.store, "bab", "shop", tc.id); err == nil || yes {
t.Fatalf("accepted unverifiable identity: %v %v", yes, err)
}
+ if yes, digest, err := CanonicalStatelessDigest(ctx, tc.store, "bab", "shop", tc.id); err == nil || yes || digest != "" {
+ t.Fatalf("returned target for unverifiable identity: %v %q %v", yes, digest, err)
+ }
})
}
// Matching retained bytes must also match the canonical artifact.