carlos / platform Public

ha: harden adoption replay and verify persistent duty recovery

Bind receipts to route generations and departure identities, preserve authority across retries, and verify current self markers or later successors. Keep exact acquired-lease restore independent of advisory progress and cover compatibility, races and census changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 68d8f53d44a899246431fb0cd5769d81bf75bac8 parent f9f8e7d
16 files changed, +770 −77
  • docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md +41 −12
  • docs/superpowers/notes/census-region-ha-p1b3b-t-claims.md +35 −8
  • internal/activator/haadopt.go +77 −7
  • internal/activator/haadopt_test.go +401 −2
  • internal/hostfiles/wake.go +20 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-region-ha-p1b3b-t.tsv +76 −20
  • internal/registry/claimreview_test.go +3 −0
  • internal/registry/forward_writers_test.go +7 −1
  • internal/registry/ha_departures.go +48 −20
  • internal/registry/ha_duties.go +8 −5
  • internal/registry/ha_duties_test.go +29 −1
  • internal/registry/ha_test.go +3 −0
  • internal/registry/hold_test.go +3 −0
  • internal/registry/importjournal_test.go +6 −0
  • internal/registry/registry_test.go +12 −0

CI failed — run details

Intent

Human

Check Opus B1 review for P1b-3b slice T: expect task-B1-review-r1.md in /home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-p1b3b-duties/.superpowers/sdd/2026-11-03-region-ha-p1b3b-duties/; read ledger progress.md; continue SDD (fix round or B2 dispatch).

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

diff --git a/docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md b/docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md
index 1d0597fe2..c2c47b29b 100644
--- a/docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md
+++ b/docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md
@@ -1,23 +1,24 @@
# Census approval: region-ha-p1b3b-t
-Ruling `census-ruling-region-ha-p1b3b-t`. The independent reviewer approves or rejects every change below, 16 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, 43 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. |
+| `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. |
| `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. |
+| `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. |
| `internal/host/schedule_wiring.go` `newScheduleDeps` | body | unchanged (6) | Wire Runner.WithDuty before token access through the existing Service. No new read. |
+| `internal/registry/registry.go` `Registry.migrate` | body | unchanged (20) | Create local HA duty/replay tables and revision triggers in the existing registry connection; no new database path. |
| `internal/activator/activator.go` `Service.ServeScheduled` | sites | +whole:Route ×2 | Run the local scheduled request under WithDuty and retain existing HTTP refusal text; add route arguments to background admission and error handling. No forwarding. |
| `internal/activator/activator.go` `Service.wake` | sites | +whole:Route | Install the successful-acquire observer and restrict due, worker and resident starts before doWake, off a.mu. Add a whole-route argument to restriction; refused work has known-no-start evidence. |
| `internal/activator/harelease.go` `Service.releaseHAClean` | sites | +whole:Route | Record advisory local-release basis only after ReleaseMarker succeeds. Add a whole-route argument to local duty bookkeeping; release order and lease authority unchanged. |
-| `internal/activator/hawake.go` `ExecBackend.acquireClassified` | sites | +whole:Route | Select the restriction-only AcquireHAForDuty for background contexts, including sticky HA reclassification; observe successful ordinary acquires to clear stale suppression. Add a whole-route observer argument; no new authority. |
+| `internal/activator/hatakeover.go` `ExecBackend.ownerTerminated` | sites | +registry:Host | Read route Host for structured departure-finalize telemetry; retain the same confirmation callback and visitor alarm behavior. |
| `internal/host/schedule_wiring.go` `activatorDeliverer.deliverSelected` | sites | +whole:Route ×2 | Wrap local delivery in WithDuty so lease loss returns a deferred control result before timer bookkeeping. Add whole-route arguments; no remote forwarding. |
| `internal/schedule/runner.go` `Runner.fire` | sites | -registry:Host ×4, -registry:Name ×2, -whole:Route ×5, -whole:Timer ×2 | 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. |
-Envelopes re-pinned: `internal/activator`, `internal/boxchoice`, `internal/edge`, `internal/host`, `internal/lease`, `internal/registry`, `internal/schedule`.
+Envelopes re-pinned: `internal/activator`, `internal/boxchoice`, `internal/edge`, `internal/host`, `internal/hostfiles`, `internal/lease`, `internal/registry`, `internal/schedule`, `internal/timerspec`.
Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
@@ -29,32 +30,60 @@ Recorded dispositions, which each change must still satisfy:
- `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/schedule_wiring.go` `newScheduleDeps`: legacy, task accepted-legacy. Basis: 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
+- `internal/registry/registry.go` `Registry.migrate`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the registry's SQLite side, as carlos: in the agent (/opt/carlos/carlos agent, carlos-edge.service) and in the registry child (carlos __registry-child, which a root pass forks as the service user), on every registry open; a box CLI verb that opens the registry directly runs it as whoever runs the verb: census-ruling-seeded-instances's body with two more columns added to routes (incarnation and serving_seq, INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule); self-serve moves 1 Task 7;rev3=census-ruling-rootfs-apps-2;basis=one more ALTER TABLE, routes ADD COLUMN runtime TEXT NOT NULL DEFAULT '', beside main's rate_limit, assets_off, asset_gen, incarnation and serving_seq (the last four from the merges of origin/main 3c33f2eb and 953b9fda); the same sixteen sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328/#329 plan 1 Task 4: three more ALTER TABLE statements in the existing loop, routes ADD COLUMN egress_allow, size and policy_expires_at, each TEXT NOT NULL DEFAULT '' and idempotent through the duplicate-column rule; the same sixteen sites, no read added.;rev3=census-ruling-region-ha-p1a;basis=one more ALTER TABLE in the existing loop: routes ADD COLUMN ha INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule; the same sixteen sites, no read added;rev3=census-ruling-ha-p1a-433;basis=the registry's SQLite side as carlos (agent, registry child; a box CLI verb that opens the registry directly runs it as whoever runs it), on every registry open: the ALTER TABLE routes statements are now built from the one migration definition routeAddedColumns (addedColumn name, type, default; review r1 P2): for each entry without the Claim mark, "ALTER TABLE routes ADD COLUMN " + spec(), byte for byte the statements main runs, in main's order, under the same duplicate-column rule. +registry:Claim is that mark, +whole:addedColumn the struct. Every name, type and default is an in-binary literal; no statement added, removed or changed; no read added.;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: one more CREATE TABLE IF NOT EXISTS regional_domains (host TEXT PRIMARY KEY, target, account, app, region TEXT NOT NULL DEFAULT '', created_at INTEGER NOT NULL DEFAULT 0), beside wildcard_domains; the added sites are that statement (+file:Exec, +registry:sql), an in-binary literal; additive, no existing statement changed
- `internal/activator/activator.go` `Service.ServeScheduled`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-plans-4d-lapse;basis=answers a scheduled request to a route the turned-off hook names with the maintenance response before serve (plans 4d). One more whole-row read: the row handed to the hook (a.disabled), as the fence and maxRunFor are asked.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: wraps the proxy so that, after the wake, fillScheduledToken(r, rt) sets an HA host's tick bearer token from its restored env file; an error there logs (+registry:Host, rt.Host) and answers 503 with Retry-After: 5; a non-HA host's tick is left as the runner built it; +whole:Route is rt handed to fillScheduledToken; keeps legacy;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 5: the activator-managed test is Route.ActivatorOwned (a hibernating instance, or an instance with a runtime) instead of Kind and Hibernate inline; reads the same fields plus Runtime through the method
- `internal/activator/activator.go` `Service.wake`: 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-wake-latency-1;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=logs that timer's breakdown to the journal after a successful wake (w.steps.String(), e.host, w.wakeTook); no read added;rev3=census-ruling-plans-4d-lapse;basis=cancels a wake whose row the turned-off hook names, like a fence, unless it is a move's active probe (plans 4d). One more whole-row read: the row handed to the hook (a.disabled). Only refuses.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: a refusal before the lease is reported once per change (noteRootfsRefusal) instead of a wake-failure event; the proc, generation and replica are installed through installProcLocked (which puts a resident under its lease watch before the fence); residency notes the outcome (noteResidentWakeLocked); same generation values;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R [pf R3.5]: the wake's context ceiling is wakeCeilingFor(e.route): the old 5 minutes for a binary row, 5 minutes plus runs.MaxTimeout for a rootfs row (room for a release inside the wake); new site +whole:Route (e.route to wakeCeilingFor, which reads Runtime only); no other change;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (branch review R1 P1-1): the wake's context is also cancelled before doWake when RetireExcept has marked the entry retired (e.retired, in memory under a.mu), as it is for a fence or a shutdown. Read sites unchanged (13). Agent, not root; it only refuses more.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Carry successful hold preparation into its wake, preserve actual mode in the generation and OnWake projection, and project serving version/mode through the narrow registry writer before releasing wake waiters. Final review I1: SetServingMode only for non-worker successful wakes with a nonempty spawned version and either a stateless generation or a mode transition from the route. Ordinary stateful wakes leave rollout status and the wake critical path unchanged.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds a.cancelHeldLegsLocked(e, 0) on the failed-wake path before the entry is deleted, and after close(e.ready) on success calls a.noteHeldAdmissible(e.host), the non-blocking held wake callback, outside a.mu. No read added.
- `internal/activator/harelease.go` `Service.releaseHAClean`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: an HA entry's release, in order: host slice read empty through haHostEmpty (else errHostSliceUnproven and nothing written; the same check, moved into that helper by final fix F1), stop and join the files publisher, its final publish (2 min budget), the replica's final sync (Finish, 30 s), the local release record, then the release marker PUT (10 s), clean only when the final publish was complete and the sync and record succeeded; a failed PUT is a persisted lease obligation; +registry:Host, +whole:Route x4
-- `internal/activator/hawake.go` `ExecBackend.acquireClassified`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the acquire's classification: a legacy route (sidecar, hand-added or not an instance) takes lease.Acquire and refuses on an HA-format lock; otherwise isHA (a record read error fails the wake, never falls back to legacy); not HA takes lease.Acquire, and an HA-format lock there marks the host HA for good and continues; HA requires haContained before any lock request, then lease.AcquireHA with the same-box proof; held and refused leases map to errLeaseHeld and errLeaseRefused (leaseError); +registry:Host, +whole:Route x7;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: the HA acquire's Proofs gain OwnerTerminated (b.ownerTerminated(ctx, rt)) beside SameBoxEmpty; one more whole:Route site passes the route to ownerTerminated; nothing new is read; the proof is consulted only by hafresh.DecideAcquire for another box's expired HA lock;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 7, two-box fleet test): the two legacy acquires call b.acquireLegacy(ctx, prefix), which is acquireLegacyLease exactly when ExecBackend.LeaseIdentity is nil and LeaseTTL is 0 (the agent never sets them), otherwise lease.AcquireAs with that identity and TTL. The classification, the HA path and every refusal are unchanged. Read sites unchanged (9). Agent, not root.
+- `internal/activator/hatakeover.go` `ExecBackend.ownerTerminated`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1b1;basis=new (region HA P1b-1): returns nil without eb.OwnerTerminated; else a closure calling it with the lock owner's instance id (from the HA lock, written by a box agent) and logging rt.Host on a takeover and, at most once a minute per host, on an error; the id goes only to EC2 DescribeInstances in this box's own account and region and is checked against the reply (termfence.SameAccountTerminated); root never calls it
- `internal/host/schedule_wiring.go` `activatorDeliverer.deliverSelected`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route
- `internal/schedule/runner.go` `Runner.fire`: hint, task E2. Basis: 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
New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+- new `internal/activator/haadopt.go:ExecBackend.adoptionCurrent`: reads +registry:Account ×2, +registry:App ×2, +registry:DBPath ×2, +registry:HoldOp, +registry:Host, +registry:ImportGate, +registry:Kind ×2, +registry:Replica, +registry:Status, +registry:Tunnel, +whole:Pair, +whole:Route ×3; written legacy, accepted-legacy, frozen
+- new `internal/activator/haadopt.go:ExecBackend.adoptionWake`: reads +registry:Sequence ×2, +registry:WakeDigest ×3, +whole:HAWakeImport ×7; written legacy, accepted-legacy, frozen
+- new `internal/activator/haadopt.go:ExecBackend.bindDutyLifetime`: reads +registry:Host ×3, +registry:Revision, +whole:DutyState ×3, +whole:Route; written legacy, accepted-legacy, frozen
+- new `internal/activator/haadopt.go:Service.AdoptHost`: reads +registry:AcquiredGeneration ×7, +registry:DepartureIID ×2, +registry:DepartureRef ×2, +registry:ExpectedPair, +registry:Host ×18, +registry:Lifetime ×2, +registry:LockETag, +registry:LockGeneration ×2, +registry:Phase ×9, +registry:Receipt, +registry:Revision ×2, +registry:Sequence ×2, +registry:WakeDigest ×2, +whole:HAAdoption ×2, +whole:HAWakeImport ×8, +whole:Pair ×4, +whole:Route ×17; written legacy, accepted-legacy, frozen
+- new `internal/activator/haadopt.go:Service.adoptionAwakeSuccessor`: reads +registry:Host ×2, +whole:Route; written legacy, accepted-legacy, frozen
+- new `internal/activator/haadopt.go:adoptionBackend`: reads +whole:Route ×2; written legacy, accepted-legacy, frozen
+- new `internal/activator/haadopt.go:adoptionPair`: reads +registry:Incarnation, +registry:ServingSeq; written legacy, accepted-legacy, frozen
- new `internal/activator/haduties.go:DutyForTick`: reads +whole:Timer; written legacy, accepted-legacy, frozen
- new `internal/activator/haduties.go:Service.Duty`: reads +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/haduties.go:Service.WithDuty`: reads +registry:Host ×2, +whole:Route ×3; written legacy, accepted-legacy, frozen
-- new `internal/activator/haduties.go:Service.allowDuty`: reads +registry:Host ×2, +whole:Route ×2; written legacy, accepted-legacy, frozen
-- new `internal/activator/haduties.go:Service.dutyInput`: reads +registry:HA, +registry:Host ×4, +registry:ImportGate, +registry:Replica, +registry:Status ×2, +registry:Tunnel, +whole:Route ×5; written legacy, accepted-legacy, frozen
-- new `internal/activator/haduties.go:Service.rememberDutyAcquired`: reads +registry:Host ×2; written legacy, accepted-legacy, frozen
-- new `internal/activator/haduties.go:Service.rememberDutyRelease`: reads +registry:Host ×2; written legacy, accepted-legacy, frozen
-- new `internal/activator/haduties.go:Service.restrictDuty`: reads +whole:Route ×2; written legacy, accepted-legacy, frozen
+- new `internal/activator/haduties.go:Service.allowDuty`: reads +registry:HolderRef, +registry:Host ×2, +registry:NotBefore, +registry:ViewKey, +whole:DutyState ×7, +whole:Route ×2; written legacy, accepted-legacy, frozen
+- new `internal/activator/haduties.go:Service.dutyInput`: reads +registry:Basis, +registry:HA, +registry:HolderEpoch, +registry:HolderIID ×2, +registry:HolderRef ×3, +registry:Host ×4, +registry:ImportGate, +registry:NotBefore ×2, +registry:Replica, +registry:Status ×2, +registry:Tunnel, +registry:ViewKey, +whole:DutyState ×2, +whole:Route ×5; written legacy, accepted-legacy, frozen
+- new `internal/activator/haduties.go:Service.dutyState`: reads +whole:DutyState, +whole:Route ×4; written legacy, accepted-legacy, frozen
+- new `internal/activator/haduties.go:Service.rememberDutyAcquired`: reads +registry:Host ×2, +whole:DutyState; written legacy, accepted-legacy, frozen
+- new `internal/activator/haduties.go:Service.rememberDutyRelease`: reads +registry:Host ×2, +whole:DutyState; written legacy, accepted-legacy, frozen
+- new `internal/activator/haduties.go:Service.restrictDuty`: reads +whole:DutyState, +whole:Route ×2; written legacy, accepted-legacy, frozen
+- new `internal/activator/haduties.go:Service.saveDuty`: reads +registry:Revision ×5, +whole:DutyState ×6; written legacy, accepted-legacy, frozen
- new `internal/activator/haduties.go:dutyBackend`: reads +whole:Route ×2; written legacy, accepted-legacy, frozen
+- new `internal/activator/haduties.go:dutyRefusal`: reads +registry:HolderIID, +registry:HolderRef ×3, +registry:NotBefore; written legacy, accepted-legacy, frozen
- new `internal/edge/wakeplacement.go:Edge.DutySnapshot`: reads +whole:Route; 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:RegistryWake`: reads +registry:Timers ×2, +whole:HAWakeImport ×2, +whole:Timer ×2; written legacy, accepted-legacy, frozen
+- new `internal/registry/ha_departures.go:Registry.CompareHAAdoption`: reads +registry:AcquiredGeneration ×2, +registry:Changed, +registry:Incarnation, +registry:Lifetime ×2, +registry:LockETag, +registry:LockGeneration ×2, +registry:Phase ×6, +registry:Receipt, +registry:Sequence, +registry:ServingSeq, +registry:WakeDigest, +registry:remote ×2, +whole:HAAdoption ×2, +whole:Pair ×2, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
+- new `internal/registry/ha_departures.go:Registry.HAAdoption`: reads +file:QueryRowContext, +registry:AcquiredGeneration, +registry:Adoption, +registry:Changed, +registry:DepartureIID, +registry:DepartureRef, +registry:LockETag, +registry:LockGeneration, +registry:Phase, +registry:Sequence, +registry:WakeDigest, +registry:remote ×2, +registry:sql, +whole:HAAdoption ×3, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
+- new `internal/registry/ha_departures.go:Registry.ImportHAWake`: reads +file:QueryRowContext ×2, +registry:DepartureIID ×3, +registry:DepartureRef ×3, +registry:Import, +registry:Incarnation, +registry:Lifetime ×4, +registry:LockETag ×3, +registry:LockGeneration ×3, +registry:Receipt ×3, +registry:Revision, +registry:Sequence, +registry:ServingSeq, +registry:WakeDigest ×2, +registry:remote ×2, +whole:HAWakeImport ×4, +whole:Pair ×4, +whole:claimTransaction, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
+- new `internal/registry/ha_departures.go:Registry.ReplaceHAWake`: reads +registry:remote ×2, +whole:HAWakeImport ×4, +whole:claimTransaction, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
+- new `internal/registry/ha_departures.go:Registry.migrateHAAdoptions`: reads +file:Exec, +registry:sql; written legacy, accepted-legacy, frozen
+- new `internal/registry/ha_departures.go:ValidateHAWake`: reads +registry:Attempts, +registry:ClaimOwnership, +registry:DueAt, +registry:Host, +registry:Kind, +registry:LastAt, +registry:Name ×3, +registry:NextAt, +registry:NextDue, +registry:Path ×5, +registry:Registration, +registry:Replication, +registry:Spec, +registry:Timers, +whole:ClaimOwnership, +whole:Timer; written legacy, accepted-legacy, frozen
+- new `internal/registry/ha_departures.go:replaceHAWake`: reads +file:QueryRowContext ×2, +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 ×2, +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_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
+- new `internal/registry/ha_duties.go:Registry.HADuty`: reads +file:QueryRow, +registry:Basis, +registry:Changed, +registry:Duty, +registry:HolderEpoch, +registry:HolderIID, +registry:HolderRef, +registry:NotBefore, +registry:Revision ×2, +registry:ViewKey, +registry:remote ×2, +registry:sql, +whole:DutyState ×3, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
+- new `internal/registry/ha_duties.go:Registry.LoadDuty`: reads +registry:Duty, +registry:Revision, +registry:remote ×2, +registry:sql, +whole:DutyState ×7, +whole:remoteClient ×2; written legacy, accepted-legacy, frozen
+- new `internal/registry/ha_duties.go:Registry.migrateHADuties`: reads +file:Exec, +registry:sql; written legacy, accepted-legacy, frozen
- new `internal/registry/timers.go:Registry.AdvanceDutyTimer`: reads +file:Exec, +registry:DueAt, +registry:Host, +registry:Kind, +registry:Name, +registry:NextAt ×2, +registry:Registration, +registry:remote, +registry:sql, +whole:remoteClient; written legacy, accepted-legacy, frozen
- new `internal/schedule/runner.go:OldDutyTick`: reads +registry:Kind, +whole:Timer; written legacy, accepted-legacy, frozen
- new `internal/schedule/runner.go:Runner.fireOwned`: reads +registry:Host ×4, +registry:Name ×2, +registry:Spec ×2, +whole:Route ×9, +whole:Timer ×8; written legacy, accepted-legacy, frozen
+- other `changed registry schema`: closed only if it is the registry schema (re-pinned)
+- reads `internal/activator/hawake.go:ExecBackend.acquireClassified`: +registry:Basis, +registry:Revision, +whole:DutyState, +whole:Route ×2; keeps legacy, task accepted-legacy
- reads `internal/host/runs.go:runsWorker.pickup`: +registry:HA, +whole:Route; keeps legacy, task accepted-legacy
+- 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:Host ×8, +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; keeps hint, task E2
-Seal: `7e30dee4fb52370555ad173512d7f03782f0fbed725a8a6bf4f7e31f52c23668` → `3dff55f1b67755f6772c778e565b91838202965a4034484b94694c3a9c0550d9`.
+Seal: `7e30dee4fb52370555ad173512d7f03782f0fbed725a8a6bf4f7e31f52c23668` → `7aa71b5794417f163f16727f0e5692b6fd6dd838037b42dbd8b2150f24043f9e`.
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 1dc415b8f..d270bc756 100644
--- a/docs/superpowers/notes/census-region-ha-p1b3b-t-claims.md
+++ b/docs/superpowers/notes/census-region-ha-p1b3b-t-claims.md
@@ -1,23 +1,23 @@
internal/activator/activator.go:Service.begin 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 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 Add the B2 DutyStore interface field and process-local duty view, suppression and invalidation state. No read added.
+internal/activator/activator.go:type Service 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.
internal/activator/activator.go:Service.ServeScheduled Run the local scheduled request under WithDuty and retain existing HTTP refusal text; add route arguments to background admission and error handling. No forwarding.
internal/activator/activator.go:Service.wake Install the successful-acquire observer and restrict due, worker and resident starts before doWake, off a.mu. Add a whole-route argument to restriction; refused work has known-no-start evidence.
internal/activator/harelease.go:Service.releaseHAClean Record advisory local-release basis only after ReleaseMarker succeeds. Add a whole-route argument to local duty bookkeeping; release order and lease authority unchanged.
-internal/activator/hawake.go:ExecBackend.acquireClassified Select the restriction-only AcquireHAForDuty for background contexts, including sticky HA reclassification; observe successful ordinary acquires to clear stale suppression. Add a whole-route observer argument; no new authority.
+internal/activator/hawake.go:ExecBackend.acquireClassified Select the restriction-only AcquireHAForDuty for background contexts, including sticky HA reclassification; observe successful ordinary acquires to clear stale suppression. Add a whole-route observer argument; no new authority. B2 binds the current authoritative lifetime and advances local revision before HA acquire, invalidating concurrent adoption I/O. Ordinary lease authority and restore ordering remain unchanged.
internal/edge/wakeplacement.go:homeMap.wakeSnapshot 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 Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation.
+internal/host/agent.go:runAgent 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.
internal/host/schedule_wiring.go:newScheduleDeps Wire Runner.WithDuty before token access through the existing Service. No new read.
internal/host/schedule_wiring.go:activatorDeliverer.deliverSelected Wrap local delivery in WithDuty so lease loss returns a deferred control result before timer bookkeeping. Add whole-route arguments; no remote forwarding.
internal/schedule/runner.go:Runner.fire 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.
internal/activator/haduties.go:DutyForTick Read the observed timer through the shared old-occurrence predicate; once-timers are never aged out.
internal/activator/haduties.go:Service.Duty Pass the local route into dutyInput and the pure chooser. Advisory decision only; no acquire or start.
internal/activator/haduties.go:Service.WithDuty Read route host for owned-awake checks and pass provisioned managed instances to restricted singleflight wake before producer writes, including cached legacy rows that discover sticky HA at acquire. Other route kinds keep their path; no authority bypass.
-internal/activator/haduties.go:Service.allowDuty Recheck lifetime and duty policy on every classified CAS round. Return a non-owner subtype only for a known foreign holder; self expiry and local denial remain deferred. Existing suppression writes and acquire restrictions retained; no read added.
-internal/activator/haduties.go:Service.dutyInput Read HA classification/lifetime from the existing backend and route host, HA, replica, tunnel, import gate and status; read advisory DutyStore state and cached home projection outside a.mu. No new filesystem or bucket path.
-internal/activator/haduties.go:Service.rememberDutyAcquired Read route host to clear peer suppression only after ordinary acquire succeeds, including visitor wakes. Local advisory state cannot authorize the lease.
-internal/activator/haduties.go:Service.rememberDutyRelease Read route host to record successful local release basis keyed to the acquired host lifetime. Failed marker writes never reach this hook.
-internal/activator/haduties.go:Service.restrictDuty Bind background restriction to the host lifetime. Use existing duty state to distinguish known peer suppression from local denial before allowing timer aging; no new I/O beyond dutyInput.
+internal/activator/haduties.go:Service.allowDuty Recheck lifetime and duty policy on every classified CAS round. Return a non-owner subtype only for a known foreign holder; self expiry and local denial remain deferred. Existing suppression writes and acquire restrictions retained; no read added. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged.
+internal/activator/haduties.go:Service.dutyInput Read HA classification/lifetime from the existing backend and route host, HA, replica, tunnel, import gate and status; read advisory DutyStore state and cached home projection outside a.mu. No new filesystem or bucket path. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged.
+internal/activator/haduties.go:Service.rememberDutyAcquired Read route host to clear peer suppression only after ordinary acquire succeeds, including visitor wakes. Local advisory state cannot authorize the lease. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged.
+internal/activator/haduties.go:Service.rememberDutyRelease Read route host to record successful local release basis keyed to the acquired host lifetime. Failed marker writes never reach this hook. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged.
+internal/activator/haduties.go:Service.restrictDuty Bind background restriction to the host lifetime. Use existing duty state to distinguish known peer suppression from local denial before allowing timer aging; no new I/O beyond dutyInput. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged.
internal/activator/haduties.go:dutyBackend Dispatch the existing backend by local route through SplitBackend, for HA classification and self identity. No new I/O.
internal/edge/wakeplacement.go:Edge.DutySnapshot Pass the route to the existing cached home projection; no store reads, network reads or new publication.
internal/host/runs.go:runsWorker.dutyStillOwned Read route HA/host and existing service classification; after sink construction require an HA route still held awake locally before RunPick. Refusal only.
@@ -26,3 +26,30 @@ internal/host/runs.go:runsWorker.pickup Wrap both bucket and relay pickup in the
internal/registry/timers.go:Registry.AdvanceDutyTimer Update only local recurring timer progress with registration, DueAt and NextAt comparisons. Read timer fields and existing registry sql/remote handles; no last-delivery stamp, once deletion or external path.
internal/schedule/runner.go:OldDutyTick Read timer kind and natural due occurrence; only recurring occurrences at least 15 minutes old qualify. No writes.
internal/schedule/runner.go:Runner.fireOwned Existing fire body moved beneath admission; deferred delivery now returns without recording a failure. Same token preparation, parsing, guarded row checks and delivery authority.
+internal/registry/registry.go:Registry.migrate Create local HA duty/replay tables and revision triggers in the existing registry connection; no new database path.
+internal/activator/hatakeover.go:ExecBackend.ownerTerminated Read route Host for structured departure-finalize telemetry; retain the same confirmation callback and visitor alarm behavior.
+internal/activator/haadopt.go:ExecBackend.adoptionCurrent Read the current registry route and authoritative lifetime index/record; compare Pair, account, app, DB path, kind and admission fields before effects. Refusal only.
+internal/activator/haadopt.go:ExecBackend.adoptionWake Read only the configured files manifest and its validated wake object. Validate wire state and reuse only bytes already checked against an equal digest; never fetch DB, file-tree or secret objects.
+internal/activator/haadopt.go:ExecBackend.bindDutyLifetime Read existing local duty revision and bind only current record facts to the registry Pair; changed binding invalidates old authority and receipt access.
+internal/activator/haadopt.go:Service.AdoptHost Serialize through the existing host operation state. Read local route/revision/receipt plus configured lock/manifest/wake objects; use only restricted ordinary acquire, exact guarded restore, ordinary unclean release and verified readback for adoption. No process launch, local-copy reuse or secret access.
+internal/activator/haadopt.go:adoptionBackend Select the existing ExecBackend through SplitBackend using the route; no I/O.
+internal/activator/haadopt.go:adoptionPair Read route Incarnation and ServingSeq for transaction comparisons; no I/O.
+internal/activator/haduties.go:Service.dutyState Read the current registry route and existing authoritative lifetime before binding/loading the persistent DutyStore. Pending import never produces adopted basis.
+internal/activator/haduties.go:Service.saveDuty DutyState is now an alias of registry.DutyState, so existing revision and state reads enter the registry census. Save behavior and CAS remain advisory.
+internal/activator/haduties.go:dutyRefusal DutyState alias makes the existing holder and deadline reads visible to the registry census; refusal behavior unchanged.
+internal/hostfiles/wake.go:RegistryWake Convert wire timers into registry rows, checking wake version/host and shared timer grammar before effects; no I/O.
+internal/registry/ha_departures.go:Registry.CompareHAAdoption 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.
+internal/registry/ha_departures.go:Registry.HAAdoption Query local receipt progress only while its binding matches the active route lifetime; remote transport returns the same result. Historical receipts remain inaccessible after retirement.
+internal/registry/ha_departures.go:Registry.ImportHAWake Validate all state then transactionally compare current Pair, lifetime, binding, revision and receipt before replacing rows and recording pending authority. Replays never replace rows.
+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.
+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.
+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.
+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.
+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.
+internal/registry/ha_duties.go:Registry.LoadDuty Load persisted duty state or initialize an unbound live row with captured revision; refuse an already different binding.
+internal/registry/ha_duties.go:Registry.migrateHADuties Create local duties and revision/binding triggers. Timer and relevant route mutations advance revision in their own transaction; retirement/recreation clears authority and suppression.
+internal/hostfiles/wake.go:ImportWake Delegate validated conversion to one atomic ReplaceHAWake transaction instead of three independent writes; no lease or file effect.
+internal/registry/remote_dispatch.go:Registry.dispatchRemote Dispatch typed duty, import, exact replacement and guarded receipt operations through the existing service-user registry transport, preserving comparisons and errors.
+internal/activator/haadopt.go:Service.adoptionAwakeSuccessor Read the configured lock and current route/lifetime to recognize an already awake local successor with strictly later generation and independently bound ref/iid. Recheck HoldsAwake before returning Superseded; no registry or lease writes.
diff --git a/internal/activator/haadopt.go b/internal/activator/haadopt.go
index 0d57370bd..b57c3a6f3 100644
--- a/internal/activator/haadopt.go
+++ b/internal/activator/haadopt.go
@@ -66,7 +66,7 @@ func adoptionNames(v hafresh.View, ref, iid, life string) bool {
return ok && o.HA && o.Ref == ref && o.IID == iid
}
-func (b *ExecBackend) adoptionWake(ctx context.Context, host string) (registry.HAWakeImport, error) {
+func (b *ExecBackend) adoptionWake(ctx context.Context, host string, cached ...registry.HAWakeImport) (registry.HAWakeImport, error) {
if b.FilesStore == nil {
return registry.HAWakeImport{}, registry.ErrHAWake
}
@@ -78,6 +78,17 @@ func (b *ExecBackend) adoptionWake(ctx context.Context, host string) (registry.H
if !found {
return registry.HAWakeImport{}, registry.ErrHAWake
}
+ if err := hostfiles.ValidateWakeEntry(prefix, m); err != nil {
+ return registry.HAWakeImport{}, err
+ }
+ if len(cached) > 0 {
+ entry, present := m.Platform[hostfiles.WakeItem]
+ if (present && entry.SHA256 == cached[0].WakeDigest) || (!present && cached[0].WakeDigest == "absent") {
+ state := cached[0]
+ state.Sequence = m.Seq
+ return state, nil
+ }
+ }
ws, found, err := hostfiles.LoadWake(ctx, b.FilesStore, prefix, m, nil)
if err != nil {
return registry.HAWakeImport{}, err
@@ -104,6 +115,9 @@ func (a *Service) AdoptHost(ctx context.Context, rt registry.Route, req Adoption
if b == nil || b.Registry == nil || haLegacyRoute(rt) || req.Departure == "" || req.Lifetime == "" || req.Ref == "" || req.IID == "" || !b.self().Complete() {
return Deferred, registry.ErrHAChanged
}
+ if b.self() != lease.CurrentSelf() {
+ return Deferred, registry.ErrHAChanged
+ }
if err := b.haContained(rt); err != nil {
return Deferred, err
}
@@ -121,16 +135,25 @@ func (a *Service) AdoptHost(ctx context.Context, rt registry.Route, req Adoption
return Deferred, nil
}
a.mu.Lock()
- if a.shuttingDown || a.fences[rt.Host] != 0 || a.entries[rt.Host] != nil || a.disabled(rt) {
+ if a.shuttingDown || a.fences[rt.Host] != 0 || a.disabled(rt) {
a.mu.Unlock()
return Deferred, nil
}
+ if live := a.entries[rt.Host]; live != nil {
+ awake := a.ownedLocked(live, false) == nil
+ a.mu.Unlock()
+ if !awake {
+ return Deferred, nil
+ }
+ return a.adoptionAwakeSuccessor(ctx, b, rt, req)
+ }
e := &actEntry{host: rt.Host, route: rt, state: actWaking, ready: make(chan struct{}), duty: true}
- a.entries[rt.Host] = e
+ a.putEntryLocked(rt.Host, e)
a.mu.Unlock()
defer func() {
a.mu.Lock()
if a.entries[rt.Host] == e {
+ a.cancelHeldLegsLocked(e, 0)
delete(a.entries, rt.Host)
}
e.err = ErrDutyDeferred
@@ -138,12 +161,15 @@ func (a *Service) AdoptHost(ctx context.Context, rt registry.Route, req Adoption
a.mu.Unlock()
}()
+ ctx, cancel := context.WithCancel(ctx)
+ stop := context.AfterFunc(a.lifeCtx, cancel)
+ defer func() { stop(); cancel() }()
reg := b.Registry
progress, exists, err := reg.HAAdoption(ctx, rt.Host, req.Lifetime, req.Departure)
if err != nil {
return Deferred, err
}
- if exists && (progress.LockETag != req.Observed.ETag || progress.LockGeneration != req.Observed.Lock.Generation) {
+ if exists && (progress.DepartureRef != req.Ref || progress.DepartureIID != req.IID || progress.LockGeneration > req.Observed.Lock.Generation) {
return Deferred, registry.ErrHAChanged
}
read := func() (hafresh.View, error) {
@@ -183,6 +209,16 @@ func (a *Service) AdoptHost(ctx context.Context, rt registry.Route, req Adoption
}
if exists && (progress.Phase == "marker_pending" || progress.Phase == "adopted") && selfMarker(view) {
if progress.Phase == "adopted" {
+ if err := b.adoptionCurrent(ctx, rt, req); err != nil {
+ return Deferred, err
+ }
+ _, ok, err := reg.HAAdoption(ctx, rt.Host, req.Lifetime, req.Departure)
+ if err != nil {
+ return Deferred, err
+ }
+ if !ok {
+ return Deferred, registry.ErrHAChanged
+ }
return AlreadyAdopted, nil
}
if err := phase("adopted", progress.AcquiredGeneration, nil); err != nil {
@@ -199,7 +235,7 @@ func (a *Service) AdoptHost(ctx context.Context, rt registry.Route, req Adoption
} else if o, ok := hafresh.ParseOwner(view.Lock.Owner); ok {
ref, iid = o.Ref, o.IID
}
- ownPending := exists && ref == self.Ref && iid == self.IID && view.Lock.Generation == progress.AcquiredGeneration && progress.Phase != "adopted"
+ ownPending := exists && ref == self.Ref && iid == self.IID && (view.Lock.Generation == progress.AcquiredGeneration || (progress.Phase == "acquiring" && view.Lock.Generation+1 == progress.AcquiredGeneration)) && progress.Phase != "adopted"
if !ownPending && !(ref == req.Ref && iid == req.IID) && adoptionNames(view, ref, iid, req.Lifetime) {
ok, err := a.AdoptionIdentity(ctx, ref, iid)
if err != nil {
@@ -214,13 +250,14 @@ func (a *Service) AdoptHost(ctx context.Context, rt registry.Route, req Adoption
}
}
departed := view.ETag == req.Observed.ETag && view.Lock.Generation == req.Observed.Lock.Generation && adoptionNames(view, req.Ref, req.IID, req.Lifetime)
- ownReplay := exists && progress.Phase != "adopted" && view.Lock.Generation == progress.AcquiredGeneration && adoptionNames(view, self.Ref, self.IID, req.Lifetime)
+ ownReplay := exists && progress.Phase != "adopted" && (view.Lock.Generation == progress.AcquiredGeneration || (progress.Phase == "acquiring" && view.Lock.Generation+1 == progress.AcquiredGeneration)) && adoptionNames(view, self.Ref, self.IID, req.Lifetime)
if !departed && !ownReplay {
return Deferred, nil
}
if view.Lock.Release == nil && !a.now().After(view.Lock.ExpiresAt) {
return Deferred, nil
}
+ var staged []registry.HAWakeImport
if !exists {
s, err := b.adoptionWake(ctx, rt.Host)
if err != nil {
@@ -229,6 +266,8 @@ func (a *Service) AdoptHost(ctx context.Context, rt registry.Route, req Adoption
if err = b.adoptionCurrent(ctx, rt, req); err != nil {
return Deferred, err
}
+ staged = append(staged, s)
+ s.DepartureRef, s.DepartureIID = req.Ref, req.IID
s.Lifetime, s.Revision, s.Receipt, s.LockETag, s.LockGeneration = req.Lifetime, req.Revision, req.Departure, req.Observed.ETag, req.Observed.Lock.Generation
imported, err := reg.ImportHAWake(ctx, rt.Host, req.Pair, s)
if err != nil {
@@ -276,7 +315,7 @@ func (a *Service) AdoptHost(ctx context.Context, rt registry.Route, req Adoption
return Deferred, err
}
// The newly acquired lease's manifest outranks all earlier local progress.
- exact, err := b.adoptionWake(ctx, rt.Host)
+ exact, err := b.adoptionWake(ctx, rt.Host, staged...)
if err != nil {
return Deferred, err
}
@@ -286,6 +325,8 @@ func (a *Service) AdoptHost(ctx context.Context, rt registry.Route, req Adoption
if err = held.Err(); err != nil {
return Deferred, err
}
+ exact.Lifetime = req.Lifetime
+ exact.ExpectedPair = &req.Pair
if err = reg.ReplaceHAWake(ctx, rt.Host, exact); err != nil {
return Deferred, err
}
@@ -330,3 +371,32 @@ func (b *ExecBackend) bindDutyLifetime(ctx context.Context, rt registry.Route, l
}
return b.Registry.LoadDuty(ctx, rt.Host, life)
}
+
+// A live local holder can discharge a departure without changing its wake state.
+func (a *Service) adoptionAwakeSuccessor(ctx context.Context, b *ExecBackend, rt registry.Route, req Adoption) (AdoptResult, error) {
+ if a.AdoptionIdentity == nil {
+ return Deferred, nil
+ }
+ v, err := lease.ReadLock(ctx, b.Cfg.Bucket, b.Cfg.hibernatePrefix(rt.Host), b.Cfg.Region)
+ if err != nil {
+ return Deferred, err
+ }
+ self := b.self()
+ if v.Lock.Release != nil || v.Lock.Generation <= req.Observed.Lock.Generation || !adoptionNames(v, self.Ref, self.IID, req.Lifetime) {
+ return Deferred, nil
+ }
+ bound, err := a.AdoptionIdentity(ctx, self.Ref, self.IID)
+ if err != nil {
+ return Deferred, err
+ }
+ if !bound {
+ return Deferred, nil
+ }
+ if err = b.adoptionCurrent(ctx, rt, req); err != nil {
+ return Deferred, err
+ }
+ if !a.HoldsAwake(rt.Host) {
+ return Deferred, nil
+ }
+ return Superseded, nil
+}
diff --git a/internal/activator/haadopt_test.go b/internal/activator/haadopt_test.go
index 8c9df849c..f0e125add 100644
--- a/internal/activator/haadopt_test.go
+++ b/internal/activator/haadopt_test.go
@@ -1,8 +1,13 @@
package activator
import (
+ "bytes"
"context"
"encoding/json"
+ "fmt"
+ "github.com/carlosframework/platform/internal/release"
+ "log"
+ "path/filepath"
"strings"
"testing"
"time"
@@ -17,8 +22,9 @@ func haAdoptionFixture(t *testing.T) (*haSvc, Adoption) {
t.Helper()
s := haService(t, "shop.example.com")
s.a.DutyStore = s.b.Registry
+ publishManifest(t, s.b, s.rt, nil, "CARLOS_ADMIN_TOKEN=t1\nCARLOS_INSTANCE_KEY=k1\n")
publishAdoptWake(t, s, hostfiles.WakeState{V: 1, Host: s.rt.Host, NextDue: time.Now().Add(48 * time.Hour).Unix(), Timers: []hostfiles.WakeTimer{{Name: "reminder", Kind: "once", Spec: "at 9999999999", Path: "/remind", NextAt: 9999999999, DueAt: 9999999999, Registration: "original"}}})
- putLockFor(t, s.b, s.rt, markerBody(t, "b", "i-b", haFixOf(s.b).lifetime, 5, false))
+ putLockFor(t, s.b, s.rt, haAdoptMarker(t, "b", "i-b", haFixOf(s.b).lifetime, 5, false))
v, err := lease.ReadLock(context.Background(), s.b.Cfg.Bucket, s.b.Cfg.hibernatePrefix(s.rt.Host), s.b.Cfg.Region)
if err != nil {
t.Fatal(err)
@@ -50,7 +56,7 @@ func TestHAAdoptAuthority(t *testing.T) {
ctx := context.Background()
switch kind {
case "clean":
- putLockFor(t, s.b, s.rt, markerBody(t, "b", "i-b", req.Lifetime, 5, true))
+ putLockFor(t, s.b, s.rt, haAdoptMarker(t, "b", "i-b", req.Lifetime, 5, true))
case "held", "expiry equality", "expired":
expiry := time.Now().Add(time.Hour)
if kind == "expired" {
@@ -193,3 +199,396 @@ func TestHAAdoptManifestBoundary(t *testing.T) {
}
var _ DutyStore = (*registry.Registry)(nil)
+
+type adoptReadStore struct {
+ release.Store
+ onGet func(string)
+}
+
+func (s adoptReadStore) Get(ctx context.Context, key string) ([]byte, string, error) {
+ if s.onGet != nil {
+ s.onGet(key)
+ }
+ return s.Store.Get(ctx, key)
+}
+
+func TestHAAdoptRaces(t *testing.T) {
+ for _, kind := range []string{"registration", "next_due", "lifetime", "visitor", "authoritative publication", "acquire CAS"} {
+ t.Run(kind, func(t *testing.T) {
+ s, req := haAdoptionFixture(t)
+ ctx := context.Background()
+ called := false
+ original := s.b.FilesStore
+ if kind == "acquire CAS" {
+ s.fx.BeforeWrite(func(method, key string) {
+ if !called && key == lockKeyOf(s.b, s.rt) {
+ called = true
+ putLockFor(t, s.b, s.rt, haAdoptMarker(t, "c", "i-c", req.Lifetime, 8, false))
+ }
+ })
+ } else {
+ s.b.FilesStore = adoptReadStore{Store: original, onGet: func(key string) {
+ if called || key != hostfiles.ManifestKey(s.b.filesPrefix(s.rt.Host)) {
+ return
+ }
+ called = true
+ switch kind {
+ case "registration":
+ if err := s.b.Registry.UpsertTimer(registry.Timer{Host: s.rt.Host, Name: "reminder", Kind: "once", Spec: "at 999", Path: "/new", NextAt: 999}); err != nil {
+ t.Fatal(err)
+ }
+ case "next_due":
+ _ = s.b.Registry.SetNextDue(s.rt.Host, 999)
+ case "lifetime":
+ _, _ = s.b.Registry.InstallLifetimeIf(s.rt.Host, registry.Pair{}, registry.Pair{Incarnation: 2})
+ case "visitor":
+ wait, cancel := context.WithTimeout(ctx, 20*time.Millisecond)
+ defer cancel()
+ done, err := s.a.begin(wait, s.rt, true, nil)
+ if done != nil {
+ done()
+ }
+ if err == nil {
+ t.Error("visitor ran during import")
+ }
+ case "authoritative publication":
+ // Publish after the first manifest is read, during the acquire PUT below.
+ s.fx.BeforeWrite(func(method, key string) {
+ if key != lockKeyOf(s.b, s.rt) {
+ return
+ }
+ s.fx.BeforeWrite(nil)
+ publishAdoptWake(t, s, hostfiles.WakeState{V: 1, Host: s.rt.Host, NextDue: 777, Timers: []hostfiles.WakeTimer{{Name: "new-once", Kind: "once", Spec: "at 777", Path: "/new", NextAt: 777, Registration: "interim"}}})
+ })
+ }
+ }}
+ }
+ got, err := s.a.AdoptHost(ctx, s.rt, req)
+ if !called {
+ t.Fatal("race did not reach I/O")
+ }
+ if kind == "visitor" || kind == "authoritative publication" {
+ if err != nil || got != Adopted {
+ t.Fatalf("adopt %v %v", got, err)
+ }
+ } else if got != Deferred {
+ t.Fatalf("race overwritten %v %v", got, err)
+ }
+ if kind == "registration" {
+ row, _ := s.b.Registry.GetTimer(s.rt.Host, "reminder")
+ if row == nil || row.NextAt != 999 {
+ t.Fatalf("registration overwritten %+v", row)
+ }
+ }
+ if kind == "authoritative publication" {
+ rows, _ := s.b.Registry.TimersFor(s.rt.Host)
+ if len(rows) != 1 || rows[0].Name != "new-once" {
+ t.Fatalf("staged rows beat manifest %+v", rows)
+ }
+ }
+ })
+ }
+}
+
+func TestHAAdoptRestartPhases(t *testing.T) {
+ for _, phase := range []string{"imported_pending_authority", "acquiring", "acquired", "marker_pending", "adopted"} {
+ t.Run(phase, func(t *testing.T) {
+ s, req := haAdoptionFixture(t)
+ ctx := context.Background()
+ reg := s.b.Registry
+ state, err := s.b.adoptionWake(ctx, s.rt.Host)
+ if err != nil {
+ t.Fatal(err)
+ }
+ state.DepartureRef, state.DepartureIID = req.Ref, req.IID
+ state.Lifetime, state.Revision, state.Receipt, state.LockETag, state.LockGeneration = req.Lifetime, req.Revision, req.Departure, req.Observed.ETag, req.Observed.Lock.Generation
+ if _, err = reg.ImportHAWake(ctx, s.rt.Host, req.Pair, state); err != nil {
+ t.Fatal(err)
+ }
+ progress, _, err := reg.HAAdoption(ctx, s.rt.Host, req.Lifetime, req.Departure)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if phase != "imported_pending_authority" {
+ for _, next := range []string{"acquiring", "acquired", "marker_pending", "adopted"} {
+ d, _, _ := reg.HADuty(s.rt.Host, req.Lifetime)
+ old := progress.Phase
+ progress.Phase = next
+ progress.AcquiredGeneration = 6
+ if ok, err := reg.CompareHAAdoption(ctx, s.rt.Host, req.Pair, d.Revision, old, progress); err != nil || !ok {
+ t.Fatalf("phase %v %v", ok, err)
+ }
+ if next == phase {
+ break
+ }
+ }
+
+ if phase == "acquiring" || phase == "acquired" {
+ body, _ := json.Marshal(hafresh.Lock{Generation: 6, Owner: hafresh.OwnerFor(lease.CurrentSelf(), 99999, true), ExpiresAt: time.Now().Add(-time.Hour)})
+ putLockFor(t, s.b, s.rt, body)
+ } else {
+ putLockFor(t, s.b, s.rt, haAdoptMarker(t, "a", "i-a", req.Lifetime, 6, false))
+ }
+ }
+ // A fresh service has no fallback duty map or in-memory operation state.
+ path := reg.Path()
+ reg.Close()
+ reg, err = registry.Open(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer reg.Close()
+ s.b.Registry = reg
+ sameBoxReady(s.b)
+ fresh := New(s.a.cfg, s.b, reg)
+ fresh.DutyStore = reg
+ got, err := fresh.AdoptHost(ctx, s.rt, req)
+ if err != nil || (got != Adopted && got != AlreadyAdopted) {
+ t.Fatalf("restart %s: %v %v", phase, got, err)
+ }
+ })
+ }
+}
+
+func TestHAAdoptSuperseded(t *testing.T) {
+ for _, valid := range []bool{false, true} {
+ t.Run(fmt.Sprint(valid), func(t *testing.T) {
+ s, req := haAdoptionFixture(t)
+ putLockFor(t, s.b, s.rt, haAdoptMarker(t, "c", "i-c", req.Lifetime, 8, false))
+ s.a.AdoptionIdentity = func(ctx context.Context, ref, iid string) (bool, error) {
+ return valid && ref == "c" && iid == "i-c", nil
+ }
+ got, err := s.a.AdoptHost(context.Background(), s.rt, req)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if valid && got != Superseded || !valid && got != Deferred {
+ t.Fatalf("successor %v", got)
+ }
+ })
+ }
+}
+
+func haAdoptMarker(t *testing.T, ref, iid, life string, generation int64, clean bool) []byte {
+ t.Helper()
+ body, err := hafresh.MarkerBody(generation, hafresh.Marker{V: 1, Box: ref, IID: iid, Lifetime: life, At: time.Now().UTC(), Clean: clean})
+ if err != nil {
+ t.Fatal(err)
+ }
+ return body
+}
+
+func TestHAAdoptRequestBudget(t *testing.T) {
+ s, req := haAdoptionFixture(t)
+ ctx := context.Background()
+ publishManifest(t, s.b, s.rt, map[string]string{"private.txt": "file tree"}, "PRIVATE=secret")
+ m, _, err := hostfiles.Load(ctx, s.b.FilesStore, s.b.filesPrefix(s.rt.Host))
+ if err != nil {
+ t.Fatal(err)
+ }
+ key := m.Platform[hostfiles.WakeItem].Object
+ start := len(s.fx.Requests())
+ got, err := s.a.AdoptHost(ctx, s.rt, req)
+ if err != nil || got != Adopted {
+ t.Fatalf("adopt %v %v", got, err)
+ }
+ wakes, manifests, locks, puts := 0, 0, 0, 0
+ for _, r := range s.fx.Requests()[start:] {
+ switch r {
+ case "GET " + key:
+ wakes++
+ case "GET " + hostfiles.ManifestKey(s.b.filesPrefix(s.rt.Host)):
+ manifests++
+ case "GET " + lockKeyOf(s.b, s.rt):
+ locks++
+ case "PUT " + lockKeyOf(s.b, s.rt):
+ puts++
+ default:
+ t.Fatalf("unexpected request: %s", r)
+ }
+ }
+ if wakes != 1 || manifests != 2 || locks != 3 || puts != 2 {
+ t.Fatalf("wake=%d manifest=%d lock=%d put=%d", wakes, manifests, locks, puts)
+ }
+}
+
+func TestHAAdoptSequentialDepartures(t *testing.T) {
+ s, req := haAdoptionFixture(t)
+ ctx := context.Background()
+ for _, ref := range []string{"a", "c", "d"} {
+ lease.SetSelf(hafresh.Self{Ref: ref, IID: "i-" + ref, Account: "111122223333", Region: "eu-west-1"})
+ if ref != "a" {
+ reg, err := registry.Open(filepath.Join(t.TempDir(), "registry.db"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer reg.Close()
+ if err = reg.Upsert(s.rt); err != nil {
+ t.Fatal(err)
+ }
+ s.b.Registry = reg
+ s.a = New(s.a.cfg, s.b, reg)
+ s.a.DutyStore = reg
+ req.Observed, err = lease.ReadLock(ctx, s.b.Cfg.Bucket, s.b.Cfg.hibernatePrefix(s.rt.Host), s.b.Cfg.Region)
+ if err != nil {
+ t.Fatal(err)
+ }
+ req.Ref, req.IID = req.Observed.Lock.Release.Box, req.Observed.Lock.Release.IID
+ req.Departure = "departure-" + req.Ref
+ d, err := reg.LoadDuty(ctx, s.rt.Host, req.Lifetime)
+ if err != nil {
+ t.Fatal(err)
+ }
+ req.Revision = d.Revision
+ }
+ got, err := s.a.AdoptHost(ctx, s.rt, req)
+ if err != nil || got != Adopted {
+ t.Fatalf("adopter %s: %v %v", ref, got, err)
+ }
+ }
+ // Later duty acquisition needs only the final adopter's unclean marker.
+ s.b.OwnerTerminated = func(context.Context, string) (bool, error) {
+ t.Error("consulted an earlier departure")
+ return false, nil
+ }
+ s.a.now = func() time.Time { return time.Now().Add(48 * time.Hour) }
+ fresh := New(s.a.cfg, s.b, s.b.Registry)
+ fresh.DutyStore = s.b.Registry
+ fresh.now = s.a.now
+ s.a = fresh
+ worked := false
+ err := s.a.WithDuty(ctx, s.rt, func(context.Context) error { worked = true; return nil })
+ if err != nil || !worked || !s.wokeHere() {
+ t.Fatalf("future duty worked=%v woke=%v err=%v", worked, s.wokeHere(), err)
+ }
+}
+
+func TestHAAdoptThenOrdinaryRestore(t *testing.T) {
+ s, req := haAdoptionFixture(t)
+ ctx := context.Background()
+ if got, err := s.a.AdoptHost(ctx, s.rt, req); err != nil || got != Adopted {
+ t.Fatalf("adopt %v %v", got, err)
+ }
+ for range 3 {
+ _ = s.b.Registry.SetNextDue(s.rt.Host, 100)
+ }
+ if err := s.b.Registry.UpsertTimer(registry.Timer{Host: s.rt.Host, Name: "old-tick", Kind: "schedule", Spec: "every 1m", Path: "/tick", NextAt: 60, DueAt: 60}); err != nil {
+ t.Fatal(err)
+ }
+ tick, err := s.b.Registry.GetTimer(s.rt.Host, "old-tick")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if changed, err := s.b.Registry.AdvanceDutyTimer(*tick, 120); err != nil || !changed {
+ t.Fatalf("advisory advance %v %v", changed, err)
+ }
+
+ publishAdoptWake(t, s, hostfiles.WakeState{V: 1, Host: s.rt.Host, NextDue: 777, Timers: []hostfiles.WakeTimer{{Name: "interim", Kind: "once", Spec: "at 777", Path: "/job", NextAt: 777, Registration: "peer-new"}}})
+ putLockFor(t, s.b, s.rt, haAdoptMarker(t, "c", "i-c", req.Lifetime, 8, false))
+ done, err := s.a.begin(ctx, s.rt, true, nil)
+ if done != nil {
+ defer done()
+ }
+ if err != nil {
+ t.Fatal(err)
+ }
+ rows, err := s.b.Registry.TimersFor(s.rt.Host)
+ if err != nil || len(rows) != 1 || rows[0].Name != "interim" || rows[0].Registration != "peer-new" {
+ t.Fatalf("ordinary restore %+v %v", rows, err)
+ }
+}
+
+func TestHAAdoptAmbiguousMarkerResponse(t *testing.T) {
+ s, req := haAdoptionFixture(t)
+ ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
+ s.fx.AfterWrite(func(method, key string) {
+ if method == "PUT" && key == lockKeyOf(s.b, s.rt) && strings.Contains(string(s.fx.LockBody(s.b.Cfg.hibernatePrefix(s.rt.Host))), "carlos_release") {
+ cancel()
+ }
+ })
+ got, _ := s.a.AdoptHost(ctx, s.rt, req)
+ if got != Deferred {
+ t.Fatalf("lost response completed: %v", got)
+ }
+ s.fx.AfterWrite(nil)
+ before := len(s.fx.Requests())
+ got, err := s.a.AdoptHost(context.Background(), s.rt, req)
+ if err != nil || got != Adopted {
+ t.Fatalf("marker readback replay %v %v", got, err)
+ }
+ for _, r := range s.fx.Requests()[before:] {
+ if strings.HasPrefix(r, "PUT ") {
+ t.Fatalf("replay reacquired %s", r)
+ }
+ }
+}
+func TestDepartureFinalizeTelemetry(t *testing.T) {
+ s, req := haAdoptionFixture(t)
+ var output bytes.Buffer
+ old := log.Writer()
+ log.SetOutput(&output)
+ defer log.SetOutput(old)
+ body, _ := json.Marshal(hafresh.Lock{Generation: 5, Owner: heldByB, ExpiresAt: time.Now().Add(-time.Hour)})
+ putLockFor(t, s.b, s.rt, body)
+ var err error
+ req.Observed, err = lease.ReadLock(context.Background(), s.b.Cfg.Bucket, s.b.Cfg.hibernatePrefix(s.rt.Host), s.b.Cfg.Region)
+ if err != nil {
+ t.Fatal(err)
+ }
+ s.b.OwnerTerminated = func(context.Context, string) (bool, error) { return true, nil }
+ got, err := s.a.AdoptHost(context.Background(), s.rt, req)
+ if err != nil || got != Adopted {
+ t.Fatalf("adopt %v %v", got, err)
+ }
+ if !strings.Contains(output.String(), "cause=departure-finalize") || strings.Contains(output.String(), "taking the host over") {
+ t.Fatalf("finalizer telemetry %s", output.String())
+ }
+ output.Reset()
+ _, _ = s.b.ownerTerminated(context.Background(), s.rt)("i-b")
+ if !strings.Contains(output.String(), "taking the host over") {
+ t.Fatalf("visitor telemetry %s", output.String())
+ }
+}
+
+func TestHAAdoptReclassifiesSameDepartureCAS(t *testing.T) {
+ s, req := haAdoptionFixture(t)
+ ctx := context.Background()
+ changed := false
+ s.fx.BeforeWrite(func(method, key string) {
+ if !changed && method == "PUT" && key == lockKeyOf(s.b, s.rt) {
+ changed = true
+ putLockFor(t, s.b, s.rt, haAdoptMarker(t, req.Ref, req.IID, req.Lifetime, req.Observed.Lock.Generation, false))
+ }
+ })
+ got, _ := s.a.AdoptHost(ctx, s.rt, req)
+ if got != Deferred || !changed {
+ t.Fatalf("first CAS %v changed=%v", got, changed)
+ }
+ s.fx.BeforeWrite(nil)
+ var err error
+ req.Observed, err = lease.ReadLock(ctx, s.b.Cfg.Bucket, s.b.Cfg.hibernatePrefix(s.rt.Host), s.b.Cfg.Region)
+ if err != nil {
+ t.Fatal(err)
+ }
+ got, err = s.a.AdoptHost(ctx, s.rt, req)
+ if err != nil || got != Adopted {
+ t.Fatalf("fresh same-departure view %v %v", got, err)
+ }
+}
+
+func TestHAAdoptSupersededAwake(t *testing.T) {
+ s, req := haAdoptionFixture(t)
+ ctx := context.Background()
+ done, err := s.a.begin(ctx, s.rt, true, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer done()
+ s.a.AdoptionIdentity = func(_ context.Context, ref, iid string) (bool, error) { return ref == "a" && iid == "i-a", nil }
+ got, err := s.a.AdoptHost(ctx, s.rt, req)
+ if err != nil || got != Superseded {
+ t.Fatalf("awake successor %v %v", got, err)
+ }
+}
diff --git a/internal/hostfiles/wake.go b/internal/hostfiles/wake.go
index 32c3019ec..82bf5a39d 100644
--- a/internal/hostfiles/wake.go
+++ b/internal/hostfiles/wake.go
@@ -126,3 +126,23 @@ func LoadWake(ctx context.Context, s release.Store, prefix string, m Manifest, o
}
return ws, true, nil
}
+
+// ValidateWakeEntry checks the manifest reference before cached validated bytes
+// can be reused. It reads no object and admits only this files generation.
+func ValidateWakeEntry(prefix string, m Manifest) error {
+ if err := checkPrefix(prefix); err != nil {
+ return err
+ }
+ e, ok := m.Platform[WakeItem]
+ if !ok {
+ return nil
+ }
+ if e.Deleted || e.Skipped != "" || e.Torn || e.Sealed != "" {
+ return registry.ErrHAWake
+ }
+ origins, err := admitted(prefix, nil)
+ if err != nil {
+ return err
+ }
+ return checkEntry(e, origins)
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 3d6c65fbe..9d863a418 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -67,4 +67,4 @@ plan14-root-reads-domains-zone-credentials.tsv 3b6cd29b87d2728254936722ab45fdadc
plan14-root-reads-devbox-identity.tsv 66a5df05f18f70c3162ad05aa316c1e69c0f053d54f8b682262c266d6aa50772
plan14-root-reads-region-ha-home-placement.tsv b0304f75d2c5f1b9818d0f282b89c00c00b33e3f9bf974031687527c191fb161
plan14-root-reads-storedoor-stream-get.tsv 7e30dee4fb52370555ad173512d7f03782f0fbed725a8a6bf4f7e31f52c23668
-plan14-root-reads-region-ha-p1b3b-t.tsv 3dff55f1b67755f6772c778e565b91838202965a4034484b94694c3a9c0550d9
+plan14-root-reads-region-ha-p1b3b-t.tsv 7aa71b5794417f163f16727f0e5692b6fd6dd838037b42dbd8b2150f24043f9e
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 f0d212677..f7be82efd 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,63 +1,119 @@
# 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.
-# 6 body, 6 sites, 7 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
-# 16 new dispositions: 1 reads re-frozen at their disposition with the claim, 15 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+# 7 body, 6 sites, 9 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 43 new dispositions: 4 reads re-frozen at their disposition with the claim, 38 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 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 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
+@legacy ae8a982ca0849a01741e5577c326fc7b4c8fc2fdc0617de90f4b4a58afadc41f internal/registry/registry.go Registry.migrate legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the registry's SQLite side, as carlos: in the agent (/opt/carlos/carlos agent, carlos-edge.service) and in the registry child (carlos __registry-child, which a root pass forks as the service user), on every registry open; a box CLI verb that opens the registry directly runs it as whoever runs the verb: census-ruling-seeded-instances's body with two more columns added to routes (incarnation and serving_seq, INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule); self-serve moves 1 Task 7;rev3=census-ruling-rootfs-apps-2;basis=one more ALTER TABLE, routes ADD COLUMN runtime TEXT NOT NULL DEFAULT '', beside main's rate_limit, assets_off, asset_gen, incarnation and serving_seq (the last four from the merges of origin/main 3c33f2eb and 953b9fda); the same sixteen sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328/#329 plan 1 Task 4: three more ALTER TABLE statements in the existing loop, routes ADD COLUMN egress_allow, size and policy_expires_at, each TEXT NOT NULL DEFAULT '' and idempotent through the duplicate-column rule; the same sixteen sites, no read added.;rev3=census-ruling-region-ha-p1a;basis=one more ALTER TABLE in the existing loop: routes ADD COLUMN ha INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule; the same sixteen sites, no read added;rev3=census-ruling-ha-p1a-433;basis=the registry's SQLite side as carlos (agent, registry child; a box CLI verb that opens the registry directly runs it as whoever runs it), on every registry open: the ALTER TABLE routes statements are now built from the one migration definition routeAddedColumns (addedColumn name, type, default; review r1 P2): for each entry without the Claim mark, "ALTER TABLE routes ADD COLUMN " + spec(), byte for byte the statements main runs, in main's order, under the same duplicate-column rule. +registry:Claim is that mark, +whole:addedColumn the struct. Every name, type and default is an in-binary literal; no statement added, removed or changed; no read added.;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: one more CREATE TABLE IF NOT EXISTS regional_domains (host TEXT PRIMARY KEY, target, account, app, region TEXT NOT NULL DEFAULT '', created_at INTEGER NOT NULL DEFAULT 0), beside wildcard_domains; the added sites are that statement (+file:Exec, +registry:sql), an in-binary literal; additive, no existing statement changed;rev3=census-ruling-region-ha-p1b3b-t;basis=Create local HA duty/replay tables and revision triggers in the existing registry connection; no new database path. file:Exec@1694,file:Exec@2248,file:Exec@3186,file:Exec@3465,file:Exec@4328,file:Exec@4504,file:Exec@51,file:Exec@600,file:Exec@963,registry:Claim@525,registry:sql@1694,registry:sql@2248,registry:sql@3186,registry:sql@3465,registry:sql@4328,registry:sql@4504,registry:sql@51,registry:sql@600,registry:sql@963,whole:addedColumn@500 c1f7b84329329b6e6508187c7b17d8b5917257800ddb58d60d6e4500dd9d97ab
+@legacy 0ba72f271652762c5d3515d89457c2a91ea61b7f21dcd3c8cb2c62db49012ee2 internal/activator/haadopt.go ExecBackend.adoptionCurrent legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read the current registry route and authoritative lifetime index/record; compare Pair, account, app, DB path, kind and admission fields before effects. Refusal only. registry:Account@222,registry:Account@237,registry:App@251,registry:App@262,registry:DBPath@272,registry:DBPath@286,registry:HoldOp@322,registry:Host@128,registry:ImportGate@342,registry:Kind@299,registry:Kind@311,registry:Replica@366,registry:Status@401,registry:Tunnel@381,whole:Pair@214,whole:Route@174,whole:Route@202,whole:Route@487 5254a172500177ca70cdaa8a04eca26977bd3494d40354ac44904ad9dd4b9ff7
+@legacy 9e1066b0701a2907ef3565ed3bb63789241af783a325fd8fa1c9f10d6568e806 internal/activator/haadopt.go ExecBackend.adoptionWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read only the configured files manifest and its validated wake object. Validate wire state and reuse only bytes already checked against an equal digest; never fetch DB, file-tree or secret objects. registry:Sequence@1148,registry:Sequence@745,registry:WakeDigest@1168,registry:WakeDigest@646,registry:WakeDigest@684,whole:HAWakeImport@1137,whole:HAWakeImport@1198,whole:HAWakeImport@548,whole:HAWakeImport@646,whole:HAWakeImport@684,whole:HAWakeImport@732,whole:HAWakeImport@778 492e282c3a6c817c6818226bbd554c7ecb02c284b828bceb86edb21670d5927a
+@legacy d56b3f146d98007386dcb8b9851ca3234be9f505224c1f51340115cf8bc9b5b3 internal/activator/haadopt.go ExecBackend.bindDutyLifetime legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read existing local duty revision and bind only current record facts to the registry Pair; changed binding invalidates old authority and receipt access. registry:Host@155,registry:Host@256,registry:Host@422,registry:Revision@289,whole:DutyState@202,whole:DutyState@327,whole:DutyState@361,whole:Route@278 a5a2a03c9f1695761901a08f2d4ce3d34c1384f6391336e176bf2446a20ffffc
+@legacy 87230d13977408a12363209f3d015f9710f289a016a0d1e04d930e01b92a9c42 internal/activator/haadopt.go Service.AdoptHost legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Serialize through the existing host operation state. Read local route/revision/receipt plus configured lock/manifest/wake objects; use only restricted ordinary acquire, exact guarded restore, ordinary unclean release and verified readback for adoption. No process launch, local-copy reuse or secret access. registry:AcquiredGeneration@2326,registry:AcquiredGeneration@2699,registry:AcquiredGeneration@3477,registry:AcquiredGeneration@4089,registry:AcquiredGeneration@4180,registry:AcquiredGeneration@4819,registry:AcquiredGeneration@4910,registry:DepartureIID@1797,registry:DepartureIID@5418,registry:DepartureRef@1761,registry:DepartureRef@5402,registry:ExpectedPair@7476,registry:Host@1162,registry:Host@1258,registry:Host@1330,registry:Host@1399,registry:Host@1665,registry:Host@2040,registry:Host@2543,registry:Host@2880,registry:Host@3267,registry:Host@5231,registry:Host@5652,registry:Host@5837,registry:Host@6389,registry:Host@7238,registry:Host@7540,registry:Host@8103,registry:Host@861,registry:Host@959,registry:Lifetime@5454,registry:Lifetime@7445,registry:LockETag@5489,registry:LockGeneration@1833,registry:LockGeneration@5501,registry:Phase@2658,registry:Phase@2675,registry:Phase@3017,registry:Phase@3055,registry:Phase@3111,registry:Phase@4121,registry:Phase@4213,registry:Phase@4763,registry:Phase@4851,registry:Receipt@5478,registry:Revision@2899,registry:Revision@5466,registry:Sequence@2803,registry:Sequence@2823,registry:WakeDigest@2762,registry:WakeDigest@2784,whole:HAAdoption@2916,whole:HAAdoption@5793,whole:HAWakeImport@2745,whole:HAWakeImport@5373,whole:HAWakeImport@5389,whole:HAWakeImport@5397,whole:HAWakeImport@5671,whole:HAWakeImport@7247,whole:HAWakeImport@7549,whole:HAWakeImport@7641,whole:Pair@2893,whole:Pair@5665,whole:Pair@7482,whole:Pair@7502,whole:Route@1128,whole:Route@1171,whole:Route@1178,whole:Route@138,whole:Route@193,whole:Route@2475,whole:Route@3177,whole:Route@4490,whole:Route@453,whole:Route@531,whole:Route@5320,whole:Route@6532,whole:Route@6577,whole:Route@6749,whole:Route@723,whole:Route@7334,whole:Route@889 08ea0276802063cdd4b011db9367a1884d197a0ce0b27442d6904898e973566e
+@legacy b77a83881e9c9b4683781ea536a6fd51448f76689edad3203ddff8f135619e5b internal/activator/haadopt.go Service.adoptionAwakeSuccessor legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read the configured lock and current route/lifetime to recognize an already awake local successor with strictly later generation and independently bound ref/iid. Recheck HoldsAwake before returning Superseded; no registry or lease writes. registry:Host@259,registry:Host@747,whole:Route@680 8f6636a01e491f63ba53fb1e59934574d1294455205938fda8ec9904cd96f53e
+@legacy 17d2ac28599c58a17d0ffe8e4363aea230de40796debec2e9c6d6678a76a6991 internal/activator/haadopt.go adoptionBackend legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Select the existing ExecBackend through SplitBackend using the route; no I/O. whole:Route@143,whole:Route@148 e39ed566dc3449f24f809a034b0c042a36fa725ecc363d3278a724b3a35efbaa
+@legacy 5af143443d17393af4faf8cd0acf844bbce0fb0351c42f114e554c957a333de6 internal/activator/haadopt.go adoptionPair legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route Incarnation and ServingSeq for transaction comparisons; no I/O. registry:Incarnation@88,registry:ServingSeq@116 f483f537f1c75292004bcdc934e45f153f92df6935e082a16af6aabcc6f2a43f
@legacy 33abbadcf662e15febe8dd2b8f8866c830890cc4bd4c77583470d246a9094d65 internal/activator/haduties.go DutyForTick legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read the observed timer through the shared old-occurrence predicate; once-timers are never aged out. whole:Timer@120 f9a9c2fce154cf37b1d1e5ef03319ad0c4c546ad88a1aa78812b7401428995e5
@legacy 008e2ff03d5955fe5de43f0c98b7e5d7ec91773a58ed35544263401989edd905 internal/activator/haduties.go Service.Duty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Pass the local route into dutyInput and the pure chooser. Advisory decision only; no acquire or start. whole:Route@118 15122e8a380cccc304994a0f390ed0de98eb37a765d2362df73a0f6b79dae78e
@legacy 2506ebeb35560294d55dd2429da67f210297deb7283930c371c0ad3b3463e97e internal/activator/haduties.go Service.WithDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host for owned-awake checks and pass provisioned managed instances to restricted singleflight wake before producer writes, including cached legacy rows that discover sticky HA at acquire. Other route kinds keep their path; no authority bypass. registry:Host@584,registry:Host@673,whole:Route@143,whole:Route@422,whole:Route@503 69e34dcb9430c114b0765adffc97be60b72ea939c5c38296bffd7a3bec0d804d
-@legacy 4fcf0b24acbefc3e8efb7ec9e45504bdb03372a3b0302a513b18bbdba600cb0a internal/activator/haduties.go Service.allowDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Recheck lifetime and duty policy on every classified CAS round. Return a non-owner subtype only for a known foreign holder; self expiry and local denial remain deferred. Existing suppression writes and acquire restrictions retained; no read added. registry:Host@1237,registry:Host@555,whole:Route@141,whole:Route@974 2ed5e21384e91dfe599e1267994579859a267c7b9ca3a0da77ce8f93a048a552
-@legacy 53ab473449de8d43122285c04d75ebac9dcbe370ff2105273450fceac91bdd0c internal/activator/haduties.go Service.dutyInput legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read HA classification/lifetime from the existing backend and route host, HA, replica, tunnel, import gate and status; read advisory DutyStore state and cached home projection outside a.mu. No new filesystem or bucket path. registry:HA@244,registry:Host@1079,registry:Host@122,registry:Host@510,registry:Host@576,registry:ImportGate@690,registry:Replica@657,registry:Status@714,registry:Status@733,registry:Tunnel@671,whole:Route@149,whole:Route@216,whole:Route@312,whole:Route@604,whole:Route@885 9cdbbbd19a900153cc5dd6959366c5ec6042816dcb7f97b46d85476823eaf1c5
-@legacy b1d9a2c7b74809dbbf147374dd8f26208ccded1ed8b7ffee62f57e5aa632219e internal/activator/haduties.go Service.rememberDutyAcquired legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host to clear peer suppression only after ordinary acquire succeeds, including visitor wakes. Local advisory state cannot authorize the lease. registry:Host@163,registry:Host@234 74cb5761e354994ad43172ae0f4c4e4c5410a2792492f69d32d100c2dbabed46
-@legacy dd7e1dea5a8679407e0e60ca4833e4f768ed3df6209f4029796adfa5df53ee7f internal/activator/haduties.go Service.rememberDutyRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host to record successful local release basis keyed to the acquired host lifetime. Failed marker writes never reach this hook. registry:Host@162,registry:Host@233 80319f17d46f84e3164bb46ff6ca0bd834f624288644c3f1b3a9fa0b789dc616
-@legacy f4c08c7005e10fcb9013141f0fc1fa45a1cd4dab42f6b1a997c8cd21a46736ba internal/activator/haduties.go Service.restrictDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Bind background restriction to the host lifetime. Use existing duty state to distinguish known peer suppression from local denial before allowing timer aging; no new I/O beyond dutyInput. whole:Route@130,whole:Route@362 9402653561e1731804358972911dd3990a878a9034b512e13b45b2ac8fba8a9f
+@legacy 09fd90e353664d4096e744d96b61a5726ee6fe1bbe332ab9eb714a3e3c71b9a1 internal/activator/haduties.go Service.allowDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Recheck lifetime and duty policy on every classified CAS round. Return a non-owner subtype only for a known foreign holder; self expiry and local denial remain deferred. Existing suppression writes and acquire restrictions retained; no read added. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged. registry:HolderRef@1126,registry:Host@1237,registry:Host@555,registry:NotBefore@471,registry:ViewKey@1156,whole:DutyState@1258,whole:DutyState@1262,whole:DutyState@1342,whole:DutyState@317,whole:DutyState@465,whole:DutyState@576,whole:DutyState@580,whole:Route@141,whole:Route@974 2ed5e21384e91dfe599e1267994579859a267c7b9ca3a0da77ce8f93a048a552
+@legacy 485328c93be720d3f59b3520cf4bde01171b4ba402b548f345df0b535044bc8f internal/activator/haduties.go Service.dutyInput legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read HA classification/lifetime from the existing backend and route host, HA, replica, tunnel, import gate and status; read advisory DutyStore state and cached home projection outside a.mu. No new filesystem or bucket path. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged. registry:Basis@1148,registry:HA@244,registry:HolderEpoch@1383,registry:HolderIID@1225,registry:HolderIID@1427,registry:HolderRef@1161,registry:HolderRef@1211,registry:HolderRef@1413,registry:Host@1079,registry:Host@122,registry:Host@510,registry:Host@576,registry:ImportGate@690,registry:NotBefore@1453,registry:NotBefore@1509,registry:Replica@657,registry:Status@714,registry:Status@733,registry:Tunnel@671,registry:ViewKey@1256,whole:DutyState@1126,whole:DutyState@1537,whole:Route@149,whole:Route@216,whole:Route@312,whole:Route@604,whole:Route@885 9cdbbbd19a900153cc5dd6959366c5ec6042816dcb7f97b46d85476823eaf1c5
+@legacy 032a83a19a5315dae3d2a73c29cde2ad3ed0f7f4d0381904db7b53780d38abd4 internal/activator/haduties.go Service.dutyState legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read the current registry route and existing authoritative lifetime before binding/loading the persistent DutyStore. Pending import never produces adopted basis. whole:DutyState@767,whole:Route@255,whole:Route@354,whole:Route@462,whole:Route@638 06d446e724e6ea211612f0c35f5832c7766548008ba3ebbbedfb99b5fabd11f0
+@legacy 59652118acae1b2772a4525629210093270ebd9e18b0d80fc34a1b717ea95046 internal/activator/haduties.go Service.rememberDutyAcquired legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host to clear peer suppression only after ordinary acquire succeeds, including visitor wakes. Local advisory state cannot authorize the lease. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged. registry:Host@163,registry:Host@234,whole:DutyState@255 74cb5761e354994ad43172ae0f4c4e4c5410a2792492f69d32d100c2dbabed46
+@legacy 4d9325894f840ab9dd2c1752810974b6223a31f4db4de469a3962e7c106ce590 internal/activator/haduties.go Service.rememberDutyRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host to record successful local release basis keyed to the acquired host lifetime. Failed marker writes never reach this hook. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged. registry:Host@162,registry:Host@233,whole:DutyState@254 80319f17d46f84e3164bb46ff6ca0bd834f624288644c3f1b3a9fa0b789dc616
+@legacy 0642aa65559a8ceb931b0efa13b20f7ac655fcc96dde398949bdf3cd2b53bcd3 internal/activator/haduties.go Service.restrictDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Bind background restriction to the host lifetime. Use existing duty state to distinguish known peer suppression from local denial before allowing timer aging; no new I/O beyond dutyInput. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged. whole:DutyState@230,whole:Route@130,whole:Route@362 9402653561e1731804358972911dd3990a878a9034b512e13b45b2ac8fba8a9f
+@legacy 243829e68aa653933558a1a469de10e1e15e4d8ba75b1e4242f6b2f5c6ca6d3a internal/activator/haduties.go Service.saveDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=DutyState is now an alias of registry.DutyState, so existing revision and state reads enter the registry census. Save behavior and CAS remain advisory. registry:Revision@185,registry:Revision@454,registry:Revision@487,registry:Revision@531,registry:Revision@547,whole:DutyState@199,whole:DutyState@359,whole:DutyState@386,whole:DutyState@463,whole:DutyState@574,whole:DutyState@588 6e3777127af58cf8987bf71aa05d53f8ef97ca228668b4e1994312e7c70bf47f
@legacy f75c174a45a57feeca885d61031026907fee317ebf2b2dacba6a25202e070187 internal/activator/haduties.go dutyBackend legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Dispatch the existing backend by local route through SplitBackend, for HA classification and self identity. No new I/O. whole:Route@235,whole:Route@240 835097870b1a956888da998aee935491325c48d7847d7bc5ba650a23306e2db2
+@legacy 4598c4202fca743b3c7e08038176ebef0aed7794a56574ae0978094952752e14 internal/activator/haduties.go dutyRefusal legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=DutyState alias makes the existing holder and deadline reads visible to the registry census; refusal behavior unchanged. registry:HolderIID@306,registry:HolderRef@223,registry:HolderRef@245,registry:HolderRef@276,registry:NotBefore@167 7d8646a06d8d37ce9e8c736b1fb1e59b8046ba245e1957e0301791fd9032910d
@legacy 780da2b6b37d2fc6e2baa16c11257cb492226e4e553679ecc244186fb90d70d4 internal/edge/wakeplacement.go Edge.DutySnapshot legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Pass the route to the existing cached home projection; no store reads, network reads or new publication. whole:Route@108 fa66b0bb586cb9a3214d818fbe40181f3ca7d5655f5af4ac259377cf4d5c133d
@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 a91f87c8890199a4a247c9b3e102056da4365987a0f9e3fa43daf0ee6c4f25db 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. registry:Timers@284,registry:Timers@306,whole:HAWakeImport@587,whole:HAWakeImport@624,whole:Timer@290,whole:Timer@312 fa0be86a4b4a67da13e127a51905532f7edccee30a84b92c159ad4d6b19d4bba
+@legacy 9b328e13ed07321e2fcc0931e36895007ce7ffa631e0db5690b62454197c19f6 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. registry:AcquiredGeneration@1612,registry:AcquiredGeneration@366,registry:Changed@336,registry:Incarnation@1161,registry:Lifetime@1133,registry:Lifetime@1666,registry:LockETag@1699,registry:LockGeneration@1711,registry:LockGeneration@389,registry:Phase@1603,registry:Phase@1858,registry:Phase@411,registry:Phase@572,registry:Phase@628,registry:Phase@689,registry:Receipt@1678,registry:Sequence@1648,registry:ServingSeq@1179,registry:WakeDigest@1634,registry:remote@150,registry:remote@182,whole:HAAdoption@308,whole:HAAdoption@318,whole:Pair@256,whole:Pair@262,whole:remoteClient@152,whole:remoteClient@184 cf8772db67541b84ecb80c57a61427625ae39e467eb9c7b15dc0b5dd0f9e2214
+@legacy fc066eaff468d3cfc93095eecc601887b1df4bb1385b799db2fadca3292072f8 internal/registry/ha_departures.go Registry.HAAdoption legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Query local receipt progress only while its binding matches the active route lifetime; remote transport returns the same result. Historical receipts remain inaccessible after retirement. file:QueryRowContext@352,registry:AcquiredGeneration@755,registry:Adoption@259,registry:Changed@273,registry:DepartureIID@795,registry:DepartureRef@778,registry:LockETag@685,registry:LockGeneration@698,registry:Phase@745,registry:Sequence@732,registry:WakeDigest@717,registry:remote@111,registry:remote@143,registry:sql@352,whole:HAAdoption@263,whole:HAAdoption@856,whole:HAAdoption@881,whole:remoteClient@113,whole:remoteClient@145 c237de70749278359454cfe5795f3802647dadd24806f4e96a914072afdcb12c
+@legacy 46343d2d3e4af175a73085d532612ed6e192ae4b2464f6f1c14ebd9a1c8bb6b9 internal/registry/ha_departures.go Registry.ImportHAWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Validate all state then transactionally compare current Pair, lifetime, binding, revision and receipt before replacing rows and recording pending authority. Replays never replace rows. file:QueryRowContext@1432,file:QueryRowContext@797,registry:DepartureIID@1895,registry:DepartureIID@2556,registry:DepartureIID@394,registry:DepartureRef@1861,registry:DepartureRef@2540,registry:DepartureRef@370,registry:Import@266,registry:Incarnation@1029,registry:Lifetime@1219,registry:Lifetime@1616,registry:Lifetime@2463,registry:Lifetime@418,registry:LockETag@1797,registry:LockETag@2475,registry:LockETag@457,registry:LockGeneration@1825,registry:LockGeneration@2487,registry:LockGeneration@499,registry:Receipt@1599,registry:Receipt@2446,registry:Receipt@438,registry:Revision@2072,registry:Sequence@2519,registry:ServingSeq@1048,registry:WakeDigest@2505,registry:WakeDigest@477,registry:remote@125,registry:remote@157,whole:HAWakeImport@2156,whole:HAWakeImport@242,whole:HAWakeImport@248,whole:HAWakeImport@317,whole:Pair@1233,whole:Pair@1241,whole:Pair@226,whole:Pair@232,whole:claimTransaction@2146,whole:remoteClient@127,whole:remoteClient@159 14493a51df048a87f9df1e1f899647366acbf682092bce9cc262c1795bb7068f
+@legacy b7a4b67359d1c8d6b9ff084ae95ffa50b1f52196d2bf70512c4436ae1380a5fd internal/registry/ha_departures.go Registry.ReplaceHAWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=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. registry:remote@125,registry:remote@95,whole:HAWakeImport@195,whole:HAWakeImport@201,whole:HAWakeImport@258,whole:HAWakeImport@431,whole:claimTransaction@421,whole:remoteClient@127,whole:remoteClient@97 58e2ba452feb396ea64d6f280554122020486721301588d29b44b0e8c9797e2c
+@legacy feb88ca3d48df0beb51eb597eaddd778194f5eb9109151f5c8ddefa337f090c5 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. file:Exec@59,registry:sql@59 4650aa0307467c048f2a788e9d63903cc3f3438c28f65477d94b065b5385cfb8
+@legacy cd31ea496bb9f046fda6a25215a137ac1c05540855439efb8ef120608fcff45a 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. registry:Attempts@460,registry:ClaimOwnership@385,registry:DueAt@429,registry:Host@291,registry:Kind@281,registry:LastAt@444,registry:Name@334,registry:Name@350,registry:Name@508,registry:NextAt@413,registry:NextDue@75,registry:Path@555,registry:Path@586,registry:Path@622,registry:Path@656,registry:Path@693,registry:Registration@361,registry:Replication@110,registry:Spec@241,registry:Timers@195,whole:ClaimOwnership@387,whole:Timer@197 2f228199b3c797da7e79d4d7bb58b0d7d508f45b5d584e792edaae13e2a8199d
+@legacy 79f354a81814b8640bac0517237ce0ceae8136d359f8fd3f708404fa82967dca 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. file:QueryRowContext@154,file:QueryRowContext@545,registry:Attempts@1191,registry:ClaimIncarnation@1241,registry:ClaimOwner@1275,registry:ClaimOwnership@888,registry:ClaimOwnership@919,registry:ClaimOwnership@938,registry:ClaimRowID@1289,registry:ClaimRowID@959,registry:ClaimStamp@1261,registry:CreatedAt@1203,registry:DueAt@1216,registry:ExpectedPair@103,registry:ExpectedPair@355,registry:ExpectedPair@383,registry:Incarnation@355,registry:Kind@1123,registry:Kind@667,registry:LastAt@1157,registry:LastMs@1181,registry:LastStatus@1167,registry:Lifetime@410,registry:Name@1115,registry:NextAt@1147,registry:NextDue@1449,registry:Path@1139,registry:Registration@1225,registry:Registration@974,registry:Replication@1460,registry:ServingSeq@383,registry:Spec@1131,registry:Timers@840,whole:ClaimOwnership@891,whole:ClaimOwnership@921,whole:ClaimOwnership@941,whole:Pair@105,whole:Pair@357,whole:Pair@385,whole:Timer@842 3fa4a363f34443bb23f3512bafa25219ddc6c7d6046f9227441a9f67e8c13f0c
+@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
+@legacy 6f6dc16c1fd5d0df952f2cb30ad66b3fb2d95dc21740a2c99900d7f61093da94 internal/registry/ha_duties.go Registry.HADuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read local duty metadata from the existing registry or its remote transport; mismatched/inactive lifetime returns no authority. file:QueryRow@309,registry:Basis@489,registry:Changed@220,registry:Duty@210,registry:HolderEpoch@539,registry:HolderIID@513,registry:HolderRef@499,registry:NotBefore@793,registry:Revision@467,registry:Revision@743,registry:ViewKey@527,registry:remote@112,registry:remote@80,registry:sql@309,whole:DutyState@214,whole:DutyState@663,whole:DutyState@862,whole:remoteClient@114,whole:remoteClient@82 6d6ecfb20f798554349488d42fc2fb633161361867640ef8fcf481e621cc2445
+@legacy e93bd8824084189b0896aefbb6e6454c2dc5a3fd419f9d9322175fe41a5e5f5d internal/registry/ha_duties.go Registry.LoadDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Load persisted duty state or initialize an unbound live row with captured revision; refuse an already different binding. registry:Duty@221,registry:Revision@560,registry:remote@125,registry:remote@93,registry:sql@403,whole:DutyState@225,whole:DutyState@306,whole:DutyState@604,whole:DutyState@670,whole:DutyState@702,whole:DutyState@722,whole:DutyState@812,whole:remoteClient@127,whole:remoteClient@95 a9191edb17d7a125db9634178211dbd4945738262fbb13f71e9cb535c9d3aaf9
+@legacy d9f6e4cfd1237707705facbc0571fb8de96573e1a3987f85640044832828cb6f internal/registry/ha_duties.go Registry.migrateHADuties legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Create local duties and revision/binding triggers. Timer and relevant route mutations advance revision in their own transaction; retirement/recreation clears authority and suppression. file:Exec@56,registry:sql@56 0f352104efb218960cfce6b9f145d2ea76a7e71aa3d6c917c9b61d377584eed9
@legacy 15e8e57aa35412027f3907fd0de751274f9e72641e5c16f6da4b88cb2acf7a37 internal/registry/timers.go Registry.AdvanceDutyTimer legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Update only local recurring timer progress with registration, DueAt and NextAt comparisons. Read timer fields and existing registry sql/remote handles; no last-delivery stamp, once deletion or external path. file:Exec@218,registry:DueAt@416,registry:Host@384,registry:Kind@143,registry:Name@392,registry:NextAt@171,registry:NextAt@425,registry:Registration@400,registry:remote@77,registry:sql@218,whole:remoteClient@79 ce0f893ed21cc2f5df3ca365f9b27d9904b969fd8fff1d68b4cd4f4676d0bb69
@legacy 7c6c9fedebd681f46078f51a51142fb1c5df461465e20fb86abf88bf3a2bb964 internal/schedule/runner.go OldDutyTick legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read timer kind and natural due occurrence; only recurring occurrences at least 15 minutes old qualify. No writes. registry:Kind@82,whole:Timer@71 b7f99aa2e76858e06675d9aa6b9266600423714cfd7585860eeed12021eaa0f0
@legacy 351bcef78f571f8c2b6d857aa635cc7e6806782b7a9741ec83fd10c7696da63f internal/schedule/runner.go Runner.fireOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Existing fire body moved beneath admission; deferred delivery now returns without recording a failure. Same token preparation, parsing, guarded row checks and delivery authority. registry:Host@248,registry:Host@390,registry:Host@696,registry:Host@842,registry:Name@257,registry:Name@399,registry:Spec@153,registry:Spec@265,whole:Route@1010,whole:Route@1207,whole:Route@1509,whole:Route@1572,whole:Route@1776,whole:Route@667,whole:Route@747,whole:Route@773,whole:Route@884,whole:Timer@1014,whole:Timer@113,whole:Timer@1211,whole:Timer@1311,whole:Timer@1513,whole:Timer@1780,whole:Timer@322,whole:Timer@888 6cfedad07127980fe70c6206ec8e2f994c2b6ffc2017b60ddaaeba4faeb0e25f
+@legacy 95a7bd7d5dcbbc95c0d1da528070c27f93a20cb3431a21ab354c6a923976201f internal/activator/hawake.go ExecBackend.acquireClassified legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the acquire's classification: a legacy route (sidecar, hand-added or not an instance) takes lease.Acquire and refuses on an HA-format lock; otherwise isHA (a record read error fails the wake, never falls back to legacy); not HA takes lease.Acquire, and an HA-format lock there marks the host HA for good and continues; HA requires haContained before any lock request, then lease.AcquireHA with the same-box proof; held and refused leases map to errLeaseHeld and errLeaseRefused (leaseError); +registry:Host, +whole:Route x7;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: the HA acquire's Proofs gain OwnerTerminated (b.ownerTerminated(ctx, rt)) beside SameBoxEmpty; one more whole:Route site passes the route to ownerTerminated; nothing new is read; the proof is consulted only by hafresh.DecideAcquire for another box's expired HA lock;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 7, two-box fleet test): the two legacy acquires call b.acquireLegacy(ctx, prefix), which is acquireLegacyLease exactly when ExecBackend.LeaseIdentity is nil and LeaseTTL is 0 (the agent never sets them), otherwise lease.AcquireAs with that identity and TTL. The classification, the HA path and every refusal are unchanged. Read sites unchanged (9). Agent, not root.;rev3=census-ruling-region-ha-p1b3b-t;basis=Select the restriction-only AcquireHAForDuty for background contexts, including sticky HA reclassification; observe successful ordinary acquires to clear stale suppression. Add a whole-route observer argument; no new authority. B2 binds the current authoritative lifetime and advances local revision before HA acquire, invalidating concurrent adoption I/O. Ordinary lease authority and restore ordering remain unchanged. registry:Basis@1331,registry:Host@106,registry:Revision@1401,whole:DutyState@1413,whole:Route@1137,whole:Route@1274,whole:Route@1572,whole:Route@1617,whole:Route@195,whole:Route@2214,whole:Route@2310,whole:Route@533,whole:Route@584,whole:Route@834 97e8ca4ae87da0aa126b8bacfaf3c8ba446e2771a30abb03df303c861dc9dfc0
@legacy c4860d69f95a542d19c0664c392a5981581b38837d90a3d8294d6cd0a25f0757 internal/host/runs.go runsWorker.pickup legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), its runs worker: a picked run's detached execution runs under provision.WithLifetimes of the worker's judge, so execute's record writes refuse a stale record; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 16 (ruling R7): on a fleet box a run already let go is skipped before any read; the pickup CAS moves behind the run's sink (sinkFor: the bucket's, as before, or on a fleet box the run door relay once a grant verifies); one more whole-Route site, the row this box already owns passed to sinkFor; nothing new opened, run or followed;rev3=census-ruling-region-ha-p1b3b-t;basis=Wrap both bucket and relay pickup in the service duty gate; refuse an HA route when no gate exists. Reads HA and passes the route; existing pickup moved to pickupOwned. registry:HA@343,whole:Route@244,whole:Route@308,whole:Route@388 42cb4d25952fb42237296d5050bd2e21b7ecc6ff5bdb1ebae1a13d26efe648bf
+@legacy 0e04609e3758a0900e002d4e83b0a5a3acb3b9a69ff09ab6cf42d6200f806fec internal/hostfiles/wake.go ImportWake legacy accepted-legacy accepted-legacy;rev3=J1,J2,J4;basis=root-route;rev3=census-ruling-region-ha-p1b3b-t;basis=Delegate validated conversion to one atomic ReplaceHAWake transaction instead of three independent writes; no lease or file effect. whole:HAWakeImport@200 c1fa57ce9de9cb527c7a08173c1be9f50481a073d10bc810631d506a1d79ecb5
@legacy 338c8f8dbc28811430676648d55a97266f32903b9b1e56a4b9683ca287446de5 internal/activator/activator.go Service.ServeScheduled legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-plans-4d-lapse;basis=answers a scheduled request to a route the turned-off hook names with the maintenance response before serve (plans 4d). One more whole-row read: the row handed to the hook (a.disabled), as the fence and maxRunFor are asked.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: wraps the proxy so that, after the wake, fillScheduledToken(r, rt) sets an HA host's tick bearer token from its restored env file; an error there logs (+registry:Host, rt.Host) and answers 503 with Retry-After: 5; a non-HA host's tick is left as the runner built it; +whole:Route is rt handed to fillScheduledToken; keeps legacy;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 5: the activator-managed test is Route.ActivatorOwned (a hibernating instance, or an instance with a runtime) instead of Kind and Hibernate inline; reads the same fields plus Runtime through the method;rev3=census-ruling-region-ha-p1b3b-t;basis=Run the local scheduled request under WithDuty and retain existing HTTP refusal text; add route arguments to background admission and error handling. No forwarding. registry:Host@669,registry:Status@146,registry:Status@165,whole:Route@1143,whole:Route@248,whole:Route@600,whole:Route@883,whole:Route@964 41bcecc8605bfc52536690da309860ffc7464646dd4e2dbf577fc2bd287c9061
@legacy 1bfd691c54e4630c5bb20af14bc1150e618f977ab487206a9baac77d59366876 internal/activator/activator.go Service.wake 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-wake-latency-1;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=logs that timer's breakdown to the journal after a successful wake (w.steps.String(), e.host, w.wakeTook); no read added;rev3=census-ruling-plans-4d-lapse;basis=cancels a wake whose row the turned-off hook names, like a fence, unless it is a move's active probe (plans 4d). One more whole-row read: the row handed to the hook (a.disabled). Only refuses.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: a refusal before the lease is reported once per change (noteRootfsRefusal) instead of a wake-failure event; the proc, generation and replica are installed through installProcLocked (which puts a resident under its lease watch before the fence); residency notes the outcome (noteResidentWakeLocked); same generation values;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R [pf R3.5]: the wake's context ceiling is wakeCeilingFor(e.route): the old 5 minutes for a binary row, 5 minutes plus runs.MaxTimeout for a rootfs row (room for a release inside the wake); new site +whole:Route (e.route to wakeCeilingFor, which reads Runtime only); no other change;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (branch review R1 P1-1): the wake's context is also cancelled before doWake when RetireExcept has marked the entry retired (e.retired, in memory under a.mu), as it is for a fence or a shutdown. Read sites unchanged (13). Agent, not root; it only refuses more.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Carry successful hold preparation into its wake, preserve actual mode in the generation and OnWake projection, and project serving version/mode through the narrow registry writer before releasing wake waiters. Final review I1: SetServingMode only for non-worker successful wakes with a nonempty spawned version and either a stateless generation or a mode transition from the route. Ordinary stateful wakes leave rollout status and the wake critical path unchanged.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds a.cancelHeldLegsLocked(e, 0) on the failed-wake path before the entry is deleted, and after close(e.ready) on success calls a.noteHeldAdmissible(e.host), the non-blocking held wake callback, outside a.mu. No read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Install the successful-acquire observer and restrict due, worker and resident starts before doWake, off a.mu. Add a whole-route argument to restriction; refused work has known-no-start evidence. registry:Socket@8151,registry:Socket@8312,registry:Stateless@10394,registry:Stateless@9646,whole:Route@10396,whole:Route@1047,whole:Route@1350,whole:Route@2865,whole:Route@2992,whole:Route@3049,whole:Route@417,whole:Route@6399,whole:Route@8104,whole:Route@8153,whole:Route@8314,whole:Route@9637,whole:Route@9692 6204eb606d27d250370fc2a8a821195ea3eb3b8648e7656c52a25d1488a8c2b7
@legacy 099d44a548d58566d3366996f115bda81c0e28a4fbc089adee218f5dea8476fb internal/activator/harelease.go Service.releaseHAClean legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: an HA entry's release, in order: host slice read empty through haHostEmpty (else errHostSliceUnproven and nothing written; the same check, moved into that helper by final fix F1), stop and join the files publisher, its final publish (2 min budget), the replica's final sync (Finish, 30 s), the local release record, then the release marker PUT (10 s), clean only when the final publish was complete and the sync and record succeeded; a failed PUT is a persisted lease obligation; +registry:Host, +whole:Route x4;rev3=census-ruling-region-ha-p1b3b-t;basis=Record advisory local-release basis only after ReleaseMarker succeeds. Add a whole-route argument to local duty bookkeeping; release order and lease authority unchanged. registry:Host@1825,whole:Route@102,whole:Route@1098,whole:Route@1236,whole:Route@1734,whole:Route@244 1d28991be7fe53f505751cde1f9822ffee9598d2eea3834eda94f42406315236
-@legacy 289335850fa4fd291988c44bb717b11054cb934fe8432b339f74c843d5db3379 internal/activator/hawake.go ExecBackend.acquireClassified legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the acquire's classification: a legacy route (sidecar, hand-added or not an instance) takes lease.Acquire and refuses on an HA-format lock; otherwise isHA (a record read error fails the wake, never falls back to legacy); not HA takes lease.Acquire, and an HA-format lock there marks the host HA for good and continues; HA requires haContained before any lock request, then lease.AcquireHA with the same-box proof; held and refused leases map to errLeaseHeld and errLeaseRefused (leaseError); +registry:Host, +whole:Route x7;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: the HA acquire's Proofs gain OwnerTerminated (b.ownerTerminated(ctx, rt)) beside SameBoxEmpty; one more whole:Route site passes the route to ownerTerminated; nothing new is read; the proof is consulted only by hafresh.DecideAcquire for another box's expired HA lock;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 7, two-box fleet test): the two legacy acquires call b.acquireLegacy(ctx, prefix), which is acquireLegacyLease exactly when ExecBackend.LeaseIdentity is nil and LeaseTTL is 0 (the agent never sets them), otherwise lease.AcquireAs with that identity and TTL. The classification, the HA path and every refusal are unchanged. Read sites unchanged (9). Agent, not root.;rev3=census-ruling-region-ha-p1b3b-t;basis=Select the restriction-only AcquireHAForDuty for background contexts, including sticky HA reclassification; observe successful ordinary acquires to clear stale suppression. Add a whole-route observer argument; no new authority. registry:Host@106,whole:Route@1137,whole:Route@1256,whole:Route@1301,whole:Route@1898,whole:Route@195,whole:Route@1994,whole:Route@533,whole:Route@584,whole:Route@834 8b8632218aa6092a07d95d9eb9b19746693fdfb956363a4eadb64f864bfd4588
+@legacy 3a8138aa3c125359a30ff09994bbf3afc480d6d5420cdd809c9979c6e89f977f internal/activator/hatakeover.go ExecBackend.ownerTerminated legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b1;basis=new (region HA P1b-1): returns nil without eb.OwnerTerminated; else a closure calling it with the lock owner's instance id (from the HA lock, written by a box agent) and logging rt.Host on a takeover and, at most once a minute per host, on an error; the id goes only to EC2 DescribeInstances in this box's own account and region and is checked against the reply (termfence.SameAccountTerminated); root never calls it;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route Host for structured departure-finalize telemetry; retain the same confirmation callback and visitor alarm behavior. registry:Host@378,registry:Host@472,registry:Host@638 7082fa0f1b04d12676d4e0abf5d7bafaf4041fa3910e89c230ff4eba1949d785
@legacy b63fb307ecc0f675fab8628b5615fdb07abad1986396b70bc968395c561033cd 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/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-region-ha-p1b3b-t;basis=Add the B2 DutyStore interface field and process-local duty view, suppression and invalidation state. No read added. 17e0490fd371ac6b9c429da224167c2052914748946a62384f6fd90654dbedde
+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-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. 831ade9a0afe342d0ea496c5d3b0d4ea3c64821d7e0de9bd5f0d0a553b360b6b
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. file:Exec@17719,file:Open@1150,file:Statfs@45853,registry:App@11474,whole:Route@11466,whole:Route@29433 2de8f7353b97b13fd429a1aab5c15d89873649be8bb39bde6150ed24ff95faf2
+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. file:Exec@17719,file:Open@1150,file:Statfs@45875,registry:App@11474,whole:Route@11466,whole:Route@29455 0a84789bb477c067a3ca1db8fc6712da9895491fbfafdc48bf34a40b6e189416
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
+internal/registry/registry.go Registry.migrate legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the registry's SQLite side, as carlos: in the agent (/opt/carlos/carlos agent, carlos-edge.service) and in the registry child (carlos __registry-child, which a root pass forks as the service user), on every registry open; a box CLI verb that opens the registry directly runs it as whoever runs the verb: census-ruling-seeded-instances's body with two more columns added to routes (incarnation and serving_seq, INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule); self-serve moves 1 Task 7;rev3=census-ruling-rootfs-apps-2;basis=one more ALTER TABLE, routes ADD COLUMN runtime TEXT NOT NULL DEFAULT '', beside main's rate_limit, assets_off, asset_gen, incarnation and serving_seq (the last four from the merges of origin/main 3c33f2eb and 953b9fda); the same sixteen sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328/#329 plan 1 Task 4: three more ALTER TABLE statements in the existing loop, routes ADD COLUMN egress_allow, size and policy_expires_at, each TEXT NOT NULL DEFAULT '' and idempotent through the duplicate-column rule; the same sixteen sites, no read added.;rev3=census-ruling-region-ha-p1a;basis=one more ALTER TABLE in the existing loop: routes ADD COLUMN ha INTEGER NOT NULL DEFAULT 0, idempotent through the duplicate-column rule; the same sixteen sites, no read added;rev3=census-ruling-ha-p1a-433;basis=the registry's SQLite side as carlos (agent, registry child; a box CLI verb that opens the registry directly runs it as whoever runs it), on every registry open: the ALTER TABLE routes statements are now built from the one migration definition routeAddedColumns (addedColumn name, type, default; review r1 P2): for each entry without the Claim mark, "ALTER TABLE routes ADD COLUMN " + spec(), byte for byte the statements main runs, in main's order, under the same duplicate-column rule. +registry:Claim is that mark, +whole:addedColumn the struct. Every name, type and default is an in-binary literal; no statement added, removed or changed; no read added.;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: one more CREATE TABLE IF NOT EXISTS regional_domains (host TEXT PRIMARY KEY, target, account, app, region TEXT NOT NULL DEFAULT '', created_at INTEGER NOT NULL DEFAULT 0), beside wildcard_domains; the added sites are that statement (+file:Exec, +registry:sql), an in-binary literal; additive, no existing statement changed;rev3=census-ruling-region-ha-p1b3b-t;basis=Create local HA duty/replay tables and revision triggers in the existing registry connection; no new database path. file:Exec@1694,file:Exec@2248,file:Exec@3186,file:Exec@3465,file:Exec@4328,file:Exec@4504,file:Exec@51,file:Exec@600,file:Exec@963,registry:Claim@525,registry:sql@1694,registry:sql@2248,registry:sql@3186,registry:sql@3465,registry:sql@4328,registry:sql@4504,registry:sql@51,registry:sql@600,registry:sql@963,whole:addedColumn@500 c1f7b84329329b6e6508187c7b17d8b5917257800ddb58d60d6e4500dd9d97ab
+internal/activator/haadopt.go ExecBackend.adoptionCurrent legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read the current registry route and authoritative lifetime index/record; compare Pair, account, app, DB path, kind and admission fields before effects. Refusal only. registry:Account@222,registry:Account@237,registry:App@251,registry:App@262,registry:DBPath@272,registry:DBPath@286,registry:HoldOp@322,registry:Host@128,registry:ImportGate@342,registry:Kind@299,registry:Kind@311,registry:Replica@366,registry:Status@401,registry:Tunnel@381,whole:Pair@214,whole:Route@174,whole:Route@202,whole:Route@487 5254a172500177ca70cdaa8a04eca26977bd3494d40354ac44904ad9dd4b9ff7
+internal/activator/haadopt.go ExecBackend.adoptionWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read only the configured files manifest and its validated wake object. Validate wire state and reuse only bytes already checked against an equal digest; never fetch DB, file-tree or secret objects. registry:Sequence@1148,registry:Sequence@745,registry:WakeDigest@1168,registry:WakeDigest@646,registry:WakeDigest@684,whole:HAWakeImport@1137,whole:HAWakeImport@1198,whole:HAWakeImport@548,whole:HAWakeImport@646,whole:HAWakeImport@684,whole:HAWakeImport@732,whole:HAWakeImport@778 492e282c3a6c817c6818226bbd554c7ecb02c284b828bceb86edb21670d5927a
+internal/activator/haadopt.go ExecBackend.bindDutyLifetime legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read existing local duty revision and bind only current record facts to the registry Pair; changed binding invalidates old authority and receipt access. registry:Host@155,registry:Host@256,registry:Host@422,registry:Revision@289,whole:DutyState@202,whole:DutyState@327,whole:DutyState@361,whole:Route@278 a5a2a03c9f1695761901a08f2d4ce3d34c1384f6391336e176bf2446a20ffffc
+internal/activator/haadopt.go Service.AdoptHost legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Serialize through the existing host operation state. Read local route/revision/receipt plus configured lock/manifest/wake objects; use only restricted ordinary acquire, exact guarded restore, ordinary unclean release and verified readback for adoption. No process launch, local-copy reuse or secret access. registry:AcquiredGeneration@2326,registry:AcquiredGeneration@2699,registry:AcquiredGeneration@3477,registry:AcquiredGeneration@4089,registry:AcquiredGeneration@4180,registry:AcquiredGeneration@4819,registry:AcquiredGeneration@4910,registry:DepartureIID@1797,registry:DepartureIID@5418,registry:DepartureRef@1761,registry:DepartureRef@5402,registry:ExpectedPair@7476,registry:Host@1162,registry:Host@1258,registry:Host@1330,registry:Host@1399,registry:Host@1665,registry:Host@2040,registry:Host@2543,registry:Host@2880,registry:Host@3267,registry:Host@5231,registry:Host@5652,registry:Host@5837,registry:Host@6389,registry:Host@7238,registry:Host@7540,registry:Host@8103,registry:Host@861,registry:Host@959,registry:Lifetime@5454,registry:Lifetime@7445,registry:LockETag@5489,registry:LockGeneration@1833,registry:LockGeneration@5501,registry:Phase@2658,registry:Phase@2675,registry:Phase@3017,registry:Phase@3055,registry:Phase@3111,registry:Phase@4121,registry:Phase@4213,registry:Phase@4763,registry:Phase@4851,registry:Receipt@5478,registry:Revision@2899,registry:Revision@5466,registry:Sequence@2803,registry:Sequence@2823,registry:WakeDigest@2762,registry:WakeDigest@2784,whole:HAAdoption@2916,whole:HAAdoption@5793,whole:HAWakeImport@2745,whole:HAWakeImport@5373,whole:HAWakeImport@5389,whole:HAWakeImport@5397,whole:HAWakeImport@5671,whole:HAWakeImport@7247,whole:HAWakeImport@7549,whole:HAWakeImport@7641,whole:Pair@2893,whole:Pair@5665,whole:Pair@7482,whole:Pair@7502,whole:Route@1128,whole:Route@1171,whole:Route@1178,whole:Route@138,whole:Route@193,whole:Route@2475,whole:Route@3177,whole:Route@4490,whole:Route@453,whole:Route@531,whole:Route@5320,whole:Route@6532,whole:Route@6577,whole:Route@6749,whole:Route@723,whole:Route@7334,whole:Route@889 08ea0276802063cdd4b011db9367a1884d197a0ce0b27442d6904898e973566e
+internal/activator/haadopt.go Service.adoptionAwakeSuccessor legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read the configured lock and current route/lifetime to recognize an already awake local successor with strictly later generation and independently bound ref/iid. Recheck HoldsAwake before returning Superseded; no registry or lease writes. registry:Host@259,registry:Host@747,whole:Route@680 8f6636a01e491f63ba53fb1e59934574d1294455205938fda8ec9904cd96f53e
+internal/activator/haadopt.go adoptionBackend legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Select the existing ExecBackend through SplitBackend using the route; no I/O. whole:Route@143,whole:Route@148 e39ed566dc3449f24f809a034b0c042a36fa725ecc363d3278a724b3a35efbaa
+internal/activator/haadopt.go adoptionPair legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route Incarnation and ServingSeq for transaction comparisons; no I/O. registry:Incarnation@88,registry:ServingSeq@116 f483f537f1c75292004bcdc934e45f153f92df6935e082a16af6aabcc6f2a43f
internal/activator/haduties.go DutyForTick legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read the observed timer through the shared old-occurrence predicate; once-timers are never aged out. whole:Timer@120 f9a9c2fce154cf37b1d1e5ef03319ad0c4c546ad88a1aa78812b7401428995e5
internal/activator/haduties.go Service.Duty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Pass the local route into dutyInput and the pure chooser. Advisory decision only; no acquire or start. whole:Route@118 15122e8a380cccc304994a0f390ed0de98eb37a765d2362df73a0f6b79dae78e
internal/activator/haduties.go Service.WithDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host for owned-awake checks and pass provisioned managed instances to restricted singleflight wake before producer writes, including cached legacy rows that discover sticky HA at acquire. Other route kinds keep their path; no authority bypass. registry:Host@584,registry:Host@673,whole:Route@143,whole:Route@422,whole:Route@503 69e34dcb9430c114b0765adffc97be60b72ea939c5c38296bffd7a3bec0d804d
-internal/activator/haduties.go Service.allowDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Recheck lifetime and duty policy on every classified CAS round. Return a non-owner subtype only for a known foreign holder; self expiry and local denial remain deferred. Existing suppression writes and acquire restrictions retained; no read added. registry:Host@1237,registry:Host@555,whole:Route@141,whole:Route@974 2ed5e21384e91dfe599e1267994579859a267c7b9ca3a0da77ce8f93a048a552
-internal/activator/haduties.go Service.dutyInput legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read HA classification/lifetime from the existing backend and route host, HA, replica, tunnel, import gate and status; read advisory DutyStore state and cached home projection outside a.mu. No new filesystem or bucket path. registry:HA@244,registry:Host@1079,registry:Host@122,registry:Host@510,registry:Host@576,registry:ImportGate@690,registry:Replica@657,registry:Status@714,registry:Status@733,registry:Tunnel@671,whole:Route@149,whole:Route@216,whole:Route@312,whole:Route@604,whole:Route@885 9cdbbbd19a900153cc5dd6959366c5ec6042816dcb7f97b46d85476823eaf1c5
-internal/activator/haduties.go Service.rememberDutyAcquired legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host to clear peer suppression only after ordinary acquire succeeds, including visitor wakes. Local advisory state cannot authorize the lease. registry:Host@163,registry:Host@234 74cb5761e354994ad43172ae0f4c4e4c5410a2792492f69d32d100c2dbabed46
-internal/activator/haduties.go Service.rememberDutyRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host to record successful local release basis keyed to the acquired host lifetime. Failed marker writes never reach this hook. registry:Host@162,registry:Host@233 80319f17d46f84e3164bb46ff6ca0bd834f624288644c3f1b3a9fa0b789dc616
-internal/activator/haduties.go Service.restrictDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Bind background restriction to the host lifetime. Use existing duty state to distinguish known peer suppression from local denial before allowing timer aging; no new I/O beyond dutyInput. whole:Route@130,whole:Route@362 9402653561e1731804358972911dd3990a878a9034b512e13b45b2ac8fba8a9f
+internal/activator/haduties.go Service.allowDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Recheck lifetime and duty policy on every classified CAS round. Return a non-owner subtype only for a known foreign holder; self expiry and local denial remain deferred. Existing suppression writes and acquire restrictions retained; no read added. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged. registry:HolderRef@1126,registry:Host@1237,registry:Host@555,registry:NotBefore@471,registry:ViewKey@1156,whole:DutyState@1258,whole:DutyState@1262,whole:DutyState@1342,whole:DutyState@317,whole:DutyState@465,whole:DutyState@576,whole:DutyState@580,whole:Route@141,whole:Route@974 2ed5e21384e91dfe599e1267994579859a267c7b9ca3a0da77ce8f93a048a552
+internal/activator/haduties.go Service.dutyInput legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read HA classification/lifetime from the existing backend and route host, HA, replica, tunnel, import gate and status; read advisory DutyStore state and cached home projection outside a.mu. No new filesystem or bucket path. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged. registry:Basis@1148,registry:HA@244,registry:HolderEpoch@1383,registry:HolderIID@1225,registry:HolderIID@1427,registry:HolderRef@1161,registry:HolderRef@1211,registry:HolderRef@1413,registry:Host@1079,registry:Host@122,registry:Host@510,registry:Host@576,registry:ImportGate@690,registry:NotBefore@1453,registry:NotBefore@1509,registry:Replica@657,registry:Status@714,registry:Status@733,registry:Tunnel@671,registry:ViewKey@1256,whole:DutyState@1126,whole:DutyState@1537,whole:Route@149,whole:Route@216,whole:Route@312,whole:Route@604,whole:Route@885 9cdbbbd19a900153cc5dd6959366c5ec6042816dcb7f97b46d85476823eaf1c5
+internal/activator/haduties.go Service.dutyState legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read the current registry route and existing authoritative lifetime before binding/loading the persistent DutyStore. Pending import never produces adopted basis. whole:DutyState@767,whole:Route@255,whole:Route@354,whole:Route@462,whole:Route@638 06d446e724e6ea211612f0c35f5832c7766548008ba3ebbbedfb99b5fabd11f0
+internal/activator/haduties.go Service.rememberDutyAcquired legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host to clear peer suppression only after ordinary acquire succeeds, including visitor wakes. Local advisory state cannot authorize the lease. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged. registry:Host@163,registry:Host@234,whole:DutyState@255 74cb5761e354994ad43172ae0f4c4e4c5410a2792492f69d32d100c2dbabed46
+internal/activator/haduties.go Service.rememberDutyRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host to record successful local release basis keyed to the acquired host lifetime. Failed marker writes never reach this hook. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged. registry:Host@162,registry:Host@233,whole:DutyState@254 80319f17d46f84e3164bb46ff6ca0bd834f624288644c3f1b3a9fa0b789dc616
+internal/activator/haduties.go Service.restrictDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Bind background restriction to the host lifetime. Use existing duty state to distinguish known peer suppression from local denial before allowing timer aging; no new I/O beyond dutyInput. B2 aliases DutyState to registry.DutyState, exposing existing state-field reads to this census; ownership/restriction decisions are unchanged. whole:DutyState@230,whole:Route@130,whole:Route@362 9402653561e1731804358972911dd3990a878a9034b512e13b45b2ac8fba8a9f
+internal/activator/haduties.go Service.saveDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=DutyState is now an alias of registry.DutyState, so existing revision and state reads enter the registry census. Save behavior and CAS remain advisory. registry:Revision@185,registry:Revision@454,registry:Revision@487,registry:Revision@531,registry:Revision@547,whole:DutyState@199,whole:DutyState@359,whole:DutyState@386,whole:DutyState@463,whole:DutyState@574,whole:DutyState@588 6e3777127af58cf8987bf71aa05d53f8ef97ca228668b4e1994312e7c70bf47f
internal/activator/haduties.go dutyBackend legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Dispatch the existing backend by local route through SplitBackend, for HA classification and self identity. No new I/O. whole:Route@235,whole:Route@240 835097870b1a956888da998aee935491325c48d7847d7bc5ba650a23306e2db2
+internal/activator/haduties.go dutyRefusal legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=DutyState alias makes the existing holder and deadline reads visible to the registry census; refusal behavior unchanged. registry:HolderIID@306,registry:HolderRef@223,registry:HolderRef@245,registry:HolderRef@276,registry:NotBefore@167 7d8646a06d8d37ce9e8c736b1fb1e59b8046ba245e1957e0301791fd9032910d
internal/edge/wakeplacement.go Edge.DutySnapshot legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Pass the route to the existing cached home projection; no store reads, network reads or new publication. whole:Route@108 fa66b0bb586cb9a3214d818fbe40181f3ca7d5655f5af4ac259377cf4d5c133d
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 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. registry:Timers@284,registry:Timers@306,whole:HAWakeImport@587,whole:HAWakeImport@624,whole:Timer@290,whole:Timer@312 fa0be86a4b4a67da13e127a51905532f7edccee30a84b92c159ad4d6b19d4bba
+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. registry:AcquiredGeneration@1612,registry:AcquiredGeneration@366,registry:Changed@336,registry:Incarnation@1161,registry:Lifetime@1133,registry:Lifetime@1666,registry:LockETag@1699,registry:LockGeneration@1711,registry:LockGeneration@389,registry:Phase@1603,registry:Phase@1858,registry:Phase@411,registry:Phase@572,registry:Phase@628,registry:Phase@689,registry:Receipt@1678,registry:Sequence@1648,registry:ServingSeq@1179,registry:WakeDigest@1634,registry:remote@150,registry:remote@182,whole:HAAdoption@308,whole:HAAdoption@318,whole:Pair@256,whole:Pair@262,whole:remoteClient@152,whole:remoteClient@184 cf8772db67541b84ecb80c57a61427625ae39e467eb9c7b15dc0b5dd0f9e2214
+internal/registry/ha_departures.go Registry.HAAdoption legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Query local receipt progress only while its binding matches the active route lifetime; remote transport returns the same result. Historical receipts remain inaccessible after retirement. file:QueryRowContext@352,registry:AcquiredGeneration@755,registry:Adoption@259,registry:Changed@273,registry:DepartureIID@795,registry:DepartureRef@778,registry:LockETag@685,registry:LockGeneration@698,registry:Phase@745,registry:Sequence@732,registry:WakeDigest@717,registry:remote@111,registry:remote@143,registry:sql@352,whole:HAAdoption@263,whole:HAAdoption@856,whole:HAAdoption@881,whole:remoteClient@113,whole:remoteClient@145 c237de70749278359454cfe5795f3802647dadd24806f4e96a914072afdcb12c
+internal/registry/ha_departures.go Registry.ImportHAWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Validate all state then transactionally compare current Pair, lifetime, binding, revision and receipt before replacing rows and recording pending authority. Replays never replace rows. file:QueryRowContext@1432,file:QueryRowContext@797,registry:DepartureIID@1895,registry:DepartureIID@2556,registry:DepartureIID@394,registry:DepartureRef@1861,registry:DepartureRef@2540,registry:DepartureRef@370,registry:Import@266,registry:Incarnation@1029,registry:Lifetime@1219,registry:Lifetime@1616,registry:Lifetime@2463,registry:Lifetime@418,registry:LockETag@1797,registry:LockETag@2475,registry:LockETag@457,registry:LockGeneration@1825,registry:LockGeneration@2487,registry:LockGeneration@499,registry:Receipt@1599,registry:Receipt@2446,registry:Receipt@438,registry:Revision@2072,registry:Sequence@2519,registry:ServingSeq@1048,registry:WakeDigest@2505,registry:WakeDigest@477,registry:remote@125,registry:remote@157,whole:HAWakeImport@2156,whole:HAWakeImport@242,whole:HAWakeImport@248,whole:HAWakeImport@317,whole:Pair@1233,whole:Pair@1241,whole:Pair@226,whole:Pair@232,whole:claimTransaction@2146,whole:remoteClient@127,whole:remoteClient@159 14493a51df048a87f9df1e1f899647366acbf682092bce9cc262c1795bb7068f
+internal/registry/ha_departures.go Registry.ReplaceHAWake legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=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. registry:remote@125,registry:remote@95,whole:HAWakeImport@195,whole:HAWakeImport@201,whole:HAWakeImport@258,whole:HAWakeImport@431,whole:claimTransaction@421,whole:remoteClient@127,whole:remoteClient@97 58e2ba452feb396ea64d6f280554122020486721301588d29b44b0e8c9797e2c
+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. file:Exec@59,registry:sql@59 4650aa0307467c048f2a788e9d63903cc3f3438c28f65477d94b065b5385cfb8
+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. registry:Attempts@460,registry:ClaimOwnership@385,registry:DueAt@429,registry:Host@291,registry:Kind@281,registry:LastAt@444,registry:Name@334,registry:Name@350,registry:Name@508,registry:NextAt@413,registry:NextDue@75,registry:Path@555,registry:Path@586,registry:Path@622,registry:Path@656,registry:Path@693,registry:Registration@361,registry:Replication@110,registry:Spec@241,registry:Timers@195,whole:ClaimOwnership@387,whole:Timer@197 2f228199b3c797da7e79d4d7bb58b0d7d508f45b5d584e792edaae13e2a8199d
+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. file:QueryRowContext@154,file:QueryRowContext@545,registry:Attempts@1191,registry:ClaimIncarnation@1241,registry:ClaimOwner@1275,registry:ClaimOwnership@888,registry:ClaimOwnership@919,registry:ClaimOwnership@938,registry:ClaimRowID@1289,registry:ClaimRowID@959,registry:ClaimStamp@1261,registry:CreatedAt@1203,registry:DueAt@1216,registry:ExpectedPair@103,registry:ExpectedPair@355,registry:ExpectedPair@383,registry:Incarnation@355,registry:Kind@1123,registry:Kind@667,registry:LastAt@1157,registry:LastMs@1181,registry:LastStatus@1167,registry:Lifetime@410,registry:Name@1115,registry:NextAt@1147,registry:NextDue@1449,registry:Path@1139,registry:Registration@1225,registry:Registration@974,registry:Replication@1460,registry:ServingSeq@383,registry:Spec@1131,registry:Timers@840,whole:ClaimOwnership@891,whole:ClaimOwnership@921,whole:ClaimOwnership@941,whole:Pair@105,whole:Pair@357,whole:Pair@385,whole:Timer@842 3fa4a363f34443bb23f3512bafa25219ddc6c7d6046f9227441a9f67e8c13f0c
+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
+internal/registry/ha_duties.go Registry.HADuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read local duty metadata from the existing registry or its remote transport; mismatched/inactive lifetime returns no authority. file:QueryRow@309,registry:Basis@489,registry:Changed@220,registry:Duty@210,registry:HolderEpoch@539,registry:HolderIID@513,registry:HolderRef@499,registry:NotBefore@793,registry:Revision@467,registry:Revision@743,registry:ViewKey@527,registry:remote@112,registry:remote@80,registry:sql@309,whole:DutyState@214,whole:DutyState@663,whole:DutyState@862,whole:remoteClient@114,whole:remoteClient@82 6d6ecfb20f798554349488d42fc2fb633161361867640ef8fcf481e621cc2445
+internal/registry/ha_duties.go Registry.LoadDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Load persisted duty state or initialize an unbound live row with captured revision; refuse an already different binding. registry:Duty@221,registry:Revision@560,registry:remote@125,registry:remote@93,registry:sql@403,whole:DutyState@225,whole:DutyState@306,whole:DutyState@604,whole:DutyState@670,whole:DutyState@702,whole:DutyState@722,whole:DutyState@812,whole:remoteClient@127,whole:remoteClient@95 a9191edb17d7a125db9634178211dbd4945738262fbb13f71e9cb535c9d3aaf9
+internal/registry/ha_duties.go Registry.migrateHADuties legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Create local duties and revision/binding triggers. Timer and relevant route mutations advance revision in their own transaction; retirement/recreation clears authority and suppression. file:Exec@56,registry:sql@56 0f352104efb218960cfce6b9f145d2ea76a7e71aa3d6c917c9b61d377584eed9
internal/registry/timers.go Registry.AdvanceDutyTimer legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Update only local recurring timer progress with registration, DueAt and NextAt comparisons. Read timer fields and existing registry sql/remote handles; no last-delivery stamp, once deletion or external path. file:Exec@218,registry:DueAt@416,registry:Host@384,registry:Kind@143,registry:Name@392,registry:NextAt@171,registry:NextAt@425,registry:Registration@400,registry:remote@77,registry:sql@218,whole:remoteClient@79 ce0f893ed21cc2f5df3ca365f9b27d9904b969fd8fff1d68b4cd4f4676d0bb69
internal/schedule/runner.go OldDutyTick legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read timer kind and natural due occurrence; only recurring occurrences at least 15 minutes old qualify. No writes. registry:Kind@82,whole:Timer@71 b7f99aa2e76858e06675d9aa6b9266600423714cfd7585860eeed12021eaa0f0
internal/schedule/runner.go Runner.fireOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Existing fire body moved beneath admission; deferred delivery now returns without recording a failure. Same token preparation, parsing, guarded row checks and delivery authority. registry:Host@248,registry:Host@390,registry:Host@696,registry:Host@842,registry:Name@257,registry:Name@399,registry:Spec@153,registry:Spec@265,whole:Route@1010,whole:Route@1207,whole:Route@1509,whole:Route@1572,whole:Route@1776,whole:Route@667,whole:Route@747,whole:Route@773,whole:Route@884,whole:Timer@1014,whole:Timer@113,whole:Timer@1211,whole:Timer@1311,whole:Timer@1513,whole:Timer@1780,whole:Timer@322,whole:Timer@888 6cfedad07127980fe70c6206ec8e2f994c2b6ffc2017b60ddaaeba4faeb0e25f
+internal/activator/hawake.go ExecBackend.acquireClassified legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the acquire's classification: a legacy route (sidecar, hand-added or not an instance) takes lease.Acquire and refuses on an HA-format lock; otherwise isHA (a record read error fails the wake, never falls back to legacy); not HA takes lease.Acquire, and an HA-format lock there marks the host HA for good and continues; HA requires haContained before any lock request, then lease.AcquireHA with the same-box proof; held and refused leases map to errLeaseHeld and errLeaseRefused (leaseError); +registry:Host, +whole:Route x7;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: the HA acquire's Proofs gain OwnerTerminated (b.ownerTerminated(ctx, rt)) beside SameBoxEmpty; one more whole:Route site passes the route to ownerTerminated; nothing new is read; the proof is consulted only by hafresh.DecideAcquire for another box's expired HA lock;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 7, two-box fleet test): the two legacy acquires call b.acquireLegacy(ctx, prefix), which is acquireLegacyLease exactly when ExecBackend.LeaseIdentity is nil and LeaseTTL is 0 (the agent never sets them), otherwise lease.AcquireAs with that identity and TTL. The classification, the HA path and every refusal are unchanged. Read sites unchanged (9). Agent, not root.;rev3=census-ruling-region-ha-p1b3b-t;basis=Select the restriction-only AcquireHAForDuty for background contexts, including sticky HA reclassification; observe successful ordinary acquires to clear stale suppression. Add a whole-route observer argument; no new authority. B2 binds the current authoritative lifetime and advances local revision before HA acquire, invalidating concurrent adoption I/O. Ordinary lease authority and restore ordering remain unchanged. registry:Basis@1331,registry:Host@106,registry:Revision@1401,whole:DutyState@1413,whole:Route@1137,whole:Route@1274,whole:Route@1572,whole:Route@1617,whole:Route@195,whole:Route@2214,whole:Route@2310,whole:Route@533,whole:Route@584,whole:Route@834 97e8ca4ae87da0aa126b8bacfaf3c8ba446e2771a30abb03df303c861dc9dfc0
internal/host/runs.go runsWorker.pickup legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), its runs worker: a picked run's detached execution runs under provision.WithLifetimes of the worker's judge, so execute's record writes refuse a stale record; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 16 (ruling R7): on a fleet box a run already let go is skipped before any read; the pickup CAS moves behind the run's sink (sinkFor: the bucket's, as before, or on a fleet box the run door relay once a grant verifies); one more whole-Route site, the row this box already owns passed to sinkFor; nothing new opened, run or followed;rev3=census-ruling-region-ha-p1b3b-t;basis=Wrap both bucket and relay pickup in the service duty gate; refuse an HA route when no gate exists. Reads HA and passes the route; existing pickup moved to pickupOwned. registry:HA@343,whole:Route@244,whole:Route@308,whole:Route@388 42cb4d25952fb42237296d5050bd2e21b7ecc6ff5bdb1ebae1a13d26efe648bf
+internal/hostfiles/wake.go ImportWake legacy accepted-legacy accepted-legacy;rev3=J1,J2,J4;basis=root-route;rev3=census-ruling-region-ha-p1b3b-t;basis=Delegate validated conversion to one atomic ReplaceHAWake transaction instead of three independent writes; no lease or file effect. whole:HAWakeImport@200 c1fa57ce9de9cb527c7a08173c1be9f50481a073d10bc810631d506a1d79ecb5
+internal/registry/remote_dispatch.go Registry.dispatchRemote hint E2 rev3=census-ruling-self-serve-moves-1;basis=the registry child (carlos __registry-child, the service user a root pass forks): plan14-root-reads-e's mixed declaration (E2 adds only the ArtifactHosts read; every other arm is the local method of the same name), with three more write arms, SetHoldIfSeq, ReleaseHoldSeq and InstallLifetimeIf, each calling the local setter; no read operation added; self-serve moves 1 Task 7;rev3=census-ruling-instance-egress-sizes-328-329;identity=the registry child (carlos __registry-child, the service user a root pass forks);basis=#328/#329 plan 1 Task 4: one more write arm, SetPolicy, calling the local Registry.SetPolicy with the request's Host, EgressAllow, Size and PolicyExpiresAt (remoteRequest fields sent by the remote handle's holder); the new kinds registry:EgressAllow, registry:Size and registry:PolicyExpiresAt, one site each, plus one more registry:Host site, all of the request; no read operation added; the read-only worker never reaches it (serveRemote's method gate); no production root pass sends SetPolicy;rev3=census-ruling-region-ha-p1a;basis=the registry child (carlos __registry-child, the service user a root pass forks): one more write arm, SetHA, calling the local Registry.SetHA with the request's Host (+registry:Host); no read operation added; only the provision pass sends it;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 2 and 8: two new remote methods, UpsertUnlessRootfs (carlos add's guarded write) and ResidentInstances (the residency sweep's list), each calling the same-named Registry method;rev3=census-ruling-regional-domains-447;basis=#447 Task 4: two more methods on the existing remote registry transport, ListRegional and ReplaceRegionalSet (request field RDs, response field Regional), each calling the local method of the same name, which validates its own input; no new kind of read;rev3=census-ruling-fleet-secrets-key;basis=one new case, SetFleetSecretsKey, reading the request's Name, Pub, KeyFP, By and At fields and calling SetFleetSecretsKey;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Tasks 1-2: three new cases (SetFleetBoxIf reads the request's Fleet and answers Changed; PutForward reads TValue, a whole Route; DeleteForward reads Host and answers Changed); SetFleetBox gone (+registry:Changed x2, +registry:Fleet, +registry:Host, +registry:TValue, +whole:Route). Each case calls the local writer with its own guards.;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Tasks 2 and 6b): three more remote methods dispatched to their local forms, SetFleetBoxDraining (q.Fleet, q.Label, q.At, answering Number64), MarkFleetBoxLabelled (q.Fleet, q.Label, q.At) and SetFleetAssignment (q.Host, q.Assigned, q.Moved); remoteRequest gains Assigned and Moved. The registry child, not root.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Add SetServingMode dispatch using the existing remote request Host, Ver and On fields; the same local narrow writer handles it. No new transport or root path. Task 4 R24: dispatch SeedStateless with the existing Observed Route and On carriers to its symmetric guarded local method. No new transport; the existing read-only service gate still refuses writes.;rev3=census-ruling-region-ha-p1b3b-t;basis=Dispatch typed duty, import, exact replacement and guarded receipt operations through the existing service-user registry transport, preserving comparisons and errors. registry:A@8386,registry:Account@5148,registry:Accounts@3810,registry:Addr@5725,registry:Addrs@5733,registry:Adoption@686,registry:Adoption@881,registry:Alias@8434,registry:Alias@8498,registry:Alias@8586,registry:Aliases@8308,registry:Alive@10261,registry:Args@8010,registry:AssetGen@5875,registry:AssetsOff@5862,registry:Assigned@6353,registry:At@10009,registry:At@2964,registry:At@3353,registry:At@3438,registry:At@7247,registry:At@8517,registry:At@8595,registry:Attempts@10031,registry:B@3013,registry:Backing@5544,registry:BuildState@6112,registry:By@2958,registry:Changed@190,registry:Changed@2728,registry:Changed@332,registry:Changed@4233,registry:Changed@432,registry:Changed@4320,registry:Changed@4409,registry:Changed@4480,registry:Changed@4584,registry:Changed@4671,registry:Changed@4764,registry:Changed@4846,registry:Changed@6700,registry:Changed@6837,registry:Changed@700,registry:Changed@797,registry:Changed@9941,registry:Channel@5208,registry:Channel@6543,registry:Channel@7092,registry:CheckedAt@7173,registry:Class@5663,registry:DoneBefore@10270,registry:Due@10053,registry:Due@7711,registry:Due@7775,registry:Duty@180,registry:Duty@258,registry:Duty@502,registry:EgressAllow@6015,registry:Env@6611,registry:Env@7003,registry:Env@7103,registry:ExcludeHosts@9736,registry:ExcludeHosts@9831,registry:ExpectGood@7372,registry:ExpectOp@4288,registry:ExpectOp@4538,registry:ExpectPair@4718,registry:Expected@1021,registry:Expected@1494,registry:Expected@1671,registry:Expected@1982,registry:Expected@869,registry:F@2700,registry:F@2761,registry:Fleet@2786,registry:Fleet@3071,registry:Fleet@3153,registry:Fleet@3234,registry:Fleet@3335,registry:Fleet@3420,registry:Fleet@3509,registry:Fleet@6743,registry:FleetBoxes@3470,registry:Fleets@2844,registry:From@5319,registry:From@5380,registry:FromDB@5455,registry:FromOp@4376,registry:FromSock@5465,registry:Hash@6417,registry:Health@5742,registry:Host@1004,registry:Host@10109,registry:Host@10190,registry:Host@10353,registry:Host@1756,registry:Host@1867,registry:Host@218,registry:Host@290,registry:Host@369,registry:Host@3994,registry:Host@4035,registry:Host@4188,registry:Host@4264,registry:Host@4350,registry:Host@4442,registry:Host@4514,registry:Host@4620,registry:Host@470,registry:Host@4710,registry:Host@4798,registry:Host@4890,registry:Host@5140,registry:Host@5200,registry:Host@5258,registry:Host@5311,registry:Host@5372,registry:Host@5447,registry:Host@5536,registry:Host@5590,registry:Host@562,registry:Host@5655,registry:Host@5717,registry:Host@5795,registry:Host@5854,registry:Host@5942,registry:Host@6007,registry:Host@6104,registry:Host@6169,registry:Host@6230,registry:Host@6280,registry:Host@6345,registry:Host@640,registry:Host@6409,registry:Host@6470,registry:Host@6603,registry:Host@6657,registry:Host@6735,registry:Host@6872,registry:Host@6925,registry:Host@7155,registry:Host@7239,registry:Host@7296,registry:Host@7364,registry:Host@737,registry:Host@7512,registry:Host@7588,registry:Host@7648,registry:Host@7703,registry:Host@7767,registry:Host@7951,registry:Host@8002,registry:Host@8069,registry:Host@8144,registry:Host@8207,registry:Host@841,registry:Host@8804,registry:Host@8930,registry:Host@9084,registry:Host@9372,registry:Host@9436,registry:Host@9495,registry:Host@9578,registry:Host@9661,registry:Host@9892,registry:Host@9977,registry:Hosts@3873,registry:Hosts@6534,registry:Hosts@6994,registry:Hosts@7083,registry:Hosts@919,registry:Id@1976,registry:Id@2287,registry:Id@2386,registry:Id@2466,registry:Id@2617,registry:IdValue@3629,registry:Idle@8077,registry:Import@602,registry:Journal@1174,registry:Journal@1994,registry:Journal@2293,registry:Journal@2472,registry:Keep@10369,registry:KeyFP@2949,registry:Kind@10198,registry:Kind@10361,registry:Label@3080,registry:Label@3162,registry:Label@3243,registry:Label@3344,registry:Label@3429,registry:Label@6752,registry:Lifetime@226,registry:Lifetime@298,registry:Lifetime@385,registry:Lifetime@478,registry:Lifetime@745,registry:Limit@9727,registry:Limit@9822,registry:MaxRun@8085,registry:Method@151,registry:Moved@6365,registry:Ms@10025,registry:Name@10117,registry:Name@1764,registry:Name@1875,registry:Name@2814,registry:Name@2934,registry:Name@3648,registry:Name@9444,registry:Name@9503,registry:Name@9586,registry:Name@9900,registry:Name@9985,registry:Next@1033,registry:NextAt@10043,registry:NextGood@7386,registry:NextValue@2546,registry:NextValue@2644,registry:Now@1899,registry:Now@8278,registry:Now@9720,registry:Now@9815,registry:Now@9908,registry:Number64@3293,registry:Number64@3736,registry:Number@10158,registry:Number@10229,registry:Number@10314,registry:Observed@1097,registry:Observed@7445,registry:ObservedValue@1375,registry:Old@2539,registry:Old@2637,registry:On@7457,registry:On@7527,registry:On@7656,registry:On@8152,registry:On@8215,registry:Op@4206,registry:Op@4282,registry:Op@4450,registry:Op@4532,registry:Op@4628,registry:Op@4806,registry:Op@4898,registry:Owner@1012,registry:Owner@1109,registry:Owner@1392,registry:P@9038,registry:Pair@377,registry:Pair@4550,registry:Pair@4634,registry:Pair@4732,registry:Pair@648,registry:Pair@849,registry:Path@9269,registry:Paths@8966,registry:PolicyExpiresAt@6038,registry:Prefix@9092,registry:Prev@7311,registry:Pub@2942,registry:RDs@8938,registry:RateLimit@6478,registry:Receipt@757,registry:Regional@8836,registry:Registration@1772,registry:Registration@1883,registry:Registration@9594,registry:Registration@9993,registry:Replica@6238,registry:Replicas@6177,registry:Retirement@2623,registry:Revision@397,registry:Revision@490,registry:Revision@857,registry:Route@3971,registry:Routes@3929,registry:Routes@4924,registry:Routes@7809,registry:Routes@7876,registry:Routes@8245,registry:Rows@9380,registry:Seed@7959,registry:Size@6030,registry:Sqid@3640,registry:Sqid@3703,registry:Sqid@3782,registry:Status@10015,registry:Status@10125,registry:Status@1788,registry:Status@3252,registry:Status@4196,registry:Status@4272,registry:Status@4358,registry:Status@4522,registry:Status@5266,registry:Status@7163,registry:Status@8507,registry:Steering@5803,registry:StringMap@3546,registry:T@1489,registry:T@1583,registry:T@1666,registry:T@9320,registry:TValue@4076,registry:TValue@4143,registry:TValue@6802,registry:Tags@3171,registry:Target@6933,registry:Targets@1185,registry:Text@2192,registry:Text@2339,registry:Text@3750,registry:Text@9125,registry:Text@9188,registry:Timer@1441,registry:Timer@1623,registry:Timer@9408,registry:Timers@9631,registry:Timers@9690,registry:Timers@9779,registry:Times@10403,registry:To@5327,registry:To@5388,registry:ToDB@5477,registry:ToOp@4368,registry:ToSock@5485,registry:TokenHash@3089,registry:Tunnel@6665,registry:Unit@5598,registry:UpdateSettings@5950,registry:Ver@7304,registry:Ver@7520,registry:Ver@7596,registry:W@8738,registry:Wake@570,registry:Wake@656,registry:Wildcards@8632,whole:Account@3814,whole:ClaimOwnership@1014,whole:ClaimOwnership@1111,whole:ClaimOwnership@1394,whole:ClaimRow@1187,whole:ClaimRowArchive@1293,whole:ClaimRowArchive@1303,whole:ColdRows@2541,whole:ColdRows@2548,whole:ColdRows@2639,whole:ColdRows@2646,whole:DutyState@184,whole:DutyState@262,whole:DutyState@504,whole:Fleet@2702,whole:Fleet@2763,whole:Fleet@2790,whole:Fleet@2848,whole:FleetBox@3015,whole:FleetBox@3474,whole:GoodBuild@7374,whole:GoodBuild@7388,whole:HAAdoption@690,whole:HAAdoption@883,whole:HAWakeImport@572,whole:HAWakeImport@658,whole:Pair@379,whole:Pair@4552,whole:Pair@4636,whole:Pair@4720,whole:Pair@4734,whole:Pair@650,whole:Pair@851,whole:RegionalDomain@8840,whole:RegionalDomain@8940,whole:Route@1099,whole:Route@3933,whole:Route@3975,whole:Route@4078,whole:Route@4145,whole:Route@4928,whole:Route@5083,whole:Route@5089,whole:Route@6804,whole:Route@7447,whole:Route@7813,whole:Route@7880,whole:Route@8249,whole:RouteAlias@8312,whole:RouteAlias@8388,whole:RoutePath@8970,whole:RoutePath@9040,whole:Timer@1377,whole:Timer@1445,whole:Timer@1491,whole:Timer@1585,whole:Timer@1627,whole:Timer@1668,whole:Timer@9322,whole:Timer@9382,whole:Timer@9412,whole:Timer@9635,whole:Timer@9694,whole:Timer@9783,whole:WildcardDomain@8636,whole:WildcardDomain@8740 00bfe6f2bfd30b79f9973d34a79c86c595b235dfeb50e2e10318d8b1c3a7473e
internal/activator/activator.go Service.ServeScheduled legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-plans-4d-lapse;basis=answers a scheduled request to a route the turned-off hook names with the maintenance response before serve (plans 4d). One more whole-row read: the row handed to the hook (a.disabled), as the fence and maxRunFor are asked.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: wraps the proxy so that, after the wake, fillScheduledToken(r, rt) sets an HA host's tick bearer token from its restored env file; an error there logs (+registry:Host, rt.Host) and answers 503 with Retry-After: 5; a non-HA host's tick is left as the runner built it; +whole:Route is rt handed to fillScheduledToken; keeps legacy;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 5: the activator-managed test is Route.ActivatorOwned (a hibernating instance, or an instance with a runtime) instead of Kind and Hibernate inline; reads the same fields plus Runtime through the method;rev3=census-ruling-region-ha-p1b3b-t;basis=Run the local scheduled request under WithDuty and retain existing HTTP refusal text; add route arguments to background admission and error handling. No forwarding. registry:Host@669,registry:Status@146,registry:Status@165,whole:Route@1143,whole:Route@248,whole:Route@600,whole:Route@883,whole:Route@964 41bcecc8605bfc52536690da309860ffc7464646dd4e2dbf577fc2bd287c9061
internal/activator/activator.go Service.wake 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-wake-latency-1;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=logs that timer's breakdown to the journal after a successful wake (w.steps.String(), e.host, w.wakeTook); no read added;rev3=census-ruling-plans-4d-lapse;basis=cancels a wake whose row the turned-off hook names, like a fence, unless it is a move's active probe (plans 4d). One more whole-row read: the row handed to the hook (a.disabled). Only refuses.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: a refusal before the lease is reported once per change (noteRootfsRefusal) instead of a wake-failure event; the proc, generation and replica are installed through installProcLocked (which puts a resident under its lease watch before the fence); residency notes the outcome (noteResidentWakeLocked); same generation values;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R [pf R3.5]: the wake's context ceiling is wakeCeilingFor(e.route): the old 5 minutes for a binary row, 5 minutes plus runs.MaxTimeout for a rootfs row (room for a release inside the wake); new site +whole:Route (e.route to wakeCeilingFor, which reads Runtime only); no other change;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (branch review R1 P1-1): the wake's context is also cancelled before doWake when RetireExcept has marked the entry retired (e.retired, in memory under a.mu), as it is for a fence or a shutdown. Read sites unchanged (13). Agent, not root; it only refuses more.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Carry successful hold preparation into its wake, preserve actual mode in the generation and OnWake projection, and project serving version/mode through the narrow registry writer before releasing wake waiters. Final review I1: SetServingMode only for non-worker successful wakes with a nonempty spawned version and either a stateless generation or a mode transition from the route. Ordinary stateful wakes leave rollout status and the wake critical path unchanged.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds a.cancelHeldLegsLocked(e, 0) on the failed-wake path before the entry is deleted, and after close(e.ready) on success calls a.noteHeldAdmissible(e.host), the non-blocking held wake callback, outside a.mu. No read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Install the successful-acquire observer and restrict due, worker and resident starts before doWake, off a.mu. Add a whole-route argument to restriction; refused work has known-no-start evidence. registry:Socket@8151,registry:Socket@8312,registry:Stateless@10394,registry:Stateless@9646,whole:Route@10396,whole:Route@1047,whole:Route@1350,whole:Route@2865,whole:Route@2992,whole:Route@3049,whole:Route@417,whole:Route@6399,whole:Route@8104,whole:Route@8153,whole:Route@8314,whole:Route@9637,whole:Route@9692 6204eb606d27d250370fc2a8a821195ea3eb3b8648e7656c52a25d1488a8c2b7
internal/activator/harelease.go Service.releaseHAClean legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: an HA entry's release, in order: host slice read empty through haHostEmpty (else errHostSliceUnproven and nothing written; the same check, moved into that helper by final fix F1), stop and join the files publisher, its final publish (2 min budget), the replica's final sync (Finish, 30 s), the local release record, then the release marker PUT (10 s), clean only when the final publish was complete and the sync and record succeeded; a failed PUT is a persisted lease obligation; +registry:Host, +whole:Route x4;rev3=census-ruling-region-ha-p1b3b-t;basis=Record advisory local-release basis only after ReleaseMarker succeeds. Add a whole-route argument to local duty bookkeeping; release order and lease authority unchanged. registry:Host@1825,whole:Route@102,whole:Route@1098,whole:Route@1236,whole:Route@1734,whole:Route@244 1d28991be7fe53f505751cde1f9822ffee9598d2eea3834eda94f42406315236
-internal/activator/hawake.go ExecBackend.acquireClassified legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the acquire's classification: a legacy route (sidecar, hand-added or not an instance) takes lease.Acquire and refuses on an HA-format lock; otherwise isHA (a record read error fails the wake, never falls back to legacy); not HA takes lease.Acquire, and an HA-format lock there marks the host HA for good and continues; HA requires haContained before any lock request, then lease.AcquireHA with the same-box proof; held and refused leases map to errLeaseHeld and errLeaseRefused (leaseError); +registry:Host, +whole:Route x7;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: the HA acquire's Proofs gain OwnerTerminated (b.ownerTerminated(ctx, rt)) beside SameBoxEmpty; one more whole:Route site passes the route to ownerTerminated; nothing new is read; the proof is consulted only by hafresh.DecideAcquire for another box's expired HA lock;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 7, two-box fleet test): the two legacy acquires call b.acquireLegacy(ctx, prefix), which is acquireLegacyLease exactly when ExecBackend.LeaseIdentity is nil and LeaseTTL is 0 (the agent never sets them), otherwise lease.AcquireAs with that identity and TTL. The classification, the HA path and every refusal are unchanged. Read sites unchanged (9). Agent, not root.;rev3=census-ruling-region-ha-p1b3b-t;basis=Select the restriction-only AcquireHAForDuty for background contexts, including sticky HA reclassification; observe successful ordinary acquires to clear stale suppression. Add a whole-route observer argument; no new authority. registry:Host@106,whole:Route@1137,whole:Route@1256,whole:Route@1301,whole:Route@1898,whole:Route@195,whole:Route@1994,whole:Route@533,whole:Route@584,whole:Route@834 8b8632218aa6092a07d95d9eb9b19746693fdfb956363a4eadb64f864bfd4588
+internal/activator/hatakeover.go ExecBackend.ownerTerminated legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b1;basis=new (region HA P1b-1): returns nil without eb.OwnerTerminated; else a closure calling it with the lock owner's instance id (from the HA lock, written by a box agent) and logging rt.Host on a takeover and, at most once a minute per host, on an error; the id goes only to EC2 DescribeInstances in this box's own account and region and is checked against the reply (termfence.SameAccountTerminated); root never calls it;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route Host for structured departure-finalize telemetry; retain the same confirmation callback and visitor alarm behavior. registry:Host@378,registry:Host@472,registry:Host@638 7082fa0f1b04d12676d4e0abf5d7bafaf4041fa3910e89c230ff4eba1949d785
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 internal/activator 364d577b0dc6d0784248ca7560f92d76bc04e569b64f1661babff1a77fc1485e
+@coverage internal/activator 079d7d77fe4330c2b34aecfeb21f62c0a6dfa8f953663d1a98db16256d84f69f
@coverage internal/boxchoice 6b3d6aaacf54a2c2705f5c93d7799e0d9790712e165c90ead6de91e845ae8b09
@coverage internal/edge 269c0490df6ee888eee703c1735881c4047f21bf78a104fc76b604313e9ae5a7
-@coverage internal/host 88fe36e0d6b2b286d882b98285b245cc5b363741906cb90a4a12ce273f0fb964
+@coverage internal/host d8ce1e0beb20c355bee9ef64b750639cec74bc7d23980b0e4278660d7a071f04
+@coverage internal/hostfiles 0f1b6a928e2ac262337a7add97420487f836c2da779abd61a288fc1c046dc8b8
@coverage internal/lease 99d42caf6e5253517696871e30beead3c37ad74a3cc61a763ec2e931bd2d8606
-@coverage internal/registry d69a90af3d18e665f38f352423e92c1a344d5ec8ab5e7ee1220ea44e84a10058
-@coverage internal/schedule 868ec987f9b3992c1df4f680e71f480edd62ba652718b87e7f2cf75236eacbe2
+@coverage internal/registry 0e6b4e1f687caaeb08cda66396e2225f26863e96e23236b6c5700f05f90a641b
+@coverage internal/schedule 45287d297f4431ec8eaa3f515ce684d5e447f99845cfa1207e4386d4897b7f3d
+@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,Bucket,BuildState,By,Callback,CallbackError,CallbackFailed,Canary,Caps,CertExpiresAt,Changed,Channel,CheckedAt,Claim,ClaimIncarnation,ClaimOwner,ClaimOwnership,ClaimRowID,ClaimStamp,Class,Column,Contents,CreatedAt,DBPath,DNSCheckedAt,DNSStatus,Deadline,Default,Demand,DepartureIID,DepartureRef,Digest,DoneBefore,DrainingSince,Due,DueAt,Duty,EgressAllow,Env,EnvBefore,Environment,Error,ErrorKind,ExcludeHosts,ExpectGood,ExpectOp,ExpectPair,Expected,ExpectedPair,F,Failed,FenceGen,Field,Fleet,FleetBox,FleetBoxes,FleetLabel,Fleets,From,FromDB,FromOp,FromSock,Gate,GoodDemand,GoodDigest,GoodVersion,HA,Hash,Health,Held,Hibernate,HoldOp,HolderEpoch,HolderIID,HolderRef,Host,Hosts,ID,Id,IdValue,Idle,IdleSeconds,Import,ImportGate,Incarnation,Journal,Keep,KeyFP,Kind,Label,LabelledAt,LastAt,LastError,LastMs,LastStatus,Lifetime,Limit,LockETag,LockGeneration,MaxRun,MaxRunSeconds,Method,Moved,Ms,Name,Next,NextAt,NextDue,NextGood,NextValue,NotBefore,Now,Number,Number64,Observed,ObservedValue,Old,On,OnConflict,Op,Original,Owner,Ownership,P,Pair,Path,Paths,Phase,Platform,PolicyExpiresAt,Pool,Prefix,Prev,PrevVersion,Provisioned,Pub,RDs,RateLimit,Receipt,RecordKey,Region,Regional,Registration,Replica,Replicas,Replication,Retirement,Revision,Route,Routes,Row,Rows,Runtime,SecretsKeyFP,SecretsKeySetAt,SecretsKeySetBy,SecretsPub,Seed,SeedID,SeedSource,Sequence,ServingSeq,ServingVersion,Size,Slug,Socket,Spec,Sqid,State,Stateless,Status,StatusNamed,Steering,StringMap,T,TValue,Tags,Target,Targets,Text,Timer,Timers,Times,To,ToDB,ToOp,ToSock,TokenHash,Tunnel,Type,Unit,UpdateSettings,Ver,Version,ViewKey,W,Wake,WakeDigest,WakeIncarnation,Wildcards,closed,conn,connect,ctx,d,dec,done,enc,full,input,mu,output,path,readOnly,remote,sql,wait
diff --git a/internal/registry/claimreview_test.go b/internal/registry/claimreview_test.go
index 51a7b241a..43f779a3a 100644
--- a/internal/registry/claimreview_test.go
+++ b/internal/registry/claimreview_test.go
@@ -96,6 +96,9 @@ func TestClaimReviewOwnershipMigrationDoesNotOwnHoldColumn(t *testing.T) {
t.Fatal(err)
}
defer r.Close()
+ if _, err := r.sql.Exec(`DROP TRIGGER IF EXISTS ha_route_update`); err != nil {
+ t.Fatal(err)
+ }
if _, err := r.sql.Exec("ALTER TABLE routes DROP COLUMN hold_op"); err != nil {
t.Fatal(err)
}
diff --git a/internal/registry/forward_writers_test.go b/internal/registry/forward_writers_test.go
index dbb5c060e..2ef76eaef 100644
--- a/internal/registry/forward_writers_test.go
+++ b/internal/registry/forward_writers_test.go
@@ -91,7 +91,7 @@ func withoutHost(d map[string][]string, host string) map[string][]string {
for table, lines := range d {
kept := []string{}
for _, l := range lines {
- if table == "routes" && strings.HasPrefix(l, host+"\x1f") {
+ if (table == "routes" || table == "ha_duties") && strings.HasPrefix(l, host+"\x1f") {
continue
}
kept = append(kept, l)
@@ -274,6 +274,12 @@ func repointFixture(t *testing.T, r *Registry) {
func routeWriterCases() []writerCase {
ctx := context.Background()
cases := []writerCase{
+ {name: "ReplaceHAWake", encloses: []string{"replaceHAWake"}, refuses: true, setup: func(t *testing.T, r *Registry) (string, writerCall) {
+ host := plainRow(t, r, nil)
+ return host, func(bool) (bool, error) {
+ return false, r.ReplaceHAWake(context.Background(), host, HAWakeImport{NextDue: 123})
+ }
+ }},
{name: "Upsert", encloses: []string{"upsertRoute"}, refuses: true,
setup: func(t *testing.T, r *Registry) (string, writerCall) {
host := plainRow(t, r, nil)
diff --git a/internal/registry/ha_departures.go b/internal/registry/ha_departures.go
index b4a21bc0c..5ef90206e 100644
--- a/internal/registry/ha_departures.go
+++ b/internal/registry/ha_departures.go
@@ -5,15 +5,19 @@ import (
"database/sql"
"errors"
"net/url"
+ "os"
"regexp"
"strings"
+ "github.com/carlosframework/platform/internal/hostwrite"
"github.com/carlosframework/platform/internal/timerspec"
)
var ErrHAWake = errors.New("ha_wake_invalid")
type HAWakeImport struct {
+ DepartureRef, DepartureIID string
+ ExpectedPair *Pair
Timers []Timer
NextDue int64
Replication string
@@ -32,6 +36,7 @@ const (
)
type HAAdoption struct {
+ DepartureRef, DepartureIID string
Receipt, Lifetime, LockETag, WakeDigest, Phase string
LockGeneration, AcquiredGeneration int64
Sequence int64
@@ -40,8 +45,8 @@ type HAAdoption struct {
func (r *Registry) migrateHAAdoptions() error {
_, err := r.sql.Exec(`CREATE TABLE IF NOT EXISTS ha_departure_hosts (
departure_id TEXT NOT NULL,host TEXT NOT NULL,lifetime TEXT NOT NULL,
- lock_etag TEXT NOT NULL,lock_generation INTEGER NOT NULL,wake_digest TEXT NOT NULL,sequence INTEGER NOT NULL,
- phase TEXT NOT NULL,acquired_generation INTEGER NOT NULL DEFAULT 0,
+ departure_ref TEXT NOT NULL,departure_iid TEXT NOT NULL,lock_etag TEXT NOT NULL,lock_generation INTEGER NOT NULL,wake_digest TEXT NOT NULL,sequence INTEGER NOT NULL,
+ binding INTEGER NOT NULL,phase TEXT NOT NULL,acquired_generation INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY(departure_id,host,lifetime));`)
return err
}
@@ -71,23 +76,37 @@ func ValidateHAWake(host string, s HAWakeImport) error {
}
return nil
}
-func replaceHAWake(ctx context.Context, tx *sql.Tx, host string, s HAWakeImport) error {
- var kind string
- if err := tx.QueryRowContext(ctx, `SELECT kind FROM routes WHERE host=?`, host).Scan(&kind); err != nil {
+func replaceHAWake(ctx context.Context, tx *claimTransaction, host string, s HAWakeImport) error {
+ if s.ExpectedPair != nil {
+ var matches int
+ err := tx.QueryRowContext(ctx, `SELECT COUNT(*) FROM routes r JOIN ha_duties d ON r.host=d.host WHERE r.host=? AND r.incarnation=? AND r.serving_seq=? AND r.hold_op='' AND d.active=1 AND d.lifetime=?`, host, s.ExpectedPair.Incarnation, s.ExpectedPair.ServingSeq, s.Lifetime).Scan(&matches)
+ if err != nil {
+ return err
+ }
+ if matches != 1 {
+ return ErrHAChanged
+ }
+ }
+ rt, err := scanRoute(tx.QueryRowContext(ctx, `SELECT `+routeCols+` FROM routes WHERE host=?`, host).Scan)
+ if err != nil {
return err
}
- if kind == "forward" {
- return ErrHAChanged
+ if rt.Kind == "forward" {
+ return ErrForwardRow
}
if _, err := tx.ExecContext(ctx, `DELETE FROM timers WHERE host=?`, host); err != nil {
return err
}
for _, t := range s.Timers {
- if _, err := tx.ExecContext(ctx, `INSERT INTO timers (`+legacyTimerCols+`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)`, host, t.Name, t.Kind, t.Spec, t.Path, t.NextAt, t.LastAt, t.LastStatus, t.LastMs, t.Attempts, t.CreatedAt, t.DueAt, t.Registration); err != nil {
+ if hostwrite.Enabled(os.Getenv) && rt.ClaimOwnership.Valid() {
+ t.ClaimOwnership = rt.ClaimOwnership
+ t.ClaimRowID = t.Registration
+ }
+ if _, err := tx.ExecContext(ctx, `INSERT INTO timers (`+timerCols+`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, host, t.Name, t.Kind, t.Spec, t.Path, t.NextAt, t.LastAt, t.LastStatus, t.LastMs, t.Attempts, t.CreatedAt, t.DueAt, t.Registration, t.ClaimIncarnation, t.ClaimStamp, t.ClaimOwner, t.ClaimRowID); err != nil {
return err
}
}
- _, err := tx.ExecContext(ctx, `UPDATE routes SET next_due=?,replication=? WHERE host=?`, s.NextDue, s.Replication, host)
+ _, err = tx.ExecContext(ctx, `UPDATE routes SET next_due=?,replication=? WHERE host=? AND kind <> 'forward'`, s.NextDue, s.Replication, host)
return err
}
func (r *Registry) ReplaceHAWake(ctx context.Context, host string, s HAWakeImport) error {
@@ -98,7 +117,7 @@ func (r *Registry) ReplaceHAWake(ctx context.Context, host string, s HAWakeImpor
if err := ValidateHAWake(host, s); err != nil {
return err
}
- tx, err := r.sql.BeginTx(ctx, nil)
+ tx, err := r.beginClaimTransaction(ctx, true)
if err != nil {
return err
}
@@ -120,10 +139,10 @@ func (r *Registry) ImportHAWake(ctx context.Context, host string, expected Pair,
if err := ValidateHAWake(host, s); err != nil {
return ImportDeferred, err
}
- if s.Lifetime == "" || s.Receipt == "" || s.LockETag == "" || s.WakeDigest == "" || s.LockGeneration < 0 {
+ if s.DepartureRef == "" || s.DepartureIID == "" || s.Lifetime == "" || s.Receipt == "" || s.LockETag == "" || s.WakeDigest == "" || s.LockGeneration < 0 {
return ImportDeferred, ErrHAWake
}
- tx, err := r.sql.BeginTx(ctx, nil)
+ tx, err := r.beginClaimTransaction(ctx, true)
if err != nil {
return ImportDeferred, err
}
@@ -131,9 +150,10 @@ func (r *Registry) ImportHAWake(ctx context.Context, host string, expected Pair,
var life string
var revision uint64
var active bool
+ var binding uint64
var pair Pair
var hold, kind string
- err = tx.QueryRowContext(ctx, `SELECT d.lifetime,d.revision,d.active,r.incarnation,r.serving_seq,r.hold_op,r.kind FROM ha_duties d JOIN routes r ON r.host=d.host WHERE d.host=?`, host).Scan(&life, &revision, &active, &pair.Incarnation, &pair.ServingSeq, &hold, &kind)
+ err = tx.QueryRowContext(ctx, `SELECT d.lifetime,d.revision,d.active,d.binding,r.incarnation,r.serving_seq,r.hold_op,r.kind FROM ha_duties d JOIN routes r ON r.host=d.host WHERE d.host=?`, host).Scan(&life, &revision, &active, &binding, &pair.Incarnation, &pair.ServingSeq, &hold, &kind)
if errors.Is(err, sql.ErrNoRows) {
return ImportDeferred, nil
}
@@ -145,9 +165,14 @@ func (r *Registry) ImportHAWake(ctx context.Context, host string, expected Pair,
}
var etag string
var generation int64
- err = tx.QueryRowContext(ctx, `SELECT lock_etag,lock_generation FROM ha_departure_hosts WHERE departure_id=? AND host=? AND lifetime=?`, s.Receipt, host, s.Lifetime).Scan(&etag, &generation)
+ var receiptBinding uint64
+ var departureRef, departureIID string
+ err = tx.QueryRowContext(ctx, `SELECT lock_etag,lock_generation,binding,departure_ref,departure_iid FROM ha_departure_hosts WHERE departure_id=? AND host=? AND lifetime=?`, s.Receipt, host, s.Lifetime).Scan(&etag, &generation, &receiptBinding, &departureRef, &departureIID)
if err == nil {
- if etag != s.LockETag || generation != s.LockGeneration {
+ if receiptBinding != binding {
+ return ImportDeferred, nil
+ }
+ if etag != s.LockETag || generation != s.LockGeneration || departureRef != s.DepartureRef || departureIID != s.DepartureIID {
return ImportDeferred, ErrHAChanged
}
return ImportReplayed, nil
@@ -161,7 +186,7 @@ func (r *Registry) ImportHAWake(ctx context.Context, host string, expected Pair,
if err = replaceHAWake(ctx, tx, host, s); err != nil {
return ImportDeferred, err
}
- if _, err = tx.ExecContext(ctx, `INSERT INTO ha_departure_hosts(departure_id,host,lifetime,lock_etag,lock_generation,wake_digest,sequence,phase) VALUES(?,?,?,?,?,?,?,'imported_pending_authority')`, s.Receipt, host, s.Lifetime, s.LockETag, s.LockGeneration, s.WakeDigest, s.Sequence); err != nil {
+ if _, err = tx.ExecContext(ctx, `INSERT INTO ha_departure_hosts(departure_id,host,lifetime,lock_etag,lock_generation,wake_digest,sequence,binding,departure_ref,departure_iid,phase) VALUES(?,?,?,?,?,?,?,?,?,?,'imported_pending_authority')`, s.Receipt, host, s.Lifetime, s.LockETag, s.LockGeneration, s.WakeDigest, s.Sequence, binding, s.DepartureRef, s.DepartureIID); err != nil {
return ImportDeferred, err
}
if _, err = tx.ExecContext(ctx, `UPDATE ha_duties SET revision=revision+1,basis='' WHERE host=?`, host); err != nil {
@@ -178,7 +203,7 @@ func (r *Registry) HAAdoption(ctx context.Context, host, life, receipt string) (
return out.Adoption, out.Changed, err
}
a := HAAdoption{Receipt: receipt, Lifetime: life}
- err := r.sql.QueryRowContext(ctx, `SELECT lock_etag,lock_generation,wake_digest,sequence,phase,acquired_generation FROM ha_departure_hosts WHERE host=? AND lifetime=? AND departure_id=?`, host, life, receipt).Scan(&a.LockETag, &a.LockGeneration, &a.WakeDigest, &a.Sequence, &a.Phase, &a.AcquiredGeneration)
+ err := r.sql.QueryRowContext(ctx, `SELECT lock_etag,lock_generation,wake_digest,sequence,phase,acquired_generation,departure_ref,departure_iid FROM ha_departure_hosts WHERE host=? AND lifetime=? AND departure_id=? AND binding=(SELECT binding FROM ha_duties WHERE host=? AND active=1 AND lifetime=?)`, host, life, receipt, host, life).Scan(&a.LockETag, &a.LockGeneration, &a.WakeDigest, &a.Sequence, &a.Phase, &a.AcquiredGeneration, &a.DepartureRef, &a.DepartureIID)
if errors.Is(err, sql.ErrNoRows) {
return a, false, nil
}
@@ -191,11 +216,14 @@ func (r *Registry) CompareHAAdoption(ctx context.Context, host string, pair Pair
out, err := r.remote.call(ctx, remoteRequest{Method: "CompareHAAdoption", Host: host, Pair: pair, Revision: revision, Expected: oldPhase, Adoption: a}, nil)
return out.Changed, err
}
- valid := a.Phase == "acquiring" || a.Phase == "acquired" || a.Phase == "marker_pending" || a.Phase == "adopted"
+ valid := a.AcquiredGeneration > a.LockGeneration && ((a.Phase == "acquiring" && (oldPhase == "imported_pending_authority" || oldPhase == "acquiring" || oldPhase == "acquired" || oldPhase == "marker_pending")) ||
+ (a.Phase == "acquired" && oldPhase == "acquiring") ||
+ (a.Phase == "marker_pending" && oldPhase == "acquired") ||
+ (a.Phase == "adopted" && oldPhase == "marker_pending"))
if !valid {
return false, ErrHAChanged
}
- tx, err := r.sql.BeginTx(ctx, nil)
+ tx, err := r.beginClaimTransaction(ctx, true)
if err != nil {
return false, err
}
@@ -208,7 +236,7 @@ func (r *Registry) CompareHAAdoption(ctx context.Context, host string, pair Pair
if err != nil || n != 1 {
return false, err
}
- res, err = tx.ExecContext(ctx, `UPDATE ha_departure_hosts SET phase=?,acquired_generation=?,wake_digest=?,sequence=? WHERE host=? AND lifetime=? AND departure_id=? AND phase=? AND lock_etag=? AND lock_generation=?`, a.Phase, a.AcquiredGeneration, a.WakeDigest, a.Sequence, host, a.Lifetime, a.Receipt, oldPhase, a.LockETag, a.LockGeneration)
+ res, err = tx.ExecContext(ctx, `UPDATE ha_departure_hosts SET phase=?,acquired_generation=?,wake_digest=?,sequence=? WHERE host=? AND lifetime=? AND departure_id=? AND phase=? AND lock_etag=? AND lock_generation=? AND binding=(SELECT binding FROM ha_duties WHERE host=? AND active=1)`, a.Phase, a.AcquiredGeneration, a.WakeDigest, a.Sequence, host, a.Lifetime, a.Receipt, oldPhase, a.LockETag, a.LockGeneration, host)
if err != nil {
return false, err
}
diff --git a/internal/registry/ha_duties.go b/internal/registry/ha_duties.go
index 0d31635b3..6ac071727 100644
--- a/internal/registry/ha_duties.go
+++ b/internal/registry/ha_duties.go
@@ -21,17 +21,17 @@ func (r *Registry) migrateHADuties() error {
_, err := r.sql.Exec(`
CREATE TABLE IF NOT EXISTS ha_duties (
host TEXT PRIMARY KEY, lifetime TEXT NOT NULL DEFAULT '', revision INTEGER NOT NULL DEFAULT 1,
- active INTEGER NOT NULL DEFAULT 1, basis TEXT NOT NULL DEFAULT '',
+ active INTEGER NOT NULL DEFAULT 1, binding INTEGER NOT NULL DEFAULT 1, basis TEXT NOT NULL DEFAULT '',
holder_ref TEXT NOT NULL DEFAULT '', holder_iid TEXT NOT NULL DEFAULT '', view_key TEXT NOT NULL DEFAULT '',
holder_epoch INTEGER NOT NULL DEFAULT 0, not_before TEXT NOT NULL DEFAULT ''
);
INSERT OR IGNORE INTO ha_duties(host) SELECT host FROM routes;
CREATE TRIGGER IF NOT EXISTS ha_route_insert AFTER INSERT ON routes BEGIN
INSERT INTO ha_duties(host) VALUES(NEW.host) ON CONFLICT(host) DO UPDATE SET
- revision=revision+1,active=1,lifetime='',basis='',holder_ref='',holder_iid='',view_key='',holder_epoch=0,not_before='';
+ revision=revision+1,binding=binding+1,active=1,lifetime='',basis='',holder_ref='',holder_iid='',view_key='',holder_epoch=0,not_before='';
END;
CREATE TRIGGER IF NOT EXISTS ha_route_delete AFTER DELETE ON routes BEGIN
- UPDATE ha_duties SET revision=revision+1,active=0,lifetime='',basis='',holder_ref='',holder_iid='',view_key='',holder_epoch=0,not_before='' WHERE host=OLD.host;
+ UPDATE ha_duties SET revision=revision+1,binding=binding+1,active=0,lifetime='',basis='',holder_ref='',holder_iid='',view_key='',holder_epoch=0,not_before='' WHERE host=OLD.host;
END;
CREATE TRIGGER IF NOT EXISTS ha_route_update AFTER UPDATE ON routes
WHEN OLD.next_due IS NOT NEW.next_due OR OLD.replication IS NOT NEW.replication
@@ -40,9 +40,12 @@ WHEN OLD.next_due IS NOT NEW.next_due OR OLD.replication IS NOT NEW.replication
OR OLD.hold_op IS NOT NEW.hold_op OR OLD.status IS NOT NEW.status
OR OLD.hibernate IS NOT NEW.hibernate OR OLD.ha IS NOT NEW.ha
OR OLD.db_path IS NOT NEW.db_path OR OLD.backing IS NOT NEW.backing
+ OR OLD.pool IS NOT NEW.pool OR OLD.region IS NOT NEW.region OR OLD.replica IS NOT NEW.replica
+ OR OLD.tunnel IS NOT NEW.tunnel OR OLD.import_gate IS NOT NEW.import_gate
+ OR OLD.provisioned IS NOT NEW.provisioned OR OLD.runtime IS NOT NEW.runtime
BEGIN
UPDATE ha_duties SET revision=revision+1 WHERE host=NEW.host;
- UPDATE ha_duties SET lifetime='',basis='',holder_ref='',holder_iid='',view_key='',holder_epoch=0,not_before=''
+ UPDATE ha_duties SET binding=binding+1,lifetime='',basis='',holder_ref='',holder_iid='',view_key='',holder_epoch=0,not_before=''
WHERE host=NEW.host AND (OLD.incarnation IS NOT NEW.incarnation OR OLD.serving_seq IS NOT NEW.serving_seq
OR OLD.kind IS NOT NEW.kind OR OLD.account IS NOT NEW.account OR OLD.app IS NOT NEW.app OR OLD.db_path IS NOT NEW.db_path);
END;
@@ -95,7 +98,7 @@ func (r *Registry) BindHADuty(ctx context.Context, host string, pair Pair, lifet
if lifetime == "" {
return false, ErrHAChanged
}
- res, err := r.sql.ExecContext(ctx, `UPDATE ha_duties SET lifetime=?,revision=revision+1,basis='',holder_ref='',holder_iid='',view_key='',holder_epoch=0,not_before=''
+ res, err := r.sql.ExecContext(ctx, `UPDATE ha_duties SET lifetime=?,revision=revision+1,binding=binding+1,basis='',holder_ref='',holder_iid='',view_key='',holder_epoch=0,not_before=''
WHERE host=? AND active=1 AND revision=? AND lifetime<>? AND EXISTS(SELECT 1 FROM routes WHERE host=? AND incarnation=? AND serving_seq=? AND kind='instance' AND hold_op='')`, lifetime, host, revision, lifetime, host, pair.Incarnation, pair.ServingSeq)
if err != nil {
return false, err
diff --git a/internal/registry/ha_duties_test.go b/internal/registry/ha_duties_test.go
index c89152620..96e9ce77f 100644
--- a/internal/registry/ha_duties_test.go
+++ b/internal/registry/ha_duties_test.go
@@ -26,7 +26,7 @@ func adoptState(t *testing.T, r *Registry) HAWakeImport {
if err != nil {
t.Fatal(err)
}
- return HAWakeImport{Lifetime: "life", Revision: d.Revision, Receipt: "departure-1", LockETag: "dead-lock", LockGeneration: 5, WakeDigest: "digest", Sequence: 1, NextDue: 123, Replication: ReplicationStream, Timers: []Timer{{Host: "shop.example.com", Name: "reminder", Kind: "once", Spec: "at 123", Path: "/remind", NextAt: 123, DueAt: 123, Registration: "original"}}}
+ return HAWakeImport{DepartureRef: "b", DepartureIID: "i-b", Lifetime: "life", Revision: d.Revision, Receipt: "departure-1", LockETag: "dead-lock", LockGeneration: 5, WakeDigest: "digest", Sequence: 1, NextDue: 123, Replication: ReplicationStream, Timers: []Timer{{Host: "shop.example.com", Name: "reminder", Kind: "once", Spec: "at 123", Path: "/remind", NextAt: 123, DueAt: 123, Registration: "original"}}}
}
func TestHAAdoptReplay(t *testing.T) {
r, p := adoptRegistry(t)
@@ -205,3 +205,31 @@ func TestHAAdoptDutyPersistence(t *testing.T) {
t.Fatalf("retired CAS %v %v", ok, err)
}
}
+
+func TestHAAdoptReceiptCannotCrossRouteRecreation(t *testing.T) {
+ r, _ := adoptRegistry(t)
+ ctx := context.Background()
+ s := adoptState(t, r)
+ if _, err := r.ImportHAWake(ctx, "shop.example.com", Pair{}, s); err != nil {
+ t.Fatal(err)
+ }
+ if err := r.Delete("shop.example.com"); err != nil {
+ t.Fatal(err)
+ }
+ if err := r.Upsert(Route{Host: "shop.example.com", Kind: "instance", Status: "ready"}); err != nil {
+ t.Fatal(err)
+ }
+ d, err := r.LoadDuty(ctx, "shop.example.com", "life")
+ if err != nil {
+ t.Fatal(err)
+ }
+ s.Revision = d.Revision
+ got, err := r.ImportHAWake(ctx, "shop.example.com", Pair{}, s)
+ if err != nil || got != ImportDeferred {
+ t.Fatalf("recreated receipt %v %v", got, err)
+ }
+ _, ok, err := r.HAAdoption(ctx, "shop.example.com", "life", s.Receipt)
+ if err != nil || ok {
+ t.Fatalf("retired receipt grants progress %v %v", ok, err)
+ }
+}
diff --git a/internal/registry/ha_test.go b/internal/registry/ha_test.go
index 6ccdd97db..6990e2274 100644
--- a/internal/registry/ha_test.go
+++ b/internal/registry/ha_test.go
@@ -57,6 +57,9 @@ func dropRouteColumns(t *testing.T, path string, cols ...string) {
}
defer db.Close()
for _, c := range cols {
+ if _, err := db.Exec(`DROP TRIGGER IF EXISTS ha_route_update`); err != nil {
+ t.Fatal(err)
+ }
if _, err := db.Exec(`ALTER TABLE routes DROP COLUMN ` + c); err != nil {
t.Fatalf("drop %s: %v", c, err)
}
diff --git a/internal/registry/hold_test.go b/internal/registry/hold_test.go
index 4d689b418..e7c3629de 100644
--- a/internal/registry/hold_test.go
+++ b/internal/registry/hold_test.go
@@ -277,6 +277,9 @@ func TestHoldOpMigrationIdempotentOnLegacyDB(t *testing.T) {
t.Fatal(err)
}
// Strip the column to look like a pre-hold registry.
+ if _, err := r.sql.Exec(`DROP TRIGGER IF EXISTS ha_route_update`); err != nil {
+ t.Fatal(err)
+ }
if _, err := r.sql.Exec(`ALTER TABLE routes DROP COLUMN hold_op`); err != nil {
t.Fatal(err)
}
diff --git a/internal/registry/importjournal_test.go b/internal/registry/importjournal_test.go
index ed223f516..3c23cc4a5 100644
--- a/internal/registry/importjournal_test.go
+++ b/internal/registry/importjournal_test.go
@@ -324,6 +324,9 @@ func TestImportGateMigrationOnALegacyDB(t *testing.T) {
if err := r.Upsert(legacyRow()); err != nil {
t.Fatal(err)
}
+ if _, err := r.sql.Exec(`DROP TRIGGER IF EXISTS ha_route_update`); err != nil {
+ t.Fatal(err)
+ }
if _, err := r.sql.Exec(`ALTER TABLE routes DROP COLUMN import_gate`); err != nil {
t.Fatal(err)
}
@@ -755,6 +758,9 @@ func TestARegistryFromEitherSideGainsTheOthersColumns(t *testing.T) {
}
kept := mustRoute(t, r, importHost)
for _, c := range tc.drop {
+ if _, err := r.sql.Exec(`DROP TRIGGER IF EXISTS ha_route_update`); err != nil {
+ t.Fatal(err)
+ }
if _, err := r.sql.Exec(`ALTER TABLE routes DROP COLUMN ` + c); err != nil {
t.Fatal(err)
}
diff --git a/internal/registry/registry_test.go b/internal/registry/registry_test.go
index 8c46117f1..1819c663b 100644
--- a/internal/registry/registry_test.go
+++ b/internal/registry/registry_test.go
@@ -1261,6 +1261,9 @@ func TestPreCapsRegistryOpensAndReadsUngranted(t *testing.T) {
if err != nil {
t.Fatal(err)
}
+ if _, err := old.Exec(`DROP TRIGGER IF EXISTS ha_route_update`); err != nil {
+ t.Fatal(err)
+ }
if _, err := old.Exec(`ALTER TABLE routes DROP COLUMN caps`); err != nil {
t.Fatalf("simulate a pre-caps registry: %v", err)
}
@@ -1667,6 +1670,9 @@ func TestPreUnitRegistryOpensAndReadsNoUnit(t *testing.T) {
if err != nil {
t.Fatal(err)
}
+ if _, err := old.Exec(`DROP TRIGGER IF EXISTS ha_route_update`); err != nil {
+ t.Fatal(err)
+ }
if _, err := old.Exec(`ALTER TABLE routes DROP COLUMN unit`); err != nil {
t.Fatalf("simulate a pre-unit registry: %v", err)
}
@@ -3085,6 +3091,9 @@ func TestMigrateAddsRuntimeToTheImmediatelyPreviousSchema(t *testing.T) {
if err != nil {
t.Fatal(err)
}
+ if _, err := old.Exec(`DROP TRIGGER IF EXISTS ha_route_update`); err != nil {
+ t.Fatal(err)
+ }
if _, err := old.Exec(`ALTER TABLE routes DROP COLUMN runtime`); err != nil {
t.Fatalf("simulate a pre-runtime registry: %v", err)
}
@@ -3276,6 +3285,9 @@ func TestPairMigrationIdempotentOnLegacyDB(t *testing.T) {
t.Fatal(err)
}
for _, c := range []string{"incarnation", "serving_seq"} {
+ if _, err := r.sql.Exec(`DROP TRIGGER IF EXISTS ha_route_update`); err != nil {
+ t.Fatal(err)
+ }
if _, err := r.sql.Exec(`ALTER TABLE routes DROP COLUMN ` + c); err != nil {
t.Fatal(err)
}