host: test the suspect-holder metric wiring (T3b review fix)
docs/superpowers/notes/census-proposal-region-ha-g2-t3.md+1 −3internal/host/group_metrics.go+10 −0internal/host/memwatch.go+0 −8internal/host/suspects_test.go+144 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-region-ha-g2-t3.tsv+2 −4
CI passed — run details
Intent
<task-notification> <task-id>bc40ftd3u</task-id> <tool-use-id>toolu_01J8BC62RY6vVfCEDnnuiwaN</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/dc71bafb-7376-4e4b-a855-4d32f1eed771/tasks/bc40ftd3u.output</output-file> <status>completed</status> <summary>Background command "Wait for Task 3 implementer" completed (exit code 0)</summary> </task-notification>
<task-notification> <task-id>a59a5ff0377ab3816</task-id> <tool-use-id>toolu_01RTjpViZPwXv7pdknWHW6di</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/dc71bafb-7376-4e4b-a855-4d32f1eed771/tasks/a59a5ff0377ab3816.output</output-file> <status>completed</status> <summary>Agent "Opus task review of T3b" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>**Spec:** ✅ Compliant, including the controller's overrides: the alarm is folded into G0, the T3-A1 copy is verbatim (only the backticks dropped), and census NAME is region-ha-g2-t3 with Task 2's claims kept. - The new datum is group-only and appended last. `admissionMetricData` and `memwatchData` are untouched, so fixed and switch-off `PutMetricData` input is byte-identical, and the fixed flagship test now injects a count of 2 and still holds. No new loop, API call or S3 object. - The alarm matches what the box publishes string for string: `Carlos/Host` (memwatch.go:39), `SuspectHolderHosts`, `AutoScalingGroupName`. It uses Maximum, 60, 1 of 1, `> 0`, `notBreaching`, the group alarm actions on both alarm and OK, and a group-only count. - The gate admits exactly one more pair, and only for cleanup manifests. The other conditions still apply: a proven group module in both plans, a delete action, a create in the creation plan. An unlisted alarm still refuses. - The census adds no new kind of root read. **Quality:** Approved. **Critical / Important:** None. **Minors:** 1. The memwatch.go:131-138 closure that connects the atomic pointer to `suspects` has no test. If it were deleted, every test would still pass and production would publish a constant 0, so the alarm could never fire. Fix: extract a small helper (for example `suspectsFrom(ptr)`) and test it with a nil and a set pointer. 2. Pointer lifetime is fine. `runAgent` is only called from production (agent.go:261) and no test touches `processSuspectHolders`. The CAS clear can't remove another agent's backend, and the per-tick Load with a nil fallback makes start order irrelevant. Noted for the record only. 3. Task 2's tracker also counts same-box refusals (`ha_suspect_holder_same_box`), so this alarm fires for that case too. The alarm text still fits, and a grep for `ha_suspect_holder` matches both tags. The T3-R1 runbook should cover both. 4. The new alarm is outside the window simulator (`group_alarm_plan_test.py:63` filters by metric name). Its shape is pinned directly by the tftest, so this is only extra coverage. 5. There is an older "Multiple override_resource blocks" warning from group_alarms.tftest.hcl:20. It is noise, not from this task. **Tofu-suite concern:** Real, older than this task, and not blocking. - The indexed `override_data` targets are on origin/main (group.tftest.hcl:53/57, from 5c3e3fe5). OpenTofu 1.12.5 rejects them for the whole test directory. - CI never runs `tofu test`: there's nothing in `.amadan/ci.d` or the Makefile, and the only Go use is a `tofu console` check that skips when tofu is missing. The Python gate tests do run in CI through `internal/provision/region_group_guards_test.go:204`. - I ran the module's real edited `group_alarms.tftest.hcl` myself, not the implementer's harness: a scratch copy, the mock provider, hashicorp/aws 6.72.0, no credentials. - To get the file to load I collapsed the indexed EIP overrides into one and turned off one EIP check in group.tf that the collapsed override breaks. - Result: 4 passed, 0 failed. - Changing the new alarm to `breaching` failed the new assertion, as the brief required. - The provider's plugin socket is blocked by the sandbox, so that run used a sandbox-off shell. The provider came from registry.opentofu.org. The scratch copy has been deleted. **Cannot verify:** - The live G0 plan's actual 1/2/0 counts (needs a real plan). - That the box's `launch.Group` equals the ASG name at runtime. That is the same assumption the existing group alarms rely on. The branch has moved on to 62539262, a merge from origin/main that touches only a docs addendum, so nothing reviewed here changed. The full review is in `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-g2-prep/.superpowers/sdd/2026-11-05-region-ha-g2-prep/task-3-review.md`.</result> <usage><subagent_tokens>142868</subagent_tokens><tool_uses>41</tool_uses><duration_ms>331680</duration_ms></usage> </task-notification>
<task-notification> <task-id>bj9q0huqd</task-id> <tool-use-id>toolu_01Mw9NqPdS55ebbMGYZ3inFk</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/dc71bafb-7376-4e4b-a855-4d32f1eed771/tasks/bj9q0huqd.output</output-file> <status>completed</status> <summary>Background command "Wait for CI on T3 tip" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 33.1 g CO₂e (4,175,104 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-g2-prep, 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-g2-t3.md b/docs/superpowers/notes/census-proposal-region-ha-g2-t3.md| index e21bed0be..8365df4d6 100644 |
| --- a/docs/superpowers/notes/census-proposal-region-ha-g2-t3.md |
| +++ b/docs/superpowers/notes/census-proposal-region-ha-g2-t3.md |
| @@ -7,7 +7,6 @@ Ruling `census-ruling-region-ha-g2-t3`. The independent reviewer approves or rej |
| | `infra/modules/region-host/group_alarms.tf` `external` | body | unchanged (1) | T3b: add one group-mode SuspectHolderHosts Maximum alarm, 60 seconds, 1 of 1, threshold greater than zero, missing data notBreaching, existing regional SNS actions and ASG dimension. No replacement, scale, IAM, storage or root runtime authority. | |
| | `infra/modules/region-host/tests/group_alarms.tftest.hcl` `external` | body | unchanged (1) | T3b: pin fixed-mode zero count, group shape, regional SNS actions and non-breaching missing data for the new alarm; mock-provider test only, no root runtime read. | |
| | `internal/host/agent.go` `runAgent` | body | unchanged (9) | T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority. | |
| -| `internal/host/memwatch.go` `memwatchLoop` | body | unchanged (1) | T3b: wire the group-only observer to the atomic backend pointer and existing SuspectHolderHosts method; nil backend gives zero; no extra loop, cloud call, object or external read. | |
| | `internal/activator/hasamebox.go` `ExecBackend.sameBoxEmpty` | sites | +registry:Host | T3a: record refused same-box recovery using the existing route Host and lease.CurrentSelf instance id; no new external read; +registry:Host for the tracker call; the emptiness proof and S3-free refusal stay unchanged; pages through the existing sink. | |
| | `internal/activator/hatakeover.go` `ExecBackend.reportTakeover` | sites | +registry:Host ×2 | T3a: track visitor refusals and clear a host after confirmed termination; no new external read; reads only the existing route Host (+registry:Host x2) and the classified owner instance id; pages through the existing sink; departure-finalize keeps its existing immediate hourly page. | |
| @@ -20,10 +19,9 @@ Recorded dispositions, which each change must still satisfy: |
| - `infra/modules/region-host/group_alarms.tf` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p3a;basis=Add default-off termination queue age alarm, using existing queue name and regional SNS topic; no IAM, queue, consumer or instance changes. Copy sweep 1: apply approved variable and alarm descriptions verbatim; no resource, threshold, action or read changes.;rev3=census-ruling-region-ha-p3b;basis=Add group capacity, memory, clock, missing-clock and launch-failure notifications; preserve account-owner SNS rights and scope CloudWatch/EventBridge publishers by source account/ARN. Operator-applied Terraform, no box file read; notifications grant no replacement authority. |
| - `infra/modules/region-host/tests/group_alarms.tftest.hcl` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p3a;basis=Add plan-only mock queue alarm defaults, thresholds, missing-data and regional notification assertions.;rev3=census-ruling-region-ha-p3b;basis=Mock group metric producers, alarm dimensions/windows/missing data and complete scoped SNS policy; retain fixed alarm expectations. Test-only Terraform input, no root runtime read.;rev3=census-ruling-region-ha-p3b1-fixes;basis=Supply the real-shape group queue URL in the group alarm mock so the launch URL equality guard is exercised. Mock plans only; no runtime reads. |
| - `internal/host/agent.go` `runAgent`: authority, task B,C,D,F. Basis: rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: one more assignment beside eb.FilesStore: eb.EscrowKey = haEscrowKey(os.Getenv("CARLOS_SECRETS_KEY")), the agent's own environment parsed by appconfig.ParsePrivateKey as the moves pass parses it (unset or unparseable: a log line and nil, and HA publication refuses on the box). No path is opened or read, no read site added; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 4: one more goroutine beside configSyncLoop: go escrowLoop(agentCtx, reg, svc), the escrow sweep every 30 s over the same registry and Service. This body reads nothing new itself; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 5: one more call beside eb.EscrowKey: wireRawSecretPages(eb, PageOperator, metricsBoxLabel(os.Getenv, readMachineID())), which sets eb.OnRawSecret to page an operator (alerting.Page through PageOperator, LevelIncident) on its own goroutine with a 20 s timeout; metricsBoxLabel and readMachineID are the reads this body already makes for the moves refusal log; no new read site; the same six sites, offsets moved; B,C,D,F authority retained. Merge of origin/main 90c4d3aa: main's own later changes to this body are kept as main has them, under main's rulings; this branch's change is the same as above. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged.;rev3=census-ruling-probe-burst-limit;basis=two more sink wirings beside setAnalyticsSink: setProtectionSink(e.SetProtectionRecordOnly) and setAssetOwnersSource(e.AssetOwners), function values the telemetry pass calls; this body reads nothing new, the same six sites; authority B,C,D,F retained; no new root read or write kind;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains. |
| -- `internal/host/memwatch.go` `memwatchLoop`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p3a;basis=On opted-in fixed boxes only, reuse Task 2 root-owned region-config reader and Task 3 state; on existing cadence execute absolute /usr/bin/chronyc with fixed -c tracking args, one-second context and bounded 4096-byte output. No shell, tenant-named path or new timer; switch-off reads no region config and executes no clock command. Copy sweep 1: apply approved admission-metrics-disabled log prose; no control-flow or read changes.;rev3=census-ruling-region-ha-p3b;basis=Use groupMetricsAWSConfig for box-region CloudWatch with one SDK attempt on groups; extend existing admission batch using verified launch binding and clock-presence data. Same chronyc/metadata/config read paths and cadence, no new per-box poll; fixed client retries remain. |
| - `internal/activator/hasamebox.go` `ExecBackend.sameBoxEmpty`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the closure lease.AcquireHA calls as the same-box proof for taking this box's own expired HA lock: true only when sameBoxProven holds, else logs an ALERT at most once a minute and answers false; +registry:Host x2, +whole:Route |
| - `internal/activator/hatakeover.go` `ExecBackend.reportTakeover`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Final fix P2-1: report all refused proof results through the per-host alarm and distinguish visitor from departure-finalize. No reads or authority.;rev3=census-ruling-region-ha-followups;basis=Page only departure-finalize proof refusals through the injected host sink, at warning level and once per host per hour. Send on a detached five-second context and log send failures. Read the existing route Host for page throttling, body and failure logging; no new storage read or takeover authority. |
| -Seal: `05f08edeb46837a18f1abca302ad21d8c7782edef8af00cc4082f5ed4ea35ad6` → `21e537b3261dfd3add79128cf675659128fe47127b05918ca8c519dfcd7798f6`. |
| +Seal: `05f08edeb46837a18f1abca302ad21d8c7782edef8af00cc4082f5ed4ea35ad6` → `6462853d58331c23d0b2f9ee3b52ccec5198b061d864cc97ba6e7b931017f02a`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-region-ha-g2-t3.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/host/group_metrics.go b/internal/host/group_metrics.go| index 2f53f5ed2..2897a549e 100644 |
| --- a/internal/host/group_metrics.go |
| +++ b/internal/host/group_metrics.go |
| @@ -19,6 +19,15 @@ import ( |
| var processSuspectHolders atomic.Pointer[activator.ExecBackend] |
| +func suspectsFrom(p *atomic.Pointer[activator.ExecBackend]) func(time.Time) int { |
| + return func(now time.Time) int { |
| + if backend := p.Load(); backend != nil { |
| + return backend.SuspectHolderHosts(now) |
| + } |
| + return 0 |
| + } |
| +} |
| + |
| type admissionMetrics struct { |
| admitted func() bool |
| deployment, region string |
| @@ -49,6 +58,7 @@ func admissionMetricsFromEnv(getenv func(string) string, a *fixedAdmission, read |
| if m.group == "" { |
| return nil |
| } |
| + m.suspects = suspectsFrom(&processSuspectHolders) |
| } |
| return m |
| } |
diff --git a/internal/host/memwatch.go b/internal/host/memwatch.go| index b561ff6ed..c7153a9c0 100644 |
| --- a/internal/host/memwatch.go |
| +++ b/internal/host/memwatch.go |
| @@ -128,14 +128,6 @@ func memwatchLoop() { |
| w.admission = admissionMetricsFromEnv(os.Getenv, armedFixedAdmission.Load(), readRoleRegionConfig, func(ctx context.Context) (time.Duration, error) { |
| return readChronyTracking(ctx, exec.CommandContext) |
| }) |
| - if w.admission != nil && w.admission.group != "" { |
| - w.admission.suspects = func(now time.Time) int { |
| - if backend := processSuspectHolders.Load(); backend != nil { |
| - return backend.SuspectHolderHosts(now) |
| - } |
| - return 0 |
| - } |
| - } |
| if os.Getenv("CARLOS_GROUP_ADMISSION") == "1" && w.admission == nil { |
| log.Print("memwatch: admission metrics are disabled; group boxes require admission state, a deployment bucket, region configuration, and a verified launch binding") |
| } |
diff --git a/internal/host/suspects_test.go b/internal/host/suspects_test.go| new file mode 100644 |
| index 000000000..1e8e396bd |
| --- /dev/null |
| +++ b/internal/host/suspects_test.go |
| @@ -0,0 +1,144 @@ |
| +package host |
| + |
| +import ( |
| + "context" |
| + "encoding/json" |
| + "net/http" |
| + "net/http/httptest" |
| + "path/filepath" |
| + "strings" |
| + "sync/atomic" |
| + "testing" |
| + "testing/synctest" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/activator" |
| + "github.com/carlosframework/platform/internal/groupadmission" |
| + "github.com/carlosframework/platform/internal/hafresh" |
| + "github.com/carlosframework/platform/internal/instancectl" |
| + "github.com/carlosframework/platform/internal/lease" |
| + "github.com/carlosframework/platform/internal/provision" |
| + "github.com/carlosframework/platform/internal/registry" |
| +) |
| + |
| +func withSuspectMetricBackend(t *testing.T, check func(*testing.T, *activator.ExecBackend, time.Time)) { |
| + t.Helper() |
| + const host = "shop.example.com" |
| + body, err := json.Marshal(hafresh.Lock{Generation: 9, Owner: "box/v1;ref=b;iid=i-b;pid=7;ha=1", ExpiresAt: time.Unix(0, 0).UTC()}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| + w.Header().Set("Connection", "close") |
| + if r.Method != http.MethodGet || r.URL.Path != "/locks/"+activator.HibernatePrefix("", host)+"/lock.json" { |
| + t.Errorf("unexpected lease request: %s %s", r.Method, r.URL.Path) |
| + http.Error(w, "unexpected lease request", http.StatusBadRequest) |
| + return |
| + } |
| + w.Header().Set("ETag", `"held-by-b"`) |
| + _, _ = w.Write(body) |
| + })) |
| + t.Cleanup(srv.Close) |
| + for k, v := range map[string]string{ |
| + "AWS_ACCESS_KEY_ID": "test-key", "AWS_SECRET_ACCESS_KEY": "test-secret", "AWS_SESSION_TOKEN": "", "AWS_PROFILE": "", |
| + "AWS_EC2_METADATA_DISABLED": "true", "AWS_CONFIG_FILE": "/nonexistent", "AWS_SHARED_CREDENTIALS_FILE": "/nonexistent", |
| + "CARLOS_S3_ENDPOINT": srv.URL, |
| + } { |
| + t.Setenv(k, v) |
| + } |
| + t.Cleanup(lease.ProcessStateForTest()) |
| + lease.SetSelf(hafresh.Self{Ref: "a", IID: "i-a", Account: "111122223333", Region: "eu-west-1"}) |
| + if err := lease.SetObligationDir(t.TempDir()); err != nil { |
| + t.Fatal(err) |
| + } |
| + root := t.TempDir() |
| + synctest.Test(t, func(t *testing.T) { |
| + proofs := 0 |
| + b := &activator.ExecBackend{ |
| + Cfg: activator.Config{Bucket: "locks", Region: "eu-west-1"}, |
| + DataDir: filepath.Join(root, "data"), RunDirOverride: filepath.Join(root, "run"), |
| + Control: instancectl.NewClient(filepath.Join(root, "unused-control.sock")), |
| + OwnerTerminated: func(_ context.Context, iid string) (bool, error) { |
| + if iid != "i-b" { |
| + t.Fatalf("termination proof for %q, want i-b", iid) |
| + } |
| + proofs++ |
| + return false, nil |
| + }, |
| + } |
| + rt := registry.Route{Host: host, Kind: "instance", HA: true, Provisioned: true, Hibernate: true, |
| + DBPath: provision.NestedDBPath(b.DataDir, host), |
| + Socket: filepath.Join(b.RunDirOverride, "instances", provision.InstanceID(host), "app.sock")} |
| + refuse := func() { |
| + t.Helper() |
| + if held, err := b.Acquire(t.Context(), rt); held != nil || err == nil || !strings.Contains(err.Error(), hafresh.ReasonOtherExpired) { |
| + t.Fatalf("expected expired-holder refusal, got lease=%v err=%v", held, err) |
| + } |
| + } |
| + refuse() |
| + time.Sleep(11 * time.Minute) |
| + refuse() |
| + if proofs != 2 { |
| + t.Fatalf("termination proof calls=%d, want 2", proofs) |
| + } |
| + check(t, b, time.Now()) |
| + }) |
| +} |
| + |
| +func TestSuspectsFrom(t *testing.T) { |
| + withSuspectMetricBackend(t, func(t *testing.T, b *activator.ExecBackend, now time.Time) { |
| + var p atomic.Pointer[activator.ExecBackend] |
| + count := suspectsFrom(&p) |
| + if got := count(now); got != 0 { |
| + t.Fatalf("nil backend: count=%d, want 0", got) |
| + } |
| + p.Store(b) |
| + if got := count(now); got != 1 { |
| + t.Fatalf("sustained refusal: count=%d, want 1", got) |
| + } |
| + if got := count(now.Add(-2 * time.Minute)); got != 0 { |
| + t.Fatalf("before ten minutes: count=%d, want 0", got) |
| + } |
| + if got := count(now.Add(5 * time.Minute)); got != 0 { |
| + t.Fatalf("stale refusal: count=%d, want 0", got) |
| + } |
| + p.Store(&activator.ExecBackend{}) |
| + if got := count(now); got != 0 { |
| + t.Fatalf("replacement backend: count=%d, want 0", got) |
| + } |
| + p.Store(nil) |
| + if got := count(now); got != 0 { |
| + t.Fatalf("cleared backend: count=%d, want 0", got) |
| + } |
| + }) |
| +} |
| + |
| +func TestGroupMetricSuspectWiring(t *testing.T) { |
| + previous := processSuspectHolders.Swap(nil) |
| + t.Cleanup(func() { processSuspectHolders.Store(previous) }) |
| + withSuspectMetricBackend(t, func(t *testing.T, b *activator.ExecBackend, now time.Time) { |
| + env := map[string]string{"CARLOS_GROUP_ADMISSION": "1", "CARLOS_DEPLOYMENT_BUCKET": "dev-platform"} |
| + construct := func(a *fixedAdmission) *admissionMetrics { |
| + return admissionMetricsFromEnv(func(k string) string { return env[k] }, a, |
| + func(string, string) (roleRegionConfig, error) { return roleRegionConfig{RegionCode: "ie"}, nil }, |
| + func(context.Context) (time.Duration, error) { return 0, nil }) |
| + } |
| + m := construct(&fixedAdmission{group: true, launch: &groupadmission.Launch{Group: "carlos-dev-ie-group"}}) |
| + if m == nil || m.suspects == nil { |
| + t.Fatal("group admission metrics have no suspect-holder callback") |
| + } |
| + for _, step := range []struct { |
| + backend *activator.ExecBackend |
| + want int |
| + }{{nil, 0}, {b, 1}, {nil, 0}} { |
| + processSuspectHolders.Store(step.backend) |
| + o, err := m.observe(t.Context(), now) |
| + if err != nil || o.SuspectHolderHosts != step.want { |
| + t.Fatalf("process backend=%p: count=%d, want %d; err=%v", step.backend, o.SuspectHolderHosts, step.want, err) |
| + } |
| + } |
| + if fixed := construct(&fixedAdmission{}); fixed == nil || fixed.suspects != nil { |
| + t.Fatal("fixed-box admission metrics gained a suspect-holder callback") |
| + } |
| + }) |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 1306921d3..2b6a09fb9 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -97,4 +97,4 @@ plan14-root-reads-hosts-floor-release.tsv 1daafee8030f9d370adf5541b5e87313523073 |
| plan14-root-reads-region-ha-p3b2.tsv 1b5ef39b210f3c7db69e589da8a467ac4d4a4f218e1d97fb4706cd277a27eae1 |
| plan14-root-reads-region-ha-p1b3b-s.tsv 05f08edeb46837a18f1abca302ad21d8c7782edef8af00cc4082f5ed4ea35ad6 |
| plan14-root-reads-region-ha-g2-t8.tsv 05f08edeb46837a18f1abca302ad21d8c7782edef8af00cc4082f5ed4ea35ad6 |
| -plan14-root-reads-region-ha-g2-t3.tsv 21e537b3261dfd3add79128cf675659128fe47127b05918ca8c519dfcd7798f6 |
| +plan14-root-reads-region-ha-g2-t3.tsv 6462853d58331c23d0b2f9ee3b52ccec5198b061d864cc97ba6e7b931017f02a |
diff --git a/internal/provision/testdata/plan14-root-reads-region-ha-g2-t3.tsv b/internal/provision/testdata/plan14-root-reads-region-ha-g2-t3.tsv| index 28c7a3510..f40d7472c 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-region-ha-g2-t3.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-region-ha-g2-t3.tsv |
| @@ -1,18 +1,16 @@ |
| # Census overlay region-ha-g2-t3, written by census-propose (#369). census-ruling-region-ha-g2-t3, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-region-ha-g2-t3.md. |
| -# 4 body, 2 sites, 5 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +# 3 body, 2 sites, 5 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| @legacy 0707799d3c11505f5e8c0f789762ad2baa8a9ec2ad3713f6fe015f8614199f33 infra/modules/region-host/group_alarms.tf external legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3a;basis=Add default-off termination queue age alarm, using existing queue name and regional SNS topic; no IAM, queue, consumer or instance changes. Copy sweep 1: apply approved variable and alarm descriptions verbatim; no resource, threshold, action or read changes.;rev3=census-ruling-region-ha-p3b;basis=Add group capacity, memory, clock, missing-clock and launch-failure notifications; preserve account-owner SNS rights and scope CloudWatch/EventBridge publishers by source account/ARN. Operator-applied Terraform, no box file read; notifications grant no replacement authority.;rev3=census-ruling-region-ha-g2-t3;basis=T3b: add one group-mode SuspectHolderHosts Maximum alarm, 60 seconds, 1 of 1, threshold greater than zero, missing data notBreaching, existing regional SNS actions and ASG dimension. No replacement, scale, IAM, storage or root runtime authority. file:external@0 687869bbfc0287549a041ba7438a42b7a4793fe917c67ac90664240e30d97e5b |
| @legacy 46e395476d197a241d1b41673fcc4b011be6b35a2f6c61b9473dc19aadb38b21 infra/modules/region-host/tests/group_alarms.tftest.hcl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3a;basis=Add plan-only mock queue alarm defaults, thresholds, missing-data and regional notification assertions.;rev3=census-ruling-region-ha-p3b;basis=Mock group metric producers, alarm dimensions/windows/missing data and complete scoped SNS policy; retain fixed alarm expectations. Test-only Terraform input, no root runtime read.;rev3=census-ruling-region-ha-p3b1-fixes;basis=Supply the real-shape group queue URL in the group alarm mock so the launch URL equality guard is exercised. Mock plans only; no runtime reads.;rev3=census-ruling-region-ha-g2-t3;basis=T3b: pin fixed-mode zero count, group shape, regional SNS actions and non-breaching missing data for the new alarm; mock-provider test only, no root runtime read. file:external@0 98fe6ee740066dc092bd1b1f451da4bc78f62862a71292f95ff7c342f4f7ecf1 |
| -@legacy 8a3e62b0f7f510aa6eb42284cc074b7128f5d70440a42645e2ac4d376dbcb3c1 internal/host/memwatch.go memwatchLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3a;basis=On opted-in fixed boxes only, reuse Task 2 root-owned region-config reader and Task 3 state; on existing cadence execute absolute /usr/bin/chronyc with fixed -c tracking args, one-second context and bounded 4096-byte output. No shell, tenant-named path or new timer; switch-off reads no region config and executes no clock command. Copy sweep 1: apply approved admission-metrics-disabled log prose; no control-flow or read changes.;rev3=census-ruling-region-ha-p3b;basis=Use groupMetricsAWSConfig for box-region CloudWatch with one SDK attempt on groups; extend existing admission batch using verified launch binding and clock-presence data. Same chronyc/metadata/config read paths and cadence, no new per-box poll; fixed client retries remain.;rev3=census-ruling-region-ha-g2-t3;basis=T3b: wire the group-only observer to the atomic backend pointer and existing SuspectHolderHosts method; nil backend gives zero; no extra loop, cloud call, object or external read. file:CommandContext@1709 fdd85d54311bcf89295b94449d6898f6a53cf4800fb3b3b32157937dae35fe18 |
| @legacy 6adb58ef9090a3b20be51f76c5cd396b38b9bb0d8d29f49c5fb23866c3b5cd26 internal/activator/hasamebox.go ExecBackend.sameBoxEmpty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the closure lease.AcquireHA calls as the same-box proof for taking this box's own expired HA lock: true only when sameBoxProven holds, else logs an ALERT at most once a minute and answers false; +registry:Host x2, +whole:Route;rev3=census-ruling-region-ha-g2-t3;basis=T3a: record refused same-box recovery using the existing route Host and lease.CurrentSelf instance id; no new external read; +registry:Host for the tracker call; the emptiness proof and S3-free refusal stay unchanged; pages through the existing sink. registry:Host@194,registry:Host@218,registry:Host@436,whole:Route@157 8bbf73ab3184df6255726461112f7cac215f586dccb63d44fca3b4a124889844 |
| @legacy dd2a33ff52dc6e169bffab22d1936900551eac1602986f51016c36bbf99a6364 internal/activator/hatakeover.go ExecBackend.reportTakeover legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Final fix P2-1: report all refused proof results through the per-host alarm and distinguish visitor from departure-finalize. No reads or authority.;rev3=census-ruling-region-ha-followups;basis=Page only departure-finalize proof refusals through the injected host sink, at warning level and once per host per hour. Send on a detached five-second context and log send failures. Read the existing route Host for page throttling, body and failure logging; no new storage read or takeover authority.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: track visitor refusals and clear a host after confirmed termination; no new external read; reads only the existing route Host (+registry:Host x2) and the classified owner instance id; pages through the existing sink; departure-finalize keeps its existing immediate hourly page. registry:Host@1060,registry:Host@1132,registry:Host@1267,registry:Host@1419,registry:Host@347,registry:Host@409,registry:Host@516,registry:Host@957 5fa4f65f910711b5e84a5c56a9c580d470be2139285dac2357271379b3e951ff |
| infra/modules/region-host/group_alarms.tf external legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3a;basis=Add default-off termination queue age alarm, using existing queue name and regional SNS topic; no IAM, queue, consumer or instance changes. Copy sweep 1: apply approved variable and alarm descriptions verbatim; no resource, threshold, action or read changes.;rev3=census-ruling-region-ha-p3b;basis=Add group capacity, memory, clock, missing-clock and launch-failure notifications; preserve account-owner SNS rights and scope CloudWatch/EventBridge publishers by source account/ARN. Operator-applied Terraform, no box file read; notifications grant no replacement authority.;rev3=census-ruling-region-ha-g2-t3;basis=T3b: add one group-mode SuspectHolderHosts Maximum alarm, 60 seconds, 1 of 1, threshold greater than zero, missing data notBreaching, existing regional SNS actions and ASG dimension. No replacement, scale, IAM, storage or root runtime authority. file:external@0 687869bbfc0287549a041ba7438a42b7a4793fe917c67ac90664240e30d97e5b |
| infra/modules/region-host/tests/group_alarms.tftest.hcl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3a;basis=Add plan-only mock queue alarm defaults, thresholds, missing-data and regional notification assertions.;rev3=census-ruling-region-ha-p3b;basis=Mock group metric producers, alarm dimensions/windows/missing data and complete scoped SNS policy; retain fixed alarm expectations. Test-only Terraform input, no root runtime read.;rev3=census-ruling-region-ha-p3b1-fixes;basis=Supply the real-shape group queue URL in the group alarm mock so the launch URL equality guard is exercised. Mock plans only; no runtime reads.;rev3=census-ruling-region-ha-g2-t3;basis=T3b: pin fixed-mode zero count, group shape, regional SNS actions and non-breaching missing data for the new alarm; mock-provider test only, no root runtime read. file:external@0 98fe6ee740066dc092bd1b1f451da4bc78f62862a71292f95ff7c342f4f7ecf1 |
| internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: one more assignment beside eb.FilesStore: eb.EscrowKey = haEscrowKey(os.Getenv("CARLOS_SECRETS_KEY")), the agent's own environment parsed by appconfig.ParsePrivateKey as the moves pass parses it (unset or unparseable: a log line and nil, and HA publication refuses on the box). No path is opened or read, no read site added; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 4: one more goroutine beside configSyncLoop: go escrowLoop(agentCtx, reg, svc), the escrow sweep every 30 s over the same registry and Service. This body reads nothing new itself; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 5: one more call beside eb.EscrowKey: wireRawSecretPages(eb, PageOperator, metricsBoxLabel(os.Getenv, readMachineID())), which sets eb.OnRawSecret to page an operator (alerting.Page through PageOperator, LevelIncident) on its own goroutine with a 20 s timeout; metricsBoxLabel and readMachineID are the reads this body already makes for the moves refusal log; no new read site; the same six sites, offsets moved; B,C,D,F authority retained. Merge of origin/main 90c4d3aa: main's own later changes to this body are kept as main has them, under main's rulings; this branch's change is the same as above. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged.;rev3=census-ruling-probe-burst-limit;basis=two more sink wirings beside setAnalyticsSink: setProtectionSink(e.SetProtectionRecordOnly) and setAssetOwnersSource(e.AssetOwners), function values the telemetry pass calls; this body reads nothing new, the same six sites; authority B,C,D,F retained; no new root read or write kind;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority. file:Exec@19132,file:Open@1707,file:Statfs@49879,registry:App@12731,registry:Host@45961,whole:Route@12723,whole:Route@45163,whole:Route@46084,whole:Route@46146 b70e365f871ad4d885149a6c48c9e23ae67183c79a310b34fed1ec6c1e708a9f |
| -internal/host/memwatch.go memwatchLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3a;basis=On opted-in fixed boxes only, reuse Task 2 root-owned region-config reader and Task 3 state; on existing cadence execute absolute /usr/bin/chronyc with fixed -c tracking args, one-second context and bounded 4096-byte output. No shell, tenant-named path or new timer; switch-off reads no region config and executes no clock command. Copy sweep 1: apply approved admission-metrics-disabled log prose; no control-flow or read changes.;rev3=census-ruling-region-ha-p3b;basis=Use groupMetricsAWSConfig for box-region CloudWatch with one SDK attempt on groups; extend existing admission batch using verified launch binding and clock-presence data. Same chronyc/metadata/config read paths and cadence, no new per-box poll; fixed client retries remain.;rev3=census-ruling-region-ha-g2-t3;basis=T3b: wire the group-only observer to the atomic backend pointer and existing SuspectHolderHosts method; nil backend gives zero; no extra loop, cloud call, object or external read. file:CommandContext@1709 fdd85d54311bcf89295b94449d6898f6a53cf4800fb3b3b32157937dae35fe18 |
| internal/activator/hasamebox.go ExecBackend.sameBoxEmpty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the closure lease.AcquireHA calls as the same-box proof for taking this box's own expired HA lock: true only when sameBoxProven holds, else logs an ALERT at most once a minute and answers false; +registry:Host x2, +whole:Route;rev3=census-ruling-region-ha-g2-t3;basis=T3a: record refused same-box recovery using the existing route Host and lease.CurrentSelf instance id; no new external read; +registry:Host for the tracker call; the emptiness proof and S3-free refusal stay unchanged; pages through the existing sink. registry:Host@194,registry:Host@218,registry:Host@436,whole:Route@157 8bbf73ab3184df6255726461112f7cac215f586dccb63d44fca3b4a124889844 |
| internal/activator/hatakeover.go ExecBackend.reportTakeover legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Final fix P2-1: report all refused proof results through the per-host alarm and distinguish visitor from departure-finalize. No reads or authority.;rev3=census-ruling-region-ha-followups;basis=Page only departure-finalize proof refusals through the injected host sink, at warning level and once per host per hour. Send on a detached five-second context and log send failures. Read the existing route Host for page throttling, body and failure logging; no new storage read or takeover authority.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: track visitor refusals and clear a host after confirmed termination; no new external read; reads only the existing route Host (+registry:Host x2) and the classified owner instance id; pages through the existing sink; departure-finalize keeps its existing immediate hourly page. registry:Host@1060,registry:Host@1132,registry:Host@1267,registry:Host@1419,registry:Host@347,registry:Host@409,registry:Host@516,registry:Host@957 5fa4f65f910711b5e84a5c56a9c580d470be2139285dac2357271379b3e951ff |
| @coverage infra/modules/region-host 8c583fcc89c58b01bb7882af57610c8fd4f64ddaf2e4852b5612e91bf42f121f |
| @coverage infra/modules/region-host/tests 7687949dcfad73275ff3f61fc8127565623e3f1960b97de47032f71f9ce8f882 |
| @coverage internal/activator 021afc30fe767e12688922f73153b146f6a5d16a1cd1e99a09a3f1ac68ddb880 |
| @coverage internal/groupadmission 4ecaa423b61a9f15ad8d5ca20f11b35a04568604d64a80239bbbdf0a12dd68e5 |
| -@coverage internal/host 2b59a812bd0e3041ce0c7422259e61895933bd898b49610b690f44a819240aa7 |
| +@coverage internal/host 4dcf112d71bfc86fc73e71952adc8ba7ca7d8fc3d3842795e6adb1616ce7e422 |