| new file mode 100644 |
| index 000000000..d5b09c9a8 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-04-region-ha-p3b-group.md |
| @@ -0,0 +1,368 @@ |
| +# Region HA P3b: group mode implementation plan |
| + |
| +**Goal:** Boot two disposable dev IE group boxes without claims, serve an existing born-HA hapair host through the regional Network Load Balancer (NLB), and prepare operator Standby rolls and the G2 failure drills. |
| + |
| +**Architecture:** Extend the merged admission and role readers. OpenTofu creates a fixed-size Auto Scaling group (ASG), a pinned launch template and an initial launch hook, attached to the existing ingress child module. Provider-neutral Go owns admission; AWS adapters complete the hook and supply local identity. Root owns boot, maintenance permits and hairpin rules. Existing reconciliation, publication, metrics and termination cadences do the background work. |
| + |
| +**Tech stack:** Go 1.26 and the existing Auto Scaling SDK (`go.mod:3,10`); OpenTofu/AWS provider (`infra/modules/region-host/versions.tf:1`); Linux systemd, nftables, IMDSv2 and chrony. |
| + |
| +**Spec:** `docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md`, rev 6.2, §§4.3–4.4, 9.5, 9.8, 10, 12–13, 18–21. Rev 6.2 only records the already-approved N-HA14 exception in §12.1. Read this with P3 rev 3, `2026-11-01-region-ha-p3-group.md` (called **P3** below), and discussion #421's exported rulings. |
| + |
| +**Citation base:** amadan main **016599d5b97c04b2fc5e807b834fdf38e2c7a35e**, containing P3a, P1b-3b T (`9b8b2c50`), follow-ups (`f18da984`) and the store-Deny fix (`9bd45488`). All platform source `file:line` citations below refer to this base. Proposed paths and tests are explicitly marked. No sibling branch is an implementation authority. |
| + |
| +**Status:** rev 3, final. Opus R2 is READY AFTER FIXES (0 P1 / 1 P2 / 3 P3); its fixes are incorporated and review is CLOSED. There is no round 3. This revision changes only this plan and makes one local commit; no push, implementation, reviewer dispatch or account access. Product wording gets a Luna pass at build time; plan prose is exempt. |
| + |
| +## Rulings |
| + |
| +| Authority | Choice and invariant | |
| +|---|---| |
| +| Paul, N-HA9 | **I1/I2:** confirmed termination still waits the remaining lease. Admission, Standby and a receipt never authorize takeover or local-copy reuse. | |
| +| Paul, N-HA11, N-HA16/17 | **I3/I6/B1:** retain one 20s SQS consumer per box, durable termination evidence and rescan-to-finish. Started is a lifecycle fact, not a coverage or drain acknowledgment. | |
| +| Paul, N-HA12/15; controller R7 | **H4/I4:** preserve the 10s per-box suspect exclusion, one bounded lock reread per host/window, and cancellation classification. Do not make healthy visitor cancellation evidence of peer failure. | |
| +| Paul, N-HA14 | **T1/H5/I4:** one serialized operator Standby transaction, no unattended group update, fixed total membership during maintenance. The companion spec edit is verbatim P3's approved sentence; §10 is unchanged. | |
| +| Controller, P3a T2 cut | **H4/A1:** closed boxes retain name authority and answer 503 + Retry-After. Namespace withdrawal is not revived. Task 1 defines one reader invariant across every name class; upgrade every reader before group opt-in. | |
| +| Author's call, B3b-A | **R1/A1:** use the merged two-GET role reader. Own object wins, then existing regional default, then absent-both means serve. Create no role writer or seed bypass. Initial activation requires effective serve; N-HA19/D2 approves this initial restriction. | |
| +| Author's call, B3b-B | **N1:** a hairpinned client's address is this box's IMDS-reported public IPv4, checked against root boot identity and public-address validation. It is not the NLB EIP, a bridge address or an HTTP header. Task 5 specifies the authenticated kernel path. | |
| +| Author's call, B3b-C | **T1/A1:** the restart guard, immutable group marker and Restart=no drop-in ship with the first group, even though the attended roll drill is a later slice. An environment flag cannot disable them. | |
| +| Author's call, B3b-D | **T1/I4:** AWS documents no Standby hook; Task 7 alone owns any defensive return CONTINUE. Observe the exact dev behavior before enabling rolls; divergence refuses the roll. | |
| +| Author's call, B3b-E | **A1/I6/E1:** a distinct group queue uses competing consumers; a closed member journals but neither imports nor acknowledges. Tasks 2/3 preserve Started without granting duty authority. | |
| +| Paul, **N-HA19**, 2026-11-04, via the agent manager under delegation — D1 | **S1/H4:** approved staging exception to spec §19 for the limited P3b-1 first-service experiment on the recorded G1 boxes. Full G2 still waits for P2b, drain and P1b-3b slice S. | |
| +| Paul, N-HA19 — D2 | **R1/H4/I3:** groups start serve-only using the existing role reader; role transitions, drain and readiness remain blocked until their producers merge. Refuse an existing drain/platform/unknown role; do not rewrite it. | |
| +| Paul, N-HA19 — D3 | **S1/H5:** two t4g.micro boxes with 20 GiB roots, at most 24h, $5 ceiling, destroyed afterwards. Retain the memory-headroom witness; failure stops the experiment, with no automatic resize or extension. | |
| +| Paul, N-HA19 — D4 | **I6/N1:** the real sidecar hairpin witness runs on the root runner now; live sidecar/G2 evidence waits for the merged native-sidecar producer and a scoped born-HA fixture. | |
| +| Paul, N-HA19 — switch-on gate | **S1/rule 5:** the actual UTC window, infra apply, release and drill still go to Paul as a dated scoped card. D1–D4 are decided; N-HA19 does not authorize live calls or supply a switch-on date. | |
| + |
| +## Scope, slices and finish lines |
| + |
| +| Slice / one session | Work | Finish line | |
| +|---|---|---| |
| +| **P3b-1, visible group boot** | Tasks 1–6: names, ASG/IAM, boot/admission/receipt, restart protection, hairpin and real group alarms. Safety work and measurement travel with this slice. | A dated approved dev deployment: count=2 across two AZs; at least one new `g-` member demonstrably serves the existing born-HA nested hapair fixture via each NLB EIP after its own hook acknowledgment. Record UTC hook → receipt → admission → first 200 and version/body. Both members must admit before accepting the slice. | |
| +| **P3b-2, attended maintenance** | Task 7: private operator transaction tooling, same-iid roll/rollback/recovery, T1/I4 outage witness. Root guard semantics are already active in P3b-1. | One member returns from Standby on the new build, same iid, no extra launch; a >15m S3+SSM restart outage preserves it in Standby and then recovers. | |
| +| **P3b-3, G2 evidence** | Task 8: complete drill card and execute only after the named main-only addendum and scoped go. | Terminate, hang, direct-backhaul first-service hang, S3 loss, networking and all remaining §21 witnesses recorded; no G2 claim while any prerequisite is missing. | |
| + |
| +P3b-1 is the smallest safe first group merge, not six scaffolding merges. If it cannot fit one session, stop at three days or three compactions and hand off; do not drop the restart guard or hairpin to force a landing. Each implementation session ends at its slice's merge. Planning finishes at this local commit. |
| + |
| +**Switch-on gate:** G1 dev switch-on is **recorded done**, not awaiting P2b: #421 export `/home/paulca/.cache/tmp/d421.txt:365` records items 1–7 on sophie-knitting and leo-climbing, v0.34.0, on 2026-11-03 (~22:35Z report; restarts 21:54:22Z/21:56:12Z); `:381–383` records item 8 and the console restart at 23:03:11Z. These are recorded observations, not a fresh live verification. Full §19 completion still lacks P2b role/platform/readiness doors and P1b-3b slice S evidence. **P3b-1 uses main-only interfaces and does not require P2b to merge.** **N-HA19 decides D1–D4**, including the limited staging exception to §19; it does not declare the missing features complete. Before implementation **starts**, take Task 8's dated card to Paul for the actual UTC switch-on window, infra apply, release and drill, naming the deployment operator and cleanup owner. No date or live execution is authorized here: do not begin building without that gate. The first merge still travels with observed hapair service; full G2/G3 remain gated on the missing producers. |
| + |
| +**Topology:** eu-west-1, canonical `ie`, empty record placement `CARLOS_REGION`, existing dev IE bucket, `CARLOS_POOLS=hapair` only, count=2 in two public AZ subnets. Use existing born-HA fixtures; P2a's create refusal is not bypassed by writing records. Group boxes run no console/relay/platform unit. Fixed IE boxes and their EIPs stay owned by their existing modules. Group-only fault runs require cleanly sleeping hapair fixtures and withdrawing only hapair from the fixed pair under the private approval card; retain all other pools and restore the exact configuration afterward. No production EIP transfer, old-host migration, replica design (#511), fleet provisioning, moves/import design or P6 retirement work. |
| + |
| +## Round history and stopping rules |
| + |
| +P3 plan review is **CLOSED at Opus R2, READY AFTER FIXES**, after R1's 2 P1/10 P2 and R2's 0 P1/6 P2. P3a whole-branch R1 was READY, 0 P1/0 P2/3 P3 (`docs/superpowers/reviews/REVIEW-REGION-HA-P3A-BRANCH-R1.md`). This plan replaces its group outlines with executable main-based tasks; **P3b review is CLOSED at R2, READY AFTER FIXES: 0 P1 / 1 P2 / 3 P3.** R1 was NOT READY: 1 P1 / 6 P2 / 7 P3. Under stopping rule 1, apply R2 fixes without reopening review; this final revision does so. There is no round 3. Splits, renames and reviewer changes do not reset the history. |
| + |
| +Upstream history remains closed: spec/P1a/P1b-1/P1b-2/dead-holder backoff R1–R3; P1b-3a R2/N-HA12; P2a R3/N-HA13; P1b-3b R3/N-HA16/17; follow-ups branch R2. **Namespace family:** P3a F1/F2 → N1 → R2-1/R2-2, then the ruled CUT and its incomplete-cut correction. This is not permission for another iterative withdrawal repair. Task 1 implements the brief's retained-name invariant. R2 classifies its carried H4/A1 P2 as incomplete rollback-guard coverage, not a new withdrawal repair; this commission supplies the single refusal point and its guard test. No further iteration or review round is authorized. |
| + |
| +| P3b round | Input / verdict | Disposition / budget | |
| +|---|---|---| |
| +| R1, Opus | Rev 1 `cac62f37`, brief `f6720fda`; findings `REVIEW-REGION-HA-P3B-R1.md`, committed `15d43bad`: **NOT READY, 1 P1 / 6 P2 / 7 P3** | T1/I4 return-hook premise checked against AWS below; H4/A1, I6/E1, G2 and S1 fixes applied in rev 2; remaining rollback coverage closed in rev 3. | |
| +| R2, Opus | Rev 2 `473b0d4d`, brief `daf648c8`; findings `REVIEW-REGION-HA-P3B-R2.md`, committed `b7208d9b`: **READY AFTER FIXES, 0 P1 / 1 P2 / 3 P3** | **CLOSED.** Rev 3 applies the remaining H4/A1 rollback refusal and all three cheap P3s below. No R3; N-HA19 settles D1–D4. | |
| + |
| +Use `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`. Carry these histories into every brief. Only marked risky tasks get their own Opus review; every slice gets a whole-branch review and census decision. The same budget includes census and checks of newly changed root/security/termination/storage behavior after P2 fixes. At 24h without merge, report blocker, last two rounds and recommended cut on the branch discussion and to Paul; repeat daily. No reviewer is launched by this drafting session. |
| + |
| +## Current code and file map |
| + |
| +| Evidence at 016599d5 | Reuse or missing work | |
| +|---|---| |
| +| `infra/modules/region-host/main.tf:536,580`; `variables.tf:16,21`; `outputs.tf:1` | Fixed instance/EIP; caller-supplied type and volume. There is **no module default instance type**. Group resources below are new. | |
| +| `infra/modules/region-host/ingress/main.tf:1`; `ingress/outputs.tf:1,9,12`; `ingress/alarms.tf:7,28,49,70` | Reuse NLB/TGs, zone-address map, NLB SG and per-TG/regional alarms. Do not create competing ingress ownership. | |
| +| `scripts/check-region-group-plan.py:337,346,357` | Fixed/protected-resource gate exists; cross-module creates with unknown target identity still need P3a follow-up P3-2. | |
| +| `infra/modules/region-host/main.tf:153,189,195,410,456,499,843,898,722` | Existing bucket/version/metrics/SSM policies, queue and receive rights. Group-specific least privilege is absent; store DeleteObject Deny correction is present. | |
| +| `internal/boxroles/roles.go:38,50,67`; `internal/host/boxroles.go:41,53,91,114` | Strict own/default reader, error retention, change-index/backstop and 5→60s retry. No new polling or role writer needed for serve-by-absence. | |
| +| `internal/groupadmission/state.go:9,15,32,47` | `Facts`, `Launch{Group,Hook,Instance}`, `Completer.Complete(ctx, Launch)`, coalesced Admit and close-wins core already exist. | |
| +| `internal/host/group_admission.go:37,45,63,105,112,140,183,195` | Group explicitly refused; fixed path calls Admit with nil launch. Real wiring, booting publication ack and worker-after-admission helper exist. Extend them; do not add a parallel latch. | |
| +| `internal/host/agent.go:2000,2003`; `internal/hadeparture/types.go:47`; `consumer.go:73,157`; `internal/host/hadepartures_wiring.go:108,148` | Reconciled acknowledgment, actual lifecycle Started/Done/Running/Stop, existing 20s consumer and policy-scoped importer. Use Started, never goroutine creation or coverage as acknowledgment. | |
| +| `internal/host/edgesfile.go:547,558,596,617,642,954,995` | Ready reconciled routes publish before admission; role fields are applied afterward. Fresh group boxes **cannot be claimed to publish no names**. Sidecars are explicitly excluded from served names. | |
| +| `internal/edge/homemap.go:897,1065,1082`; `internal/edgesfile/homeelect.go:100,187`; `internal/edge/wakeplacement.go:32,103,163,176` | Closed-entry exact refusal and serving exclusion exist. Dial-first collision ordering is not a complete all-name ownership proof; Task 1 owns that guard. The placement projection requires the peer to publish the same host/account/app; together with pool-scoped reconciliation this excludes foreign-pool targets. Preserve the existing chooser and prove this composition in Task 6. | |
| +| `internal/hostenv/hostenv.go:39,70,131,343`; `awsssm.go:60` | Existing required/shared selections still contain claims; pool scope needs a group-specific allowlist and bounded SSM pagination. | |
| +| `internal/host/installchannel.go:442,457,464,481` | Missing first floor object currently refuses. The spec's no-floor group boot is not implemented; Task 3 must add it explicitly. | |
| +| `internal/host/boxreference.go:34,40,77,98`; `boxrecord.go:121,158`; `awsaddr.go:31,51,75`; `boxaddress.go:50,79`; `internal/edge/door.go:142` | Signed group identity and metadata address adapter exist. `ipv4Only` checks syntax only; public-source validation and kernel hairpin authentication remain new. | |
| +| `internal/host/agent.go:3451,5436`; `systemapply.go:296,552,771,1788,2008`; `systemunits.go:56`; `units/carlos-edge.service:23` | System update, unit repair, apply/recover/rollback and Restart=always remain live paths. All group variants need one root guard. | |
| +| `internal/host/group_metrics.go:25,47,72`; `memwatch.go:115,128,143,164`; `infra/modules/region-host/group_alarms.tf:8` | Metrics explicitly exclude groups today; append group samples on the existing minute batch. Queue-age alarm exists. | |
| +| `internal/console/regioningress.go:12`; `internal/console/apiboxroles.go:14,26`; `hostclaimops.go:50,59`; `awsregionmetric.go:26` | Configured public ingress parser exists. Role vocabulary remains claim-era; claim-free verified EligibleBoxes startup is P2b, not an executable dependency here. | |
| +| `internal/provision/reconcile.go:515,3286,3314`; `internal/host/hadepartures_wiring.go:108,120`; `internal/host/hadepartures.go:33,54` | Region/pool reconciliation and importer policy are present. Test the composed hapair-only path; consumer admission must not wait for every unrelated departure to complete (N-HA17). | |
| + |
| +External, read-only evidence refreshed at private `platform-infrastructure` **origin/main 80d20c47a83dec74822ce36c5bfc0651b535ebc7**: `dev/region-ie.tf:10,11` uses **t4g.medium/20 GiB** after the 2026-11-03 console-box OOM (`e3b34bd`); `dev/region-ie-b.tf:14,15` still uses **t4g.micro/20 GiB**. This is merged configuration, not live inventory. N-HA19/D3 approves console-free group micro; it is not a claim that both fixed roots use it. P3a ledger at `.claude/worktrees/region-ha-p3/.superpowers/sdd/2026-11-03-region-ha-p3a/progress.md` explicitly defers group resources, hook adapter/receipt/marker/guard, boot/IAM/hairpin and group/EligibleBoxes alarms to this work. |
| + |
| +## Global constraints and review focus |
| + |
| +**I1–I6:** retain normal lease acquire, positive local-copy proof, duty adoption and forwarding/accounting. N-HA9's remaining 15-minute lease is reported separately from replacement time. Retain N-HA17's per-departure unsupported-host pages; never turn those into consumer-start failure. No replica feature or earlier takeover. **H4/R1:** capacity is advisory for existing hosts; role errors close new starts but cannot cause a previously admitted process to exit. After admission, shared S3/SSM/reconcile/publication failures leave startup facts and health latched until local shutdown (§9.5). |
| + |
| +**A1/I4:** an NLB can route to unhealthy targets. Direct HTTP, signed backhaul, authenticated doors, tunnel delivery, schedules, workers, co-spawn, sessions and duty import all remain behind the same tenant-start gate. Groups have no fixed platform/unit exemption. **N1:** root accepts only root-owned configuration, never agent receipt content as authority; no header-based proxy trust. **B1:** local gates, hairpin and permit reads add zero cloud requests. No new per-box poll. |
| + |
| +Review the actual production wiring, response-loss windows, namespace ownership versus dial eligibility, IAM Deny/Allow composition, all restart-capable root entries, and egress enforcement before DNAT. A passing isolated helper is insufficient. Keep fixed-mode wire fields, unit behavior, SDK metric inputs and resource addresses unchanged. The three P3a branch P3s are addressed in Tasks 1–3; the separate `region-ha-followups-p3.md` remains a follow-up list, not a new review round. Task 8 checks its alert-routing/identity limits on the card. |
| + |
| +### Task 1: Retain every name while admission is closed [own review: routing authority/cache] |
| + |
| +**Files:** existing `internal/host/edgesfile.go`, `internal/edge/{homemap.go,edge.go,wakeplacement.go}`, `internal/edgesfile/{homeelect.go,snapshot.go,fold.go}`, existing `internal/console/boxselect.go` and `boxselect_ha_test.go`, `internal/host/group_admission.go`, existing `internal/host/{systemleg.go,systemleg_test.go,agent.go}`, and their home/alias tests; proposed `internal/edgesfile/{nameauthority.go,nameauthority_test.go}`, `internal/edge/group_names_test.go`, `internal/host/group_names_test.go`. Read every consumer of host/name fields, including console election, aliases, asset authorities, certificates and steering; change a consumer only where the shared predicate requires it. |
| + |
| +- [ ] Write failing `TestGroupNamesBeforeAdmission` through real reconcile → edges publication → peer fold. Enumerate exact routes, platform aliases, plain aliases, instance catch-alls, delegated served catch-alls, cert-only wildcard parents, replica-marked names and path-owner ambiguity. Sidecar names remain absent. Cross two accounts, an admitted peer's own catch-all, no address, stale/malformed admission and all role states. Confirm real routes can exist before hook completion; do not infer an empty namespace from an empty disk. |
| +- [ ] **One H4/A1 invariant:** admission changes who may serve a name, never who owns it or whether a real route exists. Implement one pure name-authority resolution helper in `internal/edgesfile/nameauthority.go`, consumed by peer fold/election and exact-versus-local-fallback dispatch. Inputs retain class, owner/target, lifetime ordering and service eligibility separately. Output distinguishes absent, held and dialable, with a separate real-route bit. Proposed interface: `ResolveNameAuthority(name string, local []NameClaim, peers []NameClaim) NameResolution`; `NameClaim` carries class, account/app/target, stamp/lifetime, eligibility and dial point; `NameResolution` carries Absent/Held/Dialable, RouteExists, owner/target and optional dial. Derive claims from the existing wire schema and local route map; make all consumers use this resolution rather than independently interpreting a held bit. Keep existing wire rows; do not introduce withdrawal or a generic held wildcard that masks another admitted app. |
| +- [ ] Resolve ownership first: real route beats another account's alias even when the route is closed; exact name beats a catch-all. Within the same established owner/target, a serving peer may supply the dial under the existing lifetime rules. A held exact entry refuses 503 with no holder and no fallback to another account. Cert-only parents supply certificates, no route/namespace reservation. A closed wildcard supplies no new concrete ownership over names served by an admitted peer's own valid catch-all. Unknown owner identity cannot authorize a cross-account dial. Preserve switch-off legacy behavior and single-hop accounting. |
| +- [ ] Add `TestGroupNameClassCensus`: schema/producer inventory must fail when a new name-bearing field or derivation appears without a table row. Drive actual `ServeHTTP`, `ExactHome`, `Owner`, console home election and `DeploymentRoutesComplete` consequences; route existence must survive admission closure and aliases must not gain route authority. Run `nice -n 19 go test ./internal/edgesfile ./internal/edge ./internal/host ./internal/console -run 'TestGroupName|Test.*Booting|Test.*Alias|Test.*HomeElect' -count=1` before/after. |
| +- [ ] Publish additive capability `names-2` from every upgraded box writer (`internal/host/edgesfile.go:198,360`; `internal/edgesfile/snapshot.go:71`). One proposed `GroupReadersReady` predicate, over the existing complete cached deployment-wide fold, requires every live peer edges file to advertise it; missing, malformed, incomplete or stale evidence refuses. Unknown peers cannot be discarded to make the test pass. Reuse existing liveness/identity rules; a merely silent peer is not proof of retirement. Call this predicate both before the first booting group edges write and before initial CONTINUE or maintenance re-admission. Self is checked by the running build capability. New group peers with no first edges file use the same pinned, verified `names-2` launch build; they are not treated as old live edges publishers. A known live peer whose file is missing remains unknown/refused. The operator inventories nonpublishing readers as well. No per-box polling or request-time reads. Later dependency errors do not clear an admitted health latch (§9.5). |
| +- [ ] `TestGroupReadersReady` drives real mixed-version fold/publication/admission: one old peer (including a different pool/region reader), incomplete snapshot or unknown freshness yields **zero group edges PUTs and zero CONTINUE**. All upgraded permits both. The deployment command inventories nonpublishing readers too; check the console's published `X-Carlos-Version` against the accepted build and record its digest (no invented console capability endpoint). Serialize all supported release/rollback commands with the group experiment record. A rollback to a pre-`names-2` build refuses until Task 8's readback proves no active group publisher and no retained group namespace; missing readback refuses. An ad hoc privileged downgrade outside that entry is unsupported, not made safe by a cached capability. |
| +- [ ] **R2 P2-1 / H4/A1 — one consumer-side refusal point:** add the fixed-box reader-capability gate in `internal/host/systemleg.go`, in `systemLeg.tick` after its pending/backoff checks and before staging or asking root (`internal/host/systemleg.go:187–210` at 016599d5). This is the common path from an observed signed pointer (`:103–147`) to artifact fetch, request write and marker touch; it catches ordinary updates and rollback regardless of which operator published the pointer. Bind the deployment-fold snapshot through the existing arming site (`internal/host/agent.go:3451–3461`). Do not add a second policy in the console. For a target release below the first `names-2` release, refuse while the complete cached deployment fold contains **any group publisher or retained group namespace**, including booting, Standby, other pools/regions and undialable entries. Missing/incomplete/stale inventory or an unknown target capability also refuses; a silent publisher is not retired. Pin the first capable release tag and verified artifact digests at release preparation; local/upload builds need a known capable digest, not a caller-asserted version. Log the reason through P3b-C12. Re-evaluate at each existing tick, including deferred requests and marker re-touches, so a pending spread cannot bypass the gate. The gate adds **0 cloud requests** and does not change fixed unit configuration. Before first group opt-in, the serialized release preflight must settle any already-issued old-build root request and verify every reader is running the capable build; the consumer gate cannot retract an apply already handed to root. Task 8's deliberate-downgrade retirement readback remains required. |
| +- [ ] Failing-first `TestSystemLegGroupReaderRollback` drives the real observe → tick → root-request path with a signed old-release pointer and an already-published/admitted group; before the gate it stages/requests and the test **must fail**. Afterwards require zero artifact fetches, request writes and marker touches. Cover a retained namespace with no dialable member, missing/stale fold, another pool/region, group arrival during the spread, cached artifacts, deferred/re-touch paths, and unknown upload digest. A verified `names-2` target may proceed; an old target proceeds only after complete fresh retirement evidence and Task 8's serialized readback. Run `nice -n 19 go test ./internal/host -run 'TestSystemLegGroupReaderRollback|TestGroupReadersReady' -count=1` FAIL→PASS. This tests the supported channel consumer, not only an operator wrapper. |
| +- [ ] Mutation witnesses, nine: drop closed real-route bit; admitted alias beats closed route; held exact falls through; cert-only becomes route; closed wildcard masks local admitted catch-all; omit a name class; admit/publish with an old peer; permit old-reader rollback without publisher readback; bypass the systemLeg gate for a pointer rollback below `names-2` with a live group publisher. Every mutation must fail the production-path guard. |
| +- [ ] Take P3a P3-1 in existing `internal/boxroles/{roles.go,roles_test.go}` and proposed `internal/boxroles/imports_test.go`: replace boxroles' `release.Store` dependency with a one-method `Get(context.Context,string) ([]byte,string,error)` interface; preserve its two GETs/strict decoding. Extend the import assertion to both boxroles and groupadmission. This is a dependency cut, no role protocol change. |
| + |
| +### Task 2: Fixed-size group and least-authority IAM [own review: infrastructure/security/termination] |
| + |
| +**Files:** existing `infra/modules/region-host/{main.tf,variables.tf,outputs.tf,group_alarms.tf}`, `scripts/check-region-group-plan.py`, `scripts/check_region_group_plan_test.py`; proposed `infra/modules/region-host/{group.tf,group_iam.tf,tests/group.tftest.hcl,tests/group_iam.tftest.hcl}`. Ingress remains its own owner. Preserve existing fixed tests; new group fixtures use mock providers only. |
| + |
| +- [ ] Failing tests `group_shape`, `fixed_state_unchanged`, `invalid_group_inputs`, `group_iam_exact_scope`, `group_no_control_writes`. Add mode=fixed default/group, integer box_count≥1 (dev card ≥2), explicit VPC plus ≥2 distinct public-AZ subnets, pinned AMI/numeric launch-template version, validated deployment/region/bucket/pool/bootstrap configuration. Refuse fixed subnet/group mixtures, relay/console settings, wrong-VPC zones and duplicate EIPs. Fixed outputs keep meaning; group instance_id is null, group outputs additive. |
| +- [ ] Instantiate a distinct group module beside fixed roots. Allow it to consume an existing ingress output bundle (TG ARNs, NLB SG, own-region EIPs) so the dev root can reuse P3a ingress without moving its state; optionally create the same child for a new region, with exactly one owner. Check TG VPC, enabled AZs and address/config agreement. ASG attaches directly to both TGs; no attachment controller. New host SG: 80 only NLB SG, 443 NLB SG plus public signed backhaul; keep VPC backhaul rule, no SSH/extra IPv6 path. NLB egress remains VPC/ports, avoiding an SG cycle. |
| +- [ ] ASG min=max=desired=count, `enabled_metrics = ["GroupInServiceInstances", "GroupDesiredCapacity"]`, `metrics_granularity = "1Minute"`, ELB+EC2 health, 60s grace, suspended AZRebalance, no refresh/scaling policy/maximum instance lifetime/Spot replacement. Use **initial_lifecycle_hook**, launching transition, 900s, default ABANDON; policies/hook must exist for initial instances. Template uses same encrypted gp3/delete-on-termination volume, IMDSv2 hop1 and public IPv4. Pin release/AMI; no automatic template adoption. Ordinary tofu count decreases stay refused; N-HA14 is an operator API transaction only. No apply while a transaction is open. `group_shape` asserts both enabled ASG metrics and 1-minute granularity; Task 6's alarm fixture checks that its exact metric inputs are enabled. |
| +- [ ] Add explicit fixed state moves only where count conversion requires them; preserve every fixed resource's attributes. Extend plan gate's known-identity guard for unknown `instance_id`, `network_interface_id`, `role`, `allocation_id` on cross-module creates (P3a P3-2). Test state/volume/ENI attachments, moved names and targeted closure drift. New group creates with expected unknown identities need a **specific resolved group-resource provenance**, not a global unknown exemption; unrelated ambiguous creates refuse. Fixed-target attachment exception remains limited to reviewed create/delete. No new blanket override. |
| +- [ ] Group IAM: define regional=`arn:<partition>:ssm:<aws-region>:<account>:parameter/carlos/<deployment>/<region>` and shared=`arn:<partition>:ssm:<aws-region>:<account>:parameter/carlos/<deployment>/shared`. Regional/shared SSM exact-path AND descendant sets in Allow and NotResource Deny are `[regional, regional+"/*", shared, shared+"/*"]`; no ancestor, sibling or release-key reads. Put bootstrap/hash/ingress under regional `boot/`, outside nonrecursive env enumeration. Configuration KMS key only, ViaService=regional SSM and matching PARAMETER_ARN. CompleteLifecycleAction only exact account/region/group-name ARN (UUID wildcard only), matching deployment/region tags; no box UpdateASG, Enter/ExitStandby, heartbeat, SetInstanceHealth, RegisterTargets or EC2 writes. Scoped DescribeInstances region only; remove broader duplicate inventory grant for groups. |
| +- [ ] Audit final policy composition, including managed attachments. Group denies Put/Delete/tagging on `control/box-roles/*`; preserve existing signed identity, termination proof, edges and lease consumers and the merged store-Deny correction. Drop broad DeleteObjectVersion/ListBucketVersions; if a merged consumer needs versions, enumerate its exact object prefix and conditioned LIST prefix with a positive witness. Keep console inventory/writer rights on fixed roles. Box gets ReceiveMessage/DeleteMessage/GetQueueAttributes on **its group module's queue only**; fixed-box queue grants remain unchanged. No additional consumer or IAM write rights. Operator seed and maintenance privileges are separate, scoped on the approval card. |
| +- [ ] The group module owns a **distinct** termination SQS queue, region-wide EC2-terminated EventBridge rule/target and anti-forgery queue policy, matching `main.tf:843–898` (14-day retention, managed encryption, explicit Deny for sends not from that rule). Reuse the module-local resource shape, never sophie's or leo's queue. All members of this ASG compete on this one queue; each still runs exactly one 20s consumer. An event goes to one member per delivery, not every member; the fixed queues receive their own independent copies. Put the group URL in the group's regional SSM selection as `CARLOS_TERMINATION_QUEUE_URL`; never overwrite either fixed host.env. `group_shape` and `group_iam_exact_scope` assert queue/rule/target identities, URL/account/region binding, receive-only rights and forged-send denial. |
| +- [ ] `group_iam_exact_scope` enumerates policy inheritance: retain `AmazonSSMManagedInstanceCore` (`main.tf:428–435`) with the explicit parameter/release-key Denies; retain DNS-01 `host_route53` only for approved zones/TXT challenges (`:256`). Retain scoped `host_steering` only when that duty is enabled, with explicit zone/name conditions and its documented account-wide health-check limitation (`:301`); assert both enabled and disabled cases. **Exclude** console-only `host_costexplorer` (`:390`), `host_console_mail` (`:777`), `host_store` bucket/user provisioning (`:693`) and `host_store_scan` (`:815`), and reject those group inputs. Serving tenants use their existing data credentials; this exclusion grants no console duty to group boxes. Keep fixed store policies and their merged Deny fix unchanged. Assert the final combined action/resource set, including managed attachments, not only each inline policy. |
| +- [ ] Run mock `tofu test -filter=tests/group.tftest.hcl` and `-filter=tests/group_iam.tftest.hcl`, plus Python gate fixtures, from owned initialized local fixtures; first FAIL then PASS. Run module fmt check. Mutate six rails: no initial hook, wildcard completion, dropped Deny, decrement via tofu, changed fixed resource, unknown foreign identity. Never use an account-backed plan as a unit test. |
| + |
| +### Task 3: Claim-free boot, hook and receipt [own review: root/admission/termination] |
| + |
| +**Files:** existing `internal/host/{group_admission.go,agent.go,installchannel.go,bootstrap.go,boxroles.go,hadepartures.go,hadepartures_wiring.go,hadepartures_scan.go,hadepartures_wiring_test.go}`, `internal/hostenv/{hostenv.go,awsssm.go,cli.go}` and existing `hostenv_test.go`, `write_linux_test.go`; existing host tests `group_admission_test.go`, `installchannel_test.go`, `host_test.go`; proposed `internal/awsregiongroup/{complete.go,complete_test.go}`, `internal/host/{group_boot.go,group_boot_test.go,group_receipt.go,group_receipt_test.go,group_config_linux.go,group_config_test.go}`, `infra/modules/region-host/group-init.sh.tftpl`. Extend existing host-env command plumbing and `docs/site/cli.md` for any option change; no separate public administration command. |
| + |
| +- [ ] Failing-first tests: `TestGroupBootOrder`, `TestGroupHostEnvNoClaims`, `TestGroupHostEnvPools`, `TestGroupHostEnvRegions`, `TestGroupInstallFloor`, `TestGroupAdmissionLifecycle`, `TestGroupAdmissionReceiptCrash`, `TestGroupAdmissionNoHibernate`. Refuse missing hibernate configuration at startup (P3a P3-3), rather than waiting forever for a consumer which cannot arm. |
| +- [ ] Boot hardening precedes credentials/tenant execution: nft IMDSv4/v6 denial, chrony, service account, root-owned no-symlink directories. Write immutable root-owned 0644 `/etc/carlos/group.json` (non-secret version/account/region/group/hook/deployment/placement/pools/config digest), separate `/etc/carlos/region-config.json`, and task-4 group unit protection before starting anything. Require the marker and matching unit/configuration on every group entry; `CARLOS_BOX_REFERENCE=group`, admission=1, HA=true and index=read must agree. Missing/unsafe marker, claims enabled, wrong identity or switch mismatch refuses; no fixed-mode fallback. |
| +- [ ] Pin group OS updates to attended Standby maintenance: disable/mask `apt-daily.timer`, `apt-daily-upgrade.timer`, their services and `unattended-upgrades.service`; set `APT::Periodic::Enable "0"` and `Unattended-Upgrade::Automatic-Reboot "false"`; configure needrestart list-only (`$nrconf{restart} = 'l'`). Apply before package installs or starting edge; no automatic reboot, package maintainer-script restart of a live edge, SSM patch association or scheduled reboot is allowed. Package/kernel updates, manual systemctl/reboot and stop/start are operator-only through Task 7. Root can bypass policy, so do not describe the application guard as an arbitrary-root sandbox. `TestGroupInitNoAutoRestart` checks the rendered template/config and ordering; Task 7 reads back effective masks, needrestart policy and absence of patch/reboot schedules. |
| +- [ ] Read operator-protected bootstrap object key/version and SHA from SSM once; verify object before any exec. New group-specific hostenv selection omits every `CARLOS_HOST_CLAIM*`, accepts explicit validated `CARLOS_POOLS`, AWS_REGION for deployment bucket, queue URL, platform ingress and canonical region separately from record placement. Compare env scope to marker, require hapair only on dev; never default empty pools to shared. Keep fixed allowlists unchanged. Bound configuration to 100 parameters/20 SSM pages at MaxResults=10, reject duplicate/conflicting keys, no secret logs or shell sourcing. |
| +- [ ] Run existing bootstrap then install-channel with safely parsed host.env. Add proposed `checkGroupInstallFloor` observation: both floor and authorization genuinely absent permits claim-free installation; either alone, unreadable, invalid or too new refuses. Observe both once. Published floor still verifies signed identity/image; no-floor still verifies signed pointer/artifact. Existing claims/--policy install stays strict; unreadable/local guard participation refuses. No fabricated identity or guard-arm. Retain `TestBootstrapAppliesTmpfilesBeforeArming` and `TestReconcileMintsNestedUnderANestedIntent`. |
| +- [ ] Install/read back dormant hairpin rules and Restart=no before agent; Task 5 activates redirect only while admitted. Whole boot must finish within the original 900s hook deadline; healthy consumer startup budgets ≤30s separately from first full reconcile and booting publication. Reuse `wireAgentAdmission`, actual `Lifecycle.Started()` and matching booting `EdgesPublished`; use nonnil Launch/Completer for first group boot. Do not complete from requests or public health checks. Full local six-condition health plus four facts precedes CONTINUE; post-call health/closure recheck precedes opening. No host orchestration mutex may be held across the cloud call; Close must win while completion is in flight, as the core already allows. Platform role on a group is refused. A drain role is not “drained”; until its producer merges the activation preflight is serve-only (D2). |
| +- [ ] Adapter validates own signed iid/account/region against immutable group/hook, sends CompleteLifecycleAction by InstanceId, and disables SDK retries. Bound completion to four total 2s attempts, 1/2/4s backoffs; **budget is per launch, not per tick**. Persist attempt/unknown state locally so an agent restart cannot reset it. Definite failed initial boot may send ABANDON within that same total; early failures without a working adapter rely on default ABANDON at 900s. No heartbeat extensions. Ambiguous CONTINUE stays closed; do not follow it with a guessed success or keep issuing CONTINUE on later ticks. Alarm and health-driven initial-launch cleanup cover accepted-but-unrecorded success; observe no accumulating live Pending members. |
| +- [ ] Host wrapper fsyncs atomic `/data/carlos/group-admission/receipt.json` before reporting successful completion: carlos-owned 0700 parent/0600 file, no symlinks, bound account/region/iid/group/hook/config digest. **Root never reads this agent receipt.** On admitted maintenance restart, a valid same-identity receipt suppresses **only the original launch action**; all local facts and readiness must recur. It cannot suppress a return action owned by Task 4's operator transaction; the box never competes for that action. Operator-mediated config rebind verifies original completion evidence, not a root trust of agent content. Wrong iid/group/hook, corrupt/absent receipt and “no active hook” never count as acknowledgment. Such an admitted member stays in Standby; no ABANDON/timeout replacement. Reboot needs new boot-id permit and address verification. |
| +- [ ] **A1/I6 choice (a):** while group admission is closed, the consumer may receive and durably journal hints, but may neither import duties (`BindHADuty`/`AdoptHost`), finalize/delete a departed peer's evidence, nor acknowledge any queue receipt. Inject the same admission/start predicate into the production departure controller before arming it. Gate its work/import/finalization and every ack path, including invalid-message and already-complete shortcuts in `hadepartures.go:153–182`; do not return a receive-record error merely because admission is closed. A successful Receive plus durable record still closes Started, avoiding the admission/consumer deadlock. After admission, the existing worker cadence resumes; closure cancels/joins work before shutdown. The queue's 120s visibility permits an admitted group peer to receive an unacked hint; a fixed queue receives a separate EventBridge copy, not this receipt. |
| +- [ ] `TestGroupDepartureAdmission` in production wiring with a shared fake queue: booting B receives a departure, Started becomes true, yet import/finalize/DeleteMessage counters stay zero; visibility expires and admitted C imports under normal proof/lease rules. Repeat with B ABANDONed, B later admitted, invalid hints, completed-journal replay and shutdown racing import. No duties become owned by a never-admitted B. Model the same receive-before-admit/redelivery/failed-boot actions in Task 6. I6 retains the existing visibility/redelivery and scan bounds; no new 15m wait for a failed boot's imported duties. |
| +- [ ] Drive real direct/hop/door/tunnel and timer/worker/session/co-spawn/duty-import paths with withheld facts: zero acquires, key mints, restores, starts, AdoptHost/BindHADuty calls, queue acknowledgments or holder headers. Close admission before shutdown/consumer Stop; Done is not synthesized. Test ack-before-receipt, receipt-before-publication, lost response, persistence failure, close-during-complete, duplicate callbacks and no retry after exhaustion. Run targeted host/groupadmission/awsregiongroup/activator/edge/hostenv tests (`-run 'TestGroup|TestPreAdmission|TestAdmission'`, nice 19) FAIL→PASS. Mutate nine rails: nil group launch, early ack, fake Started, receipt reuse, retry reset, no-floor error-as-absence, pool mismatch, shutdown reopening; closed-member import/ack. |
| + |
| +### Standby return: provider evidence and T1/I4 contract |
| + |
| +Read on 2026-11-04, public AWS documentation only; no dev observation has been performed: |
| + |
| +- **Lifecycle-hook availability, footnote 1** expressly excludes Standby: “Does not apply when you […] move instances in and out of standby mode, or delete the group with the force delete option.” The marked omission is the attach/detach clause. [https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html) |
| +- **Standby procedure:** “You return the instance to service by exiting the standby state.” Its example reports activity `PreInService`, which is not an instance `Pending:Wait` observation. [https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-enter-exit-standby.html](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-enter-exit-standby.html) |
| +- **Lifecycle page and diagram:** “You can add a lifecycle hook to your Auto Scaling group so that you can perform custom actions when instances launch or terminate.” Its scale-out discussion specifies Pending→Pending:Wait for a launch; the diagram does not override the explicit Standby exclusion. [https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-lifecycle.html](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-lifecycle.html) [https://docs.aws.amazon.com/images/autoscaling/ec2/userguide/images/auto-scaling-instance-lifecycle.png](https://docs.aws.amazon.com/images/autoscaling/ec2/userguide/images/auto-scaling-instance-lifecycle.png) |
| + |
| +**Conclusion:** R1's unconditional re-entry-hook premise is not supported by the explicit AWS availability rule. Model normal return without a hook, but never use that assumption to ignore a wait state. The ExitStandby API's `PreInService` activity alone proves neither a hook nor its completion. [https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_ExitStandby.html](https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_ExitStandby.html) |
| + |
| +**One T1/I4 return invariant, enforced in Task 7's single `return_member` transaction function:** only the serialized operator may return the same iid, after fresh process admission and role publication. It owns any return CONTINUE; the initial-launch receipt can suppress only original-launch duplicates. No maintenance branch sends ABANDON or treats elapsed time as permission to replace. Initial failed boots retain the separate 900s default ABANDON. Tasks 3/4 only supply guarded local state and tests of this contract; the box does not implement a second return controller. |
| + |
| +| Observed phase | Sole operator action / evidence | |
| +|---|---| |
| +| Standby, local readiness incomplete | Keep Standby; no ExitStandby or completion. Wait/alert/resume the same transaction. | |
| +| Standby, freshly admitted | Read root-authenticated status over Task 7's Session Manager channel: exact iid/boot-id, current edge pid/start identity, current transaction, full local health, admission and successful role publication. Persist this observation and return intent; require it ≤5s old immediately before ExitStandby. No restart/second operator may intervene. | |
| +| Return intent recorded; Exit response lost | Read exact member lifecycle/group desired/TG state before another write. Standby permits retry only after a fresh readiness observation; Pending/PreInService/InService never triggers another Exit or a blind desired increase. | |
| +| **Pending:Wait** on return (defensive provider-divergence case) | `return_member` immediately completes **CONTINUE** for the immutable group/hook and exact iid (InstanceId selection, not the original token). Recheck current-process admission first. Persist a separate return-action journal keyed by transaction+iid+boot-id+process start+Exit activity, including call intent/outcome and attempt count; never consult the launch receipt to skip it. SDK retries=1; ≤4 explicit 2s attempts, 1/2/4s backoffs, far inside 900s. No blind retry after ambiguous success: describe first. | |
| +| **Pending:Wait, current-process admission has dropped** | **Failed probe immediately**, the same outcome as loss of API access under provider divergence. Before the 900s hook deadline, stop the roll, alert the operator/controller, record the exact iid/hook/transaction/deadline and restore any reversible probe fault. Do not send CONTINUE while unready, do not send ABANDON, and do not wait the ordinary 15m Standby interval or assume Standby protection. No heartbeat or guessed deadline extension. AWS default ABANDON may terminate this disposable probe member at 900s; record that loss as FAIL, verify its eventual state/replacement and restore the approved topology under the card. It is never a passing same-iid maintenance witness; further rolls stay blocked pending resolution of the provider contract. | |
| +| InService after acknowledged completion or no-hook return | Read back same iid, unchanged total member set, desired N and both TGs healthy before restoring min N/revoking permit. An ambiguous return completion may be resolved by this transaction's observed InService plus fresh admission; this does not relax Task 3's stricter initial-launch receipt rule. | |
| +| Provider behavior differs from the approved observation | Stop/alert, do not advance to another member or start a software roll. If already returned, finish the pending action safely, then EnterStandby(decrement) and verify deregistration; retain the same iid in Standby. Never pretend an iid already in Pending:Wait is still protected by Standby. | |
| + |
| +The first **live** step of P3b-2 is one approved disposable Enter/ExitStandby observation on an already-admitted, unchanged member, using the exact hook/template and recording instance LifecycleState, activity and target states. No package/binary change precedes it. Require the documented no-return-hook result before enabling real rolls. The synthetic Pending:Wait path remains mandatory in the fakes even when the observed path has no hook. If a hook is actually observed, recover/hold the probe in Standby and refuse P3b-2 until the controller resolves the provider contract; do not silently switch to a timed safety promise. In particular, if API access is lost after an unexpected hook starts, an operator cannot guarantee stopping AWS's deadline: that is a failed probe and a roll blocker, never a passing N-HA14 witness. |
| + |
| +### Task 4: One root restart guard [own review: root/termination] |
| + |
| +**Files:** proposed `internal/host/{group_maintenance.go,group_maintenance_test.go}`, `internal/host/units/carlos-edge-group.conf`; existing `internal/host/{agent.go,systemleg.go,systemunits.go,systemapply.go,bootstrap.go,systemleg_test.go,systemunits_test.go,systemapply_test.go}`. Operator automation is Task 7; define and test its transaction protocol here with fakes so the first group already has enforceable protection. |
| + |
| +- [ ] `TestGroupMaintenanceRestartGuard` fails first on every actual apply/recover/rollback/quiesce/repoint/unit-repair entry. Central `requireGroupMaintenance` reads only root-owned marker and permit under `/etc/carlos` and `/run/carlos/group-maintenance/permit.json`: strict bounded schema, uid0, mode0600, regular single-link file, no symlink path traversal, boot-id and exact account/region/group/iid/transaction/old+new signed artifact digests. Checks occur under the mutation lock before any stop, repoint or recovery side effect. Agent-writable data is never a permit. |
| +- [ ] Disable group systemLeg; mask automatic system-update path/service, make unit repair preserve masks and the group-only `Restart=no` drop-in. Keep fixed units unchanged. A stale queued update cannot stop/repoint; an absent flag cannot remove marker enforcement. Add root gate to direct install-channel reentry on an already-booted member, so it cannot bypass system-apply protection. First boot's installation permission is consumed before edge starts, never reusable as maintenance permission. |
| +- [ ] Permits are installed only by the authenticated deployment operator over **AWS Systems Manager Session Manager**, the existing no-SSH admin channel (`main.tf:428–435`), **after** ASG Standby and both TG deregistration readback. Permit phases distinguish mutation, local verification, return and revocation; expiry refuses further mutation but never terminates or exits Standby. An already-used mutation cannot replay under a stale permit; same transaction may explicitly authorize rollback to the recorded old artifact. Operator loss leaves durable transaction/Standby intact. Root receipt/config file tampering tests are independent of agent admission tests. |
| +- [ ] Fake transaction tests require N≥2, one transaction and admitted healthy peer; lower min N→N-1 (desired/max N), EnterStandby(decrement=true), verify exact iid/desired N-1/min N-1/max N and deregistration, then permit/close/restart. Return follows the single contract above: include Standby→Pending:Wait→InService as well as documented no-hook return; operator completes a return action independently of the original receipt, then verifies same iid/healthy, restores min N and revokes last. Never blindly repair desired after an ambiguous response; read actual phase. No global suspension of HealthCheck/ReplaceUnhealthy, no EnterStandby without decrement. |
| +- [ ] `TestGroupSharedDependencyHealth`, `TestGroupMaintenanceCrashResume`, `TestGroupUnitsCannotRearmUpdate` prove S3/SSM errors leave an admitted live process healthy; restarted member stays closed in Standby. Use preserved host.env/certs/binary, no restart-time SSM refresh. Fifteen-minute wait only alerts/returns to operator. Fake time advances beyond grace/threshold/wait without replacement while held in Standby. Add `TestGroupStandbyExitPendingWait`: after fresh re-admission, a valid original receipt plus a synthetic return hook must cause one operator CONTINUE and no box completion. Run against rev 1 semantics first: its receipt suppression/no operator completion reaches default ABANDON at 900s and **must fail**. Test unready refusal before Exit, wrong transaction/process, operator resume and lost return response. Add the post-Exit admission-loss case: operator records FAIL and alerts before 900s, sends neither completion result, and the fake default ABANDON is recorded as a failed probe, never successful retention. Run targeted `nice -n 19 go test ./internal/host -run 'TestGroupMaintenance|TestGroupSharedDependency|TestGroupUnits|TestGroupStandby' -count=1`. Mutate nine rails: absent permit allowed, check after stop, wrong iid/boot-id, agent receipt trusted, repaired Restart=always, automatic ExitStandby, timeout termination, receipt suppresses return completion, completion before fresh admission. |
| + |
| +### Task 5: Own-region hairpin with a verified public source [own review: root/network trust] |
| + |
| +**Files:** proposed `internal/hairpin/{rules.go,rules_test.go}`, `internal/host/{group_hairpin.go,group_hairpin_rootrunner_linux_test.go}`, `internal/edge/{hairpin_linux.go,hairpin_other.go,hairpin_test.go}`, `infra/modules/region-host/hairpin.sh.tftpl`; existing group boot, `internal/host/group_admission.go`, `internal/edge/edge.go`, unit rendering and tests. Non-Linux builds retain an explicit unsupported group-hairpin result. |
| + |
| +- [ ] Failing `TestHairpinRules`, `TestHairpinPublicIdentity`, `TestHairpinOriginalDestination`: strict versioned root-owned `/etc/carlos/region-ingress.json`, 1–16 distinct canonical public IPv4 literals, own region only. No hostnames, arbitrary nft fragments or environment interpolation. Root owns the ruleset table and configuration. Existing metadata source is reused, but syntax-only `ipv4Only` is insufficient. |
| +- [ ] **Verified address:** at boot root reads IMDSv2 public-ipv4 from this instance, verifies signed identity against marker account/region/iid, checks public global IPv4 using the `usableDoorAddr` property plus rejection of non-public/reserved ranges, and writes a root-owned runtime snapshot bound to boot-id. The identity document does not itself sign the public-IP leaf; provenance is the local protected IMDS channel. Group boot refuses a conflicting env address override. The edge revalidates snapshot ownership/schema/boot binding before enabling hairpin; missing/unknown/private source refuses before tenant dispatch. It represents the local caller's public egress address; an outside client keeps its actual socket address. |
| +- [ ] Concrete path: two dedicated listeners bound to the validated primary host address at reserved ports 18080/18443, separate from ordinary 80/443. Root nft output DNAT catches host-network root/agent/tenant/sidecar calls to configured EIP:80/443; a corresponding prerouting rule covers supported tenant bridge/rootfs namespaces. Input filter admits these ports only for connection-tracked DNAT from local output or enumerated tenant interfaces with that original destination/port. All external/VPC/direct-port traffic is denied. No route_localnet or widened loopback trust. |
| +- [ ] **R2 P3-2 / A1/N1 — redirect only while admitted.** Install the table/listeners dormant before agent start. Couple activation and removal of both output and namespace DNAT to the current process's admission lifecycle; booting members and members closed for Standby leave new own-region connections on the ordinary NLB path to admitted peers. Do not claim this fixes an all-unhealthy NLB. Use a bounded root operation over the immutable validated rule configuration, with only enable/disable and current process identity as inputs; no caller-supplied addresses, ports or nft text, and no receipt as root authority. Enable after admission, remove redirect on closure before maintenance stops the edge, and clear prior-process rules before any restart. Existing redirected connections remain subject to the same closed start gate; they never gain tenant-start permission. `TestHairpinAdmissionLifecycle` and the root-runner witness check booting → admitted → closed/Standby → new-process re-admission, both rule paths and both EIPs: no local redirect while closed, local verified-source redirect while admitted. No additional polling. |
| +- [ ] Linux accept wrapper obtains the kernel's original destination (`SO_ORIGINAL_DST`) before TLS, verifies it against the root list/port and dedicated listener, and supplies an unforgeable connection-context hairpin mark. Handler normalizes RemoteAddr to verified public box IPv4 before rate/accounting/forward signing; strip/replace spoofed forwarding fields using the ordinary public path. No HTTP header or caller-set socket mark opts in. Preserve Host/SNI, TLS cert selection, WebSocket upgrades, request method/body and single-hop behavior. Even if input filtering is accidentally bypassed, a direct dedicated-port connection has the wrong original destination and refuses. |
| +- [ ] Prove cgroup egress checks still evaluate the requested ingress EIP, before rewrite, for host and namespace paths. Never solve a failed witness by permitting private/loopback destinations. Atomically replace only the owned nft table; persist/reload dormant before tenant units, then activate through the admission lifecycle above. Address changes need explicit root reseed under maintenance; an ordinary process restart retains verified boot snapshot, stop/start or reboot re-verifies. No DNS/SSM/IMDS polling is added. |
| +- [ ] `TestHairpinKernelAgentTenantSidecar` runs on the designated Linux root runner (never sudo on this shared machine): real agent, nested tenant, standalone sidecar and supported rootfs namespace, both EIPs, GET/POST/TLS/WebSocket. Check tenant-observed address and derived client headers; public ingress headers cannot impersonate local hairpin. Test IMDSv4/v6 denial, egress-denied EIP, direct-port forgery, wrong original destination, no rewrite loops, reboot ordering and owned-table rollback. A skipped root test is not acceptance. Mutate seven rails: trust header, use private source, broad destination rule, bypass original-destination check, weaken egress, omit namespace path, leave DNAT enabled after admission closes. Local pure tests run with nice 19; network-layout refusal that cuts supported callers goes back to Paul, not silently to a limitation note. |
| + |
| +### Task 6: Group observability and first visible slice |
| + |
| +**Files:** existing `internal/host/{group_metrics.go,memwatch.go,group_metrics_test.go,memwatch_test.go}`, `internal/groupadmission/observation.go`, `infra/modules/region-host/group_alarms.tf` and tests; proposed `infra/modules/region-host/tests/group_alarms.tftest.hcl`, `internal/host/group_boot_budget_test.go`; existing `internal/sim/regionha/{world_test.go,actions_test.go,invariants_test.go,sim_test.go}` and proposed `group_admission_test.go` in that directory. Whole-branch review covers instrumentation; any changed security/root behavior still gets the scoped check. |
| + |
| +- [ ] FAIL→PASS `TestGroupPoolIsolation` through real reconcile/publication/wakeSnapshot/CanAdopt (shared-only, hapair-only and combined peers), `TestGroupMetricsBatch`, `TestGroupAlarmProducers`, `TestGroupBootRequestBudget`: extend existing minute batch, actual box AWS region. Preserve original InstanceId MemAvailablePercent/PSI bytes; append group-name memory/clock/admitted plus existing Deployment+Region admission/clock samples. No second sampler or S3 object. Keep fixed switch-off input byte-identical. Chrony remains fixed absolute command, 1s/4KiB, synchronized/finite parsed offset; unknown is not zero. |
| +- [ ] Keep NLB alarm ownership in ingress: each TG UnHealthy maximum >0 for 10/10 minutes; Healthy minimum <count for 25/25; missing breaching. Add ASG metric math `GroupInServiceInstances - GroupDesiredCapacity < 0`, 1/1 minute, missing breaching; use actual desired so approved Standby is not misreported as missing membership. `group_alarms.tftest.hcl` asserts Task 2 enables both metric inputs with 1-minute collection before this alarm is armed; ASG metric collection adds no resource fee or box API calls. Group memory minimum <15%, 3/3 minutes, missing breaching; group clock maximum >1s, 1/1 minute. Existing queue age >600s stays. EventBridge launch-unsuccessful events scoped to group notify same-region SNS; no brittle Cause-text filter. Timeout/default ABANDON and group-size deficit are both witnesses. Alerts never trigger replacement for S3 loss. |
| +- [ ] Enumerate producers before arming alarms. P2b EligibleBoxes remains outline, not a zero/dummy stream. Record per-iid diagnostic evidence: regional aggregate clock samples alone cannot prove every member reported. Test low-member memory, missing clock, hook failure, recovery and SNS region. No missing-data suppression that invents healthy capacity. |
| +- [ ] 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. |
| + |
| +### 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. |
| + |
| +- [ ] Implement Task 4's phase machine as an attended operator command, with a durable root-on-operator-host record keyed by group and transaction, exclusive group lock and authenticated root delivery through Session Manager (approved operator identity, exact instance ARN and approved shell session document; no SSH or agent-written permit). Keep `AmazonSSMManagedInstanceCore` on the group role and the parameter Denies intact. One session delivers/reads back the bounded permit and status; every reconnect is counted. All supported operators must share that serialized release entry; a second writer or lost record refuses before changes. Record before/after API intents and responses, exact iid, member set, artifact digests, permit state and target readback. Restrict operator IAM to named group UpdateASG/EnterStandby/ExitStandby/**CompleteLifecycleAction** and required group/member/target describes; scope completion to the same group ARN/tags as the boot adapter, and enforce iid/hook/CONTINUE-only/transaction binding in `return_member` where IAM cannot express it; termination is separate scoped fault authority. No cron, daemon or box credential can run it. |
| +- [ ] Fake-provider failing-first `standby_roll_order`, `standby_response_loss`, `standby_resume`, `standby_shared_outage`, `standby_exit_pending_wait` cover every write boundary including operator death after Enter/ExitStandby and before restoring min. Refuse unsupported hand restarts **before** issuing systemctl stop. Validate staged signature and old local configuration before lowering minimum. Exercise return CONTINUE success/loss/duplicate, operator restart in Pending:Wait, and stale original receipt: the rev 1 fake must time out/ABANDON, and rev 2 must complete exactly once on a successful response. Treat Pending:Proceed as an in-flight completed action, never complete it again. Keep the same iid; do not refetch SSM parameters to restart. A local-failure termination requires independent evidence and scoped authority. |
| +- [ ] After fake tests pass, the first live step is the no-software-change provider observation above; no actual roll without its recorded pass. Verify Task 3's effective OS masks/policy and absence of automatic patch/reboot associations. Live witness, later approved: capture member IDs/activity counters; admit two members; roll one. Attempt unattended update and invalid permit (zero stop/repoint). In Standby black-hole S3+SSM, restart, drive direct/hop/door/tunnel/timer paths, hold >15 minutes, lose/recover operator connection. Require same iid, no extra launch/replacement/termination, no lifecycle completion **while unready in Standby**, closed tenant admission. Restore access, re-admit/publish, use `return_member` (0 completions on documented live return; the separate fake exercises one return CONTINUE), return same iid and restore min=desired=max=2. Test rollback/recovery through the same guard. Then hang outside maintenance to prove genuine local failure still replaces. |
| +- [ ] Bound each operator wait in Standby to 15m, then alert and retain Standby/permit/record; no automatic timeout action. After Exit, never use this 15m wait for Pending:Wait: handle it immediately under the return contract, including the explicit failed-probe action if current-process admission drops. `standby_exit_pending_wait` also asserts that this failure is recorded/alerted before 900s without unsafe CONTINUE; provider timeout is a failed probe, not a maintenance pass. A lost operator may resume only with the durable action journal and current state; no duplicate Exit or completion after InService. Run fake tests before scoped live go; mutate decrement=false, permit-before-Standby, blind desired reset, exit-on-timeout, ignored transaction lock, original receipt suppresses return completion, completion before fresh admission, treating PreInService as InService (eight). Warm multi-tenant drain/readiness claims wait for the outline below; a maintenance restart is not certification that duties drained. Record any held-request outage and remaining-lease wait, never promise seamless roll. |
| + |
| +### Task 8: Dev approval and G2 drill card |
| + |
| +**Files:** proposed private `dev/region-ha-group.tf` and `docs/superpowers/notes/2026-11-04-region-ha-p3b-dev-drill.md` for the card and evidence; platform evidence references them. Tests here are acceptance observations, not new production code. No live call is authorized by this plan. |
| + |
| +- [ ] Card names actual account id, eu-west-1 VPC/subnet/AZ/SSM/KMS/SNS/bucket ARNs, domains/fixture IDs, two group members, ingress ownership, max count/type/volume, IAM deltas, fault permissions, cost/UTC 24h window, cleanup owner and retained-versus-disposable resources. Set `CONSOLE_REGION_INGRESS` to full configured public set before publication; own-region hairpin uses only IE EIPs. Record the completed G1 switch-on evidence above and its release. For the full G2 addendum only, record P2b/S producer commits after they merge; do not make those a P3b-1 prerequisite. Refuse wrong pool, legacy fixture, unsupported sidecar, missing clock sandbox access, missing local admission or unverified namespace-reader roll. |
| +- [ ] Pin ingress alarm `expected_targets` explicitly: **2 before**, **4 during shared P3a ingress + two group members**, **2 after group removal**; both fixed targets stay registered even when their hapair pool is withdrawn. Count does not fall to 2 merely because fixtures are group-only. A separately approved dedicated group ingress uses 2 during and is removed at cleanup. Keep these thresholds during Standby: a >25m maintenance interval is expected to trip HealthyHostCount, including a >15m outage plus restore. Annotate and acknowledge that alarm with transaction id/window; do not disable delivery or change the ASG deficit alarm. Verify healthy/threshold readback and alarm recovery on return and cleanup. |
| +- [ ] Read-plan the **whole private dev root** at the proposed pinned module revision, inventory fixed IE/IE-b/UK/standby drift, then make a targeted saved plan for named group resources/ingress changes only. Run JSON gate on the full target closure. The store-Deny fix is on this base; prove the selected module revision includes it and no saved plan restores the Deny. Do not apply incidental fixed user_data/IAM/SG/EIP drift. First flagship module bump later must also pass the moved-state/fixed gate; no flagship change here. |
| +- [ ] First-service sequence: verify baseline fixtures born HA/nested and hapair-only reconciliation/placement/import; preserve fixed scopes until the approved group-only phase. Observe Pending:Wait with each readiness fact withheld, direct signed backhaul refused, real first Receive acknowledgment, full readiness, CONTINUE/receipt, admission publication, InService/healthy, then GET/POST/WebSocket/version via each EIP from outside VPC. Console remains fixed, with its existing unit stamp before any fixed admission roll. Verify DNS guidance never offers transient group public box addresses. |
| +- [ ] **G2 failure matrix:** (1) terminate one disposable admitted member; (2) hang health/agent; (3) hang immediately after first successful service reached by direct backhaul; (4) black-hole S3 on a live admitted member. For 1–3 capture health exclusion, termination proof, lease expiry, replacement boot, first200 and data loss per replication class. For 4 require health200, same iid, no automatic replacement; alarm then separately scoped operator termination. Measure §9.8 phases separately; N-HA9 waits the remaining lease, no early takeover. An initial failed boot reaches ABANDON/termination notification without live Pending buildup. All-unhealthy NLB still cannot bypass local admission. |
| + |
| +For drills 1–3, use these **acceptance limits derived from §9.8's estimates**, not a new availability SLA. Define `t0` as confirmed fault injection, `L=max(0, recorded lease expiry−t0)`; log last renewal, expiry and clock uncertainty. Probe every second with request IDs and serving iid; use server logs to account for reused connections as well as new ones. Pre-existing long requests are closed/quiesced before the fault so the failed-iid count is testable. |
| + |
| +| Drill | Numeric pass criteria | Cleanup before another fault | |
| +|---|---|---| |
| +| 1: terminate admitted member | NLB excludes failed target ≤30s from t0; first successful HA request ≤L+180s from t0; termination proof required before takeover. | Confirm terminated iid, replacement's hook/receipt/admission, two healthy group members and no excess member. | |
| +| 2: hang admitted agent/health | Exclusion ≤30s; replacement launch starts ≤180s from t0 (60s grace +120s allowance); first200 ≤L+180s. Record exclusion, termination, event, boot and restore separately. | Verify hung iid terminated and replacement admitted; if fault is aborted before termination starts, SIGCONT only that exact iid under the card and verify its state before any further action. | |
| +| 3: hang immediately after first direct-backhaul service | Capture that first200 and hang at once; same ≤30s exclusion, ≤180s replacement-start and ≤L+180s recovery bounds, including the initial 60s grace. | Same exact-iid termination/SIGCONT checks as drill 2; no lingering hung process or pending lifecycle action. | |
| + |
| +All three also require **zero successful requests served by the failed iid after exclusion**, one writer/acquirer per lease generation with monotonically increasing generations, and no takeover before proof **and** expiry. Feed acknowledged numbered writes continuously and compare restored data: stream DB committed-write loss **≤1s**; every other replication class **≤its recorded configured publish/snapshot interval**. A class without a stated interval/bound or an unmeasured restore is not a pass. Missing samples or any exceeded bound means **FAIL**: stop further injections, remove faults, restore verified fixture service, keep required resources, and report phases/loss/remaining blocker; never weaken the limit after observing it. After each run, sleep fixtures cleanly through the API and verify marker/debt state. No full G2 claim until every row and the outlined producers pass. |
| + |
| +- [ ] Observe accepted CONTINUE with lost response/receipt separately from failed boot: initial box may be InService while local admission remains closed, then is health-replaced. Record this expected conservative outcome in P3-C3 diagnostics, the timeline and launch counters; no false boot-failure label or accumulating Pending instance. Maintenance uses the distinct return contract and never infers fresh admission from this case. |
| +- [ ] Also run concurrent cold wakes (one writer), no-visitor synced timer/departure recovery using merged T, own-region hairpin for approved callers, outside-VPC ingress and signed cross-region backhaul, 30s deregistration, T1/I4 Task 7 witness and **disposable-only** EIP mapping rehearsal. Drain/role/default rollback/readiness and native-sidecar recovery remain blocked outline until their producers merge; missing items prevent full G2, even if the four fault injections pass. Use the numeric loss limits below; record the configured interval for each non-stream class before injecting a fault. |
| +- [ ] Evidence includes exact release and module SHAs, UTC fault/termination/expiry/restore/first200, hook/receipt/admission, request counters, loss windows, alarm delivery/recovery, pool inventory and per-box clock/sandbox result. Check the follow-up list's retained-edges alert subject and recreated-fixed-ref restrictions; do not replace immutable fixed identity records. P3 supplies no fixes to those unrelated follow-ups. |
| +- [ ] Rollback/cleanup: remove faults first; restore fixed hapair scope and verified fixture service before removing group capacity. Stop/sleep fixtures through supported API; if state/debt cannot be verified, keep resources and alert, never declare drain by zero process count. No retained group implies explicitly approved teardown of only experiment ASG/template/targets/alarms/parameters/new allocations. If ingress is reused, remove group attachments/resources and restore fixed target/expected-count state, **retain P3a NLB/EIPs**. If ingress is new, unprotect only named disposable allocations via a reviewed cleanup-only module copy, run saved-plan cleanup manifest gate, destroy, then discard that copy. Never delete bucket/shared identity/pre-existing EIP. The rollback command must read back zero active group members (including Standby/Pending), no group TG registrations and a complete deployment edges inventory with no active/retained group names before permitting a pre-`names-2` binary. Use normal evidence-safe retirement, not an age-only purge. Any surviving publisher, retained namespace or incomplete readback refuses the downgrade; keep the upgraded readers. Restore and verify the console version too. Record any operator-held Standby resource beyond expiry and obtain expanded duration approval; expiry never authorizes replacement. |
| + |
| +## Integration still waiting on main |
| + |
| +| Outline / producer | Required evidence before replacing this row with executable work | |
| +|---|---| |
| +| **P2b role writer/platform door — R1/S1/E1** | Actual merged operator API/CLI/CAS/audit/index contracts; desired versus applied evidence. Existing old role endpoint is not reused. Default drain/platform behavior, invalidation and fixed platform exclusion from TGs get an addendum against that main. No local role-object writes. | |
| +| **Drain — I1/I3/I6** | P2b desired-role producer **and a real drain/quiescence/import completion producer**. T's plan explicitly leaves EnqueueDrained unwired (`2026-11-03-region-ha-p1b3b-duties.md`, “Drain integration hook”). Specify leases/release debt, one-at-a-time 5s sleeps, generation invalidation, successor duties and completion ack from merged code. Started/Done is never drained. | |
| +| **Verified capacity/readiness and EligibleBoxes — H4/R1** | P2b shared verified observation and claim-free metric startup on main. Pin API, producer and its separate request budget; then arm minimum<count for 25/25 minutes, missing breaching. Keep operator review of current evidence distinct from this missing product door. | |
| +| **Native sidecar recovery — I6** | P1b-3b slice S (B6) has not been claimed merged here. Birth-only HA sidecars and departure recovery need that actual producer. Legacy gaps remain explicit per departure under N-HA17. See D4; no fake successful sidecar drain/import. | |
| + |
| +Serving-set projection, real consumer acknowledgment and console ingress are now executable/reused in Tasks 1/3/8. Group simulation covers those actual producers. No sibling P2b-plan code or proposed signature is read as authority. |
| + |
| +## Exact S3 and AWS request budget |
| + |
| +Count logical API attempts, including failures, and wire attempts including SDK retries. G/P/L/D = S3 GET/PUT/LIST/DELETE. New boot/SSM/lifecycle/operator clients pin SDK max attempts=1; explicit budgets below then equal wire attempts. Existing runtime S3 clients keep their behavior: record effective retry limit **r** in the counting witness; wire ceiling is r times logical attempts, normally r=3, and refuse unbounded/custom retry configuration for group activation. Do not silently label logical counts physical. No new per-box polling. |
| + |
| +| Path | Logical attempts / retry bound | |
| +|---|---| |
| +| Quiet roles | Existing 2G/30m = **4G/box/h**; no-op tick 0. Startup or changed scope exactly 2G, no LIST. Error backoff 5/10/20/40/60s then ≥60s, ≤128G/h including burst; runtime wire ≤r×. Group adds no new role cadence. | |
| +| Effective publication | Existing replacing helper ≤3(G+P), successful mutation index ≤4(G+P): success normally 2G+2P, ceiling **7G+7P**; unsuccessful three CAS operations ≤3G+3P, no index. Booting+admitted normally 4G+4P, ≤14G+14P; failed later retries charged anew. Receipt/permit 0S3. `names-2` adds bytes only; GroupReadersReady uses the existing cached fold, 0 extra GET/LIST and 0 group PUT while refused. | |
| +| Fixed-reader update/rollback guard | Cached deployment fold plus verified target release capability, **0 additional S3/SSM/EC2/ASG calls**; rides the existing systemLeg tick. Refusal does not fetch the artifact or write/touch a root request. The existing pointer-observation cadence is unchanged. Task 8 charges explicit retirement readback separately. | |
| +| Reader fan-out | Each coalesced mutation ≤ceil(B/1000)L+B G per reader at next existing fold; sustained bound ≤120×(ceil(B/1000)L+B G)/reader/h. B readers multiply this; no separate roles LIST. Keep original timed-write baseline separate. | |
| +| Bootstrap + install binaries | Bootstrap named/versioned object **1G**. Fresh no-floor install **4G** (pointer, two absent floors, artifact); published floor **5G** (plus signed identity). Total **5G or 6G**, 0P/L/D, retries=1 per call in the bounded boot path. Already-installed release omits artifact. Failures count attempted reads and stop. Existing reconcile/certs/identity/escrow reads are measured separately, not hidden in this line. | |
| +| SSM boot | One GetParameters for key/hash; shared/regional nonrecursive pages at MaxResults=10: max(1,ceil(S/10))+max(1,ceil(R/10)) for ordinary pages, hard **20 pages/100 env values** including empty-token pages; one separate ingress GetParameter. **≤22 calls**. KMS service decrypt work is charged per returned SecureString occurrence (including duplicate/empty-page retry behavior), ≤103 on a successful nonduplicate path including 3 boot/ingress values; box makes 0 KMS write/direct decrypt calls. No boot retry loop after failure. | |
| +| Metadata/config | First root identity fetch budgets token + document + signature (3; `internal/host/boxrecord.go:32,65`), address adapter token + public/local/mac/VPC-CIDR (5): **≤8 IMDS HTTP requests**, failures stop; reuse cached identity where available. SDK credential retrieval/refresh is existing infrastructure overhead, recorded separately. 0 EC2 membership describes. Root snapshots avoid new metadata requests on hairpin/health/request paths. | |
| +| Launch completion | Successful initial launch **1 CompleteLifecycleAction**; total ≤4 attempts/launch, SDK=1, 2s each, backoff 1/2/4s, persisted exhaustion, original 900s deadline. Initial ABANDON shares that total; default ABANDON costs 0 box calls. Valid receipt maintenance restart: **0 box ASG calls**, solely suppressing the original action. Return completion is operator-owned and charged separately below. | |
| +| Operator maintenance / provider probe | Normal **4 writes**: lower min, EnterStandby(decrement), ExitStandby, restore min. Documented return: 0 completions; synthetic/divergent Pending:Wait: **+1 successful CompleteLifecycleAction**, ≤4 attempts/return transaction (2s, 1/2/4s backoff), persisted across resume, SDK=1. Ambiguous mutation requires readback, never blind replay. ≤2×180 read rounds per invocation, 5s spacing, each ≤1 DescribeAutoScalingGroups +1 DescribeAutoScalingInstances +2 DescribeTargetHealth = **≤1,440 reads**. Pre-completion/resume readbacks consume this bound; a known Pending:Wait is handled immediately, not after a 15m wait. Provider probe is a separately counted invocation. Divergence recovery adds ≤1 min-lowering write if already restored, then ≤1 EnterStandby(decrement) and Standby readback; no termination. No box runtime poll. Release staging uses its bounded fetch budget. | |
| +| Session Manager maintenance | Per invocation: normally **1 StartSession +1 TerminateSession**; at most 4 connections/reconnections, each charged as StartSession or ResumeSession plus TerminateSession: **≤8 SSM API attempts**, SDK=1. Local status/permit messages share the authenticated stream; ≤360 status samples inside the operator read-round cap, 0 parameter GETs on restart. Channel reconnect/stream traffic is logged separately. On connection loss before Exit, retain Standby. A resumed invocation has its own stated budget; no hidden reconnect loop. | |
| +| Termination | Existing consumer ≈180 empty Receive/h/box, SDK=1; event/redelivery receives and Deletes extra. Initial ≤1 GetQueueAttributes, no GetQueueUrl/heartbeat/second consumer. Confirmation ≤1 Describe/iid/10s on suspicion, 0 healthy-path describes. No extra consumer per box; **two new group boxes add ≈360 empty Receive/h** on their distinct shared queue, plus ≤2 startup Attributes reads. Closed-member receipts are not deleted; 120s visibility redeliveries add actual Receive/scan work. Fixed-box queues/polls unchanged. | |
| +| Departure import | Retain T's actual budget, not P3's earlier abbreviated estimate: **(U+E+2N+4A+W+Q+F)G+(2A+1)P**, then completion 1D+k(G+P), k≤4. N inventory hosts, A imports, W wake objects, Q changed manifests, U identities, E edges refreshes, F proof reads. Retry/rescan attempts add their real counts; shared queue may duplicate receiver work. No new scan tick. | |
| +| Metrics | Existing ≤60 PutMetricData/h/box; extra group datums in same call, 0 S3. Pin group metric client SDK=1, so ≤60 wire submissions/h. Fixed client untouched. Console P2b separately owns ≤60 regional publishes/h and observation reads; no invented 0-read observation. | |
| +| Health, starts, names, hairpin | **0 S3/SSM/EC2/ASG calls**. NLB nominal 720 checks/target/h across two TGs is not a hard HTTP ceiling (distributed consensus). Twenty simultaneous closed-box requests cause zero acquire/start/completion work. | |
| +| Plan/apply and drills | Local mocks 0 account calls. Later provider refresh/apply and operator fault/verification and rollback inventory reads have saved-plan/card counts, separate from runtime. Publisher-retirement proof costs one complete `ceil(B/1000)L+B G` edges read plus ≤1 group/member and two TG describes per check; retries counted, no readback-error-as-empty. No account-backed request made while drafting. | |
| + |
| +`TestGroupBootRequestBudget` counts no-op/error/absence, SSM empty pages, index conflicts, failed edges CAS, duplicate callbacks, lost completion, persisted exhaustion, closed-member redelivery/no-ack, original receipt restart, return-action completion and operator resume with transport instrumentation. Runtime S3 baseline remains about 3,300–3,500 calls/box/h; adding boxes adds that baseline, even when P3b's extra path costs zero. S3 allowances are spec §18's $0.0004/1,000 G, $0.005/1,000 P/L, D free. Charge SDK retries too. |
| + |
| +## Planning costs |
| + |
| +USD, 730h/month, two AZs. P3's “Cost per region” retains NLB+two EIP monthly allowances: IE **$25.696**, UK **$26.6158**, US **$23.725**, AU **$25.696**, before NLCU/traffic. For the IE drill count the gross ingress cost even if P3a already pays it; actual incremental reused-ingress cost is lower. ASG and launch-template resource fees are $0; EC2/storage/network remain billed. |
| + |
| +| Dev IE count=2 item | Monthly allowance | 24h allowance | |
| +|---|---:|---:| |
| +| NLB + two NLB EIPs (P3 rate) | $25.696 | $0.8448 | |
| +| Two auto-assigned box IPv4 at $0.005/h each | $7.30 | $0.2400 | |
| +| Two t4g.micro Linux/on-demand at **budget rate $0.010/h each** | $14.60 | $0.4800 | |
| +| Two 20 GiB gp3 roots at **budget rate $0.10/GiB-month** | $4.00 | $0.1315 | |
| +| Nine custom series at $0.30/series-month | $2.70 | $0.0888 | |
| +| Up to eleven standard metric alarms at $0.10/month | $1.10 | $0.0362 | |
| +| **Infrastructure/observability subtotal** | **$55.396** | **$1.8212** | |
| +| One continuous NLCU at $0.006/h | $4.38 | $0.1440 | |
| +| S3/SQS/SNS/SSM/KMS, modest logs/traffic and churn reserve | card-specific | $1.00 | |
| +| **24h planning total / N-HA19 spend ceiling** | | **$2.9652 / $5.00** | |
| + |
| +Compute/storage rates above are rounded **planning allowances, not a live regional quote**. Module `variables.tf:16,21` supplies no defaults; only `host_ie_b` still supplies t4g.micro/20 GiB at the refreshed private main. Group boxes run no console. An edge OOM with Restart=no causes replacement, so N-HA19/D3 retains a boot/fixture memory witness before accepting micro. Confirm boot and fixture capacity before acceptance; resize is a new scoped choice, never an automatic workaround. Standard CPU-credit mode avoids an unpriced Unlimited burst assumption; pin it for the drill. Nine series comprise two original memory/PSI per iid, two regional admission/clock, three group memory/clock/admission. Each replacement adds two new per-iid series; eleven alarms reserve ingress six, queue, ASG deficit, group memory, group clock and later EligibleBoxes. Metric batching saves requests, not series charges. No free-tier credit assumed. Replacement overlap, unused EIPs/Standby boxes and retention beyond 24h still cost money; stop faults and alert before the cap, never terminate merely to enforce a cost timeout. |
| + |
| +Primary pricing references (public pages, no account calls): [https://aws.amazon.com/ec2/autoscaling/pricing/](https://aws.amazon.com/ec2/autoscaling/pricing/), [https://aws.amazon.com/ec2/pricing/on-demand/](https://aws.amazon.com/ec2/pricing/on-demand/), [https://aws.amazon.com/ebs/pricing/](https://aws.amazon.com/ebs/pricing/), [https://aws.amazon.com/vpc/pricing/](https://aws.amazon.com/vpc/pricing/), [https://aws.amazon.com/cloudwatch/pricing/](https://aws.amazon.com/cloudwatch/pricing/). NLB regional offer URLs and their original price date are in P3. Refresh the scoped card before go; these are not authorization to spend. |
| + |
| +Provider behavior references: Standby health exclusion/decrement semantics [https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-enter-exit-standby.html](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-enter-exit-standby.html); completion by iid [https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_CompleteLifecycleAction.html](https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_CompleteLifecycleAction.html); preserved-IP hairpin limitation [https://docs.aws.amazon.com/elasticloadbalancing/latest/network/edit-target-group-attributes.html](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/edit-target-group-attributes.html). Kernel/listener behavior is a proposed implementation requiring the root witness, not a claim established by AWS documentation. |
| + |
| +## Copy deck for controller → Luna |
| + |
| +Inventory **every added literal** under these rows before writing product/ops prose during implementation. Meanings below are requirements, not approved wording. Reuse already-approved P3a refusal text when unchanged. One Luna pass at build time; apply approved text verbatim. No copy server or model review is launched here. |
| + |
| +| ID | Destination | Required meaning | |
| +|---|---|---| |
| +| P3-C3 | group boot/config/admission/receipt diagnostics | Phase, missing fact, exhausted/unknown completion, corrupt/mismatched receipt; distinguish a failed initial launch, accepted CONTINUE with lost response/receipt (InService but locally closed, replacement expected), and operator-held maintenance. No secrets/raw env. | |
| +| P3-C4 | Terraform validations/outputs, plan gate, module README | Explicit mode/count/AZ/type inputs, protected fixed/EIP ownership, claim-free config, version pin, no unattended refresh, cost/cleanup and public-443 exception. Inventory each error and description. | |
| +| P3-C5 | alarm descriptions/notifications and runbook | Actual producer, unknown/recovery, remaining lease and class-specific loss; S3 failure requires operator decision, never automatic replacement. | |
| +| P3-C7 | private dev card/roll/drill/cleanup guide | Exact scope/window/owner, first-service versus G2, Standby recovery, retained resources/cost, no production retirement. | |
| +| P3-C8 | external health/startup 503 | Not admitted, Retry-After, no holder/account/iid detail or false “waking elsewhere” claim. | |
| +| P3b-C9 | root permit/maintenance command diagnostics | Refuse before stop; exact phase/action needed, concurrent/stale/wrong-identity permit, operator-held timeout; no suggestion to force replacement on dependency error. | |
| +| P3b-C10 | hairpin listener/rule diagnostics | Missing public identity or unsupported kernel/egress path refuses; no header-trust workaround. Public responses disclose no internal topology. | |
| +| P3b-C11 | host-env option help/CLI docs | Group-only claim-free allowlist, explicit pools/regions, safe boot selection; existing fixed mode preserved. | |
| +| P3b-C12 | first-slice refusal and G2 evidence summary | Limited first-service slice accepted separately from missing P2b/drain/sidecar producers and full G2; mixed-reader and fixed systemLeg rollback refusal, blocking publishers/retained names or unknown evidence, target versus required reader version, desired role versus applied status. | |
| + |
| +P3-C1/C6 role/drain product copy stays P2b-owned outline. Protocol field/metric/reason-code names are data. Product strings, operator shell messages, usage/errors, tofu descriptions, comments explaining new operations and docs all get inventoried; this deck does not preapprove invented text. |
| + |
| +## Census and verification |
| + |
| +This commission changes Markdown only: no census overlay now. Implementation root inputs include group marker, maintenance permit, immutable boot settings, SSM bootstrap/hash/ingress/queue URL, host.env, OS update policy, nft config/admission-controlled redirect activation and unit drop-in. Include Session Manager permit delivery and the reader-rollback guard in the authority review. Root must never consume agent-owned admission receipt or tenant-selected paths. Trace all root readers and writers of their inputs, not just direct filesystem calls; IAM and every regular infra file are in scope. |
| + |
| +For each actual slice: `make census-card`; write tab-separated CLAIMS; `make census-propose NAME=region-ha-p3b CLAIMS=<owned-file>` for P3b-1 (later slices use distinct names rather than rewriting a merged overlay). Run targeted `nice -n 19 go test ./internal/provision -run 'TestPlan14RootReadCensus|TestCensusScopeIsTheRootBinary|TestPlan14RootInputInventoryCoverage|TestCensusRebaseCarriesDispositions' -count=1`. Independent Opus reviewer for a Codex author approves every unit/envelope against amadan main, citing lines; record reviewer, exact tip and verdict on #280. No Paul census escalation; no archive edits. Preserve 9B8 record-write checks. |
| + |
| +Implementation uses failing-first named tests and bounded risky mutations, mock AWS/tofu and the designated root runner. Before each eventual landing run repo build/vet/make-test/format once, plus CGO_ENABLED=0 darwin/amd64, windows/amd64, linux/arm64 cross-compiles (arm64 <64,000,000 bytes). Use default Go cache and owned `$TMPDIR` scratch, nice 19 for CPU-heavy work; clean owned processes/files. Push/describe/green exact-tip CI/amadan squash/main-CI happens only in the later implementation session. This planning session runs static document/diff checks only. |
| + |
| +## Execution approval still needed from Paul |
| + |
| +**D1–D4 are decided by N-HA19 (2026-11-04, via the agent manager under delegation), as recorded in Rulings.** No open choice remains among their former alternatives. N-HA14 is also decided; no new maintenance exception or §10 change is requested. |
| + |
| +The remaining switch-on gate is **Paul's dated Task 8 card** for the actual UTC window, infra apply, release and drill, with account/resource IDs, permissions, traffic effects, deployment operator, cleanup owner and verification. **Recommended:** schedule the limited P3b-1 first-service experiment on the G1 boxes within the approved two-micro/20-GiB, ≤24h/$5 envelope and destroy its temporary resources afterwards. This supplies the rule-5 date and scoped execution approval that N-HA19 does not supply. No build begins without that gate; no live calls are authorized by this plan. P3b-2's provider probe must pass before any software roll; full G2 still needs the merged P2b/drain/slice-S producers and its scoped card. |
| + |
| +Require measured cold-boot plus worst-fixture memory headroom ≥15% before accepting micro. Capacity failure, any larger/retained group, duration or cost expansion, kernel-layout refusal, fixture exclusion or loss of user-visible capability returns to Paul with a revised scope; none is an automatic workaround. Keep the root-runner sidecar witness now and the live native-sidecar witness gated as N-HA19/D4 requires. |
| + |
| +## Round 1 dispositions |
| + |
| +| Finding / invariant | Disposition | Change / witness | |
| +|---|---|---| |
| +| P1-1 — T1/I4 | **Changed** | AWS hook-availability footnote explicitly excludes Standby, so decline the unconditional provider premise. Accept the missing-state defense: one operator return owner, separate action journal/receipt scope, fresh admission, mandatory Pending:Wait fake that fails rev 1, and first-live-step observation/refusal on divergence. Tasks 4/7 and revised request budget. | |
| +| P2-1 — H4/A1 | **Accepted** | `names-2`, shared cached complete-peer predicate before publication/completion, console version check, mixed-reader mutation and rollback readback that refuses surviving publishers/names. Tasks 1/8. | |
| +| P2-2 — I6/E1 | **Accepted** | Group-owned queue/rule/target/anti-forgery policy, group SSM URL and exact-scope tests; fixed queues unchanged. Shared deliveries/redeliveries budgeted. Task 2. | |
| +| P2-3 — A1/I6 | **Accepted, option (a)** | Receive/journal may start, import/finalize/ack may not; gate all shortcuts, preserve Started, prove redelivery and boot-failure cases in production wiring and simulation. Tasks 3/6. | |
| +| P2-4 — T1/I4 | **Accepted** | OS automatic update/reboot/restarters disabled; rendered-init test and live effective-policy check; all attended OS work uses Standby. Tasks 3/7. | |
| +| P2-5 — G2/I4/I5 | **Accepted** | Numeric exclusion/replacement/recovery, one-writer and replication-loss limits, explicit FAIL and per-fault cleanup. Task 8. | |
| +| P2-6 — S1 | **Changed** | Record completed G1 switch-on including later item 8; P3b-1 has no executable P2b dependency. N-HA19/D1 now approves the limited staging exception; the dated card remains required **before build**; full G2 retains named missing producers. | |
| +| P3-1 — evidence | **Accepted** | Corrected existing file to `internal/groupadmission/observation.go`. | |
| +| P3-2 — S1/capacity | **Accepted** | Private merged main 80d20c4: sophie medium, leo micro. N-HA19/D3 approves console-free micro with the retained headroom witness and OOM→replacement consequence. | |
| +| P3-3 — N1/E1 | **Accepted** | Session Manager named as permit/status transport; retain managed attachment with Denies, exact operator target/document scope and connection budget. Tasks 2/4/7. | |
| +| P3-4 — E1 | **Accepted** | Enumerated inherited DNS-01/conditional steering and excluded console cost/mail/store/scan policies; combined-policy exact-scope witness. Task 2. | |
| +| P3-5 — A1 | **Accepted** | Initial accepted-but-unrecorded CONTINUE is a distinct observed case and P3-C3 diagnostic; maintenance return has separate readback semantics. Tasks 3/8. | |
| +| P3-6 — I4/observability | **Accepted** | Expected HealthyHostCount alarm during long Standby recorded/acknowledged; no suppression or ASG deficit change. Task 8. | |
| +| P3-7 — S1/observability | **Accepted** | Reused ingress expected_targets **2→4→2**; dedicated option 2. Pool withdrawal does not change target count. Task 8. | |
| + |
| +## Round 2 dispositions |
| + |
| +| Finding / invariant | Disposition | Change / witness | |
| +|---|---|---| |
| +| R2 P2-1 — H4/A1, carried R1 P2-1 | **Applied; review CLOSED** | Task 1 chooses `internal/host/systemleg.go` as the single fixed-reader update/rollback refusal point before staging/root requests, using the cached deployment fold. Failing-first `TestSystemLegGroupReaderRollback` covers the real pointer consumer, live/retained group publishers and unknown evidence; ninth mutation bypasses the gate with a live publisher. Task 8's deliberate retirement readback remains. | |
| +| R2 P3-1 — observability | **Applied** | Task 2 enables GroupInServiceInstances/GroupDesiredCapacity at 1-minute granularity; `group_shape` and Task 6's `group_alarms.tftest.hcl` assert collection for the deficit alarm. No new box calls. | |
| +| R2 P3-2 — A1/N1 | **Applied** | Task 5 arms both DNAT paths only while the current process is admitted. Lifecycle/root-runner witnesses and a seventh mutation cover closure and re-admission; closed callers use the ordinary NLB path. | |
| +| R2 P3-3 — T1/I4 | **Applied, failed-probe option** | Standby return table and Tasks 4/7 state the operator's before-900s action after post-Exit admission loss: stop, alert, preserve evidence/restore probe faults, no unsafe CONTINUE or ABANDON. Default timeout loss is recorded as FAIL and blocks rolls. | |
| + |
| +N-HA19 settles D1–D4 without reopening review. R1 was NOT READY (1 P1 / 6 P2 / 7 P3); R2 was READY AFTER FIXES (0 P1 / 1 P2 / 3 P3). All R2 findings are incorporated in this plan; **no round 3**. These are planned implementation witnesses, not tests run or live behavior verified by this Markdown-only revision. |
| + |
| +## P3 follow-ups |
| + |
| +None left from P3b R1 or R2: all seven R1 and all three R2 P3s are incorporated above. The previously recorded `docs/superpowers/notes/region-ha-followups-p3.md` remains separate; no new review round for those items. |
| + |
| +## Self-review |
| + |
| +| Brief scope / requirement | Coverage / honest limit | |
| +|---|---| |
| +| Group mode, group IAM, automatic claim-free boot | Tasks 2/3, initial hook order and fixed-state/IAM witnesses. No live plan or boot verified here. | |
| +| N-HA14 exception, Standby, root guard, Restart=no | Verbatim companion spec edit; Tasks 4/7. No unattended update; shared outage never authorizes replacement. | |
| +| Hook adapter, receipt, ABANDON, no Pending accumulation | Task 3 initial crash matrix/budget; provider evidence and Tasks 4/7 separate return ownership; Task 8 timed evidence. | |
| +| Verified client hairpin, no proxy-trust expansion | Task 5 pins address provenance and kernel original-destination checks; all callers, both ports, real root witness required. | |
| +| Dev IE count=2/hapair-only | Scope, Tasks 6/8, D1–D4. Module has no type default; private root evidence is explicitly separate. | |
| +| G2 four faults plus T1/I4 | Tasks 7/8, §9.8 timing and N-HA9 expiry; P2b/drain/native-sidecar pieces are named blockers, not fake executables. | |
| +| Booting names and mixed-reader rollout | Task 1 preserves authority in one helper; actual main disproves a general empty-name claim. Guard covers every name class; capability checks enforce boot/admission refusal; one fixed systemLeg gate refuses old-reader updates while publishers/names remain, with Task 8 retirement readback for deliberate downgrade. | |
| +| Rulings, request/cost/copy/census/review budgets | Dedicated tables; no new per-box poll; P3 closed history retained, P3b review CLOSED at R2, READY AFTER FIXES; rev 3 applies its fixes with no R3. N-HA19 decides D1–D4; dated execution card remains required. | |
| + |
| +**Unverified:** current deployed resource IDs/configuration and continued live G1 state (the switch-on itself is recorded done), effective live IAM, ExitStandby behavior in the exact dev ASG, root kernel egress/original-destination behavior, boot timing/fit on t4g.micro, regional price quote, real alarm delivery and P2b/S interfaces not on the citation base. These remain explicit activation gates. This final revision finishes after its one-plan-file local commit. Review remains CLOSED; no push, new review or live call is authorized. |