carlos / platform Public

replicas: explicit empty baseline, restarted permit holder (#511)

Micro-fix of the final re-review (Astra), exactly four items.

P1a: a new attempt's baselines are explicit (Deploy.BaselineSet, set by
the writer at begin and carried on same-ID transitions). An empty
Previous or Baselines entry means the box may run nothing until it
holds a permit; Baseline never falls through to LastGood for it. Legacy
and bootstrap records are normalised to explicit entries at the begin.
Witnesses: TestReplicaEmptyBaselineStaysEmpty (replicas) and
TestReplicaWriterKeepsEmptyBaseline (real writer; bootstrap halted with
retry and new build, and a legacy released record, through pending,
releasing and failed).

P1b: an always-on permit holder with no generation and no in-memory
switch evidence rebuilds it from the record (ActiveBox, this revision's
permit, the lifetime), the staged target (a stat) and the absence of
any entry, and past replicaRestartBound (residentPoll +
workerStartBound) answers switched-failed once the stop is proven
(fence, releaseOps, StopUncertain). Witness:
TestReplicaRestartedHolderResolves.

P2: replicaSwitchFailure snapshots the entry's awake state under a.mu.

Cost: a sleeping copy's step is ProofOnly. execute skips resolve while
the copy is still asleep (no staging, manifest read or hash); an awake
copy is resolved and verified as before. ReplicaSwap never runs a
ProofOnly attempt past its proofs. Witness:
TestReplicaProofOnlyStepReadsNoArtifact (demand-read counting seam).

Census: stateless-replicas-4-final re-proposed (two new units,
replicaRestartedFailure and proofOnlyAttempt); record-write inventory
re-pins SetRecordReplicaRelease. make census-card is clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 86e4ace91693c3af6846927c132b367ed8eb10d4 parent 994f0ea
18 files changed, +491 −40
  • docs/superpowers/notes/census-proposal-stateless-replicas-4-final.md +8 −6
  • internal/activator/activator.go +4 −0
  • internal/activator/replicadeploy.go +98 −3
  • internal/activator/replicaswitchfail_test.go +95 −0
  • internal/activator/statelessrelease_test.go +2 −1
  • internal/activator/swap.go +5 −0
  • internal/provision/replicadeploy.go +5 −1
  • internal/provision/replicadeploy_test.go +73 −0
  • internal/provision/stateless_replicas_4_final_census_test.go +5 −2
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-stateless-replicas-4-final.tsv +17 −13
  • internal/replicas/deploy.go +14 −4
  • internal/replicas/deploy_test.go +59 −0
  • internal/replicas/types.go +7 −0
  • internal/rollout/queue.go +6 −1
  • internal/rollout/replicabaseline_test.go +56 −0
  • internal/rollout/replicas.go +15 −0
  • internal/rollout/scheduler.go +21 −8

CI failed — run details

Intent

Human

<task-notification> <task-id>a9d485278056df3b5</task-id> <tool-use-id>toolu_01GuovNM4Tt1HxsTeVz9pWCG</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/72128d15-58b8-452f-9f7e-8e864e8854d2/tasks/a9d485278056df3b5.output</output-file> <status>completed</status> <summary>Agent "Final fix wave for Plan 4" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: DONE_WITH_CONCERNS. All 12 items are fixed, each with a witness test. Commits on `stateless-replicas-4`, tip 994f0ea3: 70564164, e763088c (drill), 2a2495ca, c5ed4a51, 9aebb784, d3076e1f, 8e446710, f7970189, 0b0c2abc, 994f0ea3. Tests: all targeted suites, the three cross-compiles and the census tests pass, except 11 host `TestClaim*` tests, which fail with "hostwrite: lifecycle provider unavailable", the family already ruled environmental. The console run needed `-timeout 40m`. Census: overlay `stateless-replicas-4-final` proposed and `make census-card` is clean. The independent #280 review is owed. The record-write census is re-pinned and green. Concerns: - **Restart gap (item 3):** a failed switch is detected from in-memory evidence, so after an agent restart a copy that is not awake keeps its permit open. This is the existing deferred case. - **Sleeping permit holder:** it now steps every 15 s, re-hashing the staged build each time, for as long as its permit is open. - **Instance retry with no box holding the build:** only the record's retry is armed. No box's failure book is cleared, so check this in the drill. - **Narrow channel check:** any app box with no heartbeat metrics blocks a below-floor publication while copies are in use. - **Darwin vet:** `haingress_alias_test.go:134` fails on main too; this branch doesn't touch that file. - **Drill:** hub minute counts are per app, so the drill app must hold only the drill host. Report: `.superpowers/sdd/2026-11-01-stateless-replicas-4-deploy-and-drill/final-wave-report.md` (gitignored, not committed).</result> <usage><subagent_tokens>506258</subagent_tokens><tool_uses>230</tool_uses><duration_ms>5256828</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>bpizo8oow</task-id> <tool-use-id>toolu_01TqHD1hskfvi2tXPXv5wJk4</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/72128d15-58b8-452f-9f7e-8e864e8854d2/tasks/bpizo8oow.output</output-file> <status>completed</status> <summary>Background command "Astra census review of final-wave overlay" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>bi5atd1mt</task-id> <tool-use-id>toolu_01UupHy5HdFzhgREbiANdxsS</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/72128d15-58b8-452f-9f7e-8e864e8854d2/tasks/bi5atd1mt.output</output-file> <status>completed</status> <summary>Background command "Fable final scoped re-review" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>bzp3jv9yc</task-id> <tool-use-id>toolu_01Pytuajs25qpEY5PHBHjGPR</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/72128d15-58b8-452f-9f7e-8e864e8854d2/tasks/bzp3jv9yc.output</output-file> <status>completed</status> <summary>Background command "Astra final scoped re-review" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>bjqmm59xz</task-id> <tool-use-id>toolu_01SSMRehRo91NTxbkVQBz9cN</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/72128d15-58b8-452f-9f7e-8e864e8854d2/tasks/bjqmm59xz.output</output-file> <status>completed</status> <summary>Background command "Wait for CI on the final tip" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 110 g CO₂e (6,871,776 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on stateless-replicas-4, 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-4-final.md b/docs/superpowers/notes/census-proposal-stateless-replicas-4-final.md
index 6bf678847..471db1345 100644
--- a/docs/superpowers/notes/census-proposal-stateless-replicas-4-final.md
+++ b/docs/superpowers/notes/census-proposal-stateless-replicas-4-final.md
@@ -1,14 +1,14 @@
# Census approval: stateless-replicas-4-final
-Ruling `census-ruling-stateless-replicas-4-final`. 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-4-final`. The independent reviewer approves or rejects every change below, 5 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
| unit | change | read sites | what changed |
|---|---|---|---|
-| `internal/activator/activator.go` `type Service` | body | unchanged (0) | #511 final wave item 3: adds replicaSwitched, an in-memory map of the permit each set row switched under (host -> permit key, time, resident flag); no read added |
+| `internal/activator/activator.go` `type Service` | body | unchanged (0) | #511 final wave item 3: adds replicaSwitched, an in-memory map of the permit each set row switched under (host -> permit key, time, resident flag); no read added; #511 micro-fix P1b: adds replicaNoGen, an in-memory map (host -> permit key and when first seen) that is only the bound's clock for a restarted permit holder with no generation; no read added |
| `internal/activator/rootfsworkers.go` `Service.registerRootfsWorkers` | body | unchanged (5) | #511 final wave item 4: a failed worker registration (unreadable or invalid declaration, no worker backend, no staged identity) now also records the generation on the entry (workersUnregistered) under a.mu; the same declaration read as before, no read added |
| `internal/host/agent.go` `runAgent` | body | unchanged (9) | #511 final wave item 2: wires the swap worker's drive (armedReplicaDrive, the armed rollout manager's DriveReplicaRelease); no read added |
-| `internal/rollout/scheduler.go` `scheduler.execute` | body | unchanged (15) | #511 final wave item 3: the swapping event for a replica step is emitted only for an awake copy on another build, so a sleeping permit holder's proof-only step emits none; no read added |
-| `internal/activator/replicadeploy.go` `Service.ReplicaSwap` | sites | +whole:Route ×2 | #511 final wave item 3: records the switch per permit (noteReplicaSwitch) and, for a later step of that permit, replicaSwitchFailure may stop the switched generation with proof (FenceAndStopAs, LiftFenceAs) and answer switched-failed; the two new whole:Route sites pass the entry's route (already held) to noteReplicaSwitch for its Resident flag; no new path, file or input read |
+| `internal/activator/replicadeploy.go` `Service.ReplicaSwap` | sites | +whole:Route ×2 | #511 final wave item 3: records the switch per permit (noteReplicaSwitch) and, for a later step of that permit, replicaSwitchFailure may stop the switched generation with proof (FenceAndStopAs, LiftFenceAs) and answer switched-failed; the two new whole:Route sites pass the entry's route (already held) to noteReplicaSwitch for its Resident flag; no new path, file or input read; #511 micro-fix: clears replicaNoGen while the copy is awake; with no switch evidence and no entry, asks replicaRestartedFailure; a ProofOnly attempt (a sleeping copy's step) abandons before Swap or any start gate; no new read site |
+| `internal/rollout/scheduler.go` `scheduler.execute` | sites | +registry:Host, +whole:Route | #511 final wave item 3: the swapping event for a replica step is emitted only for an awake copy on another build, so a sleeping permit holder's proof-only step emits none; no read added; #511 micro-fix (cost): a ProofOnly replica dispatch whose copy is still asleep (Act.Current) skips resolve (no staging, manifest read or hash) and takes Manager.proofOnlyAttempt; every other dispatch resolves as before; the added Host and whole Route sites are the same registry row this unit already reads (rt) |
Envelopes re-pinned: `.`, `internal/activator`, `internal/edge`, `internal/host`, `internal/provision`, `internal/replicas`, `internal/rollout`.
@@ -19,15 +19,17 @@ Recorded dispositions, which each change must still satisfy:
- `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;rev3=census-ruling-region-ha-p1b3a;basis=Add bounded placement peer and diagnostic state and the over-capacity callback; no read in this declaration and no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Add coordinator, existing-record observation callback and per-host preparation locks; no read in the declaration. Task 3a: Add optional canonical storage-selection and durable deploy-ID callbacks; declaration only, no read or authority in these fields.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds the heldLegs map to actEntry (legs by id, under a.mu) and heldWakeHook (atomic pointer to a callback) and heldLegSeq (atomic counter) to Service. State only, in memory; no read of tenant, app or box-agent-writable input.;rev3=census-ruling-wake-storm-cap;basis=the agent as carlos: one field, wakeSlots (chan struct{}, the wake semaphore made by New from Config.WakeSlots, default 4); declaration only, no read.;rev3=census-ruling-region-ha-p1b3b-t;basis=Add the B2 DutyStore interface field and process-local duty view, suppression and invalidation state. No read added. B2 adds the verified-successor identity callback; no read in the declaration. B3b adds a nonblocking departure-suspicion callback, invoked only after an accepted holder-forward failure and after cache locks release; it cannot authorize a take.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: immutable callbacks installed before Start for tenant admission, local start permission, fixed route exemptions and shutdown closure; nil callbacks preserve switch-off behavior; no new reads. Fix R1: add an immutable startup-phase callback for response copy, set before service startup. No new read or execution authority.;rev3=census-ruling-region-ha-g2-fixes;basis=Add in-memory HA loss state and pool withdrawal jobs; no new read.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 1: one new field, drain (drainSources: two atomic func pointers for this box's and peers' drain state); no read added. region HA held-requests Task 2: one new field, moves (moveTable: per-host move state, hold counts and admission tickets in memory, under mu); no read added;rev3=census-ruling-held-move-speed;basis=the agent as carlos: one new field, moveStreams (per-host in-memory set of edge.StreamEnd for requests in flight, own mutex), for the move's early stream cut; actEntry gains drainRelease (bool, under a.mu), set by DrainStop; declarations only, no read added;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: two fields, wakeFailMu and wakeFailLogged (per-host in-memory note of the last journalled wake failure); declaration only, no read;rev3=census-ruling-w6-ingress-drain;basis=new field TenantStartsClosed func() bool; when it answers true tenantStartRefusal refuses every start, exempt routes included. Wired only by fixedAdmission.bind to the ingress drain's closed flag. Struct field only; no read added.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: one field, replicaPolicies (host to the newest observed replica deploy and this box label, under mu), set only by SetReplicaDeploy; declaration only, no read.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: one more in-memory field, replicaFailed (host to the permit whose successor failed here, under mu), so that step only proves what it kept; declaration only, no read.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 3 (#511 F11): two hook fields, MarkReplicaRelease and ReplicaReleaseMark (the failure book's per-host release mark on this box's disk). No read site.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 first commit (#511 F11): one in-memory field, heldSeen (host to the last held release attempt, error class and when it was met), under the existing wakeFailMu. Declaration only, no read.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (27d3f501) adds the background atomic.Int64 field that tests wait on; this branch keeps its replica fields. Both kept as-is; no read added.
- `internal/activator/rootfsworkers.go` `Service.registerRootfsWorkers`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: the one place a generation's declared workers are registered; reads the workers the generation declares through the existing staged-manifest read of the backend's Processes (the manifest root's staging wrote, checked against the identity's path and digest), registers each as pending on the host's own entry; an unreadable or invalid declaration registers none and web serves; starts nothing;rev3=census-ruling-stateless-replicas-4-task2-fix3;basis=Task 2 fix round 3: each registered worker records its registration time (registered: a.now()), an in-memory field the proof reads; no read added.
- `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;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority.;rev3=census-ruling-agent-start-demo-3;basis=Wire the claim activator and root snapshot client into the demo worker; pass moved readiness to status reporting. Census read-site delta: unchanged (9).;rev3=census-ruling-region-ha-g2-fixes;basis=Wire local pool evidence, live withdrawal activator, startup ingress scan and alias publication, and edge lookup; no new direct sites; new indirect record/claim reads use existing store/judge paths described in ingress helpers.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3: starts the existing record-view backstop loop with a departure-inventory listener (non-blocking, coalesced signal) even without an armed RecordView; it requests the existing full pass (backstopFullDue) there. Same nine read sites; no new read or authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Derive one signal-time deadline with a 90-second budget; cap departure stop and startup/seed/service shutdown joins by it. No read added.;rev3=census-ruling-static-sweep-periodic;basis=in the edge-ready callback, publishes e.LargestStaticTree in staticTreeSource for the disk alert line (diskAlertFrac in the metrics loop); in-memory wiring only, no read added; read sites unchanged (9);rev3=census-ruling-edge-page-cache-1;basis=wires the exec backend's CurrentInputs into the edge cache (wireCurrentInputs) and, in the ready hook after armEdgeAssetCache (whose returned store it now keeps), calls armEdgePageCache, which does nothing unless CARLOS_PAGE_CACHE=1; read sites unchanged (9); no read added;rev3=census-ruling-gvisor-demos;basis=Capture sandbox resolution and refusal once; log errors once; gate route admission and BeforeExec before process launch. No new root read. Task 5: pass the once-captured sandbox effective mode/config error into ExecBackend, UnitBackend and the immutable Client expectation. Same startup environment/registry reads; swapArming declines gVisor before placement. Task 8: arm read-only status projection with the existing Client.SandboxStatus callback. Agent status now queries the existing root /ready endpoint; no new root authority or guest-file input. Merge2 e8a1ddde: retain main wireCurrentInputs and armEdgePageCache through the existing asset-store ready hook alongside branch once-captured sandbox mode, wake gates and root status wiring. No new direct read; main page-cache helpers retain their own census overlays.;rev3=census-ruling-region-ha-held-build;basis=wires the drain state: svc.SetDrainingSource(boxDrain.IsDraining), svc.SetPeerDrainView(e.PeerDraining), e.SetPeerDrainedHook(svc.DropHoldersNaming); in-memory only; no read added; region HA held-requests Task 5: on group members, starts the drain driver over the activator, the edge and boxDrain, and serves its root-only drain socket; no read added beyond the socket's own Branch review r1: the drain state follows the root start fence on group members (the fence reader is the existing fenceLocation.read, a root-owned fixed path); e.SetPeerUndrainedHook(svc.AllowHoldersNaming) beside the drained hook (memory only); the drain socket serves only the agent's own user. No read added.;rev3=census-ruling-security-review-mitigations;basis=Wire the cached operator flat-layout choice into the exec backend's new-resident refusal; no read source added, existing authority retained.;rev3=census-ruling-w6-ingress-drain;basis=agent (user carlos), not root. Builds the ingress drain (newIngressDrain) with arming read at ask time from os.Getenv (CARLOS_REGION_HA, CARLOS_INGRESS_TARGET_GROUPS, both from the root-owned host.env), the fixed admission and lease.CurrentSelf (existing IMDS identity); its reader is awstg.Load, the box role's credentials calling ELB DescribeTargetHealth/DescribeTargetGroupAttributes (new AWS reads, by the agent). Wires admission.closeStartsForIngressDrain, the lbhealth drain condition, ingress.setEdge, and ingress.shutdownStarted in WithShutdownStarted. The drain socket (/run/carlos/.ha-drain/drain.sock, agent-user only, existing) is now also served on a fixed box with the drain configured (was group members only), routing /v1/ingress/* to the ingress drain and the group drain verbs to 404 there. armHADepartures now takes fixtureDepartureGetenv() and MakeQueue fixtureDepartureQueue(), which in a production (non-rootrunner) build are os.Getenv and nil, as before. Read sites unchanged (9).;rev3=census-ruling-stateless-replicas-4-task1;basis=Arms the fleet-only replica swap worker next to the placement worker: same console URL and fleet token as the existing replicaCoordinatorAPI, the existing activator Service; stops and joins at shutdown. No new read site, credential or bucket reader.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: sets deployWorker.step to the rollout scheduler answer for the record permit (replicaStepOf over armedRollout), an in-memory callback; no read site, credential or bucket reader added.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: the swap worker step is armedReplicaStep, the same lazy scheduler lookup as before as a named function; no read site added.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (01d6ca78, linked-deployments-slice1) starts linkLoop beside tunnelLoop; this branch keeps its replica coordinator wiring. Both kept as-is; no read added.
-- `internal/rollout/scheduler.go` `scheduler.execute`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: a dispatch marked Replica (this box permitted step) calls Manager.replicaStep, which calls activator ReplicaSwap, instead of Swap, and emits the swapping event only when the step moves; the added Host and whole Route reads are the same registry row this unit already reads (rt). Agent, not root.
- `internal/activator/replicadeploy.go` `Service.ReplicaSwap`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: new. Checks the permit (box label, phase released, not halted, ActiveBox, build), refuses a hold, asks tenantStartRefusal on the in-memory entry route, then either re-proves an existing switch (replicaSettle) or runs the existing Swap as a canary and checks replicaStepProven. Reads the in-memory entry route only; no store, file or root call of its own.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: proof-only steps (an already switched copy, a halted permit, a permit whose successor failed here) skip the start gates because nothing starts; a failed successor answers kept only after replicaKeptProven (its stop proven, an empty operation set). Reads only the in-memory entry route; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: the switch proof is replicaSwitchProof, which also reports WorkersFailed (switched, the new workers crashed or did not start within the settle window) so the step answers instead of staying open. Reads only the in-memory entry; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-task2-fix3;basis=Task 2 fix round 3: replicaSwitchProof keeps the step open while a worker start is in flight or a gate-refused start waits for its retry, and judges a never-started worker only after residentPoll + workerStartBound from registration (Service clock); a crash or restart still answers workers failed. Reads only the in-memory entry; no store, file or root call.
+- `internal/rollout/scheduler.go` `scheduler.execute`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: a dispatch marked Replica (this box permitted step) calls Manager.replicaStep, which calls activator ReplicaSwap, instead of Swap, and emits the swapping event only when the step moves; the added Host and whole Route reads are the same registry row this unit already reads (rt). Agent, not root.
New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+- new `internal/activator/replicadeploy.go:Service.replicaRestartedFailure`: reads +file:Stat, +registry:FleetBoxes, +registry:ReplicaIncarnation, +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/replicadeploy.go:Service.replicaSwitchFailure`: reads +whole:Route ×3; written legacy, accepted-legacy, frozen
- new `internal/activator/statelessrelease.go:Service.ReplicaRelease`: reads +registry:FleetBoxes, +registry:Stateless ×2, +whole:Route ×6; written legacy, accepted-legacy, frozen
- new `internal/rollout/replicas.go:Manager.DriveReplicaRelease`: reads +registry:App, +registry:FleetBoxes, +registry:ReplicaIncarnation, +whole:Route ×4; written legacy, accepted-legacy, frozen
+- new `internal/rollout/replicas.go:Manager.proofOnlyAttempt`: reads +file:Stat, +registry:App, +whole:Route; written legacy, accepted-legacy, frozen
-Seal: `93c4edaeb1b8b692499da65ae7649217787cf996e9739ea0bf9ad0f229885ec7` → `4d33f8aee523b96fc65719506f95764bb7ebbeae65cdf290ac029f06de939432`.
+Seal: `93c4edaeb1b8b692499da65ae7649217787cf996e9739ea0bf9ad0f229885ec7` → `8d27f2345572f43c3bd49a3db38e2429e648f981b7e31288f49a32fedc5e89dd`.
Overlay: `internal/provision/testdata/plan14-root-reads-stateless-replicas-4-final.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/activator/activator.go b/internal/activator/activator.go
index c0488f6c5..a35f11e0c 100644
--- a/internal/activator/activator.go
+++ b/internal/activator/activator.go
@@ -1321,6 +1321,10 @@ type Service struct {
// replicaWebFailBound) answers switched with the build failed, once its
// processes are proven stopped.
replicaSwitched map[string]replicaSwitch
+ // replicaNoGen is, per set row, the permit an always-on copy holds
+ // with no generation at all and no switch evidence, and since when
+ // (replicaRestartedFailure): only the bound's clock, never evidence.
+ replicaNoGen map[string]replicaSwitch
// Startup gates admission while the agent recovers installations. Set before publication.
Startup <-chan struct{}
diff --git a/internal/activator/replicadeploy.go b/internal/activator/replicadeploy.go
index bff01cc6f..834ec3004 100644
--- a/internal/activator/replicadeploy.go
+++ b/internal/activator/replicadeploy.go
@@ -37,7 +37,9 @@ package activator
import (
"context"
+ "errors"
"fmt"
+ "os"
"time"
"github.com/carlosframework/platform/internal/registry"
@@ -152,6 +154,11 @@ func (a *Service) ReplicaSwap(ctx context.Context, at Attempt, deploy replicas.D
failedHere := a.replicaFailed[at.Host] == key
sw, switched := a.replicaSwitched[at.Host]
switched = switched && sw.key == key
+ if e != nil && e.state == actAwake {
+ // A live generation: the restarted holder's clock starts again
+ // if the copy is ever left with none (replicaRestartedFailure).
+ delete(a.replicaNoGen, at.Host)
+ }
a.mu.Unlock()
if switched {
// This copy switched under this permit. A switched generation that
@@ -160,8 +167,18 @@ func (a *Service) ReplicaSwap(ctx context.Context, at Attempt, deploy replicas.D
if res, decided := a.replicaSwitchFailure(ctx, at.Host, sw); decided {
return res
}
+ } else if e == nil && !failedHere {
+ // No in-memory evidence (an agent restart cleared it) and no
+ // generation at all: the evidence is rebuilt from the record and
+ // this box's state, past a bound (#511 micro-fix, P1b).
+ if res, decided := a.replicaRestartedFailure(ctx, at, deploy, key); decided {
+ return res
+ }
}
- if e == nil {
+ if e == nil || at.ProofOnly {
+ // A proof-only step (a sleeping copy's: nothing staged or hashed
+ // for it) never goes past the proofs above; a copy that woke since
+ // gets a full step, with its build verified, on a later pass.
return abandon(errSwapNotAwake)
}
if route.FleetBoxes == "" {
@@ -355,9 +372,11 @@ func (a *Service) noteReplicaSwitch(host string, key replicaStepKey, rt registry
func (a *Service) replicaSwitchFailure(ctx context.Context, host string, sw replicaSwitch) (SwapResult, bool) {
a.mu.Lock()
e := a.entries[host]
+ // Snapshotted under a.mu: e.state moves with stop transitions.
+ awake := e != nil && e.state == actAwake
failed := false
switch {
- case e == nil || e.state != actAwake:
+ case !awake:
failed = sw.resident
case e.proc == nil || e.proc.Exited():
failed = true
@@ -372,7 +391,7 @@ func (a *Service) replicaSwitchFailure(ctx context.Context, host string, sw repl
past := !a.now().Before(sw.at.Add(replicaWebFailBound))
a.mu.Unlock()
if !failed {
- if !past || e == nil || e.state != actAwake {
+ if !past || !awake {
return SwapResult{}, false
}
if err := a.genHealthy(ctx, rt, gen); err == nil {
@@ -392,3 +411,79 @@ func (a *Service) replicaSwitchFailure(ctx context.Context, host string, sw repl
}
return SwapResult{Outcome: SwapAbandoned, Proven: true, WebFailed: true, Reason: "the new build failed on this copy after it switched; its processes are proven stopped"}, true
}
+
+// replicaRestartBound is how long an always-on permit holder may be left
+// with no generation at all, after its agent restarted, before its step
+// answers switched with the build failed: the bound the step gives a
+// switched copy's web and workers (replicaWebFailBound).
+var replicaRestartBound = residentPoll + workerStartBound
+
+// replicaRestartedFailure resolves a permit whose in-memory switch
+// evidence is gone (an agent restart before the ACK) and whose copy cannot
+// come back (#511 micro-fix, P1b; Astra I3). The evidence is rebuilt from
+// the record and this box's state alone:
+// - the record's ActiveBox is this box (ReplicaSwap's step 1) and key is
+// the permit of this deploy revision;
+// - the row is always on, a copy of this deploy's lifetime;
+// - the target is staged here (a stat of at.StagedPath; nothing is read
+// or hashed);
+// - there is no generation at all (no entry: nothing awake, waking or
+// stopping), so termination is trivially proven.
+//
+// The bound counts from the first step that finds it so, and holds while
+// the copy's cold wakes keep failing; any awake generation resets it
+// (ReplicaSwap). Past it, the answer is switched, failed, once the stop is
+// proven (below): the ACK resolves the permit and halts the
+// deploy, and a retry, a fix build or a rollback can begin. decided is
+// false when the evidence does not hold: the step goes on.
+func (a *Service) replicaRestartedFailure(ctx context.Context, at Attempt, deploy replicas.Deploy, key replicaStepKey) (SwapResult, bool) {
+ if a.Routes == nil || key.id == "" || key.permit == 0 || key.permit > deploy.Revision || at.StagedPath == "" {
+ return SwapResult{}, false
+ }
+ rt, err := a.Routes.Get(at.Host)
+ if err != nil || rt == nil || !rt.Resident() || rt.FleetBoxes == "" || rt.ReplicaIncarnation != deploy.Incarnation {
+ return SwapResult{}, false
+ }
+ if fi, err := os.Stat(at.StagedPath); err != nil || !fi.Mode().IsRegular() {
+ return SwapResult{}, false
+ }
+ a.mu.Lock()
+ if a.entries[at.Host] != nil {
+ a.mu.Unlock()
+ return SwapResult{}, false
+ }
+ since, ok := a.replicaNoGen[at.Host]
+ if !ok || since.key != key {
+ if a.replicaNoGen == nil {
+ a.replicaNoGen = make(map[string]replicaSwitch)
+ }
+ since = replicaSwitch{key: key, at: a.now(), resident: true}
+ a.replicaNoGen[at.Host] = since
+ }
+ past := !a.now().Before(since.at.Add(replicaRestartBound))
+ a.mu.Unlock()
+ if !past {
+ res := abandon(errSwapNotAwake)
+ res.Reason = "this copy holds the permit with nothing running; the step waits for its bound before it answers"
+ return res, true
+ }
+ // The stop proof, under a fence so no wake starts meanwhile: a stop
+ // FenceAndStopAs proves, or no generation, no release command and no
+ // stop left unproven (StopUncertain), which is all a restarted agent
+ // with no stop history can show, and all there is when nothing runs.
+ owner := fmt.Sprintf("replica-restart:%s:%d", key.id, key.permit)
+ sctx, cancel := context.WithTimeout(ctx, replicaWebFailBound)
+ _, err = a.FenceAndStopAs(sctx, at.Host, key.permit, owner)
+ cancel()
+ a.mu.Lock()
+ releasing := a.releaseOps[at.Host] != nil
+ a.mu.Unlock()
+ proven := err == nil || errors.Is(err, ErrStopUnproven) && !releasing && !a.StopUncertain(at.Host)
+ a.LiftFenceAs(at.Host, key.permit, owner)
+ if !proven {
+ res := abandon(err)
+ res.Reason = "this copy holds the permit with nothing running; its stop is not proven yet, so the step stays open"
+ return res, true
+ }
+ return SwapResult{Outcome: SwapAbandoned, Proven: true, WebFailed: true, Reason: "the new build failed on this copy after it switched and did not come back; nothing of it runs"}, true
+}
diff --git a/internal/activator/replicaswitchfail_test.go b/internal/activator/replicaswitchfail_test.go
index 7a5cf0237..d2fc8ed1c 100644
--- a/internal/activator/replicaswitchfail_test.go
+++ b/internal/activator/replicaswitchfail_test.go
@@ -6,6 +6,7 @@ import (
"testing"
"time"
+ "github.com/carlosframework/platform/internal/registry"
"github.com/carlosframework/platform/internal/release"
"github.com/carlosframework/platform/internal/replicas"
)
@@ -108,6 +109,100 @@ func TestReplicaSwitchedWebFailureResolves(t *testing.T) {
})
}
+// TestReplicaRestartedHolderResolves (#511 micro-fix, P1b; Astra I3): a
+// copy switched under its permit, its web then died, and the agent
+// restarted before the ACK, so the in-memory switch evidence is gone. Its
+// cold wakes of the target keep failing. The step, proof only as the
+// scheduler sends it for a sleeping copy, rebuilds the evidence from the
+// record (ActiveBox, this revision's permit), the staged target and the
+// absence of any generation: it answers nothing within
+// replicaRestartBound, then "switched, failed" with the stop proven. The
+// ACK resolves the permit and halts the deploy, and a retry can begin.
+// Without the staged target it never answers.
+func TestReplicaRestartedHolderResolves(t *testing.T) {
+ for _, staged := range []bool{true, false} {
+ name := "staged"
+ if !staged {
+ name = "not staged"
+ }
+ t.Run(name, func(t *testing.T) {
+ r, _ := switchedRig(t)
+ r.a.mu.Lock()
+ n := r.a.entries[r.rt.Host].gen.N
+ r.a.mu.Unlock()
+ r.b.procOf(n).exit()
+ r.a.sweepOnce()
+ waitFor(t, "the recycled entry", func() bool {
+ r.a.mu.Lock()
+ defer r.a.mu.Unlock()
+ return r.a.entries[r.rt.Host] == nil
+ })
+ // The agent restarts: its in-memory permit evidence and stop
+ // history are gone.
+ r.a.mu.Lock()
+ r.a.replicaSwitched, r.a.replicaFailed, r.a.replicaPolicies, r.a.replicaNoGen = nil, nil, nil, nil
+ r.a.stopHistory = nil
+ r.a.mu.Unlock()
+ // Every cold wake of the target fails before anything of it
+ // starts (its staged build cannot be prepared), or meets the
+ // resident backoff after the last failure.
+ r.a.StorageDeclaration = func(context.Context, registry.Route, release.StagedIdentity) (bool, string, error) {
+ return false, "", errors.New("the staged build cannot be read")
+ }
+ coldWake := func() {
+ t.Helper()
+ r.setPlan(WakePlan{Boot: r.next, Mode: ModeOverlap, Token: 2})
+ if err := waitErr(t, r.wake(r.a)); err == nil {
+ t.Fatal("the cold wake served")
+ }
+ r.a.mu.Lock()
+ defer r.a.mu.Unlock()
+ if r.a.entries[r.rt.Host] != nil {
+ t.Fatal("a failed cold wake left a generation")
+ }
+ }
+ at := Attempt{Host: r.rt.Host, Cause: CauseRelease, Build: "v2", Mode: ModeOverlap, SchedRev: 1, ProofOnly: true}
+ if staged {
+ at.StagedPath = r.next.StagedPath
+ }
+ step := func() SwapResult {
+ return r.a.ReplicaSwap(context.Background(), at, *r.store.snapshot(), "b", newestOne)
+ }
+ coldWake()
+ if res := step(); res.Proven || res.WebFailed {
+ t.Fatalf("answered with no bound passed: %+v", res)
+ }
+ r.clk.advance(replicaRestartBound / 2)
+ coldWake()
+ if res := step(); res.Proven || res.WebFailed {
+ t.Fatalf("answered within its bound: %+v", res)
+ }
+ r.clk.advance(replicaRestartBound)
+ coldWake()
+ res := step()
+ if !staged {
+ if res.Proven || res.WebFailed {
+ t.Fatalf("answered without the staged target: %+v", res)
+ }
+ return
+ }
+ webFailedAnswer(t, r, res)
+ // The box's ACK resolves the permit and halts the deploy; an
+ // explicit retry of it may then begin.
+ cur := *r.store.snapshot()
+ ack := replicas.DeployChange{Op: "ack", ID: cur.ID, Box: "b", Revision: cur.Revision, Target: cur.Target, Permit: cur.Swap.Permit, Switched: true, WebFailed: true}
+ next, err := replicas.NextDeploy(cur, ack, replicas.Coordinator{}, time.Now())
+ if err != nil || next.PermitOutstanding() || !next.Swap.Halted || next.Swap.WebFailed != "b" || !replicas.Retryable(&next) {
+ t.Fatalf("ack: %v %+v", err, next.Swap)
+ }
+ next.RetryOf = next.ID
+ if err := replicas.NewAttemptAllowed(&next, replicas.Deploy{ID: "deploy-v2-retry", Incarnation: next.Incarnation, Target: next.Target, Phase: "pending", RetryOf: next.ID}); err != nil {
+ t.Fatalf("retry refused: %v", err)
+ }
+ })
+ }
+}
+
// TestReplicaUnreadableWorkersAreFailedWorkers (#511 final wave, item 4;
// Astra I4): a generation whose worker declaration could not be read
// registered nothing, and its switch proof answers workers failed, never
diff --git a/internal/activator/statelessrelease_test.go b/internal/activator/statelessrelease_test.go
index b4642f4d7..6e4a74cf3 100644
--- a/internal/activator/statelessrelease_test.go
+++ b/internal/activator/statelessrelease_test.go
@@ -62,10 +62,11 @@ func (s *replicaReleaseStore) ReleaseState(_ context.Context, id replicas.Identi
// LastGood and Previous as the real writer keeps them
// (provision.SetRecordReplicaRelease).
if s.d != nil && s.d.ID == c.ID {
- d.LastGood, d.Previous, d.Baselines = s.d.LastGood, s.d.Previous, s.d.Clone().Baselines
+ d.LastGood, d.Previous, d.Baselines, d.BaselineSet = s.d.LastGood, s.d.Previous, s.d.Clone().Baselines, s.d.BaselineSet
} else {
d.LastGood = replicas.CarryLastGood(s.d, id.Incarnation)
d.Previous, d.Baselines = replicas.CarryBaselines(s.d, id.Incarnation, s.assigned)
+ d.BaselineSet = true
}
if phase == "released" {
d.LastGood = d.Target
diff --git a/internal/activator/swap.go b/internal/activator/swap.go
index 862a92b2e..bd3323e54 100644
--- a/internal/activator/swap.go
+++ b/internal/activator/swap.go
@@ -53,6 +53,11 @@ type Attempt struct {
RestartID string
SchedRev uint64 // scheduler revision; the newest-attempt check compares it
Canary bool // observe the 10 s settle
+ // ProofOnly marks a replicated deploy's step on a sleeping copy
+ // (ReplicaSwap): it only proves, and runs nothing. Its StagedPath, when
+ // set, is the target's staged file, present but unverified; Digest is
+ // empty. Nothing was read or hashed for it.
+ ProofOnly bool
}
// SwapOutcome is how an attempt ended.
diff --git a/internal/provision/replicadeploy.go b/internal/provision/replicadeploy.go
index fb0cff1f9..c352e1352 100644
--- a/internal/provision/replicadeploy.go
+++ b/internal/provision/replicadeploy.go
@@ -73,6 +73,10 @@ func SetRecordReplicaRelease(ctx context.Context, s release.Store, id replicas.I
// keeps that attempt's baseline, never a target it was not
// permitted. The writer owns it.
next.Previous, next.Baselines = replicas.CarryBaselines(old, id.Incarnation, rec.ReplicaAssignment != nil)
+ // Explicit (#511 micro-fix, P1a): an empty baseline is kept
+ // as "may run nothing until permitted", never read as
+ // LastGood. A legacy record is normalised here.
+ next.BaselineSet = true
if next.RetryOf != "" {
// The consuming attempt keeps the request that asked for it.
next.RetryRequest = old.RetryRequest
@@ -83,7 +87,7 @@ func SetRecordReplicaRelease(ctx context.Context, s release.Store, id replicas.I
}
// Previous and Baselines are the writer's, set at begin; a
// box's copy of them is ignored.
- next.Previous, next.Baselines = old.Previous, old.Clone().Baselines
+ next.Previous, next.Baselines, next.BaselineSet = old.Previous, old.Clone().Baselines, old.BaselineSet
if next.RetryOf != "" && next.RetryOf != old.RetryOf {
return replicas.ErrInvalid
}
diff --git a/internal/provision/replicadeploy_test.go b/internal/provision/replicadeploy_test.go
index f8c144355..eac581c44 100644
--- a/internal/provision/replicadeploy_test.go
+++ b/internal/provision/replicadeploy_test.go
@@ -1049,3 +1049,76 @@ func TestReplicaWriterCarriesPerBoxBaseline(t *testing.T) {
t.Fatalf("after done: %+v", d)
}
}
+
+// TestReplicaWriterKeepsEmptyBaseline (#511 micro-fix, P1a; Astra C1,
+// Fable I2): through the real writer, a box the replaced attempt
+// authorised to run nothing may not start the old target without a
+// permit during the replacement's pending, releasing or failed phases.
+// The bootstrap case: deploy-2 is the lifetime's first attempt, a switched
+// and b kept nothing before the halt; a retry and a new build follow. The
+// legacy case: a released record with no Previous, LastGood or
+// BaselineSet, which the begin normalises with an explicit empty baseline.
+func TestReplicaWriterKeepsEmptyBaseline(t *testing.T) {
+ v3 := replicas.Build{Version: "v3", Digest: "canonical-3"}
+ check := func(t *testing.T, w *swapWorld, step string, switched map[string]bool) {
+ t.Helper()
+ d := w.rec.ReplicaDeploy
+ if !d.BaselineSet {
+ t.Fatalf("%s: the begin left the baseline implicit: %+v", step, d)
+ }
+ for _, box := range []string{"a", "b"} {
+ if d.Allows(box, w.id.Incarnation, swapTarget.Digest) != switched[box] {
+ t.Fatalf("%s: box %s may start the old target: %t, switched %t (%+v)", step, box, !switched[box], switched[box], d)
+ }
+ }
+ }
+ t.Run("bootstrap halted", func(t *testing.T) {
+ for _, retry := range []bool{true, false} {
+ w := newSwapWorld(t)
+ order := w.change("order")
+ order.Order = []string{"a", "b"}
+ w.apply(t, order)
+ permit := w.change("permit")
+ permit.Grant = "a"
+ w.apply(t, permit)
+ w.apply(t, w.ack("a", true))
+ permit = w.change("permit")
+ permit.Grant = "b"
+ w.apply(t, permit)
+ w.apply(t, w.ack("b", false))
+ if d := w.rec.ReplicaDeploy; !d.Swap.Halted || d.Previous != (replicas.Build{}) || d.Allows("b", w.id.Incarnation, swapTarget.Digest) {
+ t.Fatalf("halted bootstrap: %+v", d)
+ }
+ id, target, retryOf := "deploy-3", v3, ""
+ if retry {
+ if _, err := RequestRecordReplicaRetry(w.ctx, w.s, w.id, "deploy-2", "retry-1"); err != nil {
+ t.Fatal(err)
+ }
+ w.rec, _ = GetRecord(w.ctx, w.s, w.id.Account, w.id.App, w.id.Host)
+ id, target, retryOf = "deploy-2r", swapTarget, "deploy-2"
+ }
+ w.release(t, id, target, retryOf, "pending")
+ check(t, w, id+" pending", map[string]bool{"a": true})
+ w.release(t, id, target, "", "releasing")
+ check(t, w, id+" releasing", map[string]bool{"a": true})
+ w.release(t, id, target, "", "failed")
+ check(t, w, id+" failed", map[string]bool{"a": true})
+ }
+ })
+ t.Run("legacy released", func(t *testing.T) {
+ for _, last := range []string{"releasing", "failed"} {
+ w := newSwapWorld(t)
+ assignmentReplace(t, w.s, w.id, func(r *Record) {
+ r.ReplicaDeploy.LastGood, r.ReplicaDeploy.Previous, r.ReplicaDeploy.BaselineSet = replicas.Build{}, replicas.Build{}, false
+ })
+ w.rec, _ = GetRecord(w.ctx, w.s, w.id.Account, w.id.App, w.id.Host)
+ w.release(t, "deploy-3", v3, "", "pending")
+ if w.rec.ReplicaDeploy.LastGood != swapTarget {
+ t.Fatalf("legacy released not normalised: %+v", w.rec.ReplicaDeploy)
+ }
+ check(t, w, "pending", nil)
+ w.release(t, "deploy-3", v3, "", last)
+ check(t, w, last, nil)
+ }
+ })
+}
diff --git a/internal/provision/stateless_replicas_4_final_census_test.go b/internal/provision/stateless_replicas_4_final_census_test.go
index 292cffa52..6076a2b88 100644
--- a/internal/provision/stateless_replicas_4_final_census_test.go
+++ b/internal/provision/stateless_replicas_4_final_census_test.go
@@ -10,7 +10,10 @@ package provision
// every other box keeps the old baseline; a record with no assignment
// keeps CarryLastGood), and a same-ID transition carries both from the
// record, ignoring a box's copy. Same CAS, field key, F8 proof, term,
-// lock and refusals; no new write path.
+// lock and refusals; no new write path. Micro-fix P1a: a new attempt
+// also sets BaselineSet (its baselines are explicit, so an empty one
+// is never read as LastGood), and a same-ID transition carries it
+// from the record, ignoring a box's copy; same write path.
// - drill.untilView (item 9): the drill's view parser reads the CLI's
// capitalised State and Health cells by column, and the failing-release
// and hub-minute checks moved beside it. "instances" is still the
@@ -23,7 +26,7 @@ package provision
func statelessReplicas4FinalWriteCensusInventory() []censusEntry {
entries := append([]censusEntry(nil), statelessReplicas4Task5WriteCensusInventory()...)
for _, r := range []censusEntry{
- {"internal/provision/replicadeploy.go", "SetRecordReplicaRelease", "record-writer", "key:SetRecordReplicaRelease,key:updateRecord", "3501e20b387566c04425f8cabe23a5ac37cac14692eb6d8202da2448bda7fcf9"},
+ {"internal/provision/replicadeploy.go", "SetRecordReplicaRelease", "record-writer", "key:SetRecordReplicaRelease,key:updateRecord", "7b001dfe233a2343515aa3f448bb9004906c5891d0a3045e518aebeeacae28b5"},
{"scripts/stateless-replicas-drill/main.go", "drill.untilView", "key-site", "lit:instances", "c405d0fb1fdd66705cde240d50ced826b83f6b6f7af5392ab2e07d2e0d457531"},
} {
replaced := false
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 4d1c6be8e..a5655eff1 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -185,4 +185,4 @@ plan14-root-reads-stateless-replicas-4-task3.tsv e69d405a8729ff5d74817448f3c36bb
plan14-root-reads-stateless-replicas-4-task3f.tsv 2b9fbe8fe47f96f2f5fc54665c851df40839dbd3ac3493d386425532737a2bc1
plan14-root-reads-stateless-replicas-4-task5.tsv 76928a781fc03ae001dce640d4e7543f09a0e51a9a70312d716999a086b1353c
plan14-root-reads-stateless-replicas-4-merge-main.tsv 93c4edaeb1b8b692499da65ae7649217787cf996e9739ea0bf9ad0f229885ec7
-plan14-root-reads-stateless-replicas-4-final.tsv 4d33f8aee523b96fc65719506f95764bb7ebbeae65cdf290ac029f06de939432
+plan14-root-reads-stateless-replicas-4-final.tsv 8d27f2345572f43c3bd49a3db38e2429e648f981b7e31288f49a32fedc5e89dd
diff --git a/internal/provision/testdata/plan14-root-reads-stateless-replicas-4-final.tsv b/internal/provision/testdata/plan14-root-reads-stateless-replicas-4-final.tsv
index 9aad50991..7cc2d972b 100644
--- a/internal/provision/testdata/plan14-root-reads-stateless-replicas-4-final.tsv
+++ b/internal/provision/testdata/plan14-root-reads-stateless-replicas-4-final.tsv
@@ -1,24 +1,28 @@
# Census overlay stateless-replicas-4-final, written by census-propose (#369). census-ruling-stateless-replicas-4-final, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-stateless-replicas-4-final.md.
-# 4 body, 1 sites, 7 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.
+# 3 body, 2 sites, 7 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 5 new dispositions: 0 reads re-frozen at their disposition with the claim, 5 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
@legacy a34916ddc5704dc7ef9be9b8ceddf7e25f3d25dc97a3350b9bf9013fbe1893bc internal/activator/rootfsworkers.go Service.registerRootfsWorkers legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: the one place a generation's declared workers are registered; reads the workers the generation declares through the existing staged-manifest read of the backend's Processes (the manifest root's staging wrote, checked against the identity's path and digest), registers each as pending on the host's own entry; an unreadable or invalid declaration registers none and web serves; starts nothing;rev3=census-ruling-stateless-replicas-4-task2-fix3;basis=Task 2 fix round 3: each registered worker records its registration time (registered: a.now()), an in-memory field the proof reads; no read added.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 4: a failed worker registration (unreadable or invalid declaration, no worker backend, no staged identity) now also records the generation on the entry (workersUnregistered) under a.mu; the same declaration read as before, no read added registry:Host@1125,registry:Host@1311,registry:Host@610,registry:Host@823,whole:Route@475 844e8909e88752166a3b92a297a408841a45e745982c83ad4151601c88d87bf6
-@legacy eaaf56ace4470f36ab1c3b1481c749feff9efa90325b45ff22d0c08530abafad internal/rollout/scheduler.go scheduler.execute legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: a dispatch marked Replica (this box permitted step) calls Manager.replicaStep, which calls activator ReplicaSwap, instead of Swap, and emits the swapping event only when the step moves; the added Host and whole Route reads are the same registry row this unit already reads (rt). Agent, not root.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3: the swapping event for a replica step is emitted only for an awake copy on another build, so a sleeping permit holder's proof-only step emits none; no read added registry:App@436,registry:GoodVersion@1739,registry:GoodVersion@1777,registry:Host@4758,registry:Host@5765,registry:Host@6010,whole:Route@129,whole:Route@2882,whole:Route@2923,whole:Route@3348,whole:Route@386,whole:Route@415,whole:Route@5720,whole:Route@6058,whole:Route@6192 182ec5d94000c07a985a2db12338cb91926d849d36ee5aa3563e9f77a389e367
-@legacy 74771761f54ae5cf29cc1e3a63fd1b9a998ca61d253a9c00662137ed69738cd2 internal/activator/replicadeploy.go Service.replicaSwitchFailure legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3 (new): for a set row that switched under a permit, reads the host's own activator entry (route, generation) under a.mu, asks genHealthy past replicaWebFailBound, and stops the failed generation with proof through the existing FenceAndStopAs/LiftFenceAs; the Route reads are the entry's in-memory registry row, no path, file or tenant input whole:Route@353,whole:Route@365,whole:Route@579 6d4ff0d0fd8fc8e4c61d7995f5feebce80f9587a12e9af71e9d8a396c17e217e
+@legacy 2dc393d1099043d32479bc6c04f7a0e6d0cf8a578d1dc4ffa5e8747226b006e4 internal/activator/replicadeploy.go Service.replicaRestartedFailure legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-final;basis=#511 micro-fix P1b (new): for an always-on set row holding this box's permit with no entry and no switch evidence, reads the host's registry row (Routes.Get: Resident, FleetBoxes, ReplicaIncarnation) and stats at.StagedPath (the root-staged release.VersionPath the rollout named; metadata only, never opened, read or run); past replicaRestartBound it fences (FenceAndStopAs), checks releaseOps and StopUncertain, lifts its own fence (LiftFenceAs) and answers switched-failed; starts nothing file:Stat@483,registry:FleetBoxes@367,registry:ReplicaIncarnation@390,whole:Route@336 b63c3eb2a1b337b4a0555dedd38eee637f7842a8d9fc166795b6ee306493356d
+@legacy 8d34823ae162690b8f94eb4524c26297141e722c1c0831c9d64b86409ac1c3ca internal/activator/replicadeploy.go Service.replicaSwitchFailure legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3 (new): for a set row that switched under a permit, reads the host's own activator entry (route, generation) under a.mu, asks genHealthy past replicaWebFailBound, and stops the failed generation with proof through the existing FenceAndStopAs/LiftFenceAs; the Route reads are the entry's in-memory registry row, no path, file or tenant input; #511 micro-fix P2: snapshots whether the entry is awake under a.mu instead of reading e.state after the unlock; no read added whole:Route@435,whole:Route@447,whole:Route@636 f82af6fd86450f86ab9699815d582d19f0eb697b03b0e628506fe0381c88b1a2
@legacy e7e4777318c49ba85f9c80e583db36e9ccbd9e9f812a1a63cc4b3ce4f2b75383 internal/activator/statelessrelease.go Service.ReplicaRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 2 (new): release-only drive of a set row; reads the host's registry row (FleetBoxes, Stateless) and runs the existing storageMode, statelessObservation and prepareStatelessRelease path an overlap swap already runs, with the staged identity the scheduler resolved; no new path, file or input registry:FleetBoxes@239,registry:Stateless@263,registry:Stateless@788,whole:Route@226,whole:Route@482,whole:Route@576,whole:Route@723,whole:Route@784,whole:Route@858 8e7630557b9e5ea42cca3e4fa78745442b7ae767ed1b79019cd186c005d23601
@legacy 084aa71aa2309c6a8553fbdcae78c394abf3c084e8b0a1ab0bebe62c35c39813 internal/rollout/replicas.go Manager.DriveReplicaRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 2 (new): the coordinator's tick drive; reads the host's registry row (Routes.Get) and checks it is a managed set row of the record's lifetime, account and app, resolves the staged target exactly as an ordinary attempt (Manager.resolve), and calls the activator's ReplicaRelease; nothing read from a tenant-named path registry:App@664,registry:FleetBoxes@541,registry:ReplicaIncarnation@564,whole:Route@511,whole:Route@534,whole:Route@642,whole:Route@823 d5f38758d2075881266dba5bb75eaa46ca7d231d6461b425755b2b1b6027f851
-@legacy a009cb098214d76cf4bde6ecff824a4e35bdae58fd1725500bf34864c6cd9d0d internal/activator/replicadeploy.go Service.ReplicaSwap legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: new. Checks the permit (box label, phase released, not halted, ActiveBox, build), refuses a hold, asks tenantStartRefusal on the in-memory entry route, then either re-proves an existing switch (replicaSettle) or runs the existing Swap as a canary and checks replicaStepProven. Reads the in-memory entry route only; no store, file or root call of its own.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: proof-only steps (an already switched copy, a halted permit, a permit whose successor failed here) skip the start gates because nothing starts; a failed successor answers kept only after replicaKeptProven (its stop proven, an empty operation set). Reads only the in-memory entry route; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: the switch proof is replicaSwitchProof, which also reports WorkersFailed (switched, the new workers crashed or did not start within the settle window) so the step answers instead of staying open. Reads only the in-memory entry; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-task2-fix3;basis=Task 2 fix round 3: replicaSwitchProof keeps the step open while a worker start is in flight or a gate-refused start waits for its retry, and judges a never-started worker only after residentPoll + workerStartBound from registration (Service clock); a crash or restart still answers workers failed. Reads only the in-memory entry; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3: records the switch per permit (noteReplicaSwitch) and, for a later step of that permit, replicaSwitchFailure may stop the switched generation with proof (FenceAndStopAs, LiftFenceAs) and answer switched-failed; the two new whole:Route sites pass the entry's route (already held) to noteReplicaSwitch for its Resident flag; no new path, file or input read registry:FleetBoxes@1084,whole:Route@1446,whole:Route@1980,whole:Route@2225,whole:Route@557,whole:Route@567 b67e0453f0c33315d1981028587b22f188d558581c35d8bd2793e2207389d2c5
-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-region-ha-p1b3a;basis=Add bounded placement peer and diagnostic state and the over-capacity callback; no read in this declaration and no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Add coordinator, existing-record observation callback and per-host preparation locks; no read in the declaration. Task 3a: Add optional canonical storage-selection and durable deploy-ID callbacks; declaration only, no read or authority in these fields.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds the heldLegs map to actEntry (legs by id, under a.mu) and heldWakeHook (atomic pointer to a callback) and heldLegSeq (atomic counter) to Service. State only, in memory; no read of tenant, app or box-agent-writable input.;rev3=census-ruling-wake-storm-cap;basis=the agent as carlos: one field, wakeSlots (chan struct{}, the wake semaphore made by New from Config.WakeSlots, default 4); declaration only, no read.;rev3=census-ruling-region-ha-p1b3b-t;basis=Add the B2 DutyStore interface field and process-local duty view, suppression and invalidation state. No read added. B2 adds the verified-successor identity callback; no read in the declaration. B3b adds a nonblocking departure-suspicion callback, invoked only after an accepted holder-forward failure and after cache locks release; it cannot authorize a take.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: immutable callbacks installed before Start for tenant admission, local start permission, fixed route exemptions and shutdown closure; nil callbacks preserve switch-off behavior; no new reads. Fix R1: add an immutable startup-phase callback for response copy, set before service startup. No new read or execution authority.;rev3=census-ruling-region-ha-g2-fixes;basis=Add in-memory HA loss state and pool withdrawal jobs; no new read.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 1: one new field, drain (drainSources: two atomic func pointers for this box's and peers' drain state); no read added. region HA held-requests Task 2: one new field, moves (moveTable: per-host move state, hold counts and admission tickets in memory, under mu); no read added;rev3=census-ruling-held-move-speed;basis=the agent as carlos: one new field, moveStreams (per-host in-memory set of edge.StreamEnd for requests in flight, own mutex), for the move's early stream cut; actEntry gains drainRelease (bool, under a.mu), set by DrainStop; declarations only, no read added;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: two fields, wakeFailMu and wakeFailLogged (per-host in-memory note of the last journalled wake failure); declaration only, no read;rev3=census-ruling-w6-ingress-drain;basis=new field TenantStartsClosed func() bool; when it answers true tenantStartRefusal refuses every start, exempt routes included. Wired only by fixedAdmission.bind to the ingress drain's closed flag. Struct field only; no read added.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: one field, replicaPolicies (host to the newest observed replica deploy and this box label, under mu), set only by SetReplicaDeploy; declaration only, no read.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: one more in-memory field, replicaFailed (host to the permit whose successor failed here, under mu), so that step only proves what it kept; declaration only, no read.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 3 (#511 F11): two hook fields, MarkReplicaRelease and ReplicaReleaseMark (the failure book's per-host release mark on this box's disk). No read site.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 first commit (#511 F11): one in-memory field, heldSeen (host to the last held release attempt, error class and when it was met), under the existing wakeFailMu. Declaration only, no read.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (27d3f501) adds the background atomic.Int64 field that tests wait on; this branch keeps its replica fields. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3: adds replicaSwitched, an in-memory map of the permit each set row switched under (host -> permit key, time, resident flag); no read added 79042e8626fc32aba3a872f31f09e0e4eadadabf31589fc9b9ef6f9e0977a7ff
+@legacy a6bae97f1109f25f5409cbbc85fb47e5451e735eb88d3cded02feb033b69e5d9 internal/rollout/replicas.go Manager.proofOnlyAttempt legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-final;basis=#511 micro-fix (cost, new): a sleeping copy's proof-only Attempt from the dispatch and the registry row execute already read (RouteAccount, App); stats release.VersionPath(OptDir, account, build, app) and sets StagedPath only for a regular file, never opening, reading or hashing it; Digest stays empty, so nothing can run on it file:Stat@353,registry:App@330,whole:Route@313 6b5ed1231c0d281ba696c43dd8df14c4b176bd3b303bbaf285e73c61d19ec2da
+@legacy 5eed85bad6a7c4ce4649c6f42570b98ab71dff9558797f40674d6cb84870565d internal/activator/replicadeploy.go Service.ReplicaSwap legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: new. Checks the permit (box label, phase released, not halted, ActiveBox, build), refuses a hold, asks tenantStartRefusal on the in-memory entry route, then either re-proves an existing switch (replicaSettle) or runs the existing Swap as a canary and checks replicaStepProven. Reads the in-memory entry route only; no store, file or root call of its own.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: proof-only steps (an already switched copy, a halted permit, a permit whose successor failed here) skip the start gates because nothing starts; a failed successor answers kept only after replicaKeptProven (its stop proven, an empty operation set). Reads only the in-memory entry route; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: the switch proof is replicaSwitchProof, which also reports WorkersFailed (switched, the new workers crashed or did not start within the settle window) so the step answers instead of staying open. Reads only the in-memory entry; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-task2-fix3;basis=Task 2 fix round 3: replicaSwitchProof keeps the step open while a worker start is in flight or a gate-refused start waits for its retry, and judges a never-started worker only after residentPoll + workerStartBound from registration (Service clock); a crash or restart still answers workers failed. Reads only the in-memory entry; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3: records the switch per permit (noteReplicaSwitch) and, for a later step of that permit, replicaSwitchFailure may stop the switched generation with proof (FenceAndStopAs, LiftFenceAs) and answer switched-failed; the two new whole:Route sites pass the entry's route (already held) to noteReplicaSwitch for its Resident flag; no new path, file or input read; #511 micro-fix: clears replicaNoGen while the copy is awake; with no switch evidence and no entry, asks replicaRestartedFailure; a ProofOnly attempt (a sleeping copy's step) abandons before Swap or any start gate; no new read site registry:FleetBoxes@1837,whole:Route@2199,whole:Route@2733,whole:Route@2978,whole:Route@557,whole:Route@567 3fdf514278e4e1da500d4605907063a09838db3a47403687972bad56febd31de
+@legacy 226e1624fe58bc0b25c9877596e475371aa5597acf2a0a528026506a14ab1ad1 internal/rollout/scheduler.go scheduler.execute legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: a dispatch marked Replica (this box permitted step) calls Manager.replicaStep, which calls activator ReplicaSwap, instead of Swap, and emits the swapping event only when the step moves; the added Host and whole Route reads are the same registry row this unit already reads (rt). Agent, not root.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3: the swapping event for a replica step is emitted only for an awake copy on another build, so a sleeping permit holder's proof-only step emits none; no read added; #511 micro-fix (cost): a ProofOnly replica dispatch whose copy is still asleep (Act.Current) skips resolve (no staging, manifest read or hash) and takes Manager.proofOnlyAttempt; every other dispatch resolves as before; the added Host and whole Route sites are the same registry row this unit already reads (rt) registry:App@436,registry:GoodVersion@1739,registry:GoodVersion@1777,registry:Host@2958,registry:Host@5156,registry:Host@6163,registry:Host@6408,whole:Route@129,whole:Route@3225,whole:Route@3269,whole:Route@3312,whole:Route@3746,whole:Route@386,whole:Route@415,whole:Route@6118,whole:Route@6456,whole:Route@6590 7f34270be36dacd7e07097864f96a3f6a8fdcce853299c2384871dadcac814fd
+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-region-ha-p1b3a;basis=Add bounded placement peer and diagnostic state and the over-capacity callback; no read in this declaration and no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Add coordinator, existing-record observation callback and per-host preparation locks; no read in the declaration. Task 3a: Add optional canonical storage-selection and durable deploy-ID callbacks; declaration only, no read or authority in these fields.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds the heldLegs map to actEntry (legs by id, under a.mu) and heldWakeHook (atomic pointer to a callback) and heldLegSeq (atomic counter) to Service. State only, in memory; no read of tenant, app or box-agent-writable input.;rev3=census-ruling-wake-storm-cap;basis=the agent as carlos: one field, wakeSlots (chan struct{}, the wake semaphore made by New from Config.WakeSlots, default 4); declaration only, no read.;rev3=census-ruling-region-ha-p1b3b-t;basis=Add the B2 DutyStore interface field and process-local duty view, suppression and invalidation state. No read added. B2 adds the verified-successor identity callback; no read in the declaration. B3b adds a nonblocking departure-suspicion callback, invoked only after an accepted holder-forward failure and after cache locks release; it cannot authorize a take.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: immutable callbacks installed before Start for tenant admission, local start permission, fixed route exemptions and shutdown closure; nil callbacks preserve switch-off behavior; no new reads. Fix R1: add an immutable startup-phase callback for response copy, set before service startup. No new read or execution authority.;rev3=census-ruling-region-ha-g2-fixes;basis=Add in-memory HA loss state and pool withdrawal jobs; no new read.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 1: one new field, drain (drainSources: two atomic func pointers for this box's and peers' drain state); no read added. region HA held-requests Task 2: one new field, moves (moveTable: per-host move state, hold counts and admission tickets in memory, under mu); no read added;rev3=census-ruling-held-move-speed;basis=the agent as carlos: one new field, moveStreams (per-host in-memory set of edge.StreamEnd for requests in flight, own mutex), for the move's early stream cut; actEntry gains drainRelease (bool, under a.mu), set by DrainStop; declarations only, no read added;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: two fields, wakeFailMu and wakeFailLogged (per-host in-memory note of the last journalled wake failure); declaration only, no read;rev3=census-ruling-w6-ingress-drain;basis=new field TenantStartsClosed func() bool; when it answers true tenantStartRefusal refuses every start, exempt routes included. Wired only by fixedAdmission.bind to the ingress drain's closed flag. Struct field only; no read added.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: one field, replicaPolicies (host to the newest observed replica deploy and this box label, under mu), set only by SetReplicaDeploy; declaration only, no read.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: one more in-memory field, replicaFailed (host to the permit whose successor failed here, under mu), so that step only proves what it kept; declaration only, no read.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 3 (#511 F11): two hook fields, MarkReplicaRelease and ReplicaReleaseMark (the failure book's per-host release mark on this box's disk). No read site.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 first commit (#511 F11): one in-memory field, heldSeen (host to the last held release attempt, error class and when it was met), under the existing wakeFailMu. Declaration only, no read.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (27d3f501) adds the background atomic.Int64 field that tests wait on; this branch keeps its replica fields. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3: adds replicaSwitched, an in-memory map of the permit each set row switched under (host -> permit key, time, resident flag); no read added; #511 micro-fix P1b: adds replicaNoGen, an in-memory map (host -> permit key and when first seen) that is only the bound's clock for a restarted permit holder with no generation; no read added 67800134553f072daba7481cddbdb55b41778c92203eb0f2eef705f9dde000cf
internal/activator/rootfsworkers.go Service.registerRootfsWorkers legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: the one place a generation's declared workers are registered; reads the workers the generation declares through the existing staged-manifest read of the backend's Processes (the manifest root's staging wrote, checked against the identity's path and digest), registers each as pending on the host's own entry; an unreadable or invalid declaration registers none and web serves; starts nothing;rev3=census-ruling-stateless-replicas-4-task2-fix3;basis=Task 2 fix round 3: each registered worker records its registration time (registered: a.now()), an in-memory field the proof reads; no read added.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 4: a failed worker registration (unreadable or invalid declaration, no worker backend, no staged identity) now also records the generation on the entry (workersUnregistered) under a.mu; the same declaration read as before, no read added registry:Host@1125,registry:Host@1311,registry:Host@610,registry:Host@823,whole:Route@475 844e8909e88752166a3b92a297a408841a45e745982c83ad4151601c88d87bf6
internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: one more assignment beside eb.FilesStore: eb.EscrowKey = haEscrowKey(os.Getenv("CARLOS_SECRETS_KEY")), the agent's own environment parsed by appconfig.ParsePrivateKey as the moves pass parses it (unset or unparseable: a log line and nil, and HA publication refuses on the box). No path is opened or read, no read site added; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 4: one more goroutine beside configSyncLoop: go escrowLoop(agentCtx, reg, svc), the escrow sweep every 30 s over the same registry and Service. This body reads nothing new itself; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 5: one more call beside eb.EscrowKey: wireRawSecretPages(eb, PageOperator, metricsBoxLabel(os.Getenv, readMachineID())), which sets eb.OnRawSecret to page an operator (alerting.Page through PageOperator, LevelIncident) on its own goroutine with a 20 s timeout; metricsBoxLabel and readMachineID are the reads this body already makes for the moves refusal log; no new read site; the same six sites, offsets moved; B,C,D,F authority retained. Merge of origin/main 90c4d3aa: main's own later changes to this body are kept as main has them, under main's rulings; this branch's change is the same as above. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged.;rev3=census-ruling-probe-burst-limit;basis=two more sink wirings beside setAnalyticsSink: setProtectionSink(e.SetProtectionRecordOnly) and setAssetOwnersSource(e.AssetOwners), function values the telemetry pass calls; this body reads nothing new, the same six sites; authority B,C,D,F retained; no new root read or write kind;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority.;rev3=census-ruling-agent-start-demo-3;basis=Wire the claim activator and root snapshot client into the demo worker; pass moved readiness to status reporting. Census read-site delta: unchanged (9).;rev3=census-ruling-region-ha-g2-fixes;basis=Wire local pool evidence, live withdrawal activator, startup ingress scan and alias publication, and edge lookup; no new direct sites; new indirect record/claim reads use existing store/judge paths described in ingress helpers.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3: starts the existing record-view backstop loop with a departure-inventory listener (non-blocking, coalesced signal) even without an armed RecordView; it requests the existing full pass (backstopFullDue) there. Same nine read sites; no new read or authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Derive one signal-time deadline with a 90-second budget; cap departure stop and startup/seed/service shutdown joins by it. No read added.;rev3=census-ruling-static-sweep-periodic;basis=in the edge-ready callback, publishes e.LargestStaticTree in staticTreeSource for the disk alert line (diskAlertFrac in the metrics loop); in-memory wiring only, no read added; read sites unchanged (9);rev3=census-ruling-edge-page-cache-1;basis=wires the exec backend's CurrentInputs into the edge cache (wireCurrentInputs) and, in the ready hook after armEdgeAssetCache (whose returned store it now keeps), calls armEdgePageCache, which does nothing unless CARLOS_PAGE_CACHE=1; read sites unchanged (9); no read added;rev3=census-ruling-gvisor-demos;basis=Capture sandbox resolution and refusal once; log errors once; gate route admission and BeforeExec before process launch. No new root read. Task 5: pass the once-captured sandbox effective mode/config error into ExecBackend, UnitBackend and the immutable Client expectation. Same startup environment/registry reads; swapArming declines gVisor before placement. Task 8: arm read-only status projection with the existing Client.SandboxStatus callback. Agent status now queries the existing root /ready endpoint; no new root authority or guest-file input. Merge2 e8a1ddde: retain main wireCurrentInputs and armEdgePageCache through the existing asset-store ready hook alongside branch once-captured sandbox mode, wake gates and root status wiring. No new direct read; main page-cache helpers retain their own census overlays.;rev3=census-ruling-region-ha-held-build;basis=wires the drain state: svc.SetDrainingSource(boxDrain.IsDraining), svc.SetPeerDrainView(e.PeerDraining), e.SetPeerDrainedHook(svc.DropHoldersNaming); in-memory only; no read added; region HA held-requests Task 5: on group members, starts the drain driver over the activator, the edge and boxDrain, and serves its root-only drain socket; no read added beyond the socket's own Branch review r1: the drain state follows the root start fence on group members (the fence reader is the existing fenceLocation.read, a root-owned fixed path); e.SetPeerUndrainedHook(svc.AllowHoldersNaming) beside the drained hook (memory only); the drain socket serves only the agent's own user. No read added.;rev3=census-ruling-security-review-mitigations;basis=Wire the cached operator flat-layout choice into the exec backend's new-resident refusal; no read source added, existing authority retained.;rev3=census-ruling-w6-ingress-drain;basis=agent (user carlos), not root. Builds the ingress drain (newIngressDrain) with arming read at ask time from os.Getenv (CARLOS_REGION_HA, CARLOS_INGRESS_TARGET_GROUPS, both from the root-owned host.env), the fixed admission and lease.CurrentSelf (existing IMDS identity); its reader is awstg.Load, the box role's credentials calling ELB DescribeTargetHealth/DescribeTargetGroupAttributes (new AWS reads, by the agent). Wires admission.closeStartsForIngressDrain, the lbhealth drain condition, ingress.setEdge, and ingress.shutdownStarted in WithShutdownStarted. The drain socket (/run/carlos/.ha-drain/drain.sock, agent-user only, existing) is now also served on a fixed box with the drain configured (was group members only), routing /v1/ingress/* to the ingress drain and the group drain verbs to 404 there. armHADepartures now takes fixtureDepartureGetenv() and MakeQueue fixtureDepartureQueue(), which in a production (non-rootrunner) build are os.Getenv and nil, as before. Read sites unchanged (9).;rev3=census-ruling-stateless-replicas-4-task1;basis=Arms the fleet-only replica swap worker next to the placement worker: same console URL and fleet token as the existing replicaCoordinatorAPI, the existing activator Service; stops and joins at shutdown. No new read site, credential or bucket reader.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: sets deployWorker.step to the rollout scheduler answer for the record permit (replicaStepOf over armedRollout), an in-memory callback; no read site, credential or bucket reader added.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: the swap worker step is armedReplicaStep, the same lazy scheduler lookup as before as a named function; no read site added.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (01d6ca78, linked-deployments-slice1) starts linkLoop beside tunnelLoop; this branch keeps its replica coordinator wiring. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 2: wires the swap worker's drive (armedReplicaDrive, the armed rollout manager's DriveReplicaRelease); no read added file:Exec@20408,file:Open@2191,file:Statfs@55346,registry:App@13287,registry:Host@50710,whole:Route@13279,whole:Route@49057,whole:Route@50833,whole:Route@50895 b3e5fc20dba69f3b1c5f40605efe66b757b0b348d2184799290f58ce8d625375
-internal/rollout/scheduler.go scheduler.execute legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: a dispatch marked Replica (this box permitted step) calls Manager.replicaStep, which calls activator ReplicaSwap, instead of Swap, and emits the swapping event only when the step moves; the added Host and whole Route reads are the same registry row this unit already reads (rt). Agent, not root.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3: the swapping event for a replica step is emitted only for an awake copy on another build, so a sleeping permit holder's proof-only step emits none; no read added registry:App@436,registry:GoodVersion@1739,registry:GoodVersion@1777,registry:Host@4758,registry:Host@5765,registry:Host@6010,whole:Route@129,whole:Route@2882,whole:Route@2923,whole:Route@3348,whole:Route@386,whole:Route@415,whole:Route@5720,whole:Route@6058,whole:Route@6192 182ec5d94000c07a985a2db12338cb91926d849d36ee5aa3563e9f77a389e367
-internal/activator/replicadeploy.go Service.replicaSwitchFailure legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3 (new): for a set row that switched under a permit, reads the host's own activator entry (route, generation) under a.mu, asks genHealthy past replicaWebFailBound, and stops the failed generation with proof through the existing FenceAndStopAs/LiftFenceAs; the Route reads are the entry's in-memory registry row, no path, file or tenant input whole:Route@353,whole:Route@365,whole:Route@579 6d4ff0d0fd8fc8e4c61d7995f5feebce80f9587a12e9af71e9d8a396c17e217e
+internal/activator/replicadeploy.go Service.replicaRestartedFailure legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-final;basis=#511 micro-fix P1b (new): for an always-on set row holding this box's permit with no entry and no switch evidence, reads the host's registry row (Routes.Get: Resident, FleetBoxes, ReplicaIncarnation) and stats at.StagedPath (the root-staged release.VersionPath the rollout named; metadata only, never opened, read or run); past replicaRestartBound it fences (FenceAndStopAs), checks releaseOps and StopUncertain, lifts its own fence (LiftFenceAs) and answers switched-failed; starts nothing file:Stat@483,registry:FleetBoxes@367,registry:ReplicaIncarnation@390,whole:Route@336 b63c3eb2a1b337b4a0555dedd38eee637f7842a8d9fc166795b6ee306493356d
+internal/activator/replicadeploy.go Service.replicaSwitchFailure legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3 (new): for a set row that switched under a permit, reads the host's own activator entry (route, generation) under a.mu, asks genHealthy past replicaWebFailBound, and stops the failed generation with proof through the existing FenceAndStopAs/LiftFenceAs; the Route reads are the entry's in-memory registry row, no path, file or tenant input; #511 micro-fix P2: snapshots whether the entry is awake under a.mu instead of reading e.state after the unlock; no read added whole:Route@435,whole:Route@447,whole:Route@636 f82af6fd86450f86ab9699815d582d19f0eb697b03b0e628506fe0381c88b1a2
internal/activator/statelessrelease.go Service.ReplicaRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 2 (new): release-only drive of a set row; reads the host's registry row (FleetBoxes, Stateless) and runs the existing storageMode, statelessObservation and prepareStatelessRelease path an overlap swap already runs, with the staged identity the scheduler resolved; no new path, file or input registry:FleetBoxes@239,registry:Stateless@263,registry:Stateless@788,whole:Route@226,whole:Route@482,whole:Route@576,whole:Route@723,whole:Route@784,whole:Route@858 8e7630557b9e5ea42cca3e4fa78745442b7ae767ed1b79019cd186c005d23601
internal/rollout/replicas.go Manager.DriveReplicaRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 2 (new): the coordinator's tick drive; reads the host's registry row (Routes.Get) and checks it is a managed set row of the record's lifetime, account and app, resolves the staged target exactly as an ordinary attempt (Manager.resolve), and calls the activator's ReplicaRelease; nothing read from a tenant-named path registry:App@664,registry:FleetBoxes@541,registry:ReplicaIncarnation@564,whole:Route@511,whole:Route@534,whole:Route@642,whole:Route@823 d5f38758d2075881266dba5bb75eaa46ca7d231d6461b425755b2b1b6027f851
-internal/activator/replicadeploy.go Service.ReplicaSwap legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: new. Checks the permit (box label, phase released, not halted, ActiveBox, build), refuses a hold, asks tenantStartRefusal on the in-memory entry route, then either re-proves an existing switch (replicaSettle) or runs the existing Swap as a canary and checks replicaStepProven. Reads the in-memory entry route only; no store, file or root call of its own.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: proof-only steps (an already switched copy, a halted permit, a permit whose successor failed here) skip the start gates because nothing starts; a failed successor answers kept only after replicaKeptProven (its stop proven, an empty operation set). Reads only the in-memory entry route; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: the switch proof is replicaSwitchProof, which also reports WorkersFailed (switched, the new workers crashed or did not start within the settle window) so the step answers instead of staying open. Reads only the in-memory entry; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-task2-fix3;basis=Task 2 fix round 3: replicaSwitchProof keeps the step open while a worker start is in flight or a gate-refused start waits for its retry, and judges a never-started worker only after residentPoll + workerStartBound from registration (Service clock); a crash or restart still answers workers failed. Reads only the in-memory entry; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3: records the switch per permit (noteReplicaSwitch) and, for a later step of that permit, replicaSwitchFailure may stop the switched generation with proof (FenceAndStopAs, LiftFenceAs) and answer switched-failed; the two new whole:Route sites pass the entry's route (already held) to noteReplicaSwitch for its Resident flag; no new path, file or input read registry:FleetBoxes@1084,whole:Route@1446,whole:Route@1980,whole:Route@2225,whole:Route@557,whole:Route@567 b67e0453f0c33315d1981028587b22f188d558581c35d8bd2793e2207389d2c5
+internal/rollout/replicas.go Manager.proofOnlyAttempt legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-final;basis=#511 micro-fix (cost, new): a sleeping copy's proof-only Attempt from the dispatch and the registry row execute already read (RouteAccount, App); stats release.VersionPath(OptDir, account, build, app) and sets StagedPath only for a regular file, never opening, reading or hashing it; Digest stays empty, so nothing can run on it file:Stat@353,registry:App@330,whole:Route@313 6b5ed1231c0d281ba696c43dd8df14c4b176bd3b303bbaf285e73c61d19ec2da
+internal/activator/replicadeploy.go Service.ReplicaSwap legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: new. Checks the permit (box label, phase released, not halted, ActiveBox, build), refuses a hold, asks tenantStartRefusal on the in-memory entry route, then either re-proves an existing switch (replicaSettle) or runs the existing Swap as a canary and checks replicaStepProven. Reads the in-memory entry route only; no store, file or root call of its own.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: proof-only steps (an already switched copy, a halted permit, a permit whose successor failed here) skip the start gates because nothing starts; a failed successor answers kept only after replicaKeptProven (its stop proven, an empty operation set). Reads only the in-memory entry route; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: the switch proof is replicaSwitchProof, which also reports WorkersFailed (switched, the new workers crashed or did not start within the settle window) so the step answers instead of staying open. Reads only the in-memory entry; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-task2-fix3;basis=Task 2 fix round 3: replicaSwitchProof keeps the step open while a worker start is in flight or a gate-refused start waits for its retry, and judges a never-started worker only after residentPoll + workerStartBound from registration (Service clock); a crash or restart still answers workers failed. Reads only the in-memory entry; no store, file or root call.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3: records the switch per permit (noteReplicaSwitch) and, for a later step of that permit, replicaSwitchFailure may stop the switched generation with proof (FenceAndStopAs, LiftFenceAs) and answer switched-failed; the two new whole:Route sites pass the entry's route (already held) to noteReplicaSwitch for its Resident flag; no new path, file or input read; #511 micro-fix: clears replicaNoGen while the copy is awake; with no switch evidence and no entry, asks replicaRestartedFailure; a ProofOnly attempt (a sleeping copy's step) abandons before Swap or any start gate; no new read site registry:FleetBoxes@1837,whole:Route@2199,whole:Route@2733,whole:Route@2978,whole:Route@557,whole:Route@567 3fdf514278e4e1da500d4605907063a09838db3a47403687972bad56febd31de
+internal/rollout/scheduler.go scheduler.execute legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: a dispatch marked Replica (this box permitted step) calls Manager.replicaStep, which calls activator ReplicaSwap, instead of Swap, and emits the swapping event only when the step moves; the added Host and whole Route reads are the same registry row this unit already reads (rt). Agent, not root.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 3: the swapping event for a replica step is emitted only for an awake copy on another build, so a sleeping permit holder's proof-only step emits none; no read added; #511 micro-fix (cost): a ProofOnly replica dispatch whose copy is still asleep (Act.Current) skips resolve (no staging, manifest read or hash) and takes Manager.proofOnlyAttempt; every other dispatch resolves as before; the added Host and whole Route sites are the same registry row this unit already reads (rt) registry:App@436,registry:GoodVersion@1739,registry:GoodVersion@1777,registry:Host@2958,registry:Host@5156,registry:Host@6163,registry:Host@6408,whole:Route@129,whole:Route@3225,whole:Route@3269,whole:Route@3312,whole:Route@3746,whole:Route@386,whole:Route@415,whole:Route@6118,whole:Route@6456,whole:Route@6590 7f34270be36dacd7e07097864f96a3f6a8fdcce853299c2384871dadcac814fd
@coverage . 8a0429c65e29d735b1b99f1dbd98c5c815ce9d307c0d7cf03bfa1b2b56c3f6e3
-@coverage internal/activator 26fc11dc0a1445b6e4808b80a2b9a2b65881a393d90cc44d4f46b36e99c6a3c4
+@coverage internal/activator 55a32534b8c5e7b2b29b8342b68849ad40779d0e872fec87dc154b527f1a4136
@coverage internal/edge 97284617ae7ac412bfa1df0f4d19718c1fb1b117691c66c9ba1cb5208fd9b57e
@coverage internal/host 0d25995e238484f1265fc4d68b76d54b1a15104d21a81e6e9c00e97d85f0dd34
-@coverage internal/provision ffccf42752bab72dded68111d4725fcabc6efccc3c66348d1704356afa73140b
-@coverage internal/replicas c743a37f618e71063b59bf18e3737fd89227b1cc859ec8930a0e9fd5540569e9
-@coverage internal/rollout 6b02933f07fe5b23acb9203bc1ab63fd25119d70a00376fe022b6c07866a2c10
+@coverage internal/provision 771079c84e16cb831649400403d4512adeedb504bf8d3f44ec69eaed6a1fb472
+@coverage internal/replicas 6ca0904cfe95b7b8185578a19e426112e4409919fc429bfae8e935fad449e2ff
+@coverage internal/rollout 06c972d3edd5eaafdd3a5313523da21d7f9d8f9ddb43c503c2c44aedf1b10b93
diff --git a/internal/replicas/deploy.go b/internal/replicas/deploy.go
index c4acc7bd1..bb198de02 100644
--- a/internal/replicas/deploy.go
+++ b/internal/replicas/deploy.go
@@ -118,6 +118,13 @@ func CarryLastGood(old *Deploy, incarnation string) Build {
// assigned says the record has a replica assignment. A record with none
// runs one copy, which runs whatever release passed without a permit, so
// its new attempt starts from CarryLastGood, as before copies.
+//
+// The result is explicit (the writer sets BaselineSet with it): an empty
+// previous, or an empty entry, is kept as "may run nothing until it holds
+// a permit", never read as LastGood. That is how a legacy or bootstrap
+// record is normalised: a box it authorised to run nothing (old released
+// with no Previous) keeps nothing through the new attempt's pending,
+// releasing and failed phases (#511 micro-fix, P1a).
func CarryBaselines(old *Deploy, incarnation string, assigned bool) (previous Build, boxes map[string]Build) {
if old == nil || old.Incarnation != incarnation {
return Build{}, nil
@@ -267,9 +274,12 @@ func NextDeploy(cur Deploy, change DeployChange, coordinator Coordinator, now ti
// promotion). For any other box it is that box's entry in Baselines, or
// else Previous: the per-box baseline the writer recorded at begin
// (CarryBaselines), so a box a halted attempt never switched keeps the
-// build it ran, not the halted target. A legacy record without Previous
-// falls back to LastGood before its release passes. It is empty when no
-// build of this lifetime ever passed a release.
+// build it ran, not the halted target. Both are explicit once the writer
+// set them (BaselineSet): an empty one means the box may run nothing until
+// it holds a permit, and never falls through to LastGood (#511 micro-fix,
+// P1a). Only a legacy record (no BaselineSet) without Previous falls back
+// to LastGood before its release passes. It is empty when no build of
+// this lifetime ever passed a release.
func (d *Deploy) Baseline(box string) Build {
switch {
case d == nil:
@@ -280,7 +290,7 @@ func (d *Deploy) Baseline(box string) Build {
if b, ok := d.Baselines[box]; ok && box != "" {
return b
}
- if ReleasePassed(d.Phase) || d.Previous != (Build{}) {
+ if d.BaselineSet || ReleasePassed(d.Phase) || d.Previous != (Build{}) {
return d.Previous
}
return d.LastGood
diff --git a/internal/replicas/deploy_test.go b/internal/replicas/deploy_test.go
index 0e7d41c6e..1a0ead224 100644
--- a/internal/replicas/deploy_test.go
+++ b/internal/replicas/deploy_test.go
@@ -1,6 +1,7 @@
package replicas
import (
+ "encoding/json"
"errors"
"math/rand"
"slices"
@@ -565,6 +566,64 @@ func TestReplicaCarryBaselinesPerBox(t *testing.T) {
}
}
+// TestReplicaEmptyBaselineStaysEmpty (#511 micro-fix, P1a; Astra C1): a
+// box the replaced attempt authorised to run nothing keeps nothing through
+// the replacement's pending, releasing, failed and unknown phases: it may
+// not start the old target (LastGood) without a permit. Covered for a
+// bootstrap attempt halted after one box switched, and for a legacy
+// released record (no Previous, no LastGood) that CarryLastGood
+// normalises to its own target.
+func TestReplicaEmptyBaselineStaysEmpty(t *testing.T) {
+ v1, v2 := Build{Version: "v1", Digest: "c1"}, Build{Version: "v2", Digest: "c2"}
+ for _, c := range []struct {
+ name string
+ old Deploy
+ switched map[string]bool
+ }{
+ {"bootstrap halted", Deploy{ID: "d1", Incarnation: "life", Target: v1, LastGood: v1, Phase: "released", BaselineSet: true, Swap: Swap{Order: []string{"a", "b"}, Completed: []string{"a"}, Halted: true}}, map[string]bool{"a": true}},
+ {"legacy released", Deploy{ID: "d1", Incarnation: "life", Target: v1, Phase: "released"}, nil},
+ } {
+ for _, retry := range []bool{true, false} {
+ target := v2
+ if retry {
+ target = v1
+ }
+ for _, phase := range []string{"pending", "releasing", "failed", "unknown"} {
+ name := c.name + "/" + target.Version + "/" + phase
+ t.Run(name, func(t *testing.T) {
+ previous, boxes := CarryBaselines(&c.old, "life", true)
+ next := Deploy{ID: "d2", Incarnation: "life", Target: target, Phase: phase, LastGood: CarryLastGood(&c.old, "life"), Previous: previous, Baselines: boxes, BaselineSet: true}
+ if next.LastGood != v1 {
+ t.Fatalf("LastGood %+v", next.LastGood)
+ }
+ for _, box := range []string{"a", "b", "z"} {
+ if next.Want(box) != c.old.Want(box) {
+ t.Fatalf("box %s: wants %+v, was authorised %+v", box, next.Want(box), c.old.Want(box))
+ }
+ if !c.switched[box] && next.Allows(box, "life", v1.Digest) {
+ t.Fatalf("box %s may start the old target without a permit", box)
+ }
+ }
+ // The JSON round trip keeps it explicit.
+ raw, err := json.Marshal(next)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var back Deploy
+ if err := json.Unmarshal(raw, &back); err != nil || back.Allows("b", "life", v1.Digest) {
+ t.Fatalf("round trip lost the explicit baseline: %s", raw)
+ }
+ })
+ }
+ }
+ }
+ // A legacy record itself (no BaselineSet) keeps its LastGood fallback.
+ legacy := Deploy{Incarnation: "life", Target: v2, LastGood: v1, Phase: "failed"}
+ if legacy.Baseline("b") != v1 {
+ t.Fatal("legacy fallback lost")
+ }
+}
+
// TestReplicaSwapWebFailedAckHalts (#511 final wave, item 3): an ack that
// the box switched and its new build then failed resolves the permit,
// completes the box and halts the deploy, as a worker failure does. It is
diff --git a/internal/replicas/types.go b/internal/replicas/types.go
index 7badec0e9..1658fc936 100644
--- a/internal/replicas/types.go
+++ b/internal/replicas/types.go
@@ -97,6 +97,13 @@ type Deploy struct {
// The writer sets it at begin and carries it unchanged; only a new
// attempt after a halted swap needs it.
Baselines map[string]Build `json:"baselines,omitempty"`
+ // BaselineSet says the writer set Previous and Baselines at begin
+ // (CarryBaselines), so they are every box's explicit baseline: an
+ // empty Previous, or an empty entry in Baselines, means the box may
+ // run nothing until it holds a permit (#511 micro-fix, P1a). Only a
+ // legacy record lacks it, and only its empty Previous falls back to
+ // LastGood (Deploy.Baseline).
+ BaselineSet bool `json:"baseline_set,omitempty"`
// Phase is the release phase: pending, releasing, released, failed,
// unknown, or done once every ordered copy switched.
Phase string `json:"phase,omitempty"`
diff --git a/internal/rollout/queue.go b/internal/rollout/queue.go
index 5ce4d1e76..9fcddf909 100644
--- a/internal/rollout/queue.go
+++ b/internal/rollout/queue.go
@@ -69,6 +69,11 @@ type dispatch struct {
// boxes, so the cohort's canary and halt rules do not; it is always
// settled as a canary.
Replica bool
+ // ProofOnly: a sleeping copy's replica step (sleepingStep), which
+ // swaps nothing and only proves. While the copy is still asleep at
+ // execute, nothing is staged, read or hashed for it (#511 micro-fix);
+ // a copy awake by then gets the full, verified resolve.
+ ProofOnly bool
}
// hostSlot is one instance's desired state. The attempt to run is derived
@@ -382,7 +387,7 @@ func (q *appQueue) sleepingStep(h *hostSlot, now time.Time) (dispatch, bool) {
return dispatch{}, false
}
id := Identity{Host: h.host, Cause: activator.CauseRelease, Build: step}
- return dispatch{ID: id, SchedRev: h.buildRev, Class: classRecover, Cohort: cohortKey(step, classRecover), Replica: true, Canary: true}, true
+ return dispatch{ID: id, SchedRev: h.buildRev, Class: classRecover, Cohort: cohortKey(step, classRecover), Replica: true, Canary: true, ProofOnly: true}, true
}
// gate is the per-host half of admit, shared with the worker recycle hook:
diff --git a/internal/rollout/replicabaseline_test.go b/internal/rollout/replicabaseline_test.go
index fceadb047..9bd70beef 100644
--- a/internal/rollout/replicabaseline_test.go
+++ b/internal/rollout/replicabaseline_test.go
@@ -2,6 +2,7 @@ package rollout
import (
"context"
+ "sync/atomic"
"testing"
"time"
@@ -174,3 +175,58 @@ func TestReplicaSleepingPermitHolderSteps(t *testing.T) {
t.Fatal("a sleeping copy was swapped")
}
}
+
+// TestReplicaProofOnlyStepReadsNoArtifact (#511 micro-fix, cost; Astra
+// concern (a)): a sleeping permit holder's step is proof only, so it reads
+// and hashes no artifact: the demand read (the artifact and manifest read
+// and hash, release.CanonicalRuntimeSelection in production) runs zero
+// times however often it steps. Its attempt carries the staged path for
+// the activator's "staged here" evidence (a stat), no digest, and
+// ProofOnly. An awake permit holder, which can execute, still verifies.
+func TestReplicaProofOnlyStepReadsNoArtifact(t *testing.T) {
+ var reads atomic.Int64
+ count := func(h *harness) {
+ h.mu.Lock()
+ h.demandHook = func(string) { reads.Add(1) }
+ h.mu.Unlock()
+ }
+ permit := replicas.Swap{Order: []string{"box-0", "box-1"}, Completed: []string{"box-0"}, ActiveBox: "box-1", Permit: 8}
+ t.Run("asleep", func(t *testing.T) {
+ reads.Store(0)
+ h, ra := newReplicaHarness(t)
+ count(h)
+ h.act.mu.Lock()
+ delete(h.act.gens, replicaHost)
+ h.act.mu.Unlock()
+ ra.mu.Lock()
+ ra.result = func(activator.Attempt) activator.SwapResult {
+ return activator.SwapResult{Outcome: activator.SwapAbandoned, Reason: "not awake"}
+ }
+ ra.mu.Unlock()
+ noteReplica(h, deployOf("v2", "v1", "released", permit))
+ h.pass()
+ settle(h)
+ settle(h)
+ if ra.stepCount() < 2 {
+ t.Fatalf("the sleeping holder stepped %d times", ra.stepCount())
+ }
+ if n := reads.Load(); n != 0 {
+ t.Fatalf("a proof-only step read or hashed the artifact %d times", n)
+ }
+ at := ra.lastStep()
+ if !at.ProofOnly || at.Digest != "" || at.StagedPath != release.VersionPath(h.opt, "bab", "v2", "blog") {
+ t.Fatalf("proof-only attempt: %+v", at)
+ }
+ })
+ t.Run("awake", func(t *testing.T) {
+ reads.Store(0)
+ h, ra := newReplicaHarness(t)
+ count(h)
+ noteReplica(h, deployOf("v2", "v1", "released", permit))
+ h.pass()
+ waitFor(t, "the permitted step", func() bool { return ra.stepCount() == 1 })
+ if at := ra.lastStep(); at.ProofOnly || at.Digest == "" || reads.Load() == 0 {
+ t.Fatalf("an executable step was not verified: %+v, %d reads", at, reads.Load())
+ }
+ })
+}
diff --git a/internal/rollout/replicas.go b/internal/rollout/replicas.go
index 0dcb0f86c..4faab8bb1 100644
--- a/internal/rollout/replicas.go
+++ b/internal/rollout/replicas.go
@@ -29,6 +29,7 @@ package rollout
import (
"context"
+ "os"
"github.com/carlosframework/platform/internal/activator"
"github.com/carlosframework/platform/internal/provision"
@@ -200,6 +201,20 @@ func (m *Manager) replicaStep(ctx context.Context, a activator.Attempt, newest f
return res
}
+// proofOnlyAttempt is a sleeping copy's replica step (dispatch.ProofOnly)
+// without resolve: no artifact read, no manifest read, no hash. StagedPath
+// is set only when the target's staged file is present (a stat), which is
+// the activator's "staged here" evidence for a restarted permit holder
+// (ReplicaSwap); Digest stays empty, so nothing can be run on it.
+func (m *Manager) proofOnlyAttempt(d dispatch, rt registry.Route) activator.Attempt {
+ a := activator.Attempt{Host: d.ID.Host, Cause: d.ID.Cause, Build: d.ID.Build, SchedRev: d.SchedRev, Canary: d.Canary, Mode: activator.ModeOverlap, ProofOnly: true}
+ path := release.VersionPath(m.d.OptDir, release.RouteAccount(rt), d.ID.Build, rt.App)
+ if fi, err := os.Stat(path); err == nil && fi.Mode().IsRegular() {
+ a.StagedPath = path
+ }
+ return a
+}
+
// replicaWant is the build a wake of rt, a set row with a noted deploy for
// its lifetime, may boot on this box (replicas.Deploy.Want). ok false: no
// such row or note; the exec gate still asks the record.
diff --git a/internal/rollout/scheduler.go b/internal/rollout/scheduler.go
index d03e566ce..2ccab1e9c 100644
--- a/internal/rollout/scheduler.go
+++ b/internal/rollout/scheduler.go
@@ -155,14 +155,27 @@ func (s *scheduler) execute(ctx context.Context, d dispatch) {
return
}
}
- a, err := m.resolve(ctx, d, *rt)
- if err != nil {
- m.stagingRefused(*rt, d.ID.Build, err)
- s.mu.Lock()
- s.q.deferHost(d.ID.Host, m.d.Now().Add(stagingDeferral))
- s.mu.Unlock()
- s.done(d, activator.SwapResult{Outcome: activator.SwapAbandoned, Reason: err.Error()}, "")
- return
+ var a activator.Attempt
+ proofOnly := false
+ if d.Replica && d.ProofOnly {
+ _, awake := m.d.Act.Current(rt.Host)
+ proofOnly = !awake
+ }
+ if proofOnly {
+ // A sleeping copy's proof-only step (#511 micro-fix): it can run
+ // nothing, so nothing is staged, read or hashed for it. A copy
+ // that woke since takes the verified resolve below.
+ a = m.proofOnlyAttempt(d, *rt)
+ } else {
+ a, err = m.resolve(ctx, d, *rt)
+ if err != nil {
+ m.stagingRefused(*rt, d.ID.Build, err)
+ s.mu.Lock()
+ s.q.deferHost(d.ID.Host, m.d.Now().Add(stagingDeferral))
+ s.mu.Unlock()
+ s.done(d, activator.SwapResult{Outcome: activator.SwapAbandoned, Reason: err.Error()}, "")
+ return
+ }
}
// The failing pointer's PromotedAt, read now, while nothing is at stake:
// done() publishes a failure without a blocking read (spec §8.1).