carlos / platform Public

docs: plan region HA P3 group infrastructure and admission

Split visible dev NLB ingress from group replacement and G2 activation. Specify main-only contracts, deferred merged-input wiring, admission and role invariants, boot/IAM/hairpin work, alarms, request and regional cost budgets, copy and census gates, and scoped dev drills.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev b9d85e5036944074e710ffc8a955f552dd15e220 parent 65420a4
1 file changed, +297 −0
  • docs/superpowers/plans/2026-11-01-region-ha-p3-group.md +297 −0
diff --git a/docs/superpowers/plans/2026-11-01-region-ha-p3-group.md b/docs/superpowers/plans/2026-11-01-region-ha-p3-group.md
new file mode 100644
index 000000000..5ec226b07
--- /dev/null
+++ b/docs/superpowers/plans/2026-11-01-region-ha-p3-group.md
@@ -0,0 +1,297 @@
+# Region HA P3: group infrastructure and admission implementation plan
+
+> **For agentic workers:** Use writing-plans task-by-task, with checkbox tracking. This commission writes and commits the plan only. No implementation, push, reviewer dispatch, infrastructure plan against an account, or apply is authorized. A later controller chooses execution tooling.
+
+**Goal:** Serve a born-HA dev instance through a regional Network Load Balancer (NLB), then prove that a replacement group box cannot serve before admission and that the dev group passes G2.
+
+**Architecture:** Keep roles, admission and the serving latch in provider-neutral Go. AWS supplies lifecycle completion, identity, termination evidence and metrics through adapters; OpenTofu owns the fixed-size Auto Scaling group (ASG), NLB, networking and IAM. Reuse the existing termination queue and the existing reconciliation, edges, change-index and metrics cadences. Unmerged placement, console and departure interfaces are outlines below, never executable dependencies disguised as current code.
+
+**Tech stack:** Go 1.26; existing S3 conditional stores; nftables/systemd on Linux; OpenTofu >= 1.10 and AWS provider >= 6.0 (`infra/modules/region-host/versions.tf:1`); existing SDK dependencies (`go.mod:10`).
+
+**Spec:** `docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md`, rev 6.1, §§4.3–4.4, 10, 12–13, 18–21. Discussion #421 supplies N-HA8's ownership change and N-HA10–13. Read with `amadan discuss show carlos/platform 421`.
+
+**Citation base:** amadan `origin/main`, **65420a4d9e0d919743ea2e95e20b1a649605db3d**, also this worktree's starting HEAD. Existing platform `file:line` references below are to that commit. Proposed files have no source line numbers. No remote branch is merged, cherry-picked or used as an implementation authority.
+
+**Status:** initial draft; no P3 review has run. Planning commit only, on `region-ha-p3-group`.
+
+## Scope, slices and switch-on
+
+**P3a: visible dev ingress.** The first implementation merge must travel with a scheduled dev deployment: an NLB in front of the existing fixed IE proving pair, serving an existing born-HA nested host. Keep its ordinary public DNS and regional EIP untouched; probe the NLB's new addresses with the host's real TLS SNI/Host. Admission, role publication, hairpin and instrumentation needed for that slice travel together. An empty NLB or a health endpoint permanently returning 503 is not its acceptance result.
+
+**P3b: replacement group and G2.** Add the launch template, fixed-size ASG, launch hook, automatic boot, group alarms and a disposable dev group region. Integrate placement, console doors and departure/drain only after their producers merge. This separates an ingress change from the authority to replace boxes; it also avoids pretending that today's fixed pair already has the full admission predicate.
+
+**Dev topology to approve:** eu-west-1, canonical region `ie`, existing home placement scope (empty CARLOS_REGION), existing dev IE data bucket, count=2 across two public AZ subnets. Reuse the operator-owned `hapair` pool and existing born-HA fixtures, with group boxes configured for **hapair only**, so they cannot adopt the shared dev tenant population. The fixed pair retains its current scopes for P3a; for the group-only G2 fault runs, first sleep the approved hapair fixtures cleanly, then temporarily withdraw only hapair from the fixed pair under the scoped roll approval. Restore it during cleanup. Readiness must prove every in-scope fixture is born HA/nested and that the merged placement/duty logic excludes boxes outside its pool. If main lacks that pool proof, the fixture inventory contains a legacy host, or the existing API refuses a needed new pool create under P2a's F5, refuse the affected drill rather than hand-write records or silently add another bucket/region. This is a dev IE group, not a new production region or an implicit grant to migrate hosts.
+
+**Sequencing refusal, rule 4:** main has no termination consumer and no active caller setting `lbhealth.State.SetHosting`. Thus neither P3a's first-serving deployment nor P3b's admission can be honestly completed against today's main alone. Tasks 1–5 specify work whose inputs exist on main; their runtime integration is held on the implementation branch until the separately listed producers merge and the outline is replaced by an executable addendum against that main. Do not land scaffolding ahead of the visible slice. Do not substitute a dummy `consumerStarted=true`, claim wiring, TCP-only health, or a second SQS consumer. P1b-3b must be able to start its consumer independently of an incoming drain producer; P3 can subsequently feed it drain completion. If that ordering is unavailable, stop at this boundary and split the integration after its merge.
+
+**Who wants it / when:** Paul wants G3 (#421, finish-line note): first test carloku.com region HA after dev G1/G2. Reserve P3a for the first approved dev release after the consumer and ingress prerequisites merge; reserve P3b for **G2 in the next approved dev release after G1 passes**, not an unspecified later flag flip. Before implementation landing, Paul supplies the actual release date/window and scoped dev go (Task 6). Without that dated window, keep the implementation on its branch (rule 5). Planning this artifact does not activate a feature. G1 requires all P1b and P2, not just 3a/P2a; G3 requires G2 and readiness. P3 alone finishes none of those gates.
+
+**Retirement boundary:** P3 makes external fixed-target attachment, drain evidence, protected EIP ownership and reversible NLB mapping possible. P6 owns the production join/drain/EIP/stop/rollback runbook. No old production box is retired here; G5 additionally needs existing-host migration, P4, P5 and P6. N-HA9/storage fencing remains separate: failure recovery may wait **the remaining 15-minute lease**, not a new unconditional few-minute promise (`docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md:441,452,704`).
+
+## Round history
+
+| Round | Brief / findings | Verdict | Invariant / disposition |
+|---|---|---|---|
+
+Empty means no P3 round, not an approval. Upstream history remains closed: spec R1–R3; P1a R1–R3; P1b-1 R1–R3; P1b-2 R1–R3; dead-holder backoff R1–R3. Boundary-only reads: P1b-3a final rev 3, Opus R2 READY AFTER FIXES/N-HA12; P2a final rev 4, Opus R3 READY AFTER FIXES/N-HA13. Neither is merged at this citation base. P3 does not reopen them or reset rounds on a split.
+
+Future briefs use `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md:1`. Stop at the first round without P1; apply its P2s without another round and keep P3s on the branch follow-up list. Maximum three rounds; a fourth needs Paul's go. Name the invariant for every finding; a second consecutive round in one family stops fixes for Paul's refuse/cut/central-enforcement decision. Census and newly changed security/root/termination/storage behavior still check final fixes within that budget. Task-level review only for the risks in rule 3; whole-branch review before landing. No reviewers are dispatched by this plan-writing session.
+
+Each implementation session owns one slice and ends at its merge. At 24 hours without merge, or a stopping-rule trigger, the controller reports the blocker, last two rounds and recommended cut on the branch discussion and to Paul; repeat each 24 hours. Three days or three compactions: `amadan branch handoff`, then stop. This drafting session ends at the local commit.
+
+## What exists on main
+
+| Evidence | Reuse / implication |
+|---|---|
+| `infra/modules/region-host/main.tf:536,580`; `infra/modules/region-host/variables.tf:65,87`; `infra/modules/region-host/outputs.tf:1,6` | One fixed instance/EIP; paired VPC/subnet validation. No launch template, ASG or NLB. Preserve fixed consumers and state identity. |
+| `infra/modules/region-host/main.tf:75,97,103,139,531` in that module | Host SG admits public 80/443, IAM role/profile exist. Group-mode 80 must be narrowed to NLB SG; public 443 remains for signed backhaul under §12.1. |
+| `infra/modules/region-host/main.tf:456,499,588,617,629` | Explicit SSM/release-key denies; per-instance recovery/memory alarms and same-region SNS. Preserve the denies and fixed-mode alarms. No group-dimension memory alarm yet. |
+| `infra/modules/region-host/main.tf:198,210,410,835,841,865,890` | SSM GetParameter, broad inventory DescribeInstances, metrics grant, termination rule/queue, anti-forgery queue policy and receive/delete/attributes rights exist. No need for another termination transport. No scoped group-completion or configuration-KMS grant exists. |
+| `internal/hostenv/hostenv.go:9,36,70,124,143,311`; `internal/hostenv/awsssm.go:60`; `internal/hostenv/write_linux.go:1` | Provider-neutral Params and safe host.env writer exist. Required/optional/shared allowlists still contain claim variables; Fetch reads shared and regional paths, adds group reference. Remove that claim requirement for this boot path. |
+| `internal/host/boxreference.go:34,77,98`; `internal/host/boxrecord.go:121,158`; `internal/host/boxaddress.go:17,34,50` | Group identity/reference and signed identity publication already exist; addresses have a provider-neutral source. Reuse, with no roster enrollment. |
+| `internal/lbhealth/lbhealth.go:71,154,185`; `internal/edge/lbhealth.go:21,34` | Six-condition predicate and HTTP endpoint exist; zero hosting state fails. No production SetHosting caller remains on main (search all non-test Go). The claim-era comment is not evidence of an active caller. |
+| `internal/host/agent.go:744,915,933,944,947,1122,1133,1836,1915`; `internal/host/edgesfile.go:970,982,1125` | Activator, serialized record passes, edges and identity loops, shutdown. First-pass and publication acknowledgments must come from actual success, not goroutine creation. |
+| `internal/edge/holderview.go:33,50`; `internal/edgesfile/snapshot.go:34,88,280`; `internal/host/edgesfile.go:262,412` | Current holder compatibility checks bucket/key/placement; main deliberately does not age this holder view. New serving/admission projection is separate. No box-role/admitted/drained publication exists. Per-host role fields are a different namespace. |
+| `internal/activator/activator.go:1676,2426,2588,5790,6013`; `internal/activator/hawake.go:289` | Existing tenant begin/acquire, shutdown and scheduled entries. Admission must block direct/forwarded and non-HTTP starts before these can acquire or launch. |
+| `internal/release/changeindex.go:31,54,72,125`; `internal/host/snapshot_loop.go:221` | Four total index-CAS attempts, existing certs/edges scopes, three-attempt replacing helper. Add one role scope and charge every mutation attempt. |
+| `internal/console/apiboxroles.go:14,21,55`; `system_roles.go:35` | Old role doors/CLI operate on a claim roster and old vocabulary. They are not the new role producer; P2b replaces them after P3 evidence merges. |
+| `internal/host/memwatch.go:90,113,137,165`; `internal/console/awsregionmetric.go:25,58`; `internal/console/hostclaimops.go:50` | Host memory sampling and AWS metric adapter exist; console EligibleBoxes startup is claim-dependent. Add group dimensions to existing samples; P2b owns claim-free capacity publication. |
+| `internal/termfence/confirm.go:51,112`; `internal/termfence/fence.go:117,154` | Existing cached termination confirmer and event decoder; AWS types stay at the existing adapter boundary. P3 does not change takeover authority. |
+| `internal/console/fleetbox.go:108,119,128`; `internal/provision/reconcile.go:527,628` | Managed fleets 1b chooses/stamps one box at create and reconciles only that assignment. It is not shared-region cold-wake placement. Reuse conventions, not FleetBox labels or fleet rental/removal authority. |
+| `internal/host/bootstrap.go:291,616`; `internal/host/host_test.go:2020`; `internal/host/agent.go:1875`; `internal/provision/reconcile.go:628`; `internal/provision/reconcile_test.go:3060` | #446 (merged **32e3e644**) already applies tmpfiles before unit arming and gives the control directory its carlos group; first mint reads nested intent. Keep both regression tests; no manual chown or flat-to-nested repair in group boot. |
+| `internal/host/installchannel.go:442,457,464,472`; `internal/host/systemapply.go:2167`; `internal/release/fetch.go:22` | **Spec/code discrepancy:** §12.3 says the floor check is a no-op without a published moves floor; main instead refuses on the first absent floor object. Task 4 must add the bounded claim-free absence case, preserving signed pointer/artifact verification and strict enforcement when either floor object exists. Do not launch against the current helper assuming the no-op is already built. |
+
+`internal/compute` is **absent** at this main (`git ls-tree -d origin/main internal/compute` has no entry); there is no merged managed-box provisioner to call. #457 phase 1b merged as 8294a52 and was drilled in v0.33.0; #457 phase 2 owns managed provisioning, durable operations, quotas and billing. #498 is the later proposal to use that provisioner for platform boxes. P3 builds no console RunInstances/TerminateInstances door, compute catalog, billing state machine or adoption of existing boxes. Its fixed-size ASG/NLB is a tofu adapter that a future #498 design can adopt. Do not wait for or duplicate an unmerged phase-2 interface.
+
+**Dev deployment root, outside this repo:** `platform-infrastructure/dev/region-ie-b.tf:9,16,22` is present at `/home/paulca/amadan.net/carlos/platform-infrastructure/dev/region-ie-b.tf`, private checkout HEAD **e57979d85a05a31f0b51d3bee071f0f14a860187** when read. It declares the second fixed IE box; it is not a live inventory. That repo's `dev/region-ie.tf:1` declares the first. #421 records leo/sophie and pool `hapair`; verify current names, profiles, pool overlap, versions and resources read-only before any drill. Its `scripts/bootstrap-box.sh:47,71,99,120` verifies a root-signed bootstrap pointer and starts the old fixed path; `scripts/harden-host.sh:33` is the existing IMDS gate reference. These are external checkout citations, not assertions about platform main or deployed state.
+
+## Global constraints and invariants
+
+| Invariant / fault family | Decision enforced by this plan |
+|---|---|
+| **I1, one writer / N-HA1,9** | Only existing HA acquire authorizes a tenant writer. Admission, role, LB health, ASG membership and termination events authorize no takeover. Never shorten TTL or accept stopped/shutting-down/missing as terminated. |
+| **I2, positive-proof reuse** | Preserve acquire→keep/restore/sealed-trio path and nested-only HA containment. A role transition, boot receipt or successful hook never proves a DB/files copy reusable. |
+| **I3, duty coverage** | Drain is incomplete until leases/releases settle and the departure importer acknowledges durable duty adoption. Zero awake processes alone is insufficient; no edges deletion or early scale-in. P1b-3b owns the importer. |
+| **I4 / A1, admission before service** | A new process starts closed; no tenant lease/start on direct ingress, backhaul, timer, worker, session or co-spawn before admission. Network health is insufficient: an NLB can fail open. Clear local permission before shutting down any component. |
+| **R1, desired is not applied** | Own role overrides regional default; absent both means serve. Startup/error is booting, not absence. Desired drain/platform never makes a box a new-wake candidate. Keep known restrictions on a failed read; with no trustworthy read stay closed. |
+| **H4 / A20, serving is not capacity** | Serving selection excludes booting/drain/platform; headroom governs create/preference only. Drain forwards to a serving peer even when full. No eligible headroom must never strand an existing host. |
+| **B1, bounded I/O** | No new per-box S3, EC2, SSM, membership or health polling loop. Role reads ride the change index; health is local; boot is bounded; one existing/N-HA11 SQS receive loop only. Charge central console reads separately. |
+| **P1, provider boundary / H26** | New core imports no AWS SDK. Generic identity, lifecycle completion, configuration and ingress addresses cross interfaces. AWS-only multi-box activation remains refused off AWS until supported identity and termination adapters exist; single-box self-hosters keep fixed behavior. |
+| **N1, network authority** | Root installs rules only from root-owned configuration; tenant/agent-writable content never becomes nft or shell input. Hairpin preserves TLS Host/SNI, IMDS denial and egress policy; it grants no new allowed destination. |
+| **T1, bounded replacement** | min=max=desired; no automatic scale-in, instance refresh, AZRebalance or capacity optimizer. Existing serving instances cannot be replaced merely by editing the launch template. Bad boot abandons; an admitted hang is ELB/EC2 replacement, not a controller S3-loss auto-replacement. |
+| **E1, ingress and rollback ownership** | Protect every regional ingress allocation, keep one owner per EIP, and reject a fixed→group destructive migration. Zone-B rehearsal precedes any zone-A old-EIP cut-over. IE platform remains fixed/outside all target groups with its own relay/MX EIP. Platform role on an ASG member is refused; the ASG automatically attaches its members, so merely publishing platform would not remove one. |
+| **S1, scoped live authority** | Implementation and fake-provider/mock tests are local. Paul separately approves account/region/domain/resource/permission/traffic/cost/duration/cleanup; an infrastructure operator applies reviewed tofu. No generic dev or plan approval grants that authority. |
+
+## File structure and contracts to build against main
+
+These interfaces are **proposed P3 contracts**, not promises made by another branch. The integration outline must adapt merged producers to them or revise this plan before review; do not invent incoming function names.
+
+| Files | Responsibility / proposed interface |
+|---|---|
+| New `internal/boxroles/{roles.go,store.go,roles_test.go}`; modify `internal/release/changeindex.go` and its tests | `type Role string` constants Serve/Drain/Platform; `type Record struct { Role Role; By string; At time.Time }` with JSON role/by/at; `func Read(ctx context.Context, s release.Store, ref, region string) (Role, error)`; `func Key(target string) (string,error)`. Strict bounded keys/body, operator data only; no write API in P3a. |
+| New `internal/groupadmission/{state.go,state_test.go}` | Pure state machine: `type Facts struct { EnvLoaded, Reconciled, RolePublished, TerminationStarted bool }`; `type Launch struct { Group, Hook, Instance string }`; `type Completer interface { Complete(context.Context, Launch) error }`; `type State` with `Observe(Facts)`, `Admit(ctx context.Context, launch *Launch, complete Completer, healthy func() bool) error`, `Admitted() bool`, `Close()`. No cloud, filesystem or goroutine in this core. Nil launch is fixed-box admission; group launch requires acknowledged completion. |
+| New `internal/host/{group_admission.go,group_admission_test.go,group_hairpin_rootrunner_linux_test.go}`; modify `agent.go`, `edgesfile.go`, activator wiring and `internal/edge/{lbhealth.go,forwardha.go}` | Own latch/ack wiring and process cancellation; publish effective role only after real success. Local tenant-start permission reads State plus effective role; `lbhealth.Default.SetHosting` reflects the four latch facts. Readiness for Complete is `len(lbhealth.Default.Failing(now))==0`; external health also requires admitted. See Task 3 for restart handling. |
+| New `internal/awsregiongroup/{complete.go,complete_test.go}` | Bind the SDK CompleteLifecycleAction method only; validate self identity/group/hook from immutable configuration. Satisfy groupadmission.Completer. Core never imports this package. |
+| New `infra/modules/region-host/ingress/{main.tf,variables.tf,outputs.tf,tests/group_ingress.tftest.hcl}` | NLB, dedicated SG, protected zone EIPs, listeners/TGs. Callable alone by P3a dev root for existing fixed targets, and by region-host group mode later. External target attachments belong to deployment root. |
+| New `infra/modules/region-host/{group.tf,group_iam.tf,group_alarms.tf,group-init.sh.tftpl,tests/group.tftest.hcl,tests/group_iam.tftest.hcl,tests/group_alarms.tftest.hcl}`; modify `main.tf`, `variables.tf`, `outputs.tf`, fixed tests; new `scripts/check-region-group-plan.py` and local fixture tests | ASG/launch template, least-authority grants, boot and alarms. Fixed default remains supported; explicit state moves for count changes. The read-only JSON plan gate refuses count decreases, fixed-instance replacement/deletion and protected EIP deletion/replacement; only a reviewed disposable-resource cleanup manifest can exempt experiment resources. P6 owns production retirement. |
+| Modify `internal/hostenv/{hostenv.go,hostenv_test.go}`, `internal/host/{installchannel.go,installchannel_test.go}`; new `internal/hairpin/{rules.go,rules_test.go}` and `infra/modules/region-host/hairpin.sh.tftpl` | Claim-free parameter allowlist and floor-absence install; pure IPv4-literal ingress validation and deterministic nft batch rendering: `func Rules(ingress []netip.Addr) ([]byte,error)`. Root script supplies validated addresses, never environment-as-shell. |
+| Modify `internal/host/memwatch.go` and tests; new `internal/groupadmission/observability.go`, adapter metrics tests | Provider-neutral observation values; batch group memory/clock/admission samples through existing metrics adapter/cadence. No new sampler or S3 objects. |
+| Later private deployment `dev/region-ha-group.tf`, `dev/region-ha-ingress.tf`, parameter seeding and version pins | P3a fixed targets; P3b disposable group, approvals and cleanup. Separate reviewed branch in platform-infrastructure; no such file is written by this commission. |
+
+## Review focus
+
+1. **First service before hook acknowledgment, NLB fail-open or a signed direct hop:** Task 3's real activator witness proves zero acquire/start/holder diagnostic while booting, including shutdown races.
+2. **Restart after hook completion, lost success response or reused receipt:** Task 3's crash/receipt matrix refuses ambiguous admission and binds a retained receipt to this identity/configuration.
+3. **Unknown role mistaken for serve, or default rollback overridden by a replacement:** Task 2 pins precedence, failure behavior and a new reference under a regional default; deferred integration tests cover forwarding/drain.
+4. **Hairpin bypasses tenant egress or IMDS isolation:** Task 4 uses the real kernel path for agent, nested tenant, sidecar and rootfs network namespace; disallowed destinations remain blocked.
+5. **Tofu edit replaces the old fixed box/EIP or launch succeeds before IAM/hook exists:** Tasks 1/5 pin fixed-state moves, initial-hook ordering, protected EIP ownership and negative/mock-provider plans; Task 6 observes initial and replacement launches.
+
+---
+
+### Task 1: Isolated dev ingress and backwards-compatible group shape [own review: networking/termination]
+
+**Files:** ingress child and group.tf/variables/outputs/main/fixed tests and JSON plan gate from the map above. New mock tests follow `infra/modules/region-host/tests/instance_metadata.tftest.hcl:1`. No account access.
+
+**Interfaces:** ingress inputs `vpc_id`, `zones` (map AZ→`{subnet_id, allocation_id}`; null allocation creates a protected EIP), `name`, `target_security_group_id`; outputs `public_ips`, `allocation_ids`, `target_group_arns`, `nlb_security_group_id`. The child accepts at least two distinct zones in one VPC. P3a root supplies fixed instance attachments to both TGs. Group mode supplies TG ARNs to ASG, with no per-instance attachment controller.
+
+Region-host gains `mode` (`fixed` default or `group`), `box_count` (integer >=1, default 1; dev/HA-sold region >=2), `group_subnet_ids` (>=2 AZs, public routing), `group_config` (deployment, region_code, placement, AWS/data/deployment-bucket regions, explicit pools set, config-KMS/bootstrap key names), and explicit ingress allocation map. Existing fixed subnet pairing remains; group mode instead requires VPC plus group subnets and forbids fixed `subnet_id`, relay and console-only provisioning settings. Caller must explicitly choose count/addresses; no silent default-VPC discovery for group placement. Existing fixed outputs keep their meaning; group `instance_id` is null, group outputs are additive. Refuse callers requiring a single instance in group mode.
+
+- [ ] **Step 1 — failing mock tests.** `fixed_state_unchanged` asserts no fixed replacement, unchanged profile/SG/volume and legacy outputs; `invalid_group_inputs` rejects unknown mode, fractional/zero count, one AZ, wrong-VPC subnet, duplicate allocation, relay group and fixed/group input mixture. `nlb_contract` asserts TCP 80/443 passthrough, instance targets, preserve_client_ip=true, cross-zone=true, deregistration_delay=30, HTTP health port 80/path `/.carlos/lb-health`, interval 10, thresholds 2/2, matcher exactly 200. `target_security` asserts NLB SG public 80/443, target 80 only NLB SG, target 443 NLB SG plus public backhaul, VPC-only backhaul rule, no SSH. NLB egress admits the target traffic/health ports; no second IPv6 ingress path is silently enabled.
+- [ ] **Step 2 — run locally.** From an owned initialized mock fixture: `tofu test -filter=tests/group_ingress.tftest.hcl` and group tests with `mock_provider "aws"`/`command = plan`. Expected FAIL for missing resources/validation, zero real API requests. Do not run an account-backed tofu plan.
+- [ ] **Step 3 — implement adapter resources.** Group ASG: min=max=desired=count, ELB health (includes EC2), grace 60s, no instance_refresh, suspended AZRebalance. Put the launch hook in **initial_lifecycle_hook**, timeout 900s/default ABANDON, so the initial instances cannot race a separately created hook. Launch template pins its version/AMI, IMDSv2/hop1, same encrypted gp3/delete-on-termination root, explicit public IPv4 for cross-region dials. No automatic template rollout. Preserve fixed aws_instance/EIP state using explicit moved blocks if adding count; verify old fixed fixtures at old→new addresses. Do not convert an existing fixed module invocation to group: instantiate a distinct group beside it. Preserve the old EIP owner; importing/transferring it is P6's approved operation, never duplicate ownership.
+- [ ] **Step 4 — pass mock tests and format.** Add assertions that ASG initial hook exists on CreateAutoScalingGroup, depends on its IAM policies, and cannot start unprotected. Never solve an IAM/ASG dependency cycle with wildcard group write rights: scope completion to exact account/region/group name ARN pattern (UUID wildcard only), plus deployment/region resource tags. Verify pinned numeric launch-template version, on-demand instances only and no refresh actions. Implement the JSON gate for `tofu show -json <saved-plan>`: refuse ASG min/max/desired decreases, fixed-instance replacement/deletion and protected EIP replacement/deletion. Local before/after fixtures prove these refusals and allow isolated ingress creation/group creation; do not rely on a comment saying “drain first”. P6 can later design a production-retirement exception. For Task 6 cleanup only, accept a reviewed manifest naming this experiment's disposable group/ingress resource addresses and allocation ids; fixture tests reject a fixed box or pre-existing regional EIP in that manifest. The gate has no blanket override. `tofu fmt -check -recursive infra/modules/region-host`; mock/gate tests PASS.
+- [ ] **Step 5 — commit locally.** Keep this on the P3a implementation branch with Tasks 2–4 and merged-input addendum until the visible-service gate is satisfied. P3b resources land only with its scheduled activation. No push/apply in this planning session.
+
+### Task 2: Desired roles, cached application and authoritative publication [own review: authority/cache]
+
+**Files:** boxroles, changeindex, host group_admission/edgesfile and tests. No console writer yet.
+
+**Interfaces:** boxroles.Read does exactly two point GETs (own and regional default), no LIST. Missing own falls back to default; missing both is Serve. Validate roles strictly with a 4,096-byte body cap; unknown fields/types/oversized objects or store errors return error, never Serve. A box reference is a valid DNS label, <=63 bytes; regional code is a nonempty deployment-configured label, <=32 bytes; slashes/path syntax are refused. Distinguish absent from unreadable. Keys are `control/box-roles/<ref>.json` and `control/box-roles/@region-<code>.json`. Supply explicit canonical region_code in root-owned launch configuration (including P3a fixed boxes), matching the console's HomeRegion for the home region; retain the existing raw placement scope, including empty home placement, for record reconciliation. Do not infer a code from the AWS region or rewrite home records. Role reads come once at start, then only when the existing change-index scope moves. Failed reads retry on the next existing reconcile opportunity with backoff, not a new timer.
+
+- [ ] **Step 1 — failing tests.** `TestRolePrecedence` (own serve can override default drain; absent own+default platform→platform; absent both→serve); `TestRoleUnreadableIsClosed` (first read fails/invalid→booting, previously restrictive role never relaxes); `TestRoleKeys` (path separators, empty/unknown region and ref rejected); `TestRoleScopeBudget` (new scope, unchanged pass 0G, observed change exactly 2G, partial errors charged); `TestRolePublisherAck` (failed/unchanged edges write cannot impersonate first success); `TestRoleFieldsAreNotHostRoles` (per-host `role:home` untouched).
+- [ ] **Step 2 — run** `nice -n 19 go test ./internal/boxroles ./internal/release ./internal/host -run 'TestRole' -count=1`. Expected FAIL before implementation.
+- [ ] **Step 3 — implement.** Add `control/box-roles` scope to ChangeScope. Publish new top-level `box_role` (`booting|serve|drain|platform`), `admitted` boolean and `drained` boolean, additive with omission preserving old readers. `box_role` avoids collision with per-host role. Desired role is separate from effective role; until startup admission completes publish booting/admitted:false/drained:false. Role change forces one existing edges publication, not a second writer. Cache success only after both own/default reads complete. Keep last applied restriction on transient error; close new-wake permission while role is unknown. Platform adopts tenant records for console reads but cannot start a tenant and is never registered as a target. Group boxes may not execute platform/Unit records; refuse an unexpected such executable before launch, with a readiness blocker rather than silently dropping a production row.
+- [ ] **Step 4 — verify** Step 2 PASS, existing edges wire readers still decode fields and malformed safety additions fail closed in the new projection only. `view` for diagnosing an actual holder stays separate from `serving`: drain holders can still answer while being slept; no change to main's deliberate holder-view age policy. New serving projection must require <=15m generation, <=1m future, compatible region/placement/bucket/key and admitted serve; integration waits for merged placement.
+- [ ] **Step 5 — commit.** Role writes, successful drain answers and console display are not claimed. Main-only tests use injected operator records; live desired-role operations wait for the proper console door in the outline.
+
+### Task 3: Serving latch, local start gate and launch completion [own review: security/termination]
+
+**Files:** groupadmission core, AWS adapter, host wiring/agent/edges, edge health; modify `internal/activator/{activator.go,hawake.go}` for the shared start gate, with tests in those packages and `internal/host/group_admission_test.go`.
+
+**Interfaces:** add `Service.TenantStartAllowed func() bool` and the corresponding backend admission callback at the existing acquire boundary. Add edge-side `type HAAdmission interface { TenantAdmitted() bool }`, implemented by the same Service; at the existing front decision, check it before exclusions/ForwardTarget or other per-request work for a tenant route, including verified hops. Nil preserves non-P3 fixed behavior. Group configuration always installs the closed gate, even when CARLOS_REGION_HA is absent/false, and then refuses that invalid configuration; a group cannot disable admission by losing the capability flag. The admitted check refuses startup/shutdown; the start callback additionally prohibits drain/platform starts. In P3 mode the same State/effective-role decision feeds the callbacks; check under existing per-host serialization before acquire and again before launch, including lease-retaining respawn paths. Place the start check after the already-owned awake-entry reuse branch, so a drain can continue serving a held instance until its paced stop. This is a local start prohibition, not a second lease algorithm. Already-awake held service may continue during drain; a process closed for shutdown cannot restart it. The incoming departure-consumer-start acknowledgment is **not implemented or guessed here**; until the outline's real wiring exists that fact is false.
+
+- [ ] **Step 1 — failing state tests.** `TestAdmissionFacts` independently withholds env, complete first regional instance+sidecar reconcile, acknowledged initial role publication and termination consumer started: no completion/admission. With all four facts and each of six lbhealth conditions, readiness succeeds. `TestAdmissionCloudAck` pins complete-before-admitted-before-publish-serve ordering; failed/late/cancelled completion does not admit. `TestAdmissionSingleFlight` gives twenty concurrent startup callbacks one completion operation, one receipt and one admitted publication; repeated successful callbacks cost zero calls. `TestAdmissionCloseWins` races completion with Close: no reopen. `TestDrainHealth` keeps admitted drain healthy for forwarding while prohibiting starts; platform excluded from targets. Health does no store/API call.
+- [ ] **Step 2 — run** `nice -n 19 go test ./internal/groupadmission ./internal/awsregiongroup ./internal/host ./internal/activator ./internal/edge -run 'TestAdmission|TestDrainHealth|TestPreAdmission' -count=1`; expected FAIL.
+- [ ] **Step 3 — implement state and adapter.** Set the hosting latch from the four successful local facts. Evaluate the full six-condition readiness in memory; do not wait for public NLB health to complete the hook (that would be circular). Group CompleteLifecycleAction sends CONTINUE with configured own group/hook and verified own iid. Fixed boxes skip the cloud action only, after the same full readiness. External LB health answers 200 only once admitted and six conditions hold. This extra admission gate prevents an ambiguous cloud success from leaving a permanently healthy booting target. Every pre-admission tenant refusal is 503 with existing retry text and **no holder identity**; a signed hop cannot bypass it. Publish booting before hook completion, then admitted effective role; never advertise serve first.
+- [ ] **Step 4 — pin crash behavior.** A successful hook acknowledgment is durably recorded in an agent-owned admission receipt, outside tenant trees, with account/region/iid/group/hook/config digest. The host's Completer wrapper persists that receipt before returning success to State.Admit, then rechecks health/closure; an AWS adapter success alone cannot open the local gate. Root never reads or executes this receipt. A same-instance process restart rechecks all local startup facts/health before re-admission; the receipt avoids completing a nonexistent hook again. A replacement iid or changed group/hook cannot reuse it. Absent/bad receipt plus “no active hook” is **not success**: remain closed and unhealthy for replacement/operator diagnosis. A response lost after AWS accepted CONTINUE remains unknown; do at most four total completion attempts, 2s each, backoffs 1/2/4s, then close health and let replacement/alarms handle it. No DescribeAutoScalingInstances polling, heartbeat extension or extra write privilege. Refuse on receipt-persistence failure even after cloud success. Test crash before ack, ack-before-receipt, receipt-before-publication, restart, corrupt receipt and close during retry.
+- [ ] **Step 5 — real production-path witnesses.** `TestPreAdmissionDirectAndHop` sends direct HTTP, verified forward and direct-public backhaul at an actual wired activator; assert **0 acquires, starts, restores, key mints, holder headers**. `TestPreAdmissionNonHTTP` drives schedule, standalone worker, co-spawn, respawn/session/run and first reconcile launch paths; no bypass. `TestAdmissionShutdownOrder` proves Close/SetHosting(false) precede edge shutdown, consumer cancellation and child stopping. `TestAdmissionAllUnhealthyNLB` sends traffic despite 503 health; still zero tenant starts. `TestAdmissionPublishedRole` observes actual store bytes and publication acknowledgment, not just a state fixture. P3a requires these real wiring witnesses after the merged consumer adapter is added.
+- [ ] **Step 6 — pass and commit.** Step 2 commands and existing targeted HA acquire/lease-loss witnesses PASS. Add build-time source-import assertion: new core directories import neither AWS nor the AWS adapter. Retain existing termfence/boxid adapters; do not refactor their whole API in this task. Keep the slice on branch until real termination-start input exists; no unused latch landing.
+
+### Task 4: Claim-free boot, IAM and local ingress hairpin [own review: root/security]
+
+**Files:** hostenv and hairpin files, boot template/group IAM, tests; update module README and `docs/site/cli.md` only after execution-time copy review if existing host-env instructions change. No new public CLI verb is needed for boot/admission.
+
+**Interfaces:** root-owned `/etc/carlos/region-ingress.json` contains version 1 and 1–16 canonical public IPv4 addresses from operator-seeded regional SSM configuration. Hairpin input is a validated data list, not nft/shell text. `group_config` pins deployment bucket region separately from box/data AWS region, canonical region_code and raw record-placement CARLOS_REGION. Runtime reads immutable non-secret launch identifiers from root-written configuration; secret values stay in the protected host.env writer.
+
+- [ ] **Step 1 — failing tests.** `TestGroupHostEnvNoClaims` removes Required/Optional/SharedKeys entries for every `CARLOS_HOST_CLAIM*`, refuses a seed containing enabled claim settings, permits no claim entry in rendered group env. `TestGroupHostEnvRegions` accepts allowlisted AWS_REGION for the deployment bucket, while data and CloudWatch/SSM regions remain the box's own; private key is never printed. `TestGroupHostEnvPools` admits explicit operator-seeded CARLOS_POOLS through provision.ParseBoxPools (`internal/host/agent.go:3542`), keeps it regional, cross-checks immutable launch scope and refuses missing/mismatched scope instead of defaulting the dev group to @shared. `TestGroupBootOrder` asserts hardening before tenant execution/credentials exposure, no binary exec before trusted SHA, env before bootstrap/install-channel, hairpin before tenant starts, fail-fast each step, no join/enroll/guard-arm. `TestGroupInstallFloor` pins both objects absent, only floor present, only authorization present, errors on either read, invalid signature, too-old image, valid floor and no-floor signed pointer/artifact mismatch. `TestGroupIAM` asserts the rights/refusals below. `TestHairpinRules` rejects empty/malformed/non-public/IPv6/nonliteral/duplicate-limit overflow inputs; only configured IPv4 destinations and TCP ports 80/443 redirect, no broad catch-all or DNS resolver loop.
+- [ ] **Step 2 — run** `nice -n 19 go test ./internal/hostenv ./internal/hairpin ./internal/host -run 'TestGroupHostEnv|TestGroupBootOrder|TestGroupInstallFloor|TestHairpinRules' -count=1`, then `tofu test -filter=tests/group_iam.tftest.hcl` in the mock fixture; expected FAIL. Use scratch binaries/data below `$TMPDIR` or `~/.cache/region-ha-p3`; default GOCACHE.
+- [ ] **Step 3 — implement boot and the floor absence rail (I1/N1).** Install nftables/chrony and a minimal service user; gate IMDSv4 and IMDSv6 to root/agent, before any tenant can run. Fetch bootstrap object and expected SHA-256 from operator-protected SSM, compare before exec. Use pinned bootstrap object/version plus digest, not mutable “latest”; keep root-signed channel verification. Add a claim-free group install-floor observation in installchannel.go: `type groupInstallFloor struct { Published bool; Identity []byte; Tag string }`; `func (in channelInstall) checkGroupInstallFloor(ctx context.Context, p *release.SystemPointer, art release.SystemArtifact, pub ed25519.PublicKey) (groupInstallFloor,error)`. Read **both** existing floor keys once. Only two genuine not-found answers mean unpublished; one absent, either error, malformed/signature failure or an incompatible published floor refuses. With a floor, read/verify the signed release identity and preserve CheckImage. With neither, verify the signed system pointer/artifact as today, and omit the claim identity/guard bookkeeping that requires a published floor; never fabricate an empty identity or arm a guard. Keep the existing claims-on/--policy path strict and unchanged. Refuse if local guard participation exists or its state is unreadable; a group marker is no bypass of an enforced floor. Run `carlos system host-env write --deployment <name> --region <code> --aws-region <box-region>`, `carlos bootstrap`, then `carlos system install-channel` with validated host.env variables loaded through the existing environment parser/systemd EnvironmentFile (not shell source), install/read back hairpin, then start agent. Include allowlisted AWS_REGION=<deployment-bucket-region>, distinct from data/SSM/metrics region. Require nested layout and run `TestBootstrapAppliesTmpfilesBeforeArming` and `TestReconcileMintsNestedUnderANestedIntent`; no chmod/chown repair after start. Bound each fetch and entire boot below 900s; timeout 15m changes only from measured dev boot plus margin in a reviewed change. Root scratch is disk-backed and removed on exit. No secrets in user-data, command arguments, shell tracing or logs.
+- [ ] **Step 4 — implement IAM.** Box SSM GetParameter/GetParameters/GetParametersByPath only under `/carlos/<deployment>/<region>/*` and `/carlos/<deployment>/shared/*`; explicit NotResource Deny matches **both** allowed prefixes and preserves release-key/ancestor denies. No broad `/carlos/*` group allowance. Store bootstrap key/hash and ingress data under the regional **nested** `boot/` path, excluded from hostenv's non-recursive direct-parameter enumeration; never make the hostenv parser accept arbitrary bootstrap keys as environment names. Configuration KMS Decrypt is key-specific, `kms:ViaService=ssm.<region>.amazonaws.com` plus `kms:EncryptionContext:PARAMETER_ARN` restricted to those parameter ARNs. Separate explicit HA DescribeInstances statement with own requested-region condition (resource `*` is AWS's Describe boundary); remove the group-mode duplicate from the broad inventory Allow so that the new condition actually bounds it. Preserve the fixed console's inventory rights. No EC2 writes. CompleteLifecycleAction only own group ARN/name/tags; no RegisterTargets, SetInstanceHealth, TerminateInstances, StartInstanceRefresh or other ASG writes. Keep existing queue read/delete/attributes grants and anti-forgery policy. Explicit group-role Deny for Put/Delete/tagging of `control/box-roles/*` closes the inherited deployment-bucket write route; only the trusted console role can write desired roles. Operator seed rights are PutParameter plus configuration-key Encrypt/GenerateDataKey/Decrypt as required by SecureString tier, distinct from box rights. Fixed platform-console IAM is not accidentally denied its role-writing authority. New metrics permit only named Carlos namespaces; console gains no new infrastructure write rights.
+- [ ] **Step 5 — implement hairpin.** Atomically replace only the owned nft table; never flush the system ruleset. Root output destination-NAT/redirect catches root, agent and host-network tenants; apply the equivalent destination rewrite on the actual tenant-network ingress/prerouting path for namespace/bridge/rootfs callers. Use local edge 80/443 and normal routing, preserving Host/SNI. Root persists/reloads rules before agent/tenant units on reboot. Updates require explicit reseed/restart; addresses are EIPs, so no periodic DNS/SSM refresh. Confirm cgroup egress policy evaluates the intended destination: a tenant disallowed the ingress address stays denied, rather than gaining loopback through NAT. Refuse network layouts for which that kernel proof fails; do not widen IPAddressAllow or loopback to make the drill pass.
+- [ ] **Step 6 — kernel/authority witnesses, then commit.** Run `TestHairpinKernelAgentTenantSidecar` on the designated Linux root runner: each configured zone EIP, GET/POST and TLS/WebSocket, with agent, a real nested tenant, standalone sidecar and supported rootfs namespace. Prove IMDSv4/v6 still denied to tenant/sidecar, unrelated IP/port unchanged, an egress-denied ingress address still denied, no rewrite loop, restart persistence and rollback of just the owned table. Local privilege skip is not acceptance. Wrong checksum, failed SSM page, wrong KMS context, forged config/receipt paths and disabled nft/chrony leave admission closed. Mock policy denial tests cover another region/group/key and direct role-object write. Pass targeted tests; commit with census claims, no apply.
+
+### Task 5: Alarms with real producers and bounded metrics [own review: infrastructure]
+
+**Files:** group_alarms and tests, memwatch plus adapter; observation values in groupadmission. Producers that need future scan/readiness evidence stay in the integration outline.
+
+**Interfaces:** extend the existing once/minute host metrics batch with group dimensions and clock offset, using the same PutMetricData call in the box's actual AWS region. Pure observation type uses time/durations/identifiers, no AWS types. NLB/TG dimensions are ARN suffixes; ASG uses AutoScalingGroupName; EligibleBoxes uses existing Carlos/Region dimensions. Alerts go to a confirmed same-region topic. Do not add a second metrics loop or a periodic S3 health object.
+
+- [ ] **Step 1 — failing mock/adapter tests.** Pin every row below, missing-data behavior, target-group aggregation and metric namespace/region. A deployment with no producer may not silently arm an all-green alarm. Test minimum group memory includes the lowest individual sample, not mean memory; failed/missing clock read is unknown, never zero.
+- [ ] **Step 2 — run** group_alarms mock tests and `nice -n 19 go test ./internal/host ./internal/groupadmission ./internal/awsregiongroup -run 'TestGroupMetric|TestGroupAlarm|TestAdmissionMetric' -count=1`; expected FAIL.
+- [ ] **Step 3 — implement the following alarm contract.** Use 60s standard-resolution periods; no autoscaling/terminate action on S3 failure. Group metrics enabled in ASG without Describe polling. Reuse SNS infrastructure convention in the same region. Initial launch failure events go to SNS through EventBridge; include all launch failures so an abandoned hook is not filtered out by brittle Cause text. Both local hook failure and timeout/launch-event drill evidence are required; do not invent a native “abandoned hooks” CloudWatch metric. AWS service events are best effort, so group-size alarms are the fallback.
+
+| Signal | Threshold / producer / invariant |
+|---|---|
+| NLB UnHealthyHostCount | Maximum >0, 10/10 minutes, each TG (no SUM double-count across TGs), missing=breaching; **I4**. |
+| NLB HealthyHostCount | Minimum <box_count, 25/25 minutes, each TG, missing=breaching; **I4**. |
+| Carlos/Region EligibleBoxes | Minimum <box_count, 25/25 minutes, missing=breaching; P2b verified serving/capacity producer required before G2; **H4/R1**. |
+| AWS/AutoScaling GroupInServiceInstances | Minimum <desired, 1/1 minute, missing=breaching; initial launch/routine boot can alert, never suppress it for 25m; **T1**. |
+| Launch/hook failure | EventBridge `EC2 Instance Launch Unsuccessful` scoped to own ASG → same-region SNS; acknowledged local completion failure recorded; timeout ABANDON exercised; **A1/T1**. |
+| Existing termination queue | ApproximateAgeOfOldestMessage >600s, 1/1 minute, missing=notBreaching for empty queue; N-HA11 consumer and missed-event drill establish real delivery; **I3**. |
+| Group memory | Carlos/Host MemAvailablePercent with group dimension, Minimum <15%, 3/3 minutes, missing=breaching; retain per-instance series; **H4**. |
+| Box clock | Absolute chrony offset >1s, 1/1 minute, missing=breaching; per-box diagnostics plus group Maximum alarm; **I1**. |
+| Takeover / duty transfer | Structured host/dead-ref/iid/latency plus metric; acquire stays P1b-1, transfer stays 3b; do not duplicate scans; **I1/I3**. |
+| Suspect or same-box refusal / marker owed | Oldest >600s; cache/release-queue observations on existing local cadence; **I1/I4**. |
+| Local set-aside / files / migration | Reason counts; oldest continuous unpublished >300s, snapshot >2 configured intervals, partial/backfill failure and migration refusal; existing runtime producers, migration slice owns its signal; **I2**. |
+| Wake without eligible capacity | Existing per-region/hour notification from placement, not a new per-box alarm sender; **A20/H4**. |
+
+- [ ] **Step 4 — verify sources and routing.** PASS local/mock tests; exercise every threshold/recovery/missing-data case with fake time. At integration, each non-P3 row must cite the actual merged producer or remain a named G2 blocker; writing an alarm with no stream does not complete §20. Migration/backfill signals are conditional on that later feature, not a requirement to build migration before G2. Add no migration feature just to produce its alarm. Verify subscriptions before live faults; alarm lag is recorded separately from failover time.
+- [ ] **Step 5 — commit**, bundled with its visible slice; deferred producers are not implemented against branch previews.
+
+## After P1b-3a / P2a merge: P3 integration outline only
+
+This section is deliberately **not an executable task list**. Wait for actual amadan-main commits, re-read the listed files, replace each outline with exact signatures/witnesses and carry the same round history. A producer merely being final/reviewed on its branch is insufficient. P2a alone supplies no role or capacity door; P1b-3a alone supplies no consumer or drain importer.
+
+| Work / invariant | Exactly what must merge first | Integration boundary and acceptance |
+|---|---|---|
+| **Serving set / H4,R1,A1** | P1b-3a's real cold-wake snapshot/chooser and per-box suspect list, including actual raw-field decoder in `internal/edge`, activator placement wiring and awake Apps publication | Project P3 box_role/admitted/drained into that producer; <=15m/future<=1m/compatible evidence. Booting/platform never candidate; drain can remain a holder during sleep. Preserve N-HA12 10s exclusion, N-HA10 front accounting, local recovery when evidence is unusable and no headroom refusal for existing hosts. No new holder-cache policy or second chooser. |
+| **Termination-start latch / I3,A1** | P1b-3b's functioning single termination consumer, durable scan/import path and its independent start/cancel acknowledgment on main | Wire actual start success into TerminationStarted. Empty queue is allowed; client construction failure is not started. No network probe to S3 in health. N-HA11 remains one 20s long-poll/box, ~180 receives/h. P3 consumes lifecycle state; it does not implement or ack the departure queue. Consumer startup cannot wait for P3 drain completion. |
+| **Console ingress / E1,N1** | P2a's complete CONSOLE_REGION_INGRESS parser/rendering/guidance on main | Validate agent PLATFORM_EDGE_IPS accepts the full public ingress set; set console ingress **before any group edges publication** so auto-public box IPv4s do not become DNS advice. Private root publishes all NLB zone EIPs, plus separately intended platform ingress; no trust-proxy expansion. Hairpin is the own-region subset, not the deployment-wide union. |
+| **Role write / R1,S1** | P3 role reader/publication and P2a merged; then P2b's operator-authenticated, claim-free role producer is planned against that main | `carlos system box role <ref|@region-code> <serve|drain|platform>`; authorization/fresh-auth ordering, CAS, audit and serial/index; saved desired versus applied status. Do not repurpose old roster role writes or provide box-local administration. Region default covers new replacement refs during rollback. P2b owns API/CLI/docs, P3 owns application. No new root read from role data. |
+| **Drain / I1,I3,R1** | P1b-3a forwarding/selection, P1b-3b one importer and durable completion ack, plus P2b role writer, all on main | Close new starts immediately, keep LB healthy and forward; sleep awake tenants one at a time, 5s spacing. Mid-stop request waits for stop then forwarded selection. Failed stop/marker/owed release keeps incomplete. Publish drained only after zero awake/waking/respawn/release debt **and imported duties acknowledged**; changed work invalidates completion. Region-default drain launched replacement never wakes. No ASG count decrease until explicitly drained/deregistered under later approved operation. |
+| **Platform / I1,R1,E1** | P2b role door plus merged forwarding set | IE fixed console adopts tenant records but never wakes/runs a tenant. Relay/MX fixed EIP remains separate; group skips console, unit-bound platform executables and relay responsibilities. Refuse platform for a verified group reference, including a region default that would put group members into platform; a new group box reading such a role stays booting and never completes its hook. Do not report an admitted ASG member as applied platform while it remains an automatic target. Fixed platform IDs must be absent from private-root attachment lists. Test console CRUD/read/restart through group placement without console migration. No P3 relay/MX cut-over. |
+| **Readiness / §20 / H4** | P2b shared verified capacity/readiness observation after P3 role/admission producers; 3b operational transfer producer | Gate on applied evidence, version, nested capability, matching bucket/key, startup/admission, role and no release debt; unknown/incomplete is not “zero capacity” or ready. Start existing CloudWatch region adapter claim-free, with exact console budget in P2b. N-HA13: no “awake on” display redesign; preserve main display/deploy-watch until its separate design. |
+| **Simulation / I1–I4** | Actual merged placement/consumer/import interfaces and current `internal/sim/regionha` | Add group boot/hook/grace/admission, lost completion, hang just after first direct-backhaul service, roles/drain and scanner death actions. Mutation pre-admission-serve must fail I1/I5 witness; failed full-health condition must block completion; cleared shutdown latch cannot reopen. Reuse I6 duty-import checks from 3b; do not duplicate their model. One serial nice-19 3,000-seed sweep per revision, not repeated whole-suite loops. |
+
+The executable addendum must also resolve the held-lease-on-drain request path using the actual merged API: retain service while held, stop safely, then place on a permitted serving peer. A drain peer must not become a free-cold-wake target; it must not be removed from holder diagnostics merely because its role changed. Tests use low headroom, no peers, stale view and a peer disappearing between choice and dial. With no permitted peer, refuse before starting; retain stop/marker duties for retry. No cut-over or scale-in is allowed from that refusal.
+
+### Task 6: Dev deployment and timed G1/G2 drills — future scoped go required
+
+**Files:** separate platform-infrastructure dev branches and a drill report in its established deployment notes; implementation branch evidence links it. This task defines the acceptance and approval card, not permission to execute it now.
+
+**Who applies what:** the P3 implementer supplies reviewed platform changes/mock evidence and the merged-input addendum. The deployment owner prepares the private dev-root change and an infrastructure operator runs the account-backed read plan and apply **only after Paul's scoped go**, passing the saved-plan JSON gate before apply. The release operator rolls dev boxes, then dev console and checks versions. Paul authorizes the destructive dev drill and its complete cleanup once; no repeated go per API call within that exact scope. Production G3 gets a different account/domain/change card. This plan authorizes none of those live calls.
+
+- [ ] **Step 1 — prepare concrete approval card.** Read current deployment config/inventory; record actual account id, eu-west-1 VPC/subnets/AZs, bucket/SSM/KMS/SNS ARNs, two fixed target ids or disposable group ids, canonical region/pool, explicit domains and fresh born-HA host/app/account. List IAM changes, new NLB/SG/two TGs/two EIPs, fixed attachments for P3a, and launch template/ASG/hook/alarms for P3b. Include maximum count, type/volume/cost, public traffic effects, 24h drill expiry, fault permissions (terminate only disposable members; never leo/sophie without separate named go), rollback and cleanup. Verify no duplicate rule/queue ownership. An existing born-HA host is not a migrated legacy host. Schedule and record actual switch-on release date before merge.
+- [ ] **Step 2 — P3a visible acceptance.** After merged producer addendum and approval, stage/read-plan private ingress against fixed pair; reject replacements/deletes of fixed boxes, current EIP, buckets or production DNS. Apply new isolated ingress/attachments; roll admission/hairpin before registration. Probe existing born-HA host from outside VPC through **each** NLB zone EIP, curl --resolve with real Host/SNI, GET/POST and WebSocket, version header/body and one accounting owner. Show local health from all six conditions, actual admission and matching buckets/key/pool. Traffic via NLB must serve, not just connect. Record the first visible result in UTC; do not call this G1/G2 or replace the normal ingress yet.
+- [ ] **Step 3 — G1 prerequisite and P3b staging.** Record all P1b/P2 main commits/releases and G1 pair drills, operator/readiness/capacity doors, direct/backhaul forwarding and role application. Only then prepare/apply the dev IE topology above: two zones/count=2, new group references, explicit hapair-only scope and the approved existing bucket. Group-only drills require the approved pair pool withdrawal and proof of no outside-pool placement/import. A different bucket/region is a new reviewed scope, not a fallback invented during apply. Set full console ingress before group publishes; own-region hairpin before workloads. Verify a box launched during regional-default drain remains non-serving, and that platform is outside TGs. Inspect initial hook Pending:Wait, withheld readiness, acknowledged completion, publication and InService/target health, in that order. No admission shortcut for rehearsals.
+- [ ] **Step 4 — admission/hang/termination drills.** Withhold each readiness fact, inject failed/ambiguous completion, send direct signed backhaul to booting box; no lease/start. Kill a disposable admitted instance with EC2 termination, measure group detection/replacement, then born-HA restores on survivors. Hang the agent/health path, including immediately after first healthy service reached through direct backhaul; full grace is 60s, not 15m. Record termination confirmation and **lease expiry separately**, never take early under N-HA9. Compare commit sequence in each replication class; stream loss ~1s, others up to configured interval. Restart admitted agent to exercise receipt without re-running a nonexistent hook. A failed boot must reach ABANDON and notify, not accumulate live Pending boxes.
+- [ ] **Step 5 — loss, placement, drain and networking.** Black-hole S3 for one disposable box: alarm/operator intervention, no S3-loss auto-replacement; after approved termination recover only at expiry. Concurrent cold wakes through both zone EIPs: one writer. Drain through CLI with full peers: sleep/marker/import evidence, 5s spacing, healthy forwarding; refusal if no peer. On disposable targets rehearse deregistration delay 30s, stop/restart and rollback role/default, plus an EIP mapping transfer using **disposable EIPs only**; P6 owns the exact production retirement rehearsal/runbook. Check outside-VPC public 80/443, preserved client identity, cross-region signed backhaul on public 443 and own-region hairpin from agent/tenant/sidecar, with IMDS/egress denial retained. Do not temporarily close public 443 to NLB-only: its second-hop redesign is outside P3.
+- [ ] **Step 6 — evidence, cleanup and gate.** UTC timelines: health/hook/admission/first service, fault/termination/expiry/restore/first200, loss window, alarm notification/recovery and per-event request counts from the built-revision counting tests. Match binary/version to tested behavior. G2 requires all §21 drills and measured §9.8 bounds including N-HA9; an unavailable producer or untested direct-hop hang is a blocker. Restore all network faults; remove disposable hosts, ASG/targets/alarms/SSM objects/EIPs with the approved operator-owned cleanup (protected EIPs require an explicit reviewed unprotect cleanup step). Never delete a shared bucket, identity or another session's files. Keep the accepted dev proving group only if the approval names it as retained; otherwise destroy temporary resources. No watcher/server/scratch outlives this work. Controller reports results on branch/#421 when authorized. G3 awaits separate readiness and production go; seven-day acceptance precedes G4, G5 stays later.
+
+## Exact request budget
+
+Logical API attempts including unsuccessful requests; SDK retries are transport attempts too. Counting-transport tests must report both. G/P/L/D denote S3 GET/PUT/LIST/DELETE. Spec prices: G $0.0004/1,000; P/L $0.005/1,000; D free (`docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md:639`). No credits for “reusing a poll” unless the no-op test actually makes zero extra calls.
+
+| Path | P3 increment / bound |
+|---|---|
+| Quiet steady box, health checks, hairpin, lease-start permission | **0 extra S3/SSM/EC2/ASG calls/hour**. Health reads atomics/local clocks only. Existing §18 box baseline remains ~3,300–3,500 S3/h, not a spending allowance. |
+| Role initial load / observed role-scope change | Exactly **2G** per affected box attempt, own+default, no L. At startup absent counts as an attempted G. Retry partial failure costs another at most 2G on an existing pass, bounded backoff; no per-request reads. For B boxes reacting to one coalesced role event: <=2B G plus index reads already in their normal poll. |
+| Later console role CAS | P2b owns it: precondition **1G+1P**, then index **kG+kP**, **1<=k<=4 total**, before any explicit verification/read-back. CAS conflict returns; no unconditional overwrite. Unchanged role reads only. See main changeIndexAttempts=4; do not interpret spec shorthand as four extra retries. |
+| Forced effective-role/admission/drained edges publication | Existing putReplacing does **a(G+P)**, **1<=a<=3**. Every successful object mutation adds index **k(G+P)**, k<=4; conflicts that do not mutate do not bump. Thus successful publication <=**7G+7P** logical calls; failed three object CAS attempts <=3G+3P, no index. Normal success 2G+2P. Receipt and state transitions are local, 0S3. |
+| Launch phase publications | At most one forced booting and one admitted-role write on successful boot: normally **4G+4P**, bounded **14G+14P** for those two successful publication operations, plus timed/route-change writes already in baseline. Shutdown/drain applied and drained completion each add one such operation when evidence changes, not on every local tick. Failed operations retried later are charged again. |
+| Edges reader amplification | Existing coalesced 30s fold, **<=120*(ceil(B/1000)+B)** calls/box/h when continuously invalidated, split LIST pages plus GETs. A rare extra mutation can add at most **ceil(B/1000)L+B G** per reader at its next fold; B readers amplify it B-fold. Role scope itself does not trigger an all-role LIST. |
+| Role+two effective publications example, B=4 | Console desired mutation normal 2G+2P; reader roles <=8G; two publications normal 4G+4P; at most two folds/reader: 8L+32G across four readers. Total incremental event envelope **46G+6P+8L = $0.0000884**, excluding P2b explicit verification, existing index polls and retries. Coalescing can lower, never raise this bound. |
+| Initial boot artifact / trusted hash | Bootstrap raw GetObject exactly **1G** for named object; SSM GetParameters batch for bootstrap key/hash exactly **1 call** (2 parameters), not S3 HEAD+GET or per-tick fetch. SHA verified before exec. Existing install-channel signed pointer/artifact reads remain charged separately by its real path; record them in boot counting witness rather than claiming they are part of the single bootstrap GET. |
+| Claim-free install-channel, fresh group box | Successful no-floor install: **4G** = signed system pointer + two absent floor keys + artifact; successful published-floor install: **5G** = pointer + both floor keys + signed release identity + artifact. **0L/0P/0D**. An already-installed same release omits artifact G; failure stops at its attempted reads. Bootstrap artifact above is another 1G, so successful boot binary preparation is **5G without floor / 6G with floor**, before existing reconcile/identity/edges work. Pin actual low-level GetObject/stream calls and prevent a second floor observation in the installer; network retries are additional attempts. No-floor does not imply network errors count as absence. |
+| host-env / ingress configuration boot reads | Two GetParametersByPath paginator chains, one shared/one regional. Set MaxResults=10: **max(1,ceil(S/10))+max(1,ceil(R/10))** calls for S/R parameters with no empty intermediate pages; actual API pages, including empty pages/tokens, are charged. Bound total configuration to 100 parameters and **20 pages total**; fail if exceeded. Put ingress data in a separately keyed regional parameter: **1 GetParameter** once at boot; no DNS/SSM refresh. KMS decrypt service work <=number of SecureString values returned (including bootstrap/ingress); count retries, never a box KMS write. |
+| Launch completion | Normal **1 CompleteLifecycleAction**/new instance; worst **4 total attempts** with SDK retries disabled at that adapter, original 900s launch deadline, no heartbeat/describe. Restart with valid same-identity receipt **0 ASG calls**. Unknown/no receipt+no hook remains closed. |
+| Identity / boot metadata | Reuse existing IMDS signed identity for self, owner and group ref where available; no new timer. Count actual IMDS requests separately in boot witness; no new EC2 list/describe on boot for membership. |
+| Termination, owned by 3b | One existing queue consumer **~180 ReceiveMessage/h/box** at WaitTimeSeconds=20 when idle; event/redelivery receives and DeleteMessage attempts extra, no ChangeMessageVisibility grant presumed. P3 adds **0 receives**. Confirmer at most **1 DescribeInstances/iid/10s/box** on suspicion, none on healthy request. No new polling. |
+| Scan/import, owned by 3b | Per attempt with H regional hosts, A matching dead/released hosts, W<=A wake objects: **(H+A+W)G**, no new region LIST if using existing reconciled records. Completion deletion **1D+kG+kP** plus any required ETag refresh G; identity at most 1G/uncached ref. Retry/duplicate attempts each charged. No per-box scan tick. P3 drain completion waits for this merged importer; it creates no second scan. |
+| Metrics | Extend existing host **<=60 PutMetricData/h/box**, no additional call per metric; no S3. Emit clock/group dimensions in same batch, actual AWS region. Console EligibleBoxes remains P2b's **<=60 calls/region/h** plus its separately budgeted verified observation reads; do not attribute its workload to P3's zero. EventBridge→SNS notifications are event workload, no polling. |
+| NLB probes / operator verification | Two TGs nominally 360 HTTP checks/target/hour/TG at 10s; AWS consensus can send more, so **720 is not a hard actual-request ceiling**. Each costs 0S3/0AWS API calls in the box. Actual count measured on dev. Operator's bounded DescribeTargetHealth/ASG/alarms reads are drill-only, never installed as a per-box watcher. |
+| Tofu | State refresh/read-plan/apply API count depends on provider diff, not a runtime polling budget. Deployment approval records the actual operation list/resource diff; no live tofu requests in this drafting session or mock tests. |
+
+Task 3/6 counting witnesses must cover no-op pass, role absence/error, index conflict, failed edges CAS, duplicate latch callback, ambiguous lifecycle response, restart receipt, and a burst of pre-admission requests. Twenty concurrent booting requests still produce **zero lease GET/PUT/starts and zero completion calls** from those requests. Admission is event-driven by startup acknowledgments, not a request side effect. State.Admit serializes/coalesces startup attempts, rechecks closure and readiness after completion, and never runs an unbounded retry operation from Observe or a request.
+
+Provider facts verified from primary documentation: NLB health checks use a distributed consensus mechanism and can route to unhealthy targets when all targets fail; this is why local admission is mandatory. Lifecycle completion can identify the instance directly, avoiding group-membership reads. Auto Scaling launch-failure events are best effort; group-size alarms provide a second signal. Sources: [https://docs.aws.amazon.com/elasticloadbalancing/latest/network/target-group-health-checks.html](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/target-group-health-checks.html), [https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_CompleteLifecycleAction.html](https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_CompleteLifecycleAction.html), [https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-event-reference.html](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-event-reference.html).
+
+## Cost per region
+
+USD, 730h/month, **two AZs/two NLB EIPs**, before tax, NLCU traffic, cross-zone transfer, compute, volumes, metrics/alarms/SNS/SSM/KMS and any additional data bucket. Public price offer read 2026-11-01, publication 2026-09-11; each region's source is linked. All four offers price NLCU at $0.006/unit-hour: **$4.38/month per continuously used NLCU**. No reserved capacity purchased.
+
+| Region | NLB fixed hourly / monthly | NLB EIPs (2) / month | NLB + EIPs / month |
+|---|---|---|---|
+| Dev IE / flagship IE, eu-west-1 (separate groups/bills) | $0.0252 / $18.396 | $7.30 | **$25.696** |
+| UK, eu-west-2 | $0.02646 / $19.3158 | $7.30 | **$26.6158** |
+| US, us-east-1 | $0.0225 / $16.425 | $7.30 | **$23.725** |
+| AU, ap-southeast-2 | $0.0252 / $18.396 | $7.30 | **$25.696** |
+
+Sources: [https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AWSELB/current/eu-west-1/index.json](https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AWSELB/current/eu-west-1/index.json), [https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AWSELB/current/eu-west-2/index.json](https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AWSELB/current/eu-west-2/index.json), [https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AWSELB/current/us-east-1/index.json](https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AWSELB/current/us-east-1/index.json), [https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AWSELB/current/ap-southeast-2/index.json](https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AWSELB/current/ap-southeast-2/index.json).
+
+AWS charges all public IPv4, including the auto-assigned box addresses: **$0.005/h = $3.65/month each**, another **$7.30/month for N=2** group boxes. Gross NLB+all IPv4 is therefore IE/AU **$32.996**, UK **$33.9158**, US **$31.025**. One primary NLB EIP reuses an already-paid regional allocation at eventual cut-over, so incremental EIP charge over today's one-EIP region is $3.65, not $7.30; during dev rehearsal both new EIPs are incremental. IE platform's separate new relay/MX EIP adds $3.65/month at its later cut-over. Each additional AZ adds $3.65/month; each public-addressed box adds $3.65 plus compute/volume. Source: [https://aws.amazon.com/vpc/pricing/](https://aws.amazon.com/vpc/pricing/).
+
+P3a reuses existing fixed compute/addresses; two new NLB EIPs cost the full $7.30/month during rehearsal. P3b disposable compute/volumes require a fresh regional quote on the approval card, **not included in those totals**. A 24h IE NLB + two EIPs + two new box IPv4 costs $1.0848 before traffic/compute/alarms; a retained group incurs the monthly line. Existing SQS estimate ~ $0.05/box/month is §18's estimate, not an additional P3 consumer. Price refresh and the complete dev maximum cost belong on the live card before go.
+
+## Copy deck for execution-time review
+
+This is a requirements inventory for the controller, not approved product wording. Plan prose is covered by writing-pipeline's implementation-plan exception. Do not write UI/CLI/docs/alert prose into product files before drafting/reviewing this deck with the copy-review workflow and applying the accepted text verbatim. No model or copy review is dispatched here.
+
+| ID | Destination | Required meaning / invariant |
+|---|---|---|
+| P3-C1 | Role CLI/API, P2b-owned `system_roles.go`, `internal/console/apiboxroles.go`, CLI docs | New serve/drain/platform vocabulary, ref/default target, operator-only; saving desired role is distinct from applied/drained. Inventory usage, invalid target/role, conflict/unreadable/write failure, audit and saved/applied messages. **R1/S1**. |
+| P3-C2 | Existing edge/activator pre-admission refusal | Reuse existing retry body; 503 with no holder identity. Do not expose group/account/iid or imply successful wake. Inventory any added explanation before shipping. **A1**. |
+| P3-C3 | Boot/admission operator diagnostics, new host/adaptor files | Identify failed phase, hook timeout/unknown acknowledgment/invalid receipt and action to inspect/replace; no secrets/raw env/credential values. Separate technical structured fields from prose. **A1/N1**. |
+| P3-C4 | Tofu variable validations/outputs/alarm descriptions, module README | Fixed/group constraints, protected EIP ownership, costs, no automatic refresh/scale-in, port-443 backhaul exception, approval/cleanup. Inventory every new description/error string. **T1/E1**. |
+| P3-C5 | Alarm notification context and operational docs | Failure/recovery/unknown producer; lease-expiry delay and replication-class loss, S3-loss manual intervention, same-region SNS. Never promise universal one-second loss or few-minute recovery before fencing. **I1/I4**. |
+| P3-C6 | Drain/platform applied result/readiness, P2b-owned | Incomplete stop/marker/import is still draining; never report safe-to-remove from zero awake count alone. Platform continues console/relay duties outside NLB. **I3/R1**. |
+| P3-C7 | Dev acceptance/deployment guidance and later P6 references | Explain isolated zone-EIP probe versus public cut-over, release/gate status, named go and costs; production retirement/runbook stays P6. **E1/S1**. |
+
+JSON names, metric names and pure structured reason codes are protocol data, not approved prose. P2a's configured-ingress deck remains its owner's; P3 adds no competing DNS guidance. N-HA13's HA display cut remains in force.
+
+## Census and verification
+
+This Markdown-only plan is outside the census: **no overlay, re-pin or approval claim now**. Execution changes all regular infra files (including templates/tests), root dependencies in host/activator/edge/release/hostenv and the new packages/embeds. Expected new/body/sites/reads/envelope classes are decided by the actual card, not pre-approved here. Root-installed hairpin/boot inputs are security-sensitive; explicitly trace SSM/config provenance and show root never consumes the agent admission receipt or tenant-named paths.
+
+At each real slice tip: `make census-card`; tab-separated CLAIMS per changed unit (what changed/new read or none); `make census-propose NAME=region-ha-p3a CLAIMS=<owned-file>` (P3b uses its own name); targeted `TestPlan14RootReadCensus|TestCensusScopeIsTheRootBinary|TestPlan14RootInputInventoryCoverage|TestCensusRebaseCarriesDispositions` in internal/provision. Reviewer from the other family decides every unit/envelope against actual amadan-main diff, records exact tip/verdict on #280; no census question escalates to Paul. Check record-write/9B8 inventories separately and re-pin only demonstrated digest changes. No archive entries. No reviewer is spawned in this commission.
+
+Implementation iteration uses named targeted tests above, `nice -n 19`, fake AWS/mock tofu and designated root-runner witnesses. Before eventual implementation landing, run repo build/vet/make-test/format once plus CGO_ENABLED=0 darwin/amd64, windows/amd64 and linux/arm64 cross-builds; arm64 output <64,000,000 bytes. Default Go cache; scratch removed. Push/describe/green exact-tip CI/amadan squash merge/main-CI follow the repository workflow **in the later authorized implementation session**. No full suite, tofu account plan/apply, production code or push in this planning session.
+
+## Open decisions for Paul and finish line
+
+1. **Dev date/window and resources:** approve a dated P3a release/drill window once the named producers merge, and the later disposable P3b count/type/region/pool/domain/cost/expiry card. Recommended first result: existing IE hapair host through isolated new NLB addresses; no ordinary DNS/EIP cut-over or termination of the proving pair.
+2. **If producers cannot land in that window:** keep P3 implementation on branch. The missing consumer/serving/console contracts must merge before integration is planned/reviewed; do not spend P3 review rounds guessing them or merge a dormant switch.
+
+No new placement/compute/replica design decision is requested from Paul. #457 phase 2 and #498 keep provisioning ownership; #511 stateless replicas remains outside this HA plan. G3 is the series finish line; G5's routine swaps await migration/P4/P5/P6/fencing.
+
+**Self-review coverage:** views/roles→Task 2 and integration serving/door rows; admission/latch/hook→Tasks 1/3; infra/IAM/boot/hairpin→Tasks 1/4; §13 enablement without retirement→slice boundary/Task 6; §18→budget; §19→dated switch-on plus G1/G2/G3 gates; §20→Task 5 with named deferred producers; §21→local/root/simulation/drill witnesses. Main-only choices have file:line evidence; incoming branch contracts are outlines. No review, live validation or gate completion is claimed by this document.