region-host: suspect-holder metric and group alarm (T3b)
docs/superpowers/notes/census-proposal-region-ha-g2-t3.md+9 −3infra/modules/region-host/group_alarms.tf+18 −0infra/modules/region-host/tests/group_alarms.tftest.hcl+10 −2internal/groupadmission/observation.go+1 −0internal/host/agent.go+2 −0internal/host/group_metrics.go+9 −0internal/host/group_metrics_test.go+53 −1internal/host/memwatch.go+8 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-region-ha-g2-t3.tsv+12 −3scripts/check-region-group-plan.py+1 −0scripts/check_region_group_plan_test.py+13 −0
Intent
<task-notification> <task-id>a5e53b70fc78e4b7d</task-id> <tool-use-id>toolu_01TRUcYribpGkCmynYMPd4vr</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/dc71bafb-7376-4e4b-a855-4d32f1eed771/tasks/a5e53b70fc78e4b7d.output</output-file> <status>completed</status> <summary>Agent "Opus task review of T3a" 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>Task 2 (T3a) passes both gates with no Critical or Important findings. The full review is at `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-g2-prep/.superpowers/sdd/2026-11-05-region-ha-g2-prep/task-2-review.md`. That file is the only thing I wrote; I made no other edits and ran no tests. **Spec verdict:** ✅ Compliant. - All five areas of the brief match the diff: the tracker, the visitor-only and same-box hooks, both clears, `SuspectHolderHosts`, and the `eb.Page` wiring. - All seven strings from `copy-t3.md` (T3-L1, T3-L2, T3-P1 to T3-P4, T3-R1) are verbatim. - Every required test is present, and both required mutations are recorded. Two items can't be confirmed from the diff: - **Empty instance ID:** if `lease.CurrentSelf().IID` is empty, same-box refusals are never tracked or paged. Please confirm every HA box has an instance ID set, fixed boxes included. - **Cross-builds:** the darwin and windows builds covered only `internal/activator` and `internal/host`, not the brief's `./cmd/...`. **Quality verdict:** Approved. On the risks you asked me to check: - **Concurrency:** no page is sent while the tracker lock is held. The lock is released before logging and paging, and a test calls the counter from inside the page sink to prove it. - **Double paging:** the two writes to `eb.Page` (`agent.go:551` and `hadepartures_wiring.go:169`) both happen before `svc.Start`, so there is no race. Both set the same `PageOperator`, so nothing pages twice, and finalizer paging is unchanged. - **Clearing:** every successful acquire goes through `markAcquiredHere`, which now clears the entry. A confirmed-terminated owner also clears it in `reportTakeover`. - **Hourly dedupe:** one page per owner per hour, however many hosts. The host list is taken in the same locked step that reserves the hour, so 20 concurrent crossings produce one page. - **No new calls:** nothing adds an S3, EC2 or SQS request. `CurrentSelf` is an atomic load. **Critical / Important:** none. **Minor:** 1. The page is sent synchronously on the wake path, blocking up to 5 s once per owner per hour, including inside the same-box proof callback. The existing finalizer page does the same; sending it on a goroutine is optional. 2. Entries refused once and never again are dropped only on the next refusal on any host, not on a timer. Growth is bounded by the box's hosts and stale entries aren't counted, so this is harmless. 3. The page text says it repeats every hour, but a repeat needs another refusal after the hour. A host nobody wakes gets no repeat. 4. The `markAcquiredHere` doc comment ("Nothing removes it") is now stale, and the new types and methods have no doc comments. 5. `ExecBackend.note` is a generic name on a large type; `noteSuspectHolder` would read better. 6. Visitor and same-box pages share one per-instance hourly map. They can't collide in practice, but no test covers it.</result> <usage><subagent_tokens>101797</subagent_tokens><tool_uses>12</tool_uses><duration_ms>137034</duration_ms></usage> </task-notification>
Attributed to this commit: 25.8 g CO₂e (3,184,707 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 b62a2780b..e21bed0be 100644 |
| --- a/docs/superpowers/notes/census-proposal-region-ha-g2-t3.md |
| +++ b/docs/superpowers/notes/census-proposal-region-ha-g2-t3.md |
| @@ -4,20 +4,26 @@ Ruling `census-ruling-region-ha-g2-t3`. The independent reviewer approves or rej |
| | unit | change | read sites | what changed | |
| |---|---|---|---| |
| -| `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. | |
| +| `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. | |
| -Envelopes re-pinned: `internal/activator`, `internal/host`. |
| +Envelopes re-pinned: `infra/modules/region-host`, `infra/modules/region-host/tests`, `internal/activator`, `internal/groupadmission`, `internal/host`. |
| 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. |
| 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` → `bb0a59db3aea6ee626a04e4165b128125c34a979fd5372b82c8849d2d3f63d6c`. |
| +Seal: `05f08edeb46837a18f1abca302ad21d8c7782edef8af00cc4082f5ed4ea35ad6` → `21e537b3261dfd3add79128cf675659128fe47127b05918ca8c519dfcd7798f6`. |
| 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/infra/modules/region-host/group_alarms.tf b/infra/modules/region-host/group_alarms.tf| index f2c0967ea..d793b3243 100644 |
| --- a/infra/modules/region-host/group_alarms.tf |
| +++ b/infra/modules/region-host/group_alarms.tf |
| @@ -125,6 +125,24 @@ resource "aws_cloudwatch_metric_alarm" "group_clock_missing" { |
| dimensions = { AutoScalingGroupName = aws_autoscaling_group.group[0].name } |
| } |
| +resource "aws_cloudwatch_metric_alarm" "group_suspect_holder" { |
| + count = var.mode == "group" ? 1 : 0 |
| + alarm_name = "${var.name}-group-suspect-holder" |
| + alarm_description = "A group member has refused a host for over 10 minutes because the lease belongs to an instance that is not confirmed terminated. Read the group's ha_suspect_holder lines, then terminate that instance in its group." |
| + namespace = "Carlos/Host" |
| + metric_name = "SuspectHolderHosts" |
| + statistic = "Maximum" |
| + period = 60 |
| + evaluation_periods = 1 |
| + datapoints_to_alarm = 1 |
| + threshold = 0 |
| + comparison_operator = "GreaterThanThreshold" |
| + treat_missing_data = "notBreaching" |
| + alarm_actions = local.group_alarm_actions |
| + ok_actions = local.group_alarm_actions |
| + dimensions = { AutoScalingGroupName = aws_autoscaling_group.group[0].name } |
| +} |
| + |
| resource "aws_cloudwatch_event_rule" "group_launch_failed" { |
| count = var.mode == "group" ? 1 : 0 |
| name = "${var.name}-launch-failed" |
diff --git a/infra/modules/region-host/tests/group_alarms.tftest.hcl b/infra/modules/region-host/tests/group_alarms.tftest.hcl| index d302d8339..f2f3eb2a6 100644 |
| --- a/infra/modules/region-host/tests/group_alarms.tftest.hcl |
| +++ b/infra/modules/region-host/tests/group_alarms.tftest.hcl |
| @@ -62,7 +62,7 @@ override_resource { |
| run "termination_alarm_default_off" { |
| command = plan |
| assert { |
| - condition = length(aws_ssm_parameter.group_ingress) == 0 && length(aws_sns_topic_policy.group_launch_failed) == 0 && length(aws_cloudwatch_metric_alarm.termination_queue_age) == 0 && length(aws_cloudwatch_metric_alarm.group_capacity) == 0 && length(aws_cloudwatch_metric_alarm.group_memory) == 0 && length(aws_cloudwatch_metric_alarm.group_clock) == 0 && length(aws_cloudwatch_metric_alarm.group_clock_missing) == 0 && length(aws_cloudwatch_event_rule.group_launch_failed) == 0 |
| + condition = length(aws_ssm_parameter.group_ingress) == 0 && length(aws_sns_topic_policy.group_launch_failed) == 0 && length(aws_cloudwatch_metric_alarm.termination_queue_age) == 0 && length(aws_cloudwatch_metric_alarm.group_capacity) == 0 && length(aws_cloudwatch_metric_alarm.group_memory) == 0 && length(aws_cloudwatch_metric_alarm.group_clock) == 0 && length(aws_cloudwatch_metric_alarm.group_clock_missing) == 0 && length(aws_cloudwatch_metric_alarm.group_suspect_holder) == 0 && length(aws_cloudwatch_event_rule.group_launch_failed) == 0 |
| error_message = "fixed plans must not gain a termination queue alarm by default" |
| } |
| } |
| @@ -219,6 +219,10 @@ run "group_alarm_producers" { |
| condition = alltrue([for a in [aws_cloudwatch_metric_alarm.group_capacity[0], aws_cloudwatch_metric_alarm.group_memory[0], aws_cloudwatch_metric_alarm.group_clock[0], aws_cloudwatch_metric_alarm.group_clock_missing[0]] : a.treat_missing_data == "breaching" && a.alarm_actions == toset([aws_sns_topic.alerts[0].arn]) && a.ok_actions == a.alarm_actions]) |
| error_message = "missing group data must breach and notify the regional topic" |
| } |
| + assert { |
| + condition = aws_cloudwatch_metric_alarm.group_suspect_holder[0].treat_missing_data == "notBreaching" && aws_cloudwatch_metric_alarm.group_suspect_holder[0].alarm_actions == toset([aws_sns_topic.alerts[0].arn]) && aws_cloudwatch_metric_alarm.group_suspect_holder[0].ok_actions == aws_cloudwatch_metric_alarm.group_suspect_holder[0].alarm_actions |
| + error_message = "suspect-holder missing data or actions changed" |
| + } |
| assert { |
| condition = aws_cloudwatch_metric_alarm.group_capacity[0].threshold == 0 && aws_cloudwatch_metric_alarm.group_capacity[0].comparison_operator == "LessThanThreshold" && aws_cloudwatch_metric_alarm.group_capacity[0].evaluation_periods == 1 && aws_cloudwatch_metric_alarm.group_capacity[0].datapoints_to_alarm == 1 && one([for q in aws_cloudwatch_metric_alarm.group_capacity[0].metric_query : q.expression if q.id == "deficit"]) == "IF(FILL(desired, -1) < 0, -1, FILL(inservice, -1) - desired)" && alltrue([for q in aws_cloudwatch_metric_alarm.group_capacity[0].metric_query : length(q.metric) == 0 ? true : q.metric[0].period == 60 && q.metric[0].namespace == "AWS/AutoScaling" && q.metric[0].dimensions == tomap({ AutoScalingGroupName = aws_autoscaling_group.group[0].name })]) |
| error_message = "capacity uses actual desired membership including approved Standby" |
| @@ -227,12 +231,16 @@ run "group_alarm_producers" { |
| condition = aws_cloudwatch_metric_alarm.group_memory[0].metric_name == "MemAvailablePercent" && aws_cloudwatch_metric_alarm.group_memory[0].statistic == "Minimum" && aws_cloudwatch_metric_alarm.group_memory[0].period == 60 && aws_cloudwatch_metric_alarm.group_memory[0].threshold == 15 && aws_cloudwatch_metric_alarm.group_memory[0].evaluation_periods == 3 && aws_cloudwatch_metric_alarm.group_memory[0].datapoints_to_alarm == 3 && aws_cloudwatch_metric_alarm.group_memory[0].comparison_operator == "LessThanThreshold" |
| error_message = "one low-memory member must breach for three consecutive minutes" |
| } |
| + assert { |
| + condition = aws_cloudwatch_metric_alarm.group_suspect_holder[0].metric_name == "SuspectHolderHosts" && aws_cloudwatch_metric_alarm.group_suspect_holder[0].statistic == "Maximum" && aws_cloudwatch_metric_alarm.group_suspect_holder[0].period == 60 && aws_cloudwatch_metric_alarm.group_suspect_holder[0].evaluation_periods == 1 && aws_cloudwatch_metric_alarm.group_suspect_holder[0].datapoints_to_alarm == 1 && aws_cloudwatch_metric_alarm.group_suspect_holder[0].threshold == 0 && aws_cloudwatch_metric_alarm.group_suspect_holder[0].comparison_operator == "GreaterThanThreshold" |
| + error_message = "suspect-holder alarm contract changed" |
| + } |
| assert { |
| condition = aws_cloudwatch_metric_alarm.group_clock[0].metric_name == "ClockOffsetSeconds" && aws_cloudwatch_metric_alarm.group_clock[0].statistic == "Maximum" && aws_cloudwatch_metric_alarm.group_clock[0].period == 60 && aws_cloudwatch_metric_alarm.group_clock[0].threshold == 1 && aws_cloudwatch_metric_alarm.group_clock[0].evaluation_periods == 1 && aws_cloudwatch_metric_alarm.group_clock[0].datapoints_to_alarm == 1 && aws_cloudwatch_metric_alarm.group_clock[0].comparison_operator == "GreaterThanThreshold" && aws_cloudwatch_metric_alarm.group_clock_missing[0].metric_name == "ClockSamplePresent" && aws_cloudwatch_metric_alarm.group_clock_missing[0].statistic == "Minimum" && aws_cloudwatch_metric_alarm.group_clock_missing[0].threshold == 1 |
| error_message = "unknown clock is not a zero offset" |
| } |
| assert { |
| - condition = one([for q in aws_cloudwatch_metric_alarm.group_capacity[0].metric_query : q.metric[0].metric_name if q.id == "inservice"]) == "GroupInServiceInstances" && one([for q in aws_cloudwatch_metric_alarm.group_capacity[0].metric_query : q.metric[0].metric_name if q.id == "desired"]) == "GroupDesiredCapacity" && alltrue([for a in [aws_cloudwatch_metric_alarm.group_memory[0], aws_cloudwatch_metric_alarm.group_clock[0], aws_cloudwatch_metric_alarm.group_clock_missing[0]] : a.namespace == "Carlos/Host" && a.dimensions == tomap({ AutoScalingGroupName = aws_autoscaling_group.group[0].name })]) |
| + condition = one([for q in aws_cloudwatch_metric_alarm.group_capacity[0].metric_query : q.metric[0].metric_name if q.id == "inservice"]) == "GroupInServiceInstances" && one([for q in aws_cloudwatch_metric_alarm.group_capacity[0].metric_query : q.metric[0].metric_name if q.id == "desired"]) == "GroupDesiredCapacity" && alltrue([for a in [aws_cloudwatch_metric_alarm.group_memory[0], aws_cloudwatch_metric_alarm.group_clock[0], aws_cloudwatch_metric_alarm.group_clock_missing[0], aws_cloudwatch_metric_alarm.group_suspect_holder[0]] : a.namespace == "Carlos/Host" && a.dimensions == tomap({ AutoScalingGroupName = aws_autoscaling_group.group[0].name })]) |
| error_message = "alarm dimensions and metric names must match the actual producers" |
| } |
| assert { |
diff --git a/internal/groupadmission/observation.go b/internal/groupadmission/observation.go| index 37d44cdc8..bf87ca7c4 100644 |
| --- a/internal/groupadmission/observation.go |
| +++ b/internal/groupadmission/observation.go |
| @@ -6,5 +6,6 @@ type Observation struct { |
| At time.Time |
| Deployment, Region string |
| Admitted bool |
| + SuspectHolderHosts int |
| ClockOffset *time.Duration |
| } |
diff --git a/internal/host/agent.go b/internal/host/agent.go| index d8fc32169..c19058384 100644 |
| --- a/internal/host/agent.go |
| +++ b/internal/host/agent.go |
| @@ -549,6 +549,8 @@ func runAgent(args []string, buildClaims ClaimFactory) { |
| confirmer := haOwnerConfirmer() |
| eb.OwnerTerminated = confirmer.Terminated |
| eb.Page = PageOperator |
| + processSuspectHolders.Store(eb) |
| + defer processSuspectHolders.CompareAndSwap(eb, nil) |
| if fs, err := newProductionFilesStore(agentCtx, cfg.Bucket, cfg.Region); err != nil { |
| log.Printf("agent: region HA: files store: %v (every HA restore that needs it fails)", err) |
| } else { |
diff --git a/internal/host/group_metrics.go b/internal/host/group_metrics.go| index ff5ce9e30..2f53f5ed2 100644 |
| --- a/internal/host/group_metrics.go |
| +++ b/internal/host/group_metrics.go |
| @@ -8,19 +8,24 @@ import ( |
| "os/exec" |
| "strconv" |
| "strings" |
| + "sync/atomic" |
| "time" |
| "github.com/aws/aws-sdk-go-v2/aws" |
| "github.com/aws/aws-sdk-go-v2/service/cloudwatch/types" |
| + "github.com/carlosframework/platform/internal/activator" |
| "github.com/carlosframework/platform/internal/groupadmission" |
| ) |
| +var processSuspectHolders atomic.Pointer[activator.ExecBackend] |
| + |
| type admissionMetrics struct { |
| admitted func() bool |
| deployment, region string |
| group string |
| state *groupadmission.State |
| clock func(context.Context) (time.Duration, error) |
| + suspects func(time.Time) int |
| } |
| func admissionMetricsFromEnv(getenv func(string) string, a *fixedAdmission, readRegion func(string, string) (roleRegionConfig, error), clock func(context.Context) (time.Duration, error)) *admissionMetrics { |
| @@ -53,6 +58,9 @@ func (m *admissionMetrics) observe(ctx context.Context, now time.Time) (groupadm |
| if m.admitted != nil { |
| o.Admitted = m.admitted() |
| } |
| + if m.suspects != nil { |
| + o.SuspectHolderHosts = m.suspects(now) |
| + } |
| offset, err := m.clock(ctx) |
| if err == nil { |
| o.ClockOffset = &offset |
| @@ -178,5 +186,6 @@ func groupMetricData(o groupadmission.Observation, group, iid string, memory flo |
| if o.ClockOffset != nil { |
| data = append(data, datum("ClockOffsetSeconds", o.ClockOffset.Seconds(), types.StandardUnitSeconds, dims), datum("ClockOffsetSeconds", o.ClockOffset.Seconds(), types.StandardUnitSeconds, member)) |
| } |
| + data = append(data, datum("SuspectHolderHosts", float64(o.SuspectHolderHosts), types.StandardUnitCount, dims)) |
| return data |
| } |
diff --git a/internal/host/group_metrics_test.go b/internal/host/group_metrics_test.go| index de9543510..c1d8d0660 100644 |
| --- a/internal/host/group_metrics_test.go |
| +++ b/internal/host/group_metrics_test.go |
| @@ -123,6 +123,9 @@ func TestAdmissionMetricFlagshipUnchanged(t *testing.T) { |
| } |
| return parseRoleRegionConfig([]byte(`{"v":1,"region_code":"ie","placement":"ie"}`), placement) |
| }, func(context.Context) (time.Duration, error) { calls++; return 1250 * time.Millisecond, clockErr }) |
| + if w.admission != nil { |
| + w.admission.suspects = func(time.Time) int { return 2 } |
| + } |
| now := time.Unix(1793745600, 0) |
| for step := 0; step < 3; step++ { |
| if enabled && step == 1 { |
| @@ -244,6 +247,7 @@ func testGroupMetricsBatch(t *testing.T) { |
| if m == nil { |
| t.Fatal("group metrics were not armed") |
| } |
| + m.suspects = func(time.Time) int { return 2 } |
| put := &fakePutter{} |
| w := memwatch{admission: m, put: put, instanceID: "i-group", mem: func() (*int64, *int64) { a, b := int64(1000), int64(140); return &a, &b }, pressure: func() (string, error) { return "some avg60=7.5", nil }, logf: func(string, ...any) {}} |
| now := time.Unix(1793745600, 0) |
| @@ -288,6 +292,7 @@ func testGroupMetricsBatch(t *testing.T) { |
| "MemAvailablePercent:AutoScalingGroupName=carlos-dev-uk-group": memory, |
| "Admitted:AutoScalingGroupName=carlos-dev-uk-group": admitted, |
| "ClockSamplePresent:AutoScalingGroupName=carlos-dev-uk-group": 1, |
| + "SuspectHolderHosts:AutoScalingGroupName=carlos-dev-uk-group": 2, |
| "ClockSamplePresent:AutoScalingGroupName=carlos-dev-uk-group,InstanceId=i-group": 1, |
| } |
| if step == 2 { |
| @@ -312,7 +317,7 @@ func TestGroupAlarmProducers(t *testing.T) { |
| if err != nil { |
| t.Fatal(err) |
| } |
| - for _, name := range []string{`"group_capacity"`, `"group_memory"`, `"group_clock"`, `"group_clock_missing"`, `"group_launch_failed"`} { |
| + for _, name := range []string{`"group_capacity"`, `"group_memory"`, `"group_clock"`, `"group_clock_missing"`, `"group_suspect_holder"`, `"group_launch_failed"`} { |
| if !strings.Contains(string(b), name) { |
| t.Errorf("missing producer-backed alarm %s", name) |
| } |
| @@ -377,3 +382,50 @@ func TestGroupMemberDiagnosticEvidence(t *testing.T) { |
| } |
| } |
| } |
| + |
| +func TestGroupMetricSuspectHolder(t *testing.T) { |
| + now := time.Unix(1793745600, 0) |
| + offset := time.Second |
| + for _, clock := range []*time.Duration{nil, &offset} { |
| + o := groupadmission.Observation{At: now, Admitted: true, ClockOffset: clock, SuspectHolderHosts: 2} |
| + got := groupMetricData(o, "test-group", "i-test", 25) |
| + wantCount := 5 |
| + if clock != nil { |
| + wantCount += 2 |
| + } |
| + if len(got) != wantCount { |
| + t.Fatalf("got %d datums, want %d", len(got), wantCount) |
| + } |
| + want := types.MetricDatum{MetricName: aws.String("SuspectHolderHosts"), Value: aws.Float64(2), Unit: types.StandardUnitCount, Timestamp: aws.Time(now), Dimensions: []types.Dimension{{Name: aws.String("AutoScalingGroupName"), Value: aws.String("test-group")}}} |
| + if !reflect.DeepEqual(got[len(got)-1], want) { |
| + t.Fatalf("suspect datum = %+v", got[len(got)-1]) |
| + } |
| + fixed := admissionMetricData(o) |
| + o.SuspectHolderHosts = 0 |
| + if !reflect.DeepEqual(fixed, admissionMetricData(o)) { |
| + t.Fatal("suspects changed fixed-box datums") |
| + } |
| + } |
| +} |
| + |
| +func TestAdmissionMetricSuspectObservation(t *testing.T) { |
| + now := time.Unix(1793745600, 0) |
| + clockErr := errors.New("clock unavailable") |
| + m := &admissionMetrics{state: &groupadmission.State{}, clock: func(context.Context) (time.Duration, error) { return 0, clockErr }} |
| + o, err := m.observe(t.Context(), now) |
| + if o.SuspectHolderHosts != 0 || !errors.Is(err, clockErr) { |
| + t.Fatalf("nil suspects: %+v %v", o, err) |
| + } |
| + calls := 0 |
| + m.suspects = func(at time.Time) int { |
| + calls++ |
| + if !at.Equal(now) { |
| + t.Fatalf("suspect time = %v", at) |
| + } |
| + return 2 |
| + } |
| + o, err = m.observe(t.Context(), now) |
| + if o.SuspectHolderHosts != 2 || calls != 1 || !errors.Is(err, clockErr) { |
| + t.Fatalf("suspects: %+v calls=%d err=%v", o, calls, err) |
| + } |
| +} |
diff --git a/internal/host/memwatch.go b/internal/host/memwatch.go| index c7153a9c0..b561ff6ed 100644 |
| --- a/internal/host/memwatch.go |
| +++ b/internal/host/memwatch.go |
| @@ -128,6 +128,14 @@ 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/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 63252130f..1306921d3 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 bb0a59db3aea6ee626a04e4165b128125c34a979fd5372b82c8849d2d3f63d6c |
| +plan14-root-reads-region-ha-g2-t3.tsv 21e537b3261dfd3add79128cf675659128fe47127b05918ca8c519dfcd7798f6 |
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 ef634a2c2..28c7a3510 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,9 +1,18 @@ |
| # 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. |
| -# 1 body, 2 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +# 4 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 |
| -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. file:Exec@19044,file:Open@1707,file:Statfs@49791,registry:App@12731,registry:Host@45873,whole:Route@12723,whole:Route@45075,whole:Route@45996,whole:Route@46058 40ba63413f1bb04807e0faff0eda913f4f10bda5cbd0a96512d130540b2b0352 |
| +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/host 492558782ed5dc2d7ea3b9078a4e3e83ed27269c2b4013b0cec1ae89ab77de72 |
| +@coverage internal/groupadmission 4ecaa423b61a9f15ad8d5ca20f11b35a04568604d64a80239bbbdf0a12dd68e5 |
| +@coverage internal/host 2b59a812bd0e3041ce0c7422259e61895933bd898b49610b690f44a819240aa7 |
diff --git a/scripts/check-region-group-plan.py b/scripts/check-region-group-plan.py| index 9b8b893f0..a4ee8b437 100755 |
| --- a/scripts/check-region-group-plan.py |
| +++ b/scripts/check-region-group-plan.py |
| @@ -62,6 +62,7 @@ GROUP_DISPOSABLE = { |
| ('aws_cloudwatch_metric_alarm', 'group_capacity'), ('aws_cloudwatch_metric_alarm', 'group_memory'), |
| ('aws_cloudwatch_metric_alarm', 'group_clock'), |
| ('aws_cloudwatch_metric_alarm', 'group_clock_missing'), |
| + ('aws_cloudwatch_metric_alarm', 'group_suspect_holder'), |
| ('aws_cloudwatch_event_rule', 'group_launch_failed'), |
| ('aws_cloudwatch_event_target', 'group_launch_failed'), |
| ('aws_sns_topic_policy', 'group_launch_failed')} |
diff --git a/scripts/check_region_group_plan_test.py b/scripts/check_region_group_plan_test.py| index 8613e2d60..bfff772b9 100644 |
| --- a/scripts/check_region_group_plan_test.py |
| +++ b/scripts/check_region_group_plan_test.py |
| @@ -568,6 +568,19 @@ class GroupModuleTests(unittest.TestCase): |
| self.gate(creation, 0) |
| self.gate(document, 0, cleanup=group_manifest(document, creation)) |
| + def test_suspect_holder_alarm_cleanup_manifest(self): |
| + for name, expected in [('group_suspect_holder', 0), ('group_unlisted', 1)]: |
| + with self.subTest(name=name): |
| + document = self.fixture('tofu-1.12-group-partial-destroy.json') |
| + creation = self.fixture('tofu-1.12-group-create.json') |
| + address = GROUP + 'aws_cloudwatch_metric_alarm.' + name + '[0]' |
| + values = {'alarm_name': 'test-group-suspect-holder'} |
| + document['resource_changes'].append(resource(address, 'aws_cloudwatch_metric_alarm', |
| + name, values, None, actions=['delete'])) |
| + creation['resource_changes'].append(resource(address, 'aws_cloudwatch_metric_alarm', |
| + name, None, values, actions=['create'])) |
| + self.gate(document, expected, cleanup=group_manifest(document, creation, [address])) |
| + |
| def test_full_destroy_needs_manifest_for_group(self): |
| document = self.fixture('tofu-1.12-group-full-destroy.json') |
| creation = self.fixture('tofu-1.12-group-create.json') |