carlos / platform Public

Preserve claim registration refusal during wake import

Require claim-owned timers to carry their original registration. Generate missing registrations only for ordinary HA restore, while generic legacy import preserves its prior shape. Keep replacement atomic and strict adoption validation intact.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 59981797b539b17f3303ed1fcc91a4a57dfd76c6 parent f7116c2
8 files changed, +80 −16
  • docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md +6 −3
  • docs/superpowers/notes/census-region-ha-p1b3b-t-claims.md +3 −1
  • internal/activator/hawake.go +1 −1
  • internal/hostfiles/wake.go +11 −0
  • internal/hostfiles/wake_test.go +41 −1
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-region-ha-p1b3b-t.tsv +12 −8
  • internal/registry/ha_departures.go +5 −1
diff --git a/docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md b/docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md
index e85069afa..3986e330b 100644
--- a/docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md
+++ b/docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md
@@ -1,12 +1,13 @@
# Census approval: region-ha-p1b3b-t
-Ruling `census-ruling-region-ha-p1b3b-t`. The independent reviewer approves or rejects every change below, 93 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+Ruling `census-ruling-region-ha-p1b3b-t`. The independent reviewer approves or rejects every change below, 94 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` `Service.begin` | body | unchanged (13) | Carry background-duty provenance into a new singleflight entry; a visitor waiting on its deferred refusal retries with ordinary visitor authority. No read added. |
| `internal/activator/activator.go` `Service.sweepOnce` | body | unchanged (39) | Tag due entries as background duties; the wake evaluates the gate off a.mu before acquire or token preparation. No read added. |
| `internal/activator/activator.go` `type Service` | body | unchanged (0) | 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. |
+| `internal/activator/hawake.go` `ExecBackend.restoreFilesClean` | body | unchanged (4) | Final fix P3-1: select the HA ordinary-wake importer after the same acquired-lease manifest restore. It alone permits generation of legacy non-claim timer registrations; claim-owned empty registrations remain refused. All file, key and manifest reads are unchanged. |
| `internal/edge/wakeplacement.go` `homeMap.wakeSnapshot` | body | unchanged (3) | Expose fresh compatible peer membership separately from per-host eligible serving entries for suppression invalidation. Existing home/pool/scope filtering remains; no new reads. |
| `internal/host/agent.go` `runAgent` | body | unchanged (6) | 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. |
| `internal/host/metrics_loop.go` `sampler.tick` | body | unchanged (1) | B5: Add one optional aggregate departure sample to the existing buffered sample; no per-host labels or separate writer. |
@@ -30,6 +31,7 @@ Recorded dispositions, which each change must still satisfy:
- `internal/activator/activator.go` `Service.begin`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body; the stop now carries its reason for a run it interrupts (beginStopLocked's why argument); read sites unchanged, offsets moved;rev3=census-ruling-edge-request-records;basis=gains a req *http.Request parameter and one edge.MarkWoke(req) call on the path that starts a wake, so the edge's request record can say which request woke the app; no read added;rev3=census-ruling-remote-instance-metrics;basis=the entries-map insertion goes through putEntryLocked (which also notes the route's tenant in memory for the metrics sampler); no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: before an entry is made, a resident inside its backoff answers errResidentBackoff, and a rootfs row must pass the locked admission (rootfsRefusalLocked) and then the backend's rootfs gates off a.mu (rootfsStartRefusal, within the request's wait bound) before Acquire, Restore or the live link; the gate key is recorded on the entry; adds refusals before the lease only;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Read serving lease health through servingError: stateless generations use local lifecycle/process supervision, while stateful generations keep the existing lease checks. No new I/O.
- `internal/activator/activator.go` `Service.sweepOnce`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=PROPOSED-seed;basis=census-ruling-FS-R6; registry remains legacy; PROPOSED-plans-2-box-limits: the sweep also narrows an entry's idle window to its account's plan idle through the SetIdleFor hook (never lengthens it; always-on workers and held probe entries are untouched; the hibernate, inflight and held-for-tick guards are unchanged).;rev3=census-ruling-plans-4c-box-throttle;basis=after the worker max_run branch, stops a non-worker entry past the plans continuous-awake ceiling (maxRunFor, passed the row), busy or not, never mid-command (plans 4c). One more whole-row read: the row handed to the hook, as idleFor already is. This bypasses the inflight and held-for-tick protections the idle stop keeps, on purpose: escalated by Astra and ACCEPTED by Paul (census owner), 2026-10-25.;rev3=census-ruling-plans-4d-lapse;basis=stops a live entry the turned-off hook names (never mid-command, never a move's active probe), stands down an exited worker it names instead of restarting it (Astra finding 4), and skips such rows in the due loop and the always-on arm so they are not woken (plans 4d). Four more whole-row reads: the row handed to the hook (a.disabled), as idleFor and maxRunFor already are. Only stops or skips.;rev3=census-ruling-remote-instance-metrics;basis=its two entries-map insertions go through putEntryLocked (which also notes the route's tenant in memory for the metrics sampler); no read added;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more call at the top, a.retryOwedMarkers() (harelease.go), which starts at most one background lease.RetryPending pass over owed region HA release markers, off a.mu; the due query, idle, max-run and lapse logic are unchanged; the same 38 sites, no read added; merge of origin/main d7ae1d76: main's change is kept as main has it (census-ruling-remote-instance-metrics: its two entries-map insertions go through putEntryLocked); this branch's change is the same as above; read sites the same 38, offsets moved;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 8: a resident (Route.Resident) is never stopped for idleness or by the continuous-awake ceiling; the due-wake check is left on Hibernate (comment); stops less, not more;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: an entry whose host has a release record open (the in-memory a.releaseOps[e.host]) is not stopped by its plan's turn-off, by idleness or by the continuous-awake ceiling until the record goes; one more sweep pass, reapReleaseOpsLocked, retries an unproven release's stop (through finishPendingStops); the same 39 read sites, no read added; stops less, not more;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 9 (PF-18): the four checks that left an entry with a run attached alone (e.cmd == nil) now read holdsAttachedLocked(e), a run or a session attached, so a session holds the idle sleep, the plans awake ceiling, the plans turned-off stop and the turned-off worker's stand-down as a run does; in-memory under a.mu; only keeps an entry awake longer; no read added, read sites unchanged;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Read serving lease health through servingError: stateless generations use local lifecycle/process supervision, while stateful generations keep the existing lease checks. No new I/O.
- `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.
+- `internal/activator/hawake.go` `ExecBackend.restoreFilesClean`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: restores the HA host's published files into a fresh <host>.restore directory beneath the instance data dir (instancefs, no link followed), renames it into place without replacing anything, writes the manifest's env item as <host>.env (instancefs.WriteAtomic, 0600) and imports the manifest's wake state into the registry (hostfiles.ImportWake, then the class for restoredReplication); the source is the host's files manifest in the hibernate bucket, written by the agents of the boxes that held the host; every failure fails the wake; +registry:Host, +whole:Route x2;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3 (fix round 1: sealed precedence before any fetch): the restore into <host>.restore is now RestoreRootBaselineShadowed with sealedShadow(host), a pure function of the manifest already read and validated: a live raw instance.key or report.token entry whose sealed item the manifest holds is neither fetched nor written (so a missing or corrupt raw object cannot fail the wake, and a sealed item that does not open fails it with no raw fallback); every other entry is restored as before, and the baseline the wake's publisher continues from is the manifest as read. Then each sealed trio item the manifest holds (instance.key.sealed, report.token.sealed) is fetched and opened with hostfiles.ReadSealed (key, sha256, v2 envelope, binding and MAC checked) and written with instancefs.WriteAtomic (openat2 directory, no symlink, O_EXCL temp, rename, 0600) into the restore directory this function created, then that directory is synced; then the same no-replace rename. The env file comes from the sealed env item through ReadSealed when present, else from the raw env item as before, written as before. The source is still the host's files manifest in the hibernate bucket; the destinations are the same restore directory and env file; no new path is opened, followed or named from input; the sealer (sealerFor) is built only when a sealed item is present. Durability 3a Task 5: after RestoreRootBaselineShadowed, noteRawSecrets(host, rm) on the manifest just restored from. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. Read sites unchanged. Durability 3a Task 5 fix round 1: the restore is RestoreRootBaselineObserved (the same read and restore as RestoreRootBaselineShadowed) with a checked callback, noteRawSecrets(host, m), run once the manifest is read and validated and before any entry is removed, fetched or written, so a restore that then fails still shows the detector the manifest; the later noteRawSecrets call is gone. No request, open or write added; read sites unchanged.
- `internal/edge/wakeplacement.go` `homeMap.wakeSnapshot`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1b3a;basis=Project cold-wake candidates from one immutable cached edges fold using the local route's canonical host, release.RouteAccount and app. Reads only in-memory route fields, cached publication additions and mirrored signing keys; no filesystem, registry, store or root authority added. Reject malformed placement evidence independently of the unchanged holder decoder; preserve explicit local safety denials even when stale.;rev3=census-ruling-region-ha-home-placement;basis=none: accepts the omitted/empty home placement, refuses explicit null; same in-memory fold reads, no new read
- `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.
- `internal/host/metrics_loop.go` `sampler.tick`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-remote-instance-metrics;basis=calls the owners probe before and after the unit read and tags readings with metrics.TagUnits and metrics.CarryTags; no read added;rev3=census-ruling-remote-metrics-nested;basis=clears the tenant tag of a reading marked leftover (a nested unit present at agent start) before CarryTags, and takes no CPU delta when a nested reading's set of cgroups changed since the previous tick; no read added
@@ -87,6 +89,7 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/host/hadepartures_wiring.go:armHADepartures`: reads +registry:Account ×2, +registry:App, +registry:IID, +registry:Incarnation, +registry:Pool, +registry:Region ×2, +registry:Revision ×2, +registry:ServingSeq, +whole:DutyState, +whole:Pair ×3, +whole:Route ×2; written legacy, accepted-legacy, frozen
- new `internal/host/runs.go:runsWorker.dutyStillOwned`: reads +registry:HA, +registry:Host, +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/host/runs.go:runsWorker.pickupOwned`: reads +whole:Route ×5; written legacy, accepted-legacy, frozen
+- new `internal/hostfiles/wake.go:ImportHAOrdinaryWake`: reads +registry:FillLegacyRegistration, +whole:HAWakeImport; written legacy, accepted-legacy, frozen
- new `internal/hostfiles/wake.go:RegistryWake`: reads +whole:HAWakeImport ×3; written legacy, accepted-legacy, frozen
- new `internal/hostfiles/wake.go:registryWake`: reads +registry:Timers ×2, +whole:HAWakeImport, +whole:Timer ×2; written legacy, accepted-legacy, frozen
- new `internal/registry/ha_departures.go:Registry.CompareHAAdoption`: reads +registry:AcquiredGeneration, +registry:Binding, +registry:Changed, +registry:Incarnation, +registry:Lifetime ×2, +registry:LockETag, +registry:LockGeneration, +registry:Phase ×2, +registry:Receipt, +registry:Sequence, +registry:ServingSeq, +registry:WakeDigest, +registry:remote ×2, +whole:HAAdoption ×3, +whole:Pair ×2, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
@@ -96,7 +99,7 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/registry/ha_departures.go:Registry.migrateHAAdoptions`: reads +file:QueryRowContext; written legacy, accepted-legacy, frozen
- new `internal/registry/ha_departures.go:ValidHAAdoptionTransition`: reads +registry:AcquiredGeneration, +registry:LockGeneration, +registry:Phase ×4; written legacy, accepted-legacy, frozen
- new `internal/registry/ha_departures.go:ValidateHAWake`: reads +registry:Attempts ×2, +registry:ClaimOwnership ×2, +registry:DueAt ×2, +registry:Host ×2, +registry:Kind ×2, +registry:LastAt ×2, +registry:Name ×5, +registry:NextAt ×2, +registry:NextDue ×2, +registry:Path ×7, +registry:Registration ×2, +registry:Replication ×2, +registry:Spec ×2, +registry:Timers, +whole:ClaimOwnership ×2, +whole:Timer; written legacy, accepted-legacy, frozen
-- new `internal/registry/ha_departures.go:replaceHAWake`: reads +file:QueryRowContext ×2, +file:Read, +registry:Attempts, +registry:ClaimIncarnation, +registry:ClaimOwner, +registry:ClaimOwnership ×3, +registry:ClaimRowID ×2, +registry:ClaimStamp, +registry:CreatedAt, +registry:DueAt, +registry:ExpectedPair ×3, +registry:Incarnation, +registry:Kind ×2, +registry:LastAt, +registry:LastMs, +registry:LastStatus, +registry:Lifetime, +registry:Name, +registry:NextAt, +registry:NextDue, +registry:Path, +registry:Registration ×4, +registry:Replication, +registry:ServingSeq, +registry:Spec, +registry:Timers, +whole:ClaimOwnership ×3, +whole:Pair ×3, +whole:Timer; written legacy, accepted-legacy, frozen
+- new `internal/registry/ha_departures.go:replaceHAWake`: reads +file:QueryRowContext ×2, +file:Read, +registry:Attempts, +registry:ClaimIncarnation, +registry:ClaimOwner, +registry:ClaimOwnership ×4, +registry:ClaimRowID ×2, +registry:ClaimStamp, +registry:CreatedAt, +registry:DueAt, +registry:ExpectedPair ×3, +registry:FillLegacyRegistration, +registry:Incarnation, +registry:Kind ×2, +registry:LastAt, +registry:LastMs, +registry:LastStatus, +registry:Lifetime, +registry:Name, +registry:NextAt, +registry:NextDue, +registry:Path, +registry:Registration ×5, +registry:Replication, +registry:ServingSeq, +registry:Spec, +registry:Timers, +whole:ClaimOwnership ×4, +whole:Pair ×3, +whole:Timer; written legacy, accepted-legacy, frozen
- new `internal/registry/ha_duties.go:Registry.AdvanceHADuty`: reads +registry:remote ×2, +registry:sql, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
- new `internal/registry/ha_duties.go:Registry.BindHADuty`: reads +registry:Changed, +registry:Incarnation, +registry:ServingSeq, +registry:remote ×2, +registry:sql, +whole:Pair ×2, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
- new `internal/registry/ha_duties.go:Registry.CompareDuty`: reads +registry:Basis ×6, +registry:Changed, +registry:HolderEpoch, +registry:HolderIID, +registry:HolderRef, +registry:NotBefore ×2, +registry:ViewKey, +registry:remote ×2, +registry:sql, +whole:DutyState ×2, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
@@ -140,6 +143,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- reads `internal/hostfiles/wake.go:ImportWake`: +whole:HAWakeImport, -whole:Route, -whole:Timer ×3; keeps legacy, task accepted-legacy
- reads `internal/registry/remote_dispatch.go:Registry.dispatchRemote`: +registry:Adoption ×2, +registry:Changed ×5, +registry:Duty ×3, +registry:Expected, +registry:HAJournal ×2, +registry:Host ×9, +registry:Import, +registry:Lifetime ×5, +registry:Pair ×3, +registry:Receipt, +registry:Revision ×3, +registry:Wake ×2, +whole:DutyState ×3, +whole:HAAdoption ×2, +whole:HAWakeImport ×2, +whole:Pair ×3, +whole:haJournalRequest, +whole:haJournalResponse; keeps hint, task E2
-Seal: `744b16d970f22476b79982e57c326157ca5137fa96ccaee4a7ae10c25248d124` → `97b9a4d6458f1084519729558dc144c2d53f75fc5a95a63437e4e160ca468220`.
+Seal: `744b16d970f22476b79982e57c326157ca5137fa96ccaee4a7ae10c25248d124` → `c68e2453bfc8afaf3794eb4c08850428982fa6954269b6b99bddfda4e6242929`.
Overlay: `internal/provision/testdata/plan14-root-reads-region-ha-p1b3b-t.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/notes/census-region-ha-p1b3b-t-claims.md b/docs/superpowers/notes/census-region-ha-p1b3b-t-claims.md
index fbb79b2b4..206a87c20 100644
--- a/docs/superpowers/notes/census-region-ha-p1b3b-t-claims.md
+++ b/docs/superpowers/notes/census-region-ha-p1b3b-t-claims.md
@@ -44,7 +44,7 @@ internal/registry/ha_departures.go:Registry.ImportHAWake Validate all state then
internal/registry/ha_departures.go:Registry.ReplaceHAWake Validate and atomically replace the acquired lease wake state; local receipt or revision never outranks that manifest. Optional lifetime/Pair guard prevents replacement across retirement. B2 fix r1: ordinary restore permits legacy timer grammar and empty registration while keeping host, replication and claim-ownership checks; adoption validates strictly before reaching this exact replacement. No new root path.
internal/registry/ha_departures.go:Registry.migrateHAAdoptions Create the host-receipt table in the existing registry connection; no new path, external object, queue or termination evidence. B2 fix r1: transactionally migrate the existing receipt table to a binding-inclusive primary key, copying all existing rows and phases. Read SQLite table metadata for idempotence; no external path read.
internal/registry/ha_departures.go:ValidateHAWake Read supplied timer/wake fields for name, path, duplicate, kind/spec and replication validation. Reuse the extracted scheduling grammar; no I/O. B2 fix r1: preserve strict adoption validation and report host and the specific failing timer/wake field. Additional field reads format diagnostics only; no I/O.
-internal/registry/ha_departures.go:replaceHAWake Query current route and optional lifetime/Pair under one SQLite transaction; replace timers, next_due and replication together. Preserve existing claim ownership when enabled; never resolve an external path. B2 fix r1: synthesize a cryptographically random registration for an empty legacy registration inside the existing atomic replacement. rand.Read is OS entropy, not a tenant-named file. Nonempty registrations and claim attribution remain unchanged.
+internal/registry/ha_departures.go:replaceHAWake Query current route and optional lifetime/Pair under one SQLite transaction; replace timers, next_due and replication together. Preserve existing claim ownership when enabled; never resolve an external path. B2 fix r1: synthesize a cryptographically random registration for an empty legacy registration inside the existing atomic replacement. rand.Read is OS entropy, not a tenant-named file. Nonempty registrations and claim attribution remain unchanged. Final fix P3-1 supersedes the broad B2 fill: refuse empty registrations on claim-owned routes before generation; generate only when the HA ordinary-restore caller opts in. Generic legacy import preserves empty registrations. Same atomic transaction and ownership checks.
internal/registry/ha_duties.go:Registry.BindHADuty Compare active route Pair and captured revision before changing its authoritative lifetime binding; clear basis and suppression on change.
internal/registry/ha_duties.go:Registry.CompareDuty Compare lifetime/revision/active state and persist advisory basis/suppression. Cannot create adopted basis; only preserve a basis already finalized.
internal/registry/ha_duties.go:Registry.HADuty Read local duty metadata from the existing registry or its remote transport; mismatched/inactive lifetime returns no authority.
@@ -106,3 +106,5 @@ internal/registry/ha_departures.go:ValidHAAdoptionTransition B5: Pure extracted
internal/registry/ha_journal.go:Registry.DepartureSummary B5: Invoke the read-only summary operation on the existing journal RPC; return count and oldest pending timestamp without host labels.
internal/activator/hatakeover.go:ExecBackend.reportTakeover Final fix P2-1: report all refused proof results through the per-host alarm and distinguish visitor from departure-finalize. No reads or authority.
internal/host/hadeparture_identity.go:departureIdentities.loadIdentity Final fix P2-2: share initial and replacement identity reads through one coalesced per-ref loader. Read only boxid.Key(ref) from the existing deployment store after callers validate the ref. Preserve signature/account/region/iid verification; cache unverified reads for 30/60/120/300 seconds, reset on edges ETag or configured binding change, hold at 300 seconds. No new path or authority.
+internal/hostfiles/wake.go:ImportHAOrdinaryWake Final fix P3-1: use existing wire validation and atomic registry replacement with legacy registration generation enabled only for ordinary HA restore. The registry still refuses an empty registration on claim-owned routes. No new path or authority.
+internal/activator/hawake.go:ExecBackend.restoreFilesClean Final fix P3-1: select the HA ordinary-wake importer after the same acquired-lease manifest restore. It alone permits generation of legacy non-claim timer registrations; claim-owned empty registrations remain refused. All file, key and manifest reads are unchanged.
diff --git a/internal/activator/hawake.go b/internal/activator/hawake.go
index 34979c890..709cf2f67 100644
--- a/internal/activator/hawake.go
+++ b/internal/activator/hawake.go
@@ -778,7 +778,7 @@ func (b *ExecBackend) restoreFilesClean(ctx context.Context, rt registry.Route)
if b.Registry == nil {
return errors.New("the files manifest carries wake state and no registry is configured")
}
- if err := hostfiles.ImportWake(b.Registry, host, ws); err != nil {
+ if err := hostfiles.ImportHAOrdinaryWake(b.Registry, host, ws); err != nil {
return err
}
// This wake replicates at the imported class (restoredReplication).
diff --git a/internal/hostfiles/wake.go b/internal/hostfiles/wake.go
index a066ebcd0..66b547c97 100644
--- a/internal/hostfiles/wake.go
+++ b/internal/hostfiles/wake.go
@@ -85,6 +85,17 @@ func ImportWake(reg *registry.Registry, host string, ws WakeState) error {
return reg.ReplaceHAWake(context.Background(), host, state)
}
+// ImportHAOrdinaryWake fills registrations omitted by old HA snapshots.
+// Claim-owned routes still require an existing registration at the registry.
+func ImportHAOrdinaryWake(reg *registry.Registry, host string, ws WakeState) error {
+ state, err := registryWake(host, ws)
+ if err != nil {
+ return err
+ }
+ state.FillLegacyRegistration = true
+ return reg.ReplaceHAWake(context.Background(), host, state)
+}
+
// RegistryWake validates the wire state before a registry transaction begins.
func RegistryWake(host string, ws WakeState) (registry.HAWakeImport, error) {
state, err := registryWake(host, ws)
diff --git a/internal/hostfiles/wake_test.go b/internal/hostfiles/wake_test.go
index 73f439565..a704f116d 100644
--- a/internal/hostfiles/wake_test.go
+++ b/internal/hostfiles/wake_test.go
@@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"path/filepath"
+ "reflect"
"strings"
"testing"
@@ -204,7 +205,7 @@ func TestImportWakeLegacyRows(t *testing.T) {
t.Fatal(err)
}
rows, err := r.TimersFor("shop.test")
- if err != nil || len(rows) != 1 || rows[0].Registration == "" || rows[0].Spec != "@every 1m" || rows[0].NextAt != 123 {
+ if err != nil || len(rows) != 1 || rows[0].Registration != "" || rows[0].Spec != "@every 1m" || rows[0].NextAt != 123 {
t.Fatalf("legacy restore %+v %v", rows, err)
}
rt, err := r.Get("shop.test")
@@ -245,3 +246,42 @@ func TestImportWakeValidationFields(t *testing.T) {
})
}
}
+
+func TestImportWakeClaimRegistration(t *testing.T) {
+ t.Setenv("CARLOS_HOST_CLAIM", "1")
+ r := wakeReg(t)
+ host := "shop.example.com"
+ owner := registry.ClaimOwnership{ClaimIncarnation: "inc", ClaimStamp: 7, ClaimOwner: "owner", ClaimRowID: "route"}
+ if err := r.Upsert(registry.Route{Host: host, Kind: "instance", HA: true, NextDue: 42, ClaimOwnership: owner}); err != nil {
+ t.Fatal(err)
+ }
+ if err := r.UpsertTimer(registry.Timer{Host: host, Name: "keep", Kind: "once", Spec: "at 100", Path: "/keep", NextAt: 100}); err != nil {
+ t.Fatal(err)
+ }
+ old, err := r.TimersFor(host)
+ if err != nil {
+ t.Fatal(err)
+ }
+ ws := WakeState{V: 1, Host: host, NextDue: 77, Timers: []WakeTimer{{Name: "job", Kind: "once", Spec: "at 123", Path: "/job", NextAt: 123}}}
+ for _, importer := range []func(*registry.Registry, string, WakeState) error{ImportWake, ImportHAOrdinaryWake} {
+ if err := importer(r, host, ws); !errors.Is(err, registry.ErrClaimOwnership) {
+ t.Fatalf("empty claim registration: %v", err)
+ }
+ }
+ rows, err := r.TimersFor(host)
+ if err != nil || !reflect.DeepEqual(rows, old) {
+ t.Fatalf("refusal changed rows: %+v %v", rows, err)
+ }
+ rt, err := r.Get(host)
+ if err != nil || rt.NextDue != 42 {
+ t.Fatalf("refusal changed route: %+v %v", rt, err)
+ }
+ ws.Timers[0].Registration = "imported"
+ if err := ImportWake(r, host, ws); err != nil {
+ t.Fatal(err)
+ }
+ rows, err = r.TimersFor(host)
+ if err != nil || len(rows) != 1 || rows[0].Registration != "imported" || rows[0].ClaimRowID != "imported" || rows[0].ClaimOwner != owner.ClaimOwner {
+ t.Fatalf("registered claim import: %+v %v", rows, err)
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 25fe781a6..75956ce81 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -74,4 +74,4 @@ plan14-root-reads-wake-storm-cap.tsv b0fc198c53bb0dacba33a54c3d8bf8fe5ac07d94b76
plan14-root-reads-domains-check-country.tsv b0fc198c53bb0dacba33a54c3d8bf8fe5ac07d94b76a31b8a69e9411115ecd85
plan14-root-reads-static-stream-extract.tsv 7fb932b118e67e23b33a374c6a4020b38976667c7ec4cfb855c0f8b598b1756b
plan14-root-reads-ls284.tsv 744b16d970f22476b79982e57c326157ca5137fa96ccaee4a7ae10c25248d124
-plan14-root-reads-region-ha-p1b3b-t.tsv 97b9a4d6458f1084519729558dc144c2d53f75fc5a95a63437e4e160ca468220
+plan14-root-reads-region-ha-p1b3b-t.tsv c68e2453bfc8afaf3794eb4c08850428982fa6954269b6b99bddfda4e6242929
diff --git a/internal/provision/testdata/plan14-root-reads-region-ha-p1b3b-t.tsv b/internal/provision/testdata/plan14-root-reads-region-ha-p1b3b-t.tsv
index 31809281f..fa81e051d 100644
--- a/internal/provision/testdata/plan14-root-reads-region-ha-p1b3b-t.tsv
+++ b/internal/provision/testdata/plan14-root-reads-region-ha-p1b3b-t.tsv
@@ -1,8 +1,9 @@
# Census overlay region-ha-p1b3b-t, written by census-propose (#369). census-ruling-region-ha-p1b3b-t, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md.
-# 10 body, 6 sites, 17 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
-# 93 new dispositions: 4 reads re-frozen at their disposition with the claim, 88 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 1 other.
+# 11 body, 6 sites, 17 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 94 new dispositions: 4 reads re-frozen at their disposition with the claim, 89 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 1 other.
@legacy 76aeefcc3063f48d5e854bd81482a114455b6182ba9544399042a8cb07dbb79a internal/activator/activator.go Service.begin legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body; the stop now carries its reason for a run it interrupts (beginStopLocked's why argument); read sites unchanged, offsets moved;rev3=census-ruling-edge-request-records;basis=gains a req *http.Request parameter and one edge.MarkWoke(req) call on the path that starts a wake, so the edge's request record can say which request woke the app; no read added;rev3=census-ruling-remote-instance-metrics;basis=the entries-map insertion goes through putEntryLocked (which also notes the route's tenant in memory for the metrics sampler); no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: before an entry is made, a resident inside its backoff answers errResidentBackoff, and a rootfs row must pass the locked admission (rootfsRefusalLocked) and then the backend's rootfs gates off a.mu (rootfsStartRefusal, within the request's wait bound) before Acquire, Restore or the live link; the gate key is recorded on the entry; adds refusals before the lease only;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Read serving lease health through servingError: stateless generations use local lifecycle/process supervision, while stateful generations keep the existing lease checks. No new I/O.;rev3=census-ruling-region-ha-p1b3b-t;basis=Carry background-duty provenance into a new singleflight entry; a visitor waiting on its deferred refusal retries with ordinary visitor authority. No read added. registry:Host@1146,registry:Host@1457,registry:Host@3513,registry:Host@3670,registry:Host@562,whole:Route@2011,whole:Route@2098,whole:Route@2179,whole:Route@2440,whole:Route@2550,whole:Route@2724,whole:Route@3522,whole:Route@3529 6dfb9ff708ed5fc62b5184ff03fb2df8e1e9fe5d84244b4c9979f3c27f3d7168
@legacy ee74269fe59778aca77cdc1c5ccca3fb0cb3322a7e8de49686c4966a86388d6c internal/activator/activator.go Service.sweepOnce legacy accepted-legacy accepted-legacy;rev3=PROPOSED-seed;basis=census-ruling-FS-R6; registry remains legacy; PROPOSED-plans-2-box-limits: the sweep also narrows an entry's idle window to its account's plan idle through the SetIdleFor hook (never lengthens it; always-on workers and held probe entries are untouched; the hibernate, inflight and held-for-tick guards are unchanged).;rev3=census-ruling-plans-4c-box-throttle;basis=after the worker max_run branch, stops a non-worker entry past the plans continuous-awake ceiling (maxRunFor, passed the row), busy or not, never mid-command (plans 4c). One more whole-row read: the row handed to the hook, as idleFor already is. This bypasses the inflight and held-for-tick protections the idle stop keeps, on purpose: escalated by Astra and ACCEPTED by Paul (census owner), 2026-10-25.;rev3=census-ruling-plans-4d-lapse;basis=stops a live entry the turned-off hook names (never mid-command, never a move's active probe), stands down an exited worker it names instead of restarting it (Astra finding 4), and skips such rows in the due loop and the always-on arm so they are not woken (plans 4d). Four more whole-row reads: the row handed to the hook (a.disabled), as idleFor and maxRunFor already are. Only stops or skips.;rev3=census-ruling-remote-instance-metrics;basis=its two entries-map insertions go through putEntryLocked (which also notes the route's tenant in memory for the metrics sampler); no read added;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more call at the top, a.retryOwedMarkers() (harelease.go), which starts at most one background lease.RetryPending pass over owed region HA release markers, off a.mu; the due query, idle, max-run and lapse logic are unchanged; the same 38 sites, no read added; merge of origin/main d7ae1d76: main's change is kept as main has it (census-ruling-remote-instance-metrics: its two entries-map insertions go through putEntryLocked); this branch's change is the same as above; read sites the same 38, offsets moved;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 8: a resident (Route.Resident) is never stopped for idleness or by the continuous-awake ceiling; the due-wake check is left on Hibernate (comment); stops less, not more;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: an entry whose host has a release record open (the in-memory a.releaseOps[e.host]) is not stopped by its plan's turn-off, by idleness or by the continuous-awake ceiling until the record goes; one more sweep pass, reapReleaseOpsLocked, retries an unproven release's stop (through finishPendingStops); the same 39 read sites, no read added; stops less, not more;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 9 (PF-18): the four checks that left an entry with a run attached alone (e.cmd == nil) now read holdsAttachedLocked(e), a run or a session attached, so a session holds the idle sleep, the plans awake ceiling, the plans turned-off stop and the turned-off worker's stand-down as a run does; in-memory under a.mu; only keeps an entry awake longer; no read added, read sites unchanged;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Read serving lease health through servingError: stateless generations use local lifecycle/process supervision, while stateful generations keep the existing lease checks. No new I/O.;rev3=census-ruling-region-ha-p1b3b-t;basis=Tag due entries as background duties; the wake evaluates the gate off a.mu before acquire or token preparation. No read added. registry:Hibernate@10805,registry:Hibernate@14563,registry:Hibernate@23821,registry:Hibernate@5680,registry:Hibernate@7879,registry:Host@23890,registry:Host@23948,registry:Host@24415,registry:Host@24508,registry:Host@25260,registry:Host@25361,registry:Host@26425,registry:Host@26712,registry:Host@26768,registry:NextDue@25198,registry:Status@23837,whole:Route@10807,whole:Route@11666,whole:Route@14565,whole:Route@16498,whole:Route@18208,whole:Route@18398,whole:Route@18691,whole:Route@18863,whole:Route@19010,whole:Route@23221,whole:Route@23997,whole:Route@24912,whole:Route@25269,whole:Route@25276,whole:Route@26240,whole:Route@26541,whole:Route@26745,whole:Route@5491,whole:Route@5682,whole:Route@7712,whole:Route@7881,whole:Route@8074,whole:Route@8537 bb62b361b6dff7e47fa68665994a5b73860a499107a67c32af002c608bc936fd
+@legacy 347ba2c8e28c0fba07c5e8b3943bc7b06d6f8637adde611c76c445880d0790ce internal/activator/hawake.go ExecBackend.restoreFilesClean legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: restores the HA host's published files into a fresh <host>.restore directory beneath the instance data dir (instancefs, no link followed), renames it into place without replacing anything, writes the manifest's env item as <host>.env (instancefs.WriteAtomic, 0600) and imports the manifest's wake state into the registry (hostfiles.ImportWake, then the class for restoredReplication); the source is the host's files manifest in the hibernate bucket, written by the agents of the boxes that held the host; every failure fails the wake; +registry:Host, +whole:Route x2;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3 (fix round 1: sealed precedence before any fetch): the restore into <host>.restore is now RestoreRootBaselineShadowed with sealedShadow(host), a pure function of the manifest already read and validated: a live raw instance.key or report.token entry whose sealed item the manifest holds is neither fetched nor written (so a missing or corrupt raw object cannot fail the wake, and a sealed item that does not open fails it with no raw fallback); every other entry is restored as before, and the baseline the wake's publisher continues from is the manifest as read. Then each sealed trio item the manifest holds (instance.key.sealed, report.token.sealed) is fetched and opened with hostfiles.ReadSealed (key, sha256, v2 envelope, binding and MAC checked) and written with instancefs.WriteAtomic (openat2 directory, no symlink, O_EXCL temp, rename, 0600) into the restore directory this function created, then that directory is synced; then the same no-replace rename. The env file comes from the sealed env item through ReadSealed when present, else from the raw env item as before, written as before. The source is still the host's files manifest in the hibernate bucket; the destinations are the same restore directory and env file; no new path is opened, followed or named from input; the sealer (sealerFor) is built only when a sealed item is present. Durability 3a Task 5: after RestoreRootBaselineShadowed, noteRawSecrets(host, rm) on the manifest just restored from. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. Read sites unchanged. Durability 3a Task 5 fix round 1: the restore is RestoreRootBaselineObserved (the same read and restore as RestoreRootBaselineShadowed) with a checked callback, noteRawSecrets(host, m), run once the manifest is read and validated and before any entry is removed, fetched or written, so a restore that then fails still shows the detector the manifest; the later noteRawSecrets call is gone. No request, open or write added; read sites unchanged.;rev3=census-ruling-region-ha-p1b3b-t;basis=Final fix P3-1: select the HA ordinary-wake importer after the same acquired-lease manifest restore. It alone permits generation of legacy non-claim timer registrations; claim-owned empty registrations remain refused. All file, key and manifest reads are unchanged. registry:Host@97,whole:Route@1086,whole:Route@1586,whole:Route@200 ab610659651abbdec808ec92d816645009d438f8318e985b2491786f54bf828f
@legacy ebed63ce52f359e7554f0fa5c285656548b89ff2aa30032636c28ec98d37fe65 internal/edge/wakeplacement.go homeMap.wakeSnapshot legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3a;basis=Project cold-wake candidates from one immutable cached edges fold using the local route's canonical host, release.RouteAccount and app. Reads only in-memory route fields, cached publication additions and mirrored signing keys; no filesystem, registry, store or root authority added. Reject malformed placement evidence independently of the unchanged holder decoder; preserve explicit local safety denials even when stale.;rev3=census-ruling-region-ha-home-placement;basis=none: accepts the omitted/empty home placement, refuses explicit null; same in-memory fold reads, no new read;rev3=census-ruling-region-ha-p1b3b-t;basis=Expose fresh compatible peer membership separately from per-host eligible serving entries for suppression invalidation. Existing home/pool/scope filtering remains; no new reads. registry:App@2370,registry:Host@1412,whole:Route@1443 35b52d47574c903f65776ba3c476ab38457c93caf027279263774e084023c03d
@legacy 0813afc53e16b9b2f678e5bfe154ac4c1c2731876b6b8d31780444638352df45 internal/host/metrics_loop.go sampler.tick legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-remote-instance-metrics;basis=calls the owners probe before and after the unit read and tags readings with metrics.TagUnits and metrics.CarryTags; no read added;rev3=census-ruling-remote-metrics-nested;basis=clears the tenant tag of a reading marked leftover (a nested unit present at agent start) before CarryTags, and takes no CPU delta when a nested reading's set of cgroups changed since the previous tick; no read added;rev3=census-ruling-region-ha-p1b3b-t;basis=B5: Add one optional aggregate departure sample to the existing buffered sample; no per-host labels or separate writer. file:ReadBytes@1093 c0e169d758f7c7667d4dab97c107b5a4df103d37c80664541537f1271de0f212
@legacy 9b219c8225b21f0a817d1cc9445fc2e4e2ef6a9a8775023ba4b8aefd6e2ac151 internal/host/schedule_wiring.go newScheduleDeps legacy accepted-legacy accepted-legacy;rev3=census-ruling-moves-offline-fixes;basis=root-route (J1, main's disposition); the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), from armSchedule: main's body with the runner's Skip set to scheduleSkip; no new read site;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Runner.WithDuty before token access through the existing Service. No new read. registry:App@1535,registry:App@388,registry:Host@1602,registry:Host@396,whole:Route@1530,whole:Route@383 2ff029a7052cfa470acdcac13e011f4f34174410d670554f5846b75b6952fb1b
@@ -50,6 +51,7 @@
@legacy c618b2f7046ff9dac738a764e91965166fae639740265c4eae6c1e894282516c internal/host/hadepartures_wiring.go armHADepartures legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B3 fix r1: Install proof adapter, adoption identity and suspicion callbacks before asynchronous startup. Lazily retry the same deployment/data clients; lifetime callback reads only the current host through ExecBackend.TerminationLifetime. Add bounded structured paging for unresolved per-iid records. No new bucket, tenant input path or acquire bypass. B4: Wire the shared lock reader and existing AdoptHost entry. Read local route, Pair and duty revision only after authoritative inventory eligibility; bind its record lifetime and refuse missing/mismatched local routes. No route synthesis or pool widening. B5: Publish the armed controller to the existing metrics sampler. No new loop, remote source or process authority. registry:Account@3494,registry:Account@7057,registry:App@7084,registry:IID@3515,registry:Incarnation@7244,registry:Pool@7103,registry:Region@3505,registry:Region@7124,registry:Revision@7479,registry:Revision@7876,registry:ServingSeq@7272,whole:DutyState@7598,whole:Pair@7461,whole:Pair@7854,whole:Pair@7860,whole:Route@7044,whole:Route@7753 274399080d57f2461d4ffc9e9bee0c3346131e9c938a0463df817f9960f8b3d4
@legacy e154d74a30627fba72d2c1f0dd79786d939df5bb9d54a7866d799ec855d90465 internal/host/runs.go runsWorker.dutyStillOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route HA/host and existing service classification; after sink construction require an HA route still held awake locally before RunPick. Refusal only. registry:HA@309,registry:Host@287,whole:Route@237 d7b9c563b32e042e798ffbd98633be9a8eb13eaa68b574693be5937b1cd95ded
@legacy 32bf4eac2498036ddb8b662a319b1ea1af72c75509b3c62ae283614b635abdc4 internal/host/runs.go runsWorker.pickupOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Gate pickup and detached exec. When the detached gate refuses before exec, finish with the existing RefusedIncarnation result, close the picked sink and forget the active handle. Existing guarded sink Finish and cleanup paths are reused; no new input or path read. whole:Route@1180,whole:Route@1946,whole:Route@2020,whole:Route@2288,whole:Route@956 8e426a60b8e738d2dec98df9788d37bcaecbc9726c745e22a39e17ddd9abfdee
+@legacy 98166962a1b44a4259ce2794a56fd2cc29683486f7bf9ecfcfcdf12e77859f7e internal/hostfiles/wake.go ImportHAOrdinaryWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Final fix P3-1: use existing wire validation and atomic registry replacement with legacy registration generation enabled only for ordinary HA restore. The registry still refuses an empty registration on claim-owned routes. No new path or authority. registry:FillLegacyRegistration@157,whole:HAWakeImport@247 75af497e0bc888d5c0b71cd0db293d4eb71f38110eaf04c9f0f97c019a9b1d28
@legacy 2631277f66e8a62ef010f25c2373081a1b660891dac60b7500bef99b9dbe6f93 internal/hostfiles/wake.go RegistryWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Convert wire timers into registry rows, checking wake version/host and shared timer grammar before effects; no I/O. B2 fix r1: adoption keeps strict validation after shared wire conversion; no I/O added. whole:HAWakeImport@142,whole:HAWakeImport@164,whole:HAWakeImport@201 4846985dc07c4bb0a2668caf66abbef5e7677b90ce6d689e60ea0612bce3b51b
@legacy 5fd4614c38f99b82e9b24c77dece8efc8d2dc5907901bd6d446e77e8c544162d internal/hostfiles/wake.go registryWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B2 fix r1: shared pure wire conversion validates version, host and replication, wraps ErrHAWake with host and failing field, and preserves all timer fields. No path or I/O added. registry:Timers@645,registry:Timers@667,whole:HAWakeImport@948,whole:Timer@651,whole:Timer@673 e7458b1b2b9841f19eefc4b3edbd711a793d5338441e46728b74f042263c8ec2
@legacy c7118b565b19f61a8fd33b04eb9891e12aee4b9ce3d8767a47fbdd37071fc39b internal/registry/ha_departures.go Registry.CompareHAAdoption legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read local duty revision, lifetime/Pair, binding and exact receipt phase before a transactional legal phase transition; adopted basis is written only by the central finalizer after verified marker readback. B2 fix r1: require the caller receipt Binding as well as the current live binding, Pair, revision and phase. An old receipt cannot finalize a fresh binding even with identical lock fields. B5: Extract the identical phase/generation predicate into ValidHAAdoptionTransition for simulation reuse. Transactional Pair/revision/binding guards unchanged. registry:AcquiredGeneration@1287,registry:Binding@1404,registry:Changed@336,registry:Incarnation@822,registry:Lifetime@1341,registry:Lifetime@794,registry:LockETag@1374,registry:LockGeneration@1386,registry:Phase@1278,registry:Phase@1544,registry:Receipt@1353,registry:Sequence@1323,registry:ServingSeq@840,registry:WakeDigest@1309,registry:remote@150,registry:remote@182,whole:HAAdoption@308,whole:HAAdoption@318,whole:HAAdoption@402,whole:Pair@256,whole:Pair@262,whole:remoteClient@152,whole:remoteClient@184 057640520a5ca16f7cbe65a29868744ff390d06ec91ce0c768a101babb4bba85
@@ -59,7 +61,7 @@
@legacy 906f5b518039168721c979d82c348362dbf97fb5a4fda32fa3a571389c308a23 internal/registry/ha_departures.go Registry.migrateHAAdoptions legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Create the host-receipt table in the existing registry connection; no new path, external object, queue or termination evidence. B2 fix r1: transactionally migrate the existing receipt table to a binding-inclusive primary key, copying all existing rows and phases. Read SQLite table metadata for idempotence; no external path read. file:QueryRowContext@723 12ca2f6802c46bda86c24b63879555ec340622c52f9a6db0fdb6de3778c32119
@legacy b7d8fb8b581ccc57a73837b3565ad9caab1a3ea86ab35b785a5d52d2d37cc455 internal/registry/ha_departures.go ValidHAAdoptionTransition legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B5: Pure extracted phase and generation guard, identical to the prior inline expression. Reads only the supplied adoption fields. registry:AcquiredGeneration@77,registry:LockGeneration@100,registry:Phase@122,registry:Phase@283,registry:Phase@339,registry:Phase@400 38b021a2c772c97dca23e8ac1e16e23c375b81dc801c568745b093fe7e7f305b
@legacy 6a6f49f51870b1161e9804866552fc19f11f2235e494f64c4c93af473bab518b internal/registry/ha_departures.go ValidateHAWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read supplied timer/wake fields for name, path, duplicate, kind/spec and replication validation. Reuse the extracted scheduling grammar; no I/O. B2 fix r1: preserve strict adoption validation and report host and the specific failing timer/wake field. Additional field reads format diagnostics only; no I/O. registry:Attempts@1268,registry:Attempts@1334,registry:ClaimOwnership@915,registry:ClaimOwnership@998,registry:DueAt@1107,registry:DueAt@1168,registry:Host@398,registry:Host@460,registry:Kind@844,registry:Kind@898,registry:LastAt@1186,registry:LastAt@1249,registry:Name@379,registry:Name@502,registry:Name@518,registry:Name@573,registry:Name@592,registry:NextAt@1025,registry:NextAt@1088,registry:NextDue@125,registry:NextDue@183,registry:Path@1382,registry:Path@1413,registry:Path@1449,registry:Path@1483,registry:Path@1520,registry:Path@1637,registry:Path@1766,registry:Registration@612,registry:Registration@688,registry:Replication@219,registry:Replication@281,registry:Spec@743,registry:Spec@814,registry:Timers@345,whole:ClaimOwnership@1000,whole:ClaimOwnership@917,whole:Timer@347 c6efec0ab69c79e32cb63cd1601440ee96d60cfeecb3b2f6e2dd14b224bcb887
-@legacy 1d66611402913ae979c7b0f815907824f484a617de324872d1131c702dd37073 internal/registry/ha_departures.go replaceHAWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Query current route and optional lifetime/Pair under one SQLite transaction; replace timers, next_due and replication together. Preserve existing claim ownership when enabled; never resolve an external path. B2 fix r1: synthesize a cryptographically random registration for an empty legacy registration inside the existing atomic replacement. rand.Read is OS entropy, not a tenant-named file. Nonempty registrations and claim attribution remain unchanged. file:QueryRowContext@154,file:QueryRowContext@545,file:Read@914,registry:Attempts@1355,registry:ClaimIncarnation@1405,registry:ClaimOwner@1439,registry:ClaimOwnership@1052,registry:ClaimOwnership@1083,registry:ClaimOwnership@1102,registry:ClaimRowID@1123,registry:ClaimRowID@1453,registry:ClaimStamp@1425,registry:CreatedAt@1367,registry:DueAt@1380,registry:ExpectedPair@103,registry:ExpectedPair@355,registry:ExpectedPair@383,registry:Incarnation@355,registry:Kind@1287,registry:Kind@667,registry:LastAt@1321,registry:LastMs@1345,registry:LastStatus@1331,registry:Lifetime@410,registry:Name@1279,registry:NextAt@1311,registry:NextDue@1613,registry:Path@1303,registry:Registration@1138,registry:Registration@1389,registry:Registration@856,registry:Registration@968,registry:Replication@1624,registry:ServingSeq@383,registry:Spec@1295,registry:Timers@840,whole:ClaimOwnership@1055,whole:ClaimOwnership@1085,whole:ClaimOwnership@1105,whole:Pair@105,whole:Pair@357,whole:Pair@385,whole:Timer@842 b22d865c0815a84b2377c8a04031f2611dff9192f96ea8928924433f2b7a186d
+@legacy c07f596f76d55bddb843ac9c0ff64861ae0c651a20f681f2dcd604d57684ec65 internal/registry/ha_departures.go replaceHAWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Query current route and optional lifetime/Pair under one SQLite transaction; replace timers, next_due and replication together. Preserve existing claim ownership when enabled; never resolve an external path. B2 fix r1: synthesize a cryptographically random registration for an empty legacy registration inside the existing atomic replacement. rand.Read is OS entropy, not a tenant-named file. Nonempty registrations and claim attribution remain unchanged. Final fix P3-1 supersedes the broad B2 fill: refuse empty registrations on claim-owned routes before generation; generate only when the HA ordinary-restore caller opts in. Generic legacy import preserves empty registrations. Same atomic transaction and ownership checks. file:QueryRowContext@154,file:QueryRowContext@545,file:Read@1063,registry:Attempts@1504,registry:ClaimIncarnation@1554,registry:ClaimOwner@1588,registry:ClaimOwnership@1201,registry:ClaimOwnership@1232,registry:ClaimOwnership@1251,registry:ClaimOwnership@912,registry:ClaimRowID@1272,registry:ClaimRowID@1602,registry:ClaimStamp@1574,registry:CreatedAt@1516,registry:DueAt@1529,registry:ExpectedPair@103,registry:ExpectedPair@355,registry:ExpectedPair@383,registry:FillLegacyRegistration@1001,registry:Incarnation@355,registry:Kind@1436,registry:Kind@667,registry:LastAt@1470,registry:LastMs@1494,registry:LastStatus@1480,registry:Lifetime@410,registry:Name@1428,registry:NextAt@1460,registry:NextDue@1762,registry:Path@1452,registry:Registration@1117,registry:Registration@1287,registry:Registration@1538,registry:Registration@856,registry:Registration@977,registry:Replication@1773,registry:ServingSeq@383,registry:Spec@1444,registry:Timers@840,whole:ClaimOwnership@1204,whole:ClaimOwnership@1234,whole:ClaimOwnership@1254,whole:ClaimOwnership@915,whole:Pair@105,whole:Pair@357,whole:Pair@385,whole:Timer@842 60707f431ee215d248c0e5dd90f5fd88f46f431c282de16601a2f18ade98792c
@legacy 03f9042a0ef2672e596c9148998b24d6d2cd5e57347c5b2b6f744d482ae10678 internal/registry/ha_duties.go Registry.AdvanceHADuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B2 fix r1: existing registry connection unconditionally increments revision for the active host before ordinary acquire, without changing lifetime, binding or authority basis. Same remote transport; no new path. registry:remote@109,registry:remote@79,registry:sql@212,whole:remoteClient@111,whole:remoteClient@81 dcae31822613834c66d24a4fbef9b0a191ca3b779493337ed9df709a7af696fa
@legacy 01a0429a74a7cb190d038d95a02e2c7f50addd5ea8d9a55cf32fc0ec48dc6443 internal/registry/ha_duties.go Registry.BindHADuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Compare active route Pair and captured revision before changing its authoritative lifetime binding; clear basis and suppression on change. registry:Changed@295,registry:Incarnation@772,registry:ServingSeq@790,registry:remote@129,registry:remote@161,registry:sql@381,whole:Pair@228,whole:Pair@234,whole:remoteClient@131,whole:remoteClient@163 462faa643bfccd5e908dd5aae913157e56047ec64197358dfeea7a889a63c594
@legacy 412982c337f81c649f8583e682c3f7c4f03740ead564f967b6e5993c2cdf86a0 internal/registry/ha_duties.go Registry.CompareDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Compare lifetime/revision/active state and persist advisory basis/suppression. Cannot create adopted basis; only preserve a basis already finalized. registry:Basis@311,registry:Basis@331,registry:Basis@363,registry:Basis@396,registry:Basis@810,registry:Basis@918,registry:Changed@287,registry:HolderEpoch@868,registry:HolderIID@838,registry:HolderRef@822,registry:NotBefore@475,registry:NotBefore@514,registry:ViewKey@854,registry:remote@124,registry:remote@156,registry:sql@576,whole:DutyState@260,whole:DutyState@266,whole:remoteClient@126,whole:remoteClient@158 91fb5e1534c512cd1702eeb2b069e829103ee780cc34310ba428ee1fa2a5f116
@@ -108,6 +110,7 @@
internal/activator/activator.go Service.begin legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body; the stop now carries its reason for a run it interrupts (beginStopLocked's why argument); read sites unchanged, offsets moved;rev3=census-ruling-edge-request-records;basis=gains a req *http.Request parameter and one edge.MarkWoke(req) call on the path that starts a wake, so the edge's request record can say which request woke the app; no read added;rev3=census-ruling-remote-instance-metrics;basis=the entries-map insertion goes through putEntryLocked (which also notes the route's tenant in memory for the metrics sampler); no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: before an entry is made, a resident inside its backoff answers errResidentBackoff, and a rootfs row must pass the locked admission (rootfsRefusalLocked) and then the backend's rootfs gates off a.mu (rootfsStartRefusal, within the request's wait bound) before Acquire, Restore or the live link; the gate key is recorded on the entry; adds refusals before the lease only;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Read serving lease health through servingError: stateless generations use local lifecycle/process supervision, while stateful generations keep the existing lease checks. No new I/O.;rev3=census-ruling-region-ha-p1b3b-t;basis=Carry background-duty provenance into a new singleflight entry; a visitor waiting on its deferred refusal retries with ordinary visitor authority. No read added. registry:Host@1146,registry:Host@1457,registry:Host@3513,registry:Host@3670,registry:Host@562,whole:Route@2011,whole:Route@2098,whole:Route@2179,whole:Route@2440,whole:Route@2550,whole:Route@2724,whole:Route@3522,whole:Route@3529 6dfb9ff708ed5fc62b5184ff03fb2df8e1e9fe5d84244b4c9979f3c27f3d7168
internal/activator/activator.go Service.sweepOnce legacy accepted-legacy accepted-legacy;rev3=PROPOSED-seed;basis=census-ruling-FS-R6; registry remains legacy; PROPOSED-plans-2-box-limits: the sweep also narrows an entry's idle window to its account's plan idle through the SetIdleFor hook (never lengthens it; always-on workers and held probe entries are untouched; the hibernate, inflight and held-for-tick guards are unchanged).;rev3=census-ruling-plans-4c-box-throttle;basis=after the worker max_run branch, stops a non-worker entry past the plans continuous-awake ceiling (maxRunFor, passed the row), busy or not, never mid-command (plans 4c). One more whole-row read: the row handed to the hook, as idleFor already is. This bypasses the inflight and held-for-tick protections the idle stop keeps, on purpose: escalated by Astra and ACCEPTED by Paul (census owner), 2026-10-25.;rev3=census-ruling-plans-4d-lapse;basis=stops a live entry the turned-off hook names (never mid-command, never a move's active probe), stands down an exited worker it names instead of restarting it (Astra finding 4), and skips such rows in the due loop and the always-on arm so they are not woken (plans 4d). Four more whole-row reads: the row handed to the hook (a.disabled), as idleFor and maxRunFor already are. Only stops or skips.;rev3=census-ruling-remote-instance-metrics;basis=its two entries-map insertions go through putEntryLocked (which also notes the route's tenant in memory for the metrics sampler); no read added;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more call at the top, a.retryOwedMarkers() (harelease.go), which starts at most one background lease.RetryPending pass over owed region HA release markers, off a.mu; the due query, idle, max-run and lapse logic are unchanged; the same 38 sites, no read added; merge of origin/main d7ae1d76: main's change is kept as main has it (census-ruling-remote-instance-metrics: its two entries-map insertions go through putEntryLocked); this branch's change is the same as above; read sites the same 38, offsets moved;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 8: a resident (Route.Resident) is never stopped for idleness or by the continuous-awake ceiling; the due-wake check is left on Hibernate (comment); stops less, not more;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: an entry whose host has a release record open (the in-memory a.releaseOps[e.host]) is not stopped by its plan's turn-off, by idleness or by the continuous-awake ceiling until the record goes; one more sweep pass, reapReleaseOpsLocked, retries an unproven release's stop (through finishPendingStops); the same 39 read sites, no read added; stops less, not more;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 9 (PF-18): the four checks that left an entry with a run attached alone (e.cmd == nil) now read holdsAttachedLocked(e), a run or a session attached, so a session holds the idle sleep, the plans awake ceiling, the plans turned-off stop and the turned-off worker's stand-down as a run does; in-memory under a.mu; only keeps an entry awake longer; no read added, read sites unchanged;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Read serving lease health through servingError: stateless generations use local lifecycle/process supervision, while stateful generations keep the existing lease checks. No new I/O.;rev3=census-ruling-region-ha-p1b3b-t;basis=Tag due entries as background duties; the wake evaluates the gate off a.mu before acquire or token preparation. No read added. registry:Hibernate@10805,registry:Hibernate@14563,registry:Hibernate@23821,registry:Hibernate@5680,registry:Hibernate@7879,registry:Host@23890,registry:Host@23948,registry:Host@24415,registry:Host@24508,registry:Host@25260,registry:Host@25361,registry:Host@26425,registry:Host@26712,registry:Host@26768,registry:NextDue@25198,registry:Status@23837,whole:Route@10807,whole:Route@11666,whole:Route@14565,whole:Route@16498,whole:Route@18208,whole:Route@18398,whole:Route@18691,whole:Route@18863,whole:Route@19010,whole:Route@23221,whole:Route@23997,whole:Route@24912,whole:Route@25269,whole:Route@25276,whole:Route@26240,whole:Route@26541,whole:Route@26745,whole:Route@5491,whole:Route@5682,whole:Route@7712,whole:Route@7881,whole:Route@8074,whole:Route@8537 bb62b361b6dff7e47fa68665994a5b73860a499107a67c32af002c608bc936fd
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. b41760c19ad7d46f4006fbd6a37ae03dd44dbf3e643ef378164d715184adeab8
+internal/activator/hawake.go ExecBackend.restoreFilesClean legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: restores the HA host's published files into a fresh <host>.restore directory beneath the instance data dir (instancefs, no link followed), renames it into place without replacing anything, writes the manifest's env item as <host>.env (instancefs.WriteAtomic, 0600) and imports the manifest's wake state into the registry (hostfiles.ImportWake, then the class for restoredReplication); the source is the host's files manifest in the hibernate bucket, written by the agents of the boxes that held the host; every failure fails the wake; +registry:Host, +whole:Route x2;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3 (fix round 1: sealed precedence before any fetch): the restore into <host>.restore is now RestoreRootBaselineShadowed with sealedShadow(host), a pure function of the manifest already read and validated: a live raw instance.key or report.token entry whose sealed item the manifest holds is neither fetched nor written (so a missing or corrupt raw object cannot fail the wake, and a sealed item that does not open fails it with no raw fallback); every other entry is restored as before, and the baseline the wake's publisher continues from is the manifest as read. Then each sealed trio item the manifest holds (instance.key.sealed, report.token.sealed) is fetched and opened with hostfiles.ReadSealed (key, sha256, v2 envelope, binding and MAC checked) and written with instancefs.WriteAtomic (openat2 directory, no symlink, O_EXCL temp, rename, 0600) into the restore directory this function created, then that directory is synced; then the same no-replace rename. The env file comes from the sealed env item through ReadSealed when present, else from the raw env item as before, written as before. The source is still the host's files manifest in the hibernate bucket; the destinations are the same restore directory and env file; no new path is opened, followed or named from input; the sealer (sealerFor) is built only when a sealed item is present. Durability 3a Task 5: after RestoreRootBaselineShadowed, noteRawSecrets(host, rm) on the manifest just restored from. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. Read sites unchanged. Durability 3a Task 5 fix round 1: the restore is RestoreRootBaselineObserved (the same read and restore as RestoreRootBaselineShadowed) with a checked callback, noteRawSecrets(host, m), run once the manifest is read and validated and before any entry is removed, fetched or written, so a restore that then fails still shows the detector the manifest; the later noteRawSecrets call is gone. No request, open or write added; read sites unchanged.;rev3=census-ruling-region-ha-p1b3b-t;basis=Final fix P3-1: select the HA ordinary-wake importer after the same acquired-lease manifest restore. It alone permits generation of legacy non-claim timer registrations; claim-owned empty registrations remain refused. All file, key and manifest reads are unchanged. registry:Host@97,whole:Route@1086,whole:Route@1586,whole:Route@200 ab610659651abbdec808ec92d816645009d438f8318e985b2491786f54bf828f
internal/edge/wakeplacement.go homeMap.wakeSnapshot legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3a;basis=Project cold-wake candidates from one immutable cached edges fold using the local route's canonical host, release.RouteAccount and app. Reads only in-memory route fields, cached publication additions and mirrored signing keys; no filesystem, registry, store or root authority added. Reject malformed placement evidence independently of the unchanged holder decoder; preserve explicit local safety denials even when stale.;rev3=census-ruling-region-ha-home-placement;basis=none: accepts the omitted/empty home placement, refuses explicit null; same in-memory fold reads, no new read;rev3=census-ruling-region-ha-p1b3b-t;basis=Expose fresh compatible peer membership separately from per-host eligible serving entries for suppression invalidation. Existing home/pool/scope filtering remains; no new reads. registry:App@2370,registry:Host@1412,whole:Route@1443 35b52d47574c903f65776ba3c476ab38457c93caf027279263774e084023c03d
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. file:Exec@17788,file:Open@1150,file:Statfs@46382,registry:App@11543,whole:Route@11535,whole:Route@29818 ba9f9a14d31e4b36fe865d1d367e39b79b190b0c872d9517668bb230e51a9c7d
internal/host/metrics_loop.go sampler.tick legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-remote-instance-metrics;basis=calls the owners probe before and after the unit read and tags readings with metrics.TagUnits and metrics.CarryTags; no read added;rev3=census-ruling-remote-metrics-nested;basis=clears the tenant tag of a reading marked leftover (a nested unit present at agent start) before CarryTags, and takes no CPU delta when a nested reading's set of cgroups changed since the previous tick; no read added;rev3=census-ruling-region-ha-p1b3b-t;basis=B5: Add one optional aggregate departure sample to the existing buffered sample; no per-host labels or separate writer. file:ReadBytes@1093 c0e169d758f7c7667d4dab97c107b5a4df103d37c80664541537f1271de0f212
@@ -156,6 +159,7 @@ internal/host/hadepartures_scan.go Controller.retryScan legacy accepted-legacy a
internal/host/hadepartures_wiring.go armHADepartures legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B3 fix r1: Install proof adapter, adoption identity and suspicion callbacks before asynchronous startup. Lazily retry the same deployment/data clients; lifetime callback reads only the current host through ExecBackend.TerminationLifetime. Add bounded structured paging for unresolved per-iid records. No new bucket, tenant input path or acquire bypass. B4: Wire the shared lock reader and existing AdoptHost entry. Read local route, Pair and duty revision only after authoritative inventory eligibility; bind its record lifetime and refuse missing/mismatched local routes. No route synthesis or pool widening. B5: Publish the armed controller to the existing metrics sampler. No new loop, remote source or process authority. registry:Account@3494,registry:Account@7057,registry:App@7084,registry:IID@3515,registry:Incarnation@7244,registry:Pool@7103,registry:Region@3505,registry:Region@7124,registry:Revision@7479,registry:Revision@7876,registry:ServingSeq@7272,whole:DutyState@7598,whole:Pair@7461,whole:Pair@7854,whole:Pair@7860,whole:Route@7044,whole:Route@7753 274399080d57f2461d4ffc9e9bee0c3346131e9c938a0463df817f9960f8b3d4
internal/host/runs.go runsWorker.dutyStillOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route HA/host and existing service classification; after sink construction require an HA route still held awake locally before RunPick. Refusal only. registry:HA@309,registry:Host@287,whole:Route@237 d7b9c563b32e042e798ffbd98633be9a8eb13eaa68b574693be5937b1cd95ded
internal/host/runs.go runsWorker.pickupOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Gate pickup and detached exec. When the detached gate refuses before exec, finish with the existing RefusedIncarnation result, close the picked sink and forget the active handle. Existing guarded sink Finish and cleanup paths are reused; no new input or path read. whole:Route@1180,whole:Route@1946,whole:Route@2020,whole:Route@2288,whole:Route@956 8e426a60b8e738d2dec98df9788d37bcaecbc9726c745e22a39e17ddd9abfdee
+internal/hostfiles/wake.go ImportHAOrdinaryWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Final fix P3-1: use existing wire validation and atomic registry replacement with legacy registration generation enabled only for ordinary HA restore. The registry still refuses an empty registration on claim-owned routes. No new path or authority. registry:FillLegacyRegistration@157,whole:HAWakeImport@247 75af497e0bc888d5c0b71cd0db293d4eb71f38110eaf04c9f0f97c019a9b1d28
internal/hostfiles/wake.go RegistryWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Convert wire timers into registry rows, checking wake version/host and shared timer grammar before effects; no I/O. B2 fix r1: adoption keeps strict validation after shared wire conversion; no I/O added. whole:HAWakeImport@142,whole:HAWakeImport@164,whole:HAWakeImport@201 4846985dc07c4bb0a2668caf66abbef5e7677b90ce6d689e60ea0612bce3b51b
internal/hostfiles/wake.go registryWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B2 fix r1: shared pure wire conversion validates version, host and replication, wraps ErrHAWake with host and failing field, and preserves all timer fields. No path or I/O added. registry:Timers@645,registry:Timers@667,whole:HAWakeImport@948,whole:Timer@651,whole:Timer@673 e7458b1b2b9841f19eefc4b3edbd711a793d5338441e46728b74f042263c8ec2
internal/registry/ha_departures.go Registry.CompareHAAdoption legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read local duty revision, lifetime/Pair, binding and exact receipt phase before a transactional legal phase transition; adopted basis is written only by the central finalizer after verified marker readback. B2 fix r1: require the caller receipt Binding as well as the current live binding, Pair, revision and phase. An old receipt cannot finalize a fresh binding even with identical lock fields. B5: Extract the identical phase/generation predicate into ValidHAAdoptionTransition for simulation reuse. Transactional Pair/revision/binding guards unchanged. registry:AcquiredGeneration@1287,registry:Binding@1404,registry:Changed@336,registry:Incarnation@822,registry:Lifetime@1341,registry:Lifetime@794,registry:LockETag@1374,registry:LockGeneration@1386,registry:Phase@1278,registry:Phase@1544,registry:Receipt@1353,registry:Sequence@1323,registry:ServingSeq@840,registry:WakeDigest@1309,registry:remote@150,registry:remote@182,whole:HAAdoption@308,whole:HAAdoption@318,whole:HAAdoption@402,whole:Pair@256,whole:Pair@262,whole:remoteClient@152,whole:remoteClient@184 057640520a5ca16f7cbe65a29868744ff390d06ec91ce0c768a101babb4bba85
@@ -165,7 +169,7 @@ internal/registry/ha_departures.go Registry.ReplaceHAWake legacy accepted-legacy
internal/registry/ha_departures.go Registry.migrateHAAdoptions legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Create the host-receipt table in the existing registry connection; no new path, external object, queue or termination evidence. B2 fix r1: transactionally migrate the existing receipt table to a binding-inclusive primary key, copying all existing rows and phases. Read SQLite table metadata for idempotence; no external path read. file:QueryRowContext@723 12ca2f6802c46bda86c24b63879555ec340622c52f9a6db0fdb6de3778c32119
internal/registry/ha_departures.go ValidHAAdoptionTransition legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B5: Pure extracted phase and generation guard, identical to the prior inline expression. Reads only the supplied adoption fields. registry:AcquiredGeneration@77,registry:LockGeneration@100,registry:Phase@122,registry:Phase@283,registry:Phase@339,registry:Phase@400 38b021a2c772c97dca23e8ac1e16e23c375b81dc801c568745b093fe7e7f305b
internal/registry/ha_departures.go ValidateHAWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read supplied timer/wake fields for name, path, duplicate, kind/spec and replication validation. Reuse the extracted scheduling grammar; no I/O. B2 fix r1: preserve strict adoption validation and report host and the specific failing timer/wake field. Additional field reads format diagnostics only; no I/O. registry:Attempts@1268,registry:Attempts@1334,registry:ClaimOwnership@915,registry:ClaimOwnership@998,registry:DueAt@1107,registry:DueAt@1168,registry:Host@398,registry:Host@460,registry:Kind@844,registry:Kind@898,registry:LastAt@1186,registry:LastAt@1249,registry:Name@379,registry:Name@502,registry:Name@518,registry:Name@573,registry:Name@592,registry:NextAt@1025,registry:NextAt@1088,registry:NextDue@125,registry:NextDue@183,registry:Path@1382,registry:Path@1413,registry:Path@1449,registry:Path@1483,registry:Path@1520,registry:Path@1637,registry:Path@1766,registry:Registration@612,registry:Registration@688,registry:Replication@219,registry:Replication@281,registry:Spec@743,registry:Spec@814,registry:Timers@345,whole:ClaimOwnership@1000,whole:ClaimOwnership@917,whole:Timer@347 c6efec0ab69c79e32cb63cd1601440ee96d60cfeecb3b2f6e2dd14b224bcb887
-internal/registry/ha_departures.go replaceHAWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Query current route and optional lifetime/Pair under one SQLite transaction; replace timers, next_due and replication together. Preserve existing claim ownership when enabled; never resolve an external path. B2 fix r1: synthesize a cryptographically random registration for an empty legacy registration inside the existing atomic replacement. rand.Read is OS entropy, not a tenant-named file. Nonempty registrations and claim attribution remain unchanged. file:QueryRowContext@154,file:QueryRowContext@545,file:Read@914,registry:Attempts@1355,registry:ClaimIncarnation@1405,registry:ClaimOwner@1439,registry:ClaimOwnership@1052,registry:ClaimOwnership@1083,registry:ClaimOwnership@1102,registry:ClaimRowID@1123,registry:ClaimRowID@1453,registry:ClaimStamp@1425,registry:CreatedAt@1367,registry:DueAt@1380,registry:ExpectedPair@103,registry:ExpectedPair@355,registry:ExpectedPair@383,registry:Incarnation@355,registry:Kind@1287,registry:Kind@667,registry:LastAt@1321,registry:LastMs@1345,registry:LastStatus@1331,registry:Lifetime@410,registry:Name@1279,registry:NextAt@1311,registry:NextDue@1613,registry:Path@1303,registry:Registration@1138,registry:Registration@1389,registry:Registration@856,registry:Registration@968,registry:Replication@1624,registry:ServingSeq@383,registry:Spec@1295,registry:Timers@840,whole:ClaimOwnership@1055,whole:ClaimOwnership@1085,whole:ClaimOwnership@1105,whole:Pair@105,whole:Pair@357,whole:Pair@385,whole:Timer@842 b22d865c0815a84b2377c8a04031f2611dff9192f96ea8928924433f2b7a186d
+internal/registry/ha_departures.go replaceHAWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Query current route and optional lifetime/Pair under one SQLite transaction; replace timers, next_due and replication together. Preserve existing claim ownership when enabled; never resolve an external path. B2 fix r1: synthesize a cryptographically random registration for an empty legacy registration inside the existing atomic replacement. rand.Read is OS entropy, not a tenant-named file. Nonempty registrations and claim attribution remain unchanged. Final fix P3-1 supersedes the broad B2 fill: refuse empty registrations on claim-owned routes before generation; generate only when the HA ordinary-restore caller opts in. Generic legacy import preserves empty registrations. Same atomic transaction and ownership checks. file:QueryRowContext@154,file:QueryRowContext@545,file:Read@1063,registry:Attempts@1504,registry:ClaimIncarnation@1554,registry:ClaimOwner@1588,registry:ClaimOwnership@1201,registry:ClaimOwnership@1232,registry:ClaimOwnership@1251,registry:ClaimOwnership@912,registry:ClaimRowID@1272,registry:ClaimRowID@1602,registry:ClaimStamp@1574,registry:CreatedAt@1516,registry:DueAt@1529,registry:ExpectedPair@103,registry:ExpectedPair@355,registry:ExpectedPair@383,registry:FillLegacyRegistration@1001,registry:Incarnation@355,registry:Kind@1436,registry:Kind@667,registry:LastAt@1470,registry:LastMs@1494,registry:LastStatus@1480,registry:Lifetime@410,registry:Name@1428,registry:NextAt@1460,registry:NextDue@1762,registry:Path@1452,registry:Registration@1117,registry:Registration@1287,registry:Registration@1538,registry:Registration@856,registry:Registration@977,registry:Replication@1773,registry:ServingSeq@383,registry:Spec@1444,registry:Timers@840,whole:ClaimOwnership@1204,whole:ClaimOwnership@1234,whole:ClaimOwnership@1254,whole:ClaimOwnership@915,whole:Pair@105,whole:Pair@357,whole:Pair@385,whole:Timer@842 60707f431ee215d248c0e5dd90f5fd88f46f431c282de16601a2f18ade98792c
internal/registry/ha_duties.go Registry.AdvanceHADuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=B2 fix r1: existing registry connection unconditionally increments revision for the active host before ordinary acquire, without changing lifetime, binding or authority basis. Same remote transport; no new path. registry:remote@109,registry:remote@79,registry:sql@212,whole:remoteClient@111,whole:remoteClient@81 dcae31822613834c66d24a4fbef9b0a191ca3b779493337ed9df709a7af696fa
internal/registry/ha_duties.go Registry.BindHADuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Compare active route Pair and captured revision before changing its authoritative lifetime binding; clear basis and suppression on change. registry:Changed@295,registry:Incarnation@772,registry:ServingSeq@790,registry:remote@129,registry:remote@161,registry:sql@381,whole:Pair@228,whole:Pair@234,whole:remoteClient@131,whole:remoteClient@163 462faa643bfccd5e908dd5aae913157e56047ec64197358dfeea7a889a63c594
internal/registry/ha_duties.go Registry.CompareDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Compare lifetime/revision/active state and persist advisory basis/suppression. Cannot create adopted basis; only preserve a basis already finalized. registry:Basis@311,registry:Basis@331,registry:Basis@363,registry:Basis@396,registry:Basis@810,registry:Basis@918,registry:Changed@287,registry:HolderEpoch@868,registry:HolderIID@838,registry:HolderRef@822,registry:NotBefore@475,registry:NotBefore@514,registry:ViewKey@854,registry:remote@124,registry:remote@156,registry:sql@576,whole:DutyState@260,whole:DutyState@266,whole:remoteClient@126,whole:remoteClient@158 91fb5e1534c512cd1702eeb2b069e829103ee780cc34310ba428ee1fa2a5f116
@@ -214,20 +218,20 @@ internal/activator/hawake.go ExecBackend.acquireClassified legacy accepted-legac
internal/host/schedule_wiring.go activatorDeliverer.deliverSelected legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-p1b3b-t;basis=Wrap local delivery in WithDuty so lease loss returns a deferred control result before timer bookkeeping. Add whole-route arguments; no remote forwarding. registry:Host@539,registry:Host@821,registry:Socket@185,registry:Socket@2615,registry:Socket@861,whole:Route@1741,whole:Route@1865,whole:Route@1941,whole:Route@2014,whole:Route@759 afd339dd7acde53dc86f0f55c0a83fa41845bb23825b94ac7fb11ace3330b648
internal/schedule/runner.go Runner.fire hint E2 accepted-legacy;rev3=census-ruling-moves-offline-fixes;basis=root-route (main: J1) PROPOSED E46: captured claim selection and root journal mutation; root RPC outside service host exclusion; SQL/route data never grants root authority. Executing identity: service controller; root for inventory/retirement callbacks. moves-offline-fixes: with Skip set (only the agent's runner sets it, scheduleSkip), the row is read again before the token and a skipped host gets no token and no record; class and task unchanged;rev3=census-ruling-region-ha-p1b3b-t;basis=Call WithDuty before token preparation; record non-deferred pre-delivery wake errors through the existing retry and event policy after timerStillDue. Adds spec and whole timer/route reads for record. Advance only known non-owner recurring occurrences through the existing registration/DueAt guard; no second outcome after callback execution. registry:Spec@410,registry:Spec@626,whole:Route@125,whole:Route@200,whole:Route@269,whole:Route@454,whole:Timer@129,whole:Timer@273,whole:Timer@374,whole:Timer@458,whole:Timer@589,whole:Timer@801 7e8eb8e42de11c2c7a6f21d02a424875f74809343673be4e0009624765d63ac2
@coverage . ad11fb4d8b0a34d0b0e4bd317d522459960e8505e94553fcdcffaa65c425f3d8
-@coverage internal/activator 10ebf6ce24d96d797c3b512e8dcf59c99d89516a9588cfa23cd8f5b16d6b9426
+@coverage internal/activator 753cb3de4134530bfe8070343bd2be71d6f4fcd9f2ad389b60b75474b4687651
@coverage internal/awsterminations 61f7e5a5f85d4eed6b855f7b9f3061c72ee0c23b871745d4ab0c75fd16f7c20d
@coverage internal/boxchoice 6b3d6aaacf54a2c2705f5c93d7799e0d9790712e165c90ead6de91e845ae8b09
@coverage internal/edge 4c522d8c7a17a7508be62e248126a9f66978dd09bdb096678dacf9c9bdffb1a2
@coverage internal/hadeparture 96414c792279b1616004f4d5a3ec00b5eb9f7da3a71888c5a70f85f6649ab0e4
@coverage internal/host fb3d5907fa60faaf9d54d591ce025a1b62200ee235209e2deb858cf26334a42f
@coverage internal/hostenv d5e9735d49727a6e7ab2b0e1886dae1c170d4033dc46cb314ab9569a7a964587
-@coverage internal/hostfiles 21a32d89c6143031af13cb18bc1a2227353ed8595ab23bde7abd1e9d2df92eaf
+@coverage internal/hostfiles 2ef11dbdc72921c6e95cd4f78535fe99ea300c7651a90a3b6667e44fe4f4e406
@coverage internal/lease 46a3a2a7f3215d5f717bd23655bdaec7b78307f58dad0decb8a5fecbe06912f5
@coverage internal/metrics f6382028853ea94ef1f962546281cfd1d0351dd597193f73f593d70623f695d0
@coverage internal/provision ff304ed0b6c9445a18262ace1880fcbb2d536b49131a600a06257947bc2062ca
-@coverage internal/registry 5848d30ac8f296017dd4eabdcbe56f519b196174dc59bd8909c7070b39e7e708
+@coverage internal/registry 8c1ba3e828ea15974dbdf3ab7fccf1d7820662bf0b565500d1328b199bdb1dac
@coverage internal/release 5975bdbc3b3d5d631965872cb3ca20d31a9e2cfa7d91819d22ade21aa11012ec
@coverage internal/schedule 45287d297f4431ec8eaa3f515ce684d5e447f99845cfa1207e4386d4897b7f3d
@coverage internal/termfence 7c996207d2d79356e5278d5bb38b636242428abd5db91a15394699546da39645
@coverage internal/timerspec 66b07dd7c4e64c11458e56e54b0c982f1baba37ea3f0ceebd3b009d170c438d9
-@fields ?,A,Account,Accounts,AcquiredGeneration,AddedAt,Addr,Addrs,Adoption,Alias,Aliases,Alive,AllowAbsent,App,Archives,Args,AssetGen,AssetsOff,Assigned,At,Attempts,B,Backing,Basis,Binding,Blocked,Body,Bucket,BuildState,By,Callback,CallbackError,CallbackFailed,Canary,Caps,CertExpiresAt,Changed,Channel,CheckedAt,Claim,ClaimIncarnation,ClaimOwner,ClaimOwnership,ClaimRowID,ClaimStamp,Class,Code,Column,Contents,Count,CreatedAt,Cursor,DBPath,DNSCheckedAt,DNSStatus,Deadline,Default,DeleteUncertain,Demand,Departure,DepartureIID,DepartureRef,Departures,Digest,DoneBefore,DrainingSince,Due,DueAt,Duty,EdgesETag,EgressAllow,EnrolledAt,Env,EnvBefore,Environment,Error,ErrorKind,ExcludeHosts,ExpectGood,ExpectOp,ExpectPair,Expected,ExpectedPair,F,Failed,FenceGen,Field,Fleet,FleetBox,FleetBoxes,FleetLabel,Fleets,Found,From,FromDB,FromOp,FromSock,Gate,Generation,GoodDemand,GoodDigest,GoodVersion,HA,HAJournal,Hash,Health,Held,Hibernate,Hint,Hints,HoldOp,HolderEpoch,HolderIID,HolderRef,Host,Hosts,ID,IID,Id,IdValue,Identity,Idle,IdleSeconds,Import,ImportGate,Inbox,Incarnation,InventoryGeneration,Journal,Keep,Key,KeyFP,Keys,Kind,Label,LabelledAt,LastAt,LastBlocked,LastError,LastMs,LastPage,LastStatus,Lifetime,Limit,LockETag,LockGeneration,MaxRun,MaxRunSeconds,MessageID,Method,Moved,Ms,Name,Next,NextAt,NextAttempt,NextDue,NextGood,NextValue,NotBefore,Now,Number,Number64,Observation,Observed,ObservedValue,Offset,Old,Oldest,On,OnConflict,Op,Original,Owner,Ownership,P,Page,Pair,Path,Paths,PermissionAlerted,Phase,Platform,PolicyExpiresAt,Pool,Prefix,Prev,PrevVersion,ProofDigest,ProofKey,Provisioned,Pub,RDs,RateLimit,Raw,Receipt,ReceivedAt,RecordDigest,RecordKey,Ref,Region,Regional,Registration,Replica,Replicas,Replication,Rescan,Result,Retirement,RetryCount,Revision,Route,Routes,Row,Rows,Runtime,Scan,SecretsKeyFP,SecretsKeySetAt,SecretsKeySetBy,SecretsPub,Seed,SeedID,SeedSource,Sequence,ServingSeq,ServingVersion,Size,Slug,Socket,Spec,Sqid,StartedAt,State,Stateless,Status,StatusNamed,Steering,StringMap,Summary,T,TValue,Tags,Target,Targets,Text,Timer,Timers,Times,To,ToDB,ToOp,ToSock,TokenHash,Tunnel,Type,Unit,Unresolved,UpdateSettings,Ver,Version,ViewKey,W,Wake,WakeDigest,WakeIncarnation,Walk,Wildcards,closed,conn,connect,ctx,d,dec,done,enc,full,input,mu,output,path,readOnly,remote,sql,wait
+@fields ?,A,Account,Accounts,AcquiredGeneration,AddedAt,Addr,Addrs,Adoption,Alias,Aliases,Alive,AllowAbsent,App,Archives,Args,AssetGen,AssetsOff,Assigned,At,Attempts,B,Backing,Basis,Binding,Blocked,Body,Bucket,BuildState,By,Callback,CallbackError,CallbackFailed,Canary,Caps,CertExpiresAt,Changed,Channel,CheckedAt,Claim,ClaimIncarnation,ClaimOwner,ClaimOwnership,ClaimRowID,ClaimStamp,Class,Code,Column,Contents,Count,CreatedAt,Cursor,DBPath,DNSCheckedAt,DNSStatus,Deadline,Default,DeleteUncertain,Demand,Departure,DepartureIID,DepartureRef,Departures,Digest,DoneBefore,DrainingSince,Due,DueAt,Duty,EdgesETag,EgressAllow,EnrolledAt,Env,EnvBefore,Environment,Error,ErrorKind,ExcludeHosts,ExpectGood,ExpectOp,ExpectPair,Expected,ExpectedPair,F,Failed,FenceGen,Field,FillLegacyRegistration,Fleet,FleetBox,FleetBoxes,FleetLabel,Fleets,Found,From,FromDB,FromOp,FromSock,Gate,Generation,GoodDemand,GoodDigest,GoodVersion,HA,HAJournal,Hash,Health,Held,Hibernate,Hint,Hints,HoldOp,HolderEpoch,HolderIID,HolderRef,Host,Hosts,ID,IID,Id,IdValue,Identity,Idle,IdleSeconds,Import,ImportGate,Inbox,Incarnation,InventoryGeneration,Journal,Keep,Key,KeyFP,Keys,Kind,Label,LabelledAt,LastAt,LastBlocked,LastError,LastMs,LastPage,LastStatus,Lifetime,Limit,LockETag,LockGeneration,MaxRun,MaxRunSeconds,MessageID,Method,Moved,Ms,Name,Next,NextAt,NextAttempt,NextDue,NextGood,NextValue,NotBefore,Now,Number,Number64,Observation,Observed,ObservedValue,Offset,Old,Oldest,On,OnConflict,Op,Original,Owner,Ownership,P,Page,Pair,Path,Paths,PermissionAlerted,Phase,Platform,PolicyExpiresAt,Pool,Prefix,Prev,PrevVersion,ProofDigest,ProofKey,Provisioned,Pub,RDs,RateLimit,Raw,Receipt,ReceivedAt,RecordDigest,RecordKey,Ref,Region,Regional,Registration,Replica,Replicas,Replication,Rescan,Result,Retirement,RetryCount,Revision,Route,Routes,Row,Rows,Runtime,Scan,SecretsKeyFP,SecretsKeySetAt,SecretsKeySetBy,SecretsPub,Seed,SeedID,SeedSource,Sequence,ServingSeq,ServingVersion,Size,Slug,Socket,Spec,Sqid,StartedAt,State,Stateless,Status,StatusNamed,Steering,StringMap,Summary,T,TValue,Tags,Target,Targets,Text,Timer,Timers,Times,To,ToDB,ToOp,ToSock,TokenHash,Tunnel,Type,Unit,Unresolved,UpdateSettings,Ver,Version,ViewKey,W,Wake,WakeDigest,WakeIncarnation,Walk,Wildcards,closed,conn,connect,ctx,d,dec,done,enc,full,input,mu,output,path,readOnly,remote,sql,wait
diff --git a/internal/registry/ha_departures.go b/internal/registry/ha_departures.go
index 1854c1c9f..9a9879534 100644
--- a/internal/registry/ha_departures.go
+++ b/internal/registry/ha_departures.go
@@ -22,6 +22,7 @@ type HAWakeImport struct {
DepartureRef, DepartureIID string
ExpectedPair *Pair
Timers []Timer
+ FillLegacyRegistration bool
NextDue int64
Replication string
Lifetime string
@@ -163,7 +164,10 @@ func replaceHAWake(ctx context.Context, tx *claimTransaction, host string, s HAW
return err
}
for _, t := range s.Timers {
- if t.Registration == "" {
+ if t.Registration == "" && hostwrite.Enabled(os.Getenv) && rt.ClaimOwnership.Valid() {
+ return ErrClaimOwnership
+ }
+ if t.Registration == "" && s.FillLegacyRegistration {
var id [16]byte
if _, err := rand.Read(id[:]); err != nil {
return err