carlos / platform Public

region-host: HA group-capacity alarm pages after 5 breaching minutes

Planned member launches leave a group one short for 1-2 minutes, and
the 1-of-1 alarm fired on each: 76 ALARM/OK pairs on the dev IE and
flagship US groups 2026-11-04..11, none over 2 minutes. Now 5 of 5
x 60 s; same metric math, threshold, missing-data handling and actions;
the approved description is unchanged.

Paging: about 4 periods later for the same data. A period breaches when
the group is short or an ASG input is missing (FILL), so an observed
recovery breaks the sequence but a missing recovery sample does not.
Launch failures still notify via EventBridge. Supersession notes in the
P3/P3b plans. Census ruling census-ruling-group-capacity-damping (#280).
Astra READY (3 rounds). Paul approved via 8a3d302.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from group-capacity-damping into main.
claude agent, operated by paul@keymail.dev 4fe12300318eb231b2af1679708a5295ae519fbb parent e6d1f20
7 files changed, +54 −4
  • docs/superpowers/notes/census-proposal-group-capacity-damping.md +21 −0
  • docs/superpowers/plans/2026-11-01-region-ha-p3-group.md +3 −0
  • docs/superpowers/plans/2026-11-04-region-ha-p3b-group.md +3 −0
  • infra/modules/region-host/group_alarms.tf +16 −2
  • infra/modules/region-host/tests/group_alarms.tftest.hcl +2 −2
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-group-capacity-damping.tsv +8 −0

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/notes/census-proposal-group-capacity-damping.md b/docs/superpowers/notes/census-proposal-group-capacity-damping.md
new file mode 100644
index 000000000..aa97a508d
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-group-capacity-damping.md
@@ -0,0 +1,21 @@
+# Census approval: group-capacity-damping
+
+Ruling `census-ruling-group-capacity-damping`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `infra/modules/region-host/group_alarms.tf` `external` | body | unchanged (1) | group_capacity alarm: evaluation_periods and datapoints_to_alarm 1 -> 5 (alarms after 5 of 5 one-minute periods breaching), comment updated, description unchanged; same metric math, threshold, missing-data handling and actions. tofu only, run on an operator machine; no read is added and nothing on a box reads the file. |
+| `infra/modules/region-host/tests/group_alarms.tftest.hcl` `external` | body | unchanged (1) | Assert the group capacity alarm window is 5 of 5 (was 1 of 1) and update its message. Mock-provider test only, no root runtime read. |
+
+Envelopes re-pinned: `infra/modules/region-host`, `infra/modules/region-host/tests`.
+
+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.;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.;rev3=census-ruling-region-ha-g3-fixes;basis=Send existing queue, group and launch-failure notifications to the selected regional SNS topic. Keep externally owned topic policy and subscriptions outside this module; no replacement or scale authority and no new root runtime read.
+- `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.;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.
+
+Seal: `43260792034a1a20791d14c4e4476e762b40d7bcca64257ef2e9899da6af5df0` → `0c649af234a7b89a75479e59e705307e3293a59439b7b251dd4558bd46ef2100`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-group-capacity-damping.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/plans/2026-11-01-region-ha-p3-group.md b/docs/superpowers/plans/2026-11-01-region-ha-p3-group.md
index b1bd581fe..91f2eb17b 100644
--- a/docs/superpowers/plans/2026-11-01-region-ha-p3-group.md
+++ b/docs/superpowers/plans/2026-11-01-region-ha-p3-group.md
@@ -272,6 +272,9 @@ The admitted check refuses startup/shutdown; the start callback additionally pro
| Local set-aside / files / migration | Reason counts; oldest continuous unpublished >300s, snapshot >2 configured intervals, partial/backfill failure and migration refusal; existing runtime producers, migration slice owns its signal; **I2**. |
| Wake without eligible capacity | Existing per-region/hour notification from placement, not a new per-box alarm sender; **A20/H4**. |
+> **Superseded 2026-11-11 (branch group-capacity-damping, Paul via 8a3d302):** the group-capacity alarm is now 5 of 5 one-minute periods, not 1 of 1, because planned member launches (1-2 min short) fired it on every launch. See the comment on `group_capacity` in `infra/modules/region-host/group_alarms.tf`.
+
+
- [ ] **Step 4 — verify sources and routing.** PASS local/mock tests; exercise every threshold/recovery/missing-data case with fake time. At integration, each non-P3 row must cite the actual merged producer or remain a named G2 blocker; writing an alarm with no stream does not complete §20. Migration/backfill signals are conditional on that later feature, not a requirement to build migration before G2. Add no migration feature just to produce its alarm. Verify subscriptions before live faults; alarm lag is recorded separately from failover time.
- [ ] **Step 5 — commit**, bundled with its visible slice; deferred producers are not implemented against branch previews.
diff --git a/docs/superpowers/plans/2026-11-04-region-ha-p3b-group.md b/docs/superpowers/plans/2026-11-04-region-ha-p3b-group.md
index 3b5d85838..eb3f8802d 100644
--- a/docs/superpowers/plans/2026-11-04-region-ha-p3b-group.md
+++ b/docs/superpowers/plans/2026-11-04-region-ha-p3b-group.md
@@ -193,6 +193,9 @@ The first **live** step of P3b-2 is one approved disposable Enter/ExitStandby ob
- [ ] Extend actual simulation with boot/hook/response-loss/admission/first-direct-service hang, pre-admission departure delivery/redelivery/failed boot, and both no-hook and Pending:Wait maintenance-return actions; retain I1–I6 and merged production predicates. Mutation pre-admission service and failed-health completion must fail; one serial nice-19 3,000-seed sweep per implementation revision. Do not model unmerged drain as complete. Run named metrics/budget/mock tests; no extra task review solely for metrics.
- [ ] Complete census/whole-branch review and Task 8's first-service subsection under a dated scoped go. Reuse dev ingress or separately approved group ingress, set console full ingress **before** group publication, roll all readers first, verify exact SSM path reads with the actual box role, and show signed release/version and hapair service. No empty NLB acceptance. N-HA19 settles D1/D2; the dated execution card remains required before build; P2b merge is **not** a prerequisite for this limited observation. Only then land P3b-1 through amadan with exact-tip green CI; read main CI afterward.
+> **Superseded 2026-11-11 (branch group-capacity-damping, Paul via 8a3d302):** the group-capacity alarm is now 5 of 5 one-minute periods, not 1 of 1, because planned member launches (1-2 min short) fired it on every launch. See the comment on `group_capacity` in `infra/modules/region-host/group_alarms.tf`.
+
+
### Task 7: Operator Standby roll and T1/I4 witness [own review: root/termination]
**Files:** later, separate `platform-infrastructure` branch: proposed `scripts/roll-region-group.sh`, proposed `scripts/tests/roll-region-group-test.sh` for fake-AWS/transport tests, `dev/region-ha-group.tf`, and `docs/superpowers/notes/2026-11-04-region-ha-p3b-dev-drill.md`. These are proposed private paths, not existing interfaces. This planning commission writes none of them. Platform changes, if needed by testing, remain in Task 4's reviewed guard.
diff --git a/infra/modules/region-host/group_alarms.tf b/infra/modules/region-host/group_alarms.tf
index f177b6863..606d6907b 100644
--- a/infra/modules/region-host/group_alarms.tf
+++ b/infra/modules/region-host/group_alarms.tf
@@ -31,14 +31,28 @@ locals {
group_alarm_actions = local.alerts_actions
}
+# Five of five minutes, not one. A planned member launch (roll, Standby
+# return, replacement) leaves the group one short for one to two minutes:
+# 76 such ALARM/OK pairs on the dev IE and flagship US groups between
+# 2026-11-04 and 11-11, none longer than two minutes, which taught people
+# to ignore this alarm. It now needs five consecutive breaching periods
+# instead of one, about four periods later for the same data. A period
+# breaches when the group is short OR an ASG input is missing (FILL makes
+# a late sample breach), so five periods mixing the two also alarm, and a
+# late sample can delay the clear. A member that never comes back still
+# pages. An observed non-breaching period (full membership reported)
+# breaks the sequence, so a dip that reports recovered within five
+# periods does not page here; a recovery whose sample is missing still
+# counts as breaching. Launch failures notify separately through the
+# EventBridge rule below (best effort, no added window).
resource "aws_cloudwatch_metric_alarm" "group_capacity" {
count = var.mode == "group" ? 1 : 0
alarm_name = "${var.name}-group-capacity"
alarm_description = "Fewer group members are in service than the current desired capacity. Check launch failures and member health."
comparison_operator = "LessThanThreshold"
threshold = 0
- evaluation_periods = 1
- datapoints_to_alarm = 1
+ evaluation_periods = 5
+ datapoints_to_alarm = 5
treat_missing_data = "breaching"
alarm_actions = local.group_alarm_actions
ok_actions = local.group_alarm_actions
diff --git a/infra/modules/region-host/tests/group_alarms.tftest.hcl b/infra/modules/region-host/tests/group_alarms.tftest.hcl
index f2f3eb2a6..06b1b8c9d 100644
--- a/infra/modules/region-host/tests/group_alarms.tftest.hcl
+++ b/infra/modules/region-host/tests/group_alarms.tftest.hcl
@@ -224,8 +224,8 @@ run "group_alarm_producers" {
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"
+ 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 == 5 && aws_cloudwatch_metric_alarm.group_capacity[0].datapoints_to_alarm == 5 && 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, and alarms only after five consecutive breaching one-minute periods"
}
assert {
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"
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index f9452e594..61c01f0cc 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -165,3 +165,4 @@ plan14-root-reads-demo-terms-links.tsv c8e2c7ed3850823a8e379d880738982772b870ad8
plan14-root-reads-fix-silent-start-kill-861.tsv 733204d61bea49fe418d8ff0f1bfa20d77bdffb1f08a216d9de92923eea22557
plan14-root-reads-group-bucket-region.tsv 733204d61bea49fe418d8ff0f1bfa20d77bdffb1f08a216d9de92923eea22557
plan14-root-reads-w6-ingress-drain.tsv 43260792034a1a20791d14c4e4476e762b40d7bcca64257ef2e9899da6af5df0
+plan14-root-reads-group-capacity-damping.tsv 0c649af234a7b89a75479e59e705307e3293a59439b7b251dd4558bd46ef2100
diff --git a/internal/provision/testdata/plan14-root-reads-group-capacity-damping.tsv b/internal/provision/testdata/plan14-root-reads-group-capacity-damping.tsv
new file mode 100644
index 000000000..7e42926a7
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-group-capacity-damping.tsv
@@ -0,0 +1,8 @@
+# Census overlay group-capacity-damping, written by census-propose (#369). census-ruling-group-capacity-damping, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-group-capacity-damping.md.
+# 2 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+@legacy cf36c0ea936437db75d8cee8bbba1531638c4104cee4813e7078934f57643470 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.;rev3=census-ruling-region-ha-g3-fixes;basis=Send existing queue, group and launch-failure notifications to the selected regional SNS topic. Keep externally owned topic policy and subscriptions outside this module; no replacement or scale authority and no new root runtime read.;rev3=census-ruling-group-capacity-damping;basis=group_capacity alarm: evaluation_periods and datapoints_to_alarm 1 -> 5 (alarms after 5 of 5 one-minute periods breaching), comment updated, description unchanged; same metric math, threshold, missing-data handling and actions. tofu only, run on an operator machine; no read is added and nothing on a box reads the file. file:external@0 00bb28311d50c48cde502ca7c7400764b7797c88c291a4ed0179bec7a4681480
+@legacy 6305d3c6c54f8df28bf3b39c3226f3addf94257db34346dea5f85e6dd58268b3 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.;rev3=census-ruling-group-capacity-damping;basis=Assert the group capacity alarm window is 5 of 5 (was 1 of 1) and update its message. Mock-provider test only, no root runtime read. file:external@0 6865c7786c25abe0d0ec308b1e90f229cd754127165fb553ee81d6134ddba972
+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.;rev3=census-ruling-region-ha-g3-fixes;basis=Send existing queue, group and launch-failure notifications to the selected regional SNS topic. Keep externally owned topic policy and subscriptions outside this module; no replacement or scale authority and no new root runtime read.;rev3=census-ruling-group-capacity-damping;basis=group_capacity alarm: evaluation_periods and datapoints_to_alarm 1 -> 5 (alarms after 5 of 5 one-minute periods breaching), comment updated, description unchanged; same metric math, threshold, missing-data handling and actions. tofu only, run on an operator machine; no read is added and nothing on a box reads the file. file:external@0 00bb28311d50c48cde502ca7c7400764b7797c88c291a4ed0179bec7a4681480
+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.;rev3=census-ruling-group-capacity-damping;basis=Assert the group capacity alarm window is 5 of 5 (was 1 of 1) and update its message. Mock-provider test only, no root runtime read. file:external@0 6865c7786c25abe0d0ec308b1e90f229cd754127165fb553ee81d6134ddba972
+@coverage infra/modules/region-host 852b117804e6635ade13c313db7b57580678c8e81706fa3fb56c382c0d9aa251
+@coverage infra/modules/region-host/tests 5c232284952d1bcc228804b757a560fb19289f63f6d479583c706bd294ce0971