carlos / platform Public

plans: P3a plan rev 3, final (N-HA14)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 0c304d16f20b60e2e7f4b7363d028a8ac54bcf2c parent 8f99bff
1 file changed, +86 −30
  • docs/superpowers/plans/2026-11-01-region-ha-p3-group.md +86 −30

CI failed — run details

Intent

Attributed to this commit: 112 g CO₂e (10,125,285 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-p3-group, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/plans/2026-11-01-region-ha-p3-group.md b/docs/superpowers/plans/2026-11-01-region-ha-p3-group.md
index 3d3ad2e0c..6af98b282 100644
--- a/docs/superpowers/plans/2026-11-01-region-ha-p3-group.md
+++ b/docs/superpowers/plans/2026-11-01-region-ha-p3-group.md
@@ -1,4 +1,4 @@
-# Region HA P3: group infrastructure and admission implementation plan (rev 2)
+# Region HA P3: group infrastructure and admission implementation plan (rev 3, final)
> **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.
@@ -12,7 +12,9 @@
**Citation base:** fetched amadan `origin/main` on 2026-11-01: **ceee7a678780b9a742800b1a304a820bbf9f11d9**. Re-read the cited health, role/index, IAM, home-election, restart and fixed-root sources at that commit. All pre-existing source citations retain their line numbers: the only intervening main change since 65420a4d is the separate team-service prototype, outside these sources. Proposed files have no source line numbers. External private-checkout citations retain their separately stated HEAD. No unmerged branch is an implementation authority; the store-Deny branch is evidence of a blocking fix, not permission to apply it.
-**Status:** rev 2 answers Opus round 1 (NOT READY, 2 P1, 10 P2); no new review or approval is claimed. Planning commit only, on `region-ha-p3-group`. **No spec §10 change is needed with the chosen Standby mechanism. P3b does need the explicit §12.1 maintenance exception below; refuse it until approved.** The spec file is unchanged.
+**Status:** rev 3, final. Opus R1 NOT READY, R2 READY AFTER FIXES; P2s fixed. Review closed.
+
+Planning commit only, on `region-ha-p3-group`. N-HA14 approves the §12.1 Standby exception; P3b is no longer blocked on that ruling. No spec §10 change is needed. P3b's plan writes the exception into the spec file; the spec file is unchanged here.
## Scope, slices and switch-on
@@ -24,19 +26,28 @@
**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. P3a's only outside runtime producer is P1b-3b's termination-consumer start acknowledgment; P2a's ingress configuration is required before P3b group publication, not before isolated P3a fixed-target probes. 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.
+**Build coordination:** Start P3a's build after P1b-3a merges, or coordinate the shared-file work explicitly with that session. Tasks 2 and 3 touch `edgesfile` and `internal/edge/forwardha.go`, as P1b-3a does. Rebase and read the merged implementation before integrating; a final plan on an unmerged branch is not an implementation authority.
+
**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 start-ack producer merges; 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`).
+## Rulings
+
+| Ruling | Date / authority | Decision |
+|---|---|---|
+| **N-HA14** | **2026-11-01, Paul** | Group boxes roll only through the operator-run ASG Standby step, one box at a time, and never self-update unattended. The spec §12.1 maintenance exception below is **APPROVED**. P3b's plan writes it into the spec file; P3b is no longer blocked on the ruling. Scoped live execution approval is still separate. |
+
## Round history
| Round | Brief / findings | Verdict | Invariant / disposition |
|---|---|---|---|
-| 1 | `59cc03af`; brief `docs/superpowers/plans/REVIEW-BRIEF-REGION-HA-P3-R1.md`; findings `docs/superpowers/plans/REVIEW-REGION-HA-P3-R1.md` (Opus) | **NOT READY: 2 P1, 10 P2, 11 P3** | T1/I4 shared-dependency replacement; IAM boot scope; R1/B1, E1/S1, N1 and H4 families. Rev 2 dispositions below; not re-reviewed. |
+| 1 | `59cc03af`; brief `docs/superpowers/plans/REVIEW-BRIEF-REGION-HA-P3-R1.md`; findings `docs/superpowers/plans/REVIEW-REGION-HA-P3-R1.md` (Opus) | **NOT READY: 2 P1, 10 P2, 11 P3** | T1/I4 shared-dependency replacement; IAM boot scope; R1/B1, E1/S1, N1 and H4 families. Rev 2 dispositions below; R2 confirms both P1s resolved. |
+| 2 | Rev 2 `830eb8f1`, reviewed tip `3d2f5013`; brief `docs/superpowers/plans/REVIEW-BRIEF-REGION-HA-P3-R2.md`; findings `docs/superpowers/plans/REVIEW-REGION-HA-P3-R2.md` (Opus) | **READY AFTER FIXES: 0 P1, 6 P2, 9 P3** | I4/S1 switch and metrics; E1/S1 target closure/rollback; E1 zones; I4/T1 fixed-pair availability. All P2s and P3s taken in rev 3; review closed under stopping rule 1. |
-One P3 round has run. This revision neither resets the count nor claims 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.
+Two P3 rounds have run. R2 has no P1, so this review is **CLOSED**: apply its final fixes without another round. Rev 3 records those fixes and Paul's N-HA14 ruling; it does not claim a new reviewer verdict. 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.
+There is no further plan-review round. All nine R2 P3s are taken below, with no outstanding P3 follow-up. Future implementation briefs use `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md:1` and carry this history; splitting or renaming does not reopen this plan review. Census and review of newly changed security/root/termination/storage behavior remain required for the actual implementation diff within the applicable 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.
@@ -73,7 +84,7 @@ Each implementation session owns one slice and ends at its merge. At 24 hours wi
| **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. |
+| **I4 / A1, admission before service** | A new admission-managed process starts closed; no managed tenant lease/start on direct ingress, backhaul, timer, worker, session or co-spawn before admission. Task 3 explicitly defines the fixed-box platform/console/unit-backed exemptions; group boxes have none. 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. |
@@ -85,7 +96,7 @@ Each implementation session owns one slice and ends at its merge. At 24 hours wi
## Restart authority: one gate for T1 / I4
-**Invariant:** “a restart, a roll or a shared-dependency blip (S3, SSM) never terminates or replaces a box; only the box's own failure to serve does.” The single enforcement point is a **group maintenance transaction**, owned by the deployment release operator. The future private `scripts/roll-region-group.sh` is its only entry; root's proposed `internal/host/group_maintenance.go` checks its root-owned permit before any platform update can quiesce, repoint or stop the edge. Every restart-capable apply, rollback and recovery branch must use that same check, before mutations. The group boot writes an immutable root-owned group marker; losing an environment flag cannot turn this protection off. Fixed boxes keep their current restart behavior.
+**Invariant:** “a restart, a roll or a shared-dependency blip (S3, SSM) never terminates or replaces a box; only the box's own failure to serve does.” The single enforcement point is a **group maintenance transaction**, owned by the deployment release operator. The future private `scripts/roll-region-group.sh` is its only entry; root's proposed `internal/host/group_maintenance.go` checks its root-owned permit before any platform update can quiesce, repoint or stop the edge. Every restart-capable apply, rollback and recovery branch must use that same check, before mutations. The group boot writes an immutable root-owned group marker; losing an environment flag cannot turn this protection off. Non-opted-in fixed boxes keep their current restart behavior. The opted-in P3a pair uses the temporary self-update hold and staggered restarts in Task 6; it has no ASG. **N-HA14:** group rolls always use this operator-run Standby transaction, one box at a time; unattended group self-update is forbidden.
Choose **ASG Standby**, rather than a health-200 timer. A bounded timer would still turn a longer S3 outage during startup into replacement. In Standby the box is deregistered and ASG health checks are suspended for that member; local tenant permission and health may remain closed for as long as shared dependencies are unavailable. No synthetic 200 and no remote-read health input are needed. AWS documents both the health exclusion and capacity 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), [https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_EnterStandby.html](https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_EnterStandby.html).
@@ -96,13 +107,13 @@ Choose **ASG Standby**, rather than a health-200 timer. A bounded timer would st
**Spec justification:** §10's latch still clears first on shutdown and is set only by its four acknowledgments plus the six-condition predicate. §9.5's live S3-loss box keeps health 200; a restarting box in Standby can answer 503 without becoming a termination candidate. After admission, the four startup acknowledgments remain latched until local shutdown; ongoing role/reconcile/edges/SSM errors do not clear hosting or fail health. The existing §9.5 operator termination after an S3-loss alarm remains a separately authorized recovery action, never an automatic health/roll decision. **No spec §10 sentence changes.**
-**NEEDS PAUL: spec §12.1 maintenance exception (T1).** Its current first sentence is “An Auto Scaling group: `min = max = desired = box_count` (H5), across at least two zones.” Proposed replacement: “An Auto Scaling group has `min = max = desired = box_count` (H5) across at least two zones, except during one serialized operator-owned maintenance transaction: temporarily lower minimum and desired by one to put that same member in Standby without launching a replacement, keep maximum and total membership fixed, and restore desired then minimum only after the member is ready to return.” Do not change the spec file here. **Refuse P3b activation/rolls until that exception is approved and recorded; P3a has no ASG and can proceed independently.** The JSON plan gate continues to refuse ordinary decreases; the named maintenance API transaction is the sole exception, with no scale-in call and no automatic cleanup on expiry. The scoped approval card must include these operator-only ASG writes; the box role gains none.
+**APPROVED — N-HA14, Paul, 2026-11-01: spec §12.1 maintenance exception (T1).** Its current first sentence is “An Auto Scaling group: `min = max = desired = box_count` (H5), across at least two zones.” Approved replacement: “An Auto Scaling group has `min = max = desired = box_count` (H5) across at least two zones, except during one serialized operator-owned maintenance transaction: temporarily lower minimum and desired by one to put that same member in Standby without launching a replacement, keep maximum and total membership fixed, and restore desired then minimum only after the member is ready to return.” P3b's plan writes this approved exception into the spec file; do not change that file here. **P3b is no longer blocked on the ruling.** Group boxes roll only through this operator-run ASG Standby step, one box at a time, and never self-update unattended. P3a has no ASG and can proceed independently. The JSON plan gate continues to refuse ordinary decreases; the named maintenance API transaction is the sole exception, with no scale-in call and no automatic cleanup on expiry. The scoped approval card must include these operator-only ASG writes; the box role gains none.
## Rev 2 dispositions (not a second review)
| Round-1 finding / invariant | Disposition and witness |
|---|---|
-| P1-1 — T1/I4 shared dependency cannot authorize replacement | Central Standby transaction above; disable unattended group self-update/restart. Task 6 Step 4 proves same-iid retention beyond health thresholds and the 15m wait. §10 unchanged; §12.1 exception blocks P3b up front. |
+| P1-1 — T1/I4 shared dependency cannot authorize replacement | Central Standby transaction above; disable unattended group self-update/restart. Task 6 Step 4 proves same-iid retention beyond health thresholds and the 15m wait. §10 unchanged; N-HA14 now approves the §12.1 exception (R2 found the P1 resolved). |
| P1-2 — IAM/A1 boot scope | Task 4 exact SSM path ARNs plus descendants in Allow and NotResource exceptions; policy-shape positive/sibling/ancestor tests. |
| P2-1 — R1/B1 role freshness/budget | Task 2 ReadGate, Observed generation, 30m backstop, required arming and explicit disarmed refusal; budget adds 4G/box/h. |
| P2-2 — I4/R1/S1 fixed opt-in | `CARLOS_GROUP_ADMISSION=1`; group marker mandates it. Absent fixed switch omits all P3 fields/callbacks; flagship regression witness. |
@@ -113,7 +124,7 @@ Choose **ASG Standby**, rather than a health-200 timer. A bounded timer would st
| P2-7 — E1/S1 safe dev apply | Task 6 whole-root read-plan before implementation merge, store-Deny merge gate and strict targeted saved apply; no unreviewed full dev apply. |
| P2-8 — E1/T1 fixed resources | Task 1 JSON gate refuses any fixed instance/SG/IAM update, including in-place; only exact reviewed attribute exceptions. |
| P2-9 — E1 fixed SG ownership | Task 1 adds no fixed SG rule; group-only target_security assertions and acyclic SG references. |
-| P2-10 — E1/S1 rollback ownership | Task 6 Step 2 rollback specifies release and infrastructure owners, target removal, config/binary restore and verification. |
+| P2-10 — E1/S1 rollback ownership | Task 6 Step 2 rollback specifies release and infrastructure owners, target removal, switch-off/config restore and verification; any needed binary rollback is a release-owner channel repoint (R2 refinement). |
| P3-1 — evidence | N-HA10 attribution corrected to forwarding plan :21. |
| P3-2 — dependency order | P3a waits only for consumer start acknowledgment; P2a console ingress belongs to P3b. |
| P3-3 — reproducible checks | Task 1 ingress test filter runs from ingress child, not parent. |
@@ -126,11 +137,31 @@ Choose **ASG Standby**, rather than a health-200 timer. A bounded timer would st
| P3-10 — I1 clock provenance | Task 5 bounded local `chronyc -c tracking` reading, parse/error witness, no new sampler. |
| P3-11 — one source of serving truth | Coordinate edgesfile schema after P1b-3a merge; no review against that unmerged implementation. |
-All cheap P3s are taken; there is no new P3 follow-up requiring a round. If another round finds the same T1/I4 or IAM invariant again, this is two consecutive rounds in that family: stop fixes and ask Paul for the rule-2 refuse/cut/central-enforcement choice. R1 counts remain attached to this change.
+## Rev 3 final dispositions (closed round 2)
+
+| Round-2 finding / invariant | Final change and planned witness |
+|---|---|
+| P2-1 — I4/S1 switch prerequisite | Tasks 3/6 require true `CARLOS_REGION_HA` at configure and startup; startup logs a refusal. Inventory private dial, box records, `region-ha-1` capability and relocate. `TestAdmissionFixedOptIn` covers switch-on/HA-off. |
+| P2-2 — E1/S1 target closure | Literal fixed target IDs and read-only AZ lookup keep fixed modules out of the target closure. Whole-root drift is recorded; gate fixture refuses user_data drift in the closure. |
+| P2-3 — E1 zone coverage | Root assertion/card require target AZs to be a subset of ingress zones; no `NotInUse` target before probes. |
+| P2-4 — E1/S1 rollback | Switch-off is rollback, proved by flagship-unchanged. A box not admitted within 5 minutes gets old config restored immediately before infrastructure changes; binary rollback, if needed, is a release-owner channel repoint. |
+| P2-5 — I4/T1 fixed availability | Task 3 explicitly exempts fixed platform/console/unit-backed routes; Task 6 holds unattended pair self-update, rolls one at a time and records restart-to-admission on the card. |
+| P2-6 — I4/S1/B1 metrics | Clock/group data only on opted-in or group boxes; existing InstanceId datums unchanged. PutMetricData input and zero chronyc execution are in flagship-unchanged. |
+| P3-1 — N1 settings ownership | Task 6 accepts root or agent ownership of host.env, checks 0600/no symlink and read-only agent sandbox access; region-config remains root-owned. |
+| P3-2 — E1 plan gate | Unknown-value refusal is scoped to guarded fixed/protected resources; fixed `aws_eip.host` updates/re-associations are guarded. New creates may have expected unknown values. |
+| P3-3 — A1/H4 withdrawal consumers | Task 2 audits alias route precedence, wildcard parents and console edges readers, with a restart withdrawal-window witness. |
+| P3-4 — T1/I4 receipt/identity | Task 3 names persistent `/data/carlos/group-admission/receipt.json`; immutable group marker is authoritative, with any `CARLOS_BOX_REFERENCE=group` mismatch refused. |
+| P3-5 — A1 copy deck | P3-C8 is restored to the contiguous table. |
+| P3-6 — S1 index side effects | Card inventories old/new `CARLOS_CHANGE_INDEX`, changed record-walk behavior and exact rollback. |
+| P3-7 — rule 4 shared files | Build coordination covers Task 3 forwardha as well as Task 2 edgesfile. |
+| P3-8 — I1 sandbox clock | Task 6 verifies chronyc under the actual edge user/sandbox and records usable socket/UDP 323 access. |
+| P3-9 — E1 flagship module bump | First flagship module bump containing moved blocks must pass the JSON gate on its saved plan. |
+
+These are final dispositions, not another review. No P1 remained in R2, all six P2s and nine P3s are taken, and no further plan-review round is authorized.
## 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.
+These interfaces are **proposed P3 contracts**, not promises made by another branch. The integration outline must adapt merged producers to them or document the exact merged-input addendum within the closed review history; do not invent incoming function names.
| Files | Responsibility / proposed interface |
|---|---|
@@ -139,7 +170,7 @@ These interfaces are **proposed P3 contracts**, not promises made by another bra
| New `internal/host/{group_admission.go,group_admission_test.go,group_maintenance.go,group_maintenance_test.go,group_hairpin_rootrunner_linux_test.go}`; modify `agent.go`, `edgesfile.go`, `systemapply.go`, group-only unit rendering, activator wiring and `internal/edge/{lbhealth.go,forwardha.go}` | Own latch/ack wiring and process cancellation; publish effective role only after real success. Opted-in fixed/group 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, any fixed-instance/SG/IAM change and protected EIP deletion/replacement; only a reviewed disposable-resource cleanup manifest can exempt experiment resources. P6 owns production retirement. |
+| 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, any fixed-instance/SG/IAM/EIP change 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`, `scripts/roll-region-group.sh`, `scripts/configure-p3a-fixed.sh`, 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. |
@@ -158,38 +189,48 @@ These interfaces are **proposed P3 contracts**, not promises made by another bra
**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_vpc_cidrs`; outputs `public_ips`, `allocation_ids`, `target_group_arns`, `nlb_security_group_id`. The child accepts at least two distinct zones in one VPC; target_vpc_cidrs must match that VPC's validated CIDRs. It takes no host-SG reference; only the group host SG references the child's NLB SG output. P3a root supplies fixed instance attachments to both TGs. Group mode supplies TG ARNs to ASG, with no per-instance attachment controller.
+**Interfaces:** ingress inputs `vpc_id`, `zones` (map AZ→`{subnet_id, allocation_id}`; null allocation creates a protected EIP), `name`, `target_vpc_cidrs`; outputs `public_ips`, `allocation_ids`, `target_group_arns`, `nlb_security_group_id`. The child accepts at least two distinct zones in one VPC; target_vpc_cidrs must match that VPC's validated CIDRs. It takes no host-SG reference; only the group host SG references the child's NLB SG output. P3a root supplies fixed instance attachments to both TGs from **literal target-ID input variables**, never `module.host_ie*.instance_id` or another fixed-resource output. Read-only `data "aws_instance"` lookups by those IDs supply observed AZs without depending on fixed modules. A root precondition requires the target AZ set to be a subset of `keys(zones)`; mock tests include an out-of-zone target refusal. Cross-zone routing does not remove this requirement. 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 only target traffic/health ports to VPC CIDRs, never a host-SG reference back to the host's inline NLB-SG rule (no graph cycle). **E1/N1:** target_security narrowing applies only to new group SGs. P3a adds no rule to the fixed SG: its existing public 80/443 already admits NLB traffic (`main.tf:97,103`); never mix standalone rules into its inline set (`main.tf:47`, `variables.tf:144`). No second IPv6 ingress path is silently enabled.
- [ ] **Step 2 — run locally.** From the owned initialized **ingress child** fixture, run `tofu test -filter=tests/group_ingress.tftest.hcl`; from the parent fixture run 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. T1 maintenance is only the gated transaction above; no generic scale-in exception. 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; **every** change to any pre-existing fixed `aws_instance` (including user_data, instance_type, profile and volume in-place updates), `aws_security_group.host`/rules and host IAM role/profile/policies/attachments; and protected EIP replacement/deletion. Treat unknown values/change shapes as refusal. Allow exceptions only through a reviewed allow-list naming exact resource address, attribute, before/after values, purpose and approval; a wildcard or whole-resource exemption is invalid. Explicit state-address moves are allowed only with unchanged bytes/attributes. Local before/after fixtures reject update-only user_data/type/SG/policy changes as well as replacement/deletion, and allow isolated ingress/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 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; **every** change to any pre-existing fixed `aws_instance` (including user_data, instance_type, profile and volume in-place updates), `aws_security_group.host`/rules and host IAM role/profile/policies/attachments; fixed `aws_eip.host` updates/re-associations as well as deletion/replacement; and protected ingress EIP replacement/deletion. Treat unknown values or unknown change shapes on these **guarded fixed/protected resources** as refusal. Expected after-unknown values on new ingress/group creates are allowed; do not refuse every create. Allow exceptions only through a reviewed allow-list naming exact resource address, attribute, before/after values, purpose and approval; a wildcard or whole-resource exemption is invalid. Explicit state-address moves are allowed only with unchanged bytes/attributes. Local before/after fixtures reject update-only user_data/type/SG/policy/EIP re-association changes as well as replacement/deletion, including a targeted closure containing fixed user_data drift; allow isolated ingress/group creation with expected after-unknown values; 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. **P3-9/E1:** the first `carloku-infrastructure` module bump containing these moved blocks must run this JSON gate against flagship's saved plan before apply, proving fixed state/addresses remain unchanged.
- [ ] **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. **R1/H4:** P1b-3a is editing the same publication/decoder files. Wait for its build to merge before implementing shared schema/election edits, rebase the slice and re-read its actual decoder; use the integration outline for its placement projection. This adds no outside P3a runtime producer beyond the consumer start-ack, but prevents parallel competing schemas.
+**Files:** boxroles, changeindex, host group_admission/edgesfile and tests. No console writer yet. **R1/H4:** P1b-3a is editing the same publication/decoder files. Start after its build merges, or coordinate shared-file work explicitly with that session; wait for the merge before integrating schema/election edits, rebase the slice and re-read its actual decoder; use the integration outline for its placement projection. This adds no outside P3a runtime producer beyond the consumer start-ack, but prevents parallel competing schemas.
-**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. **R1/B1:** require `CARLOS_CHANGE_INDEX=read` in group and opted-in fixed settings and add it to hostenv OptionalKeys. Configuration intent is insufficient: the actual armed watch must exist (`internal/host/changeindex.go:31,50,84`). With a disarmed/nil watch, reject P3 admission before any role loop starts; non-P3 fixed boxes have no P3 reader. Do not fall back to every-pass role polling. Use one existing `release.ReadGate` with `ChangeIndexBackstop=30m` (`internal/release/changewatch.go:17,161,197,211,234`), evaluated on the existing reconcile cadence: startup, changed **Observed** scope generation or age expiry makes two GETs due. Capture generation before the read, Mark only after both reads and application succeed; never consume another reader's advisory Poll moved list as the gate. This catches a saved role whose index bump was lost. A transient unusable watch leaves restrictions applied and attempts bounded due reads on existing opportunities with backoff 5/10/20/40/60s (then >=60s); no new timer, no health coupling, and index events do not bypass the failure backoff. Each attempt costs at most 2G, <=128G/hour during sustained failure (including the initial short-backoff burst); quiet backstop adds 2G/30m = 4G/box/hour, apart from startup/events. The backstop runs at the next existing opportunity, not a new poll.
+**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 validated operator-delivered configuration (root-owned group launch config and P3a fixed region-config), 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. **R1/B1:** require `CARLOS_CHANGE_INDEX=read` in group and opted-in fixed settings and add it to hostenv OptionalKeys. Configuration intent is insufficient: the actual armed watch must exist (`internal/host/changeindex.go:31,50,84`). With a disarmed/nil watch, reject P3 admission before any role loop starts; non-P3 fixed boxes have no P3 reader. Do not fall back to every-pass role polling. Use one existing `release.ReadGate` with `ChangeIndexBackstop=30m` (`internal/release/changewatch.go:17,161,197,211,234`), evaluated on the existing reconcile cadence: startup, changed **Observed** scope generation or age expiry makes two GETs due. Capture generation before the read, Mark only after both reads and application succeed; never consume another reader's advisory Poll moved list as the gate. This catches a saved role whose index bump was lost. A transient unusable watch leaves restrictions applied and attempts bounded due reads on existing opportunities with backoff 5/10/20/40/60s (then >=60s); no new timer, no health coupling, and index events do not bypass the failure backoff. Each attempt costs at most 2G, <=128G/hour during sustained failure (including the initial short-backoff burst); quiet backstop adds 2G/30m = 4G/box/hour, apart from startup/events. The backstop runs at the next existing opportunity, not a new poll.
- [ ] **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 before backstop 0G, observed change exactly 2G, partial errors charged); `TestRolePublisherAck` (failed/unchanged edges write cannot impersonate first success); `TestRoleFieldsAreNotHostRoles` (per-host `role:home` untouched); `TestRoleReadGateBackstop` (lost bump, another consumer took moved list, change during GET, 30m due); `TestRoleDisarmed` (unset/misspelled flag or failed arm refuses group/opted-in fixed admission with zero polling); `TestRoleBackoffBudget` counts partial errors and recovery.
- [ ] **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. Only opted-in P3 boxes publish new top-level `box_role` (`booting|serve|drain|platform`), `admitted` boolean and `drained` boolean. Fixed boxes without the Task 3 switch omit **all three**, including false booleans; old-file absence preserves legacy behavior, explicit false fails closed in new 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, subject only to the stated P3a dev-console serving exception (sophie remains serve during it). 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 A1/H4** before any election, exclude explicit not-admitted/booting/drain/platform files in a shared home-eligibility projection used by `internal/edge/homemap.go:781,944` and `internal/edgesfile/homeelect.go:163` (console dial/status consumer). Audit every parser of the additive fields, not just Load callers; omitted legacy fields retain old behavior. Booting publications include identity/role but **no home/alias rows**; admission publication adds them only after State admits. Keep drain rows for holder validation/diagnostics, but they cannot win a new home choice. Fixtures put a never-admitted `g-` file first in sort order and give it the newest claim: an admitted peer still wins; without any eligible peer, return no home rather than pick the closed gate. Holders/held-service remain a separate view, unchanged. 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 4 — verify A1/H4** before any election, exclude explicit not-admitted/booting/drain/platform files in a shared home-eligibility projection used by `internal/edge/homemap.go:781,944` and `internal/edgesfile/homeelect.go:163` (console dial/status consumer). Audit every parser of the additive fields, not just Load callers; omitted legacy fields retain old behavior. Booting publications include identity/role but **no home/alias rows**; admission publication adds them only after State admits. **P3-3/A1/H4:** audit withdrawal consumers beyond election: fleet-wide “routes always win” (`internal/domains/aliases.go:257-263`), wildcard parents (`homemap.go:622-628`, `wildcard.go:898`) and console edges readers. Add `TestAdmissionWithdrawalWindow` against those actual readers during an opted-in fixed restart: no false alias takeover or wildcard reassignment, no closed-box home election, and explicit unavailable/booting console evidence rather than a misleading serving host. Preserve those namespace guarantees across withdrawal and re-publication; the audit and witness must settle this before deployment. Keep drain rows for holder validation/diagnostics, but they cannot win a new home choice. Fixtures put a never-admitted `g-` file first in sort order and give it the newest claim: an admitted peer still wins; without any eligible peer, return no home rather than pick the closed gate. Holders/held-service remain a separate view, unchanged. 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`.
+**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`. Coordinate both `edgesfile` and `internal/edge/forwardha.go` with P1b-3a as stated in Build coordination; start after its merge or coordinate with that session, then integrate against merged main.
+
+**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 shared tenant dispatch, check it before front-path exclusions/ForwardTarget or other per-request work for an admission-managed tenant route (fixed-box exemptions below), including verified hops, authenticated door calls and tunnel deliveries (frontForwardHA alone skips these at `forwardha.go:148`).
+
+**I4/R1/S1:** fixed admission is enabled only by the exact operator-delivered `CARLOS_GROUP_ADMISSION=1` switch (add it to hostenv OptionalKeys). Switch-on requires `CARLOS_REGION_HA` to parse true: the configure script refuses before changing config or restarting if its proposed settings do not satisfy this; startup installs the closed gate and logs a configuration refusal before tenant execution when it is false/absent/invalid. `CARLOS_REGION_HA` also turns on private dial, box-record publication, the `region-ha-1` capability and the relocate pass; include these effects in the fixed-roll approval. Absent/0 admission switch means no admission callback/State, no P3 role reader and no P3 publication fields.
+
+Pin `TestAdmissionFixedOptIn` and `TestAdmissionFlagshipUnchanged`: the switch-off fixed box retains HTTP/door/tunnel/worker/timer behavior, edges bytes, restart behavior and the exact PutMetricData input even with CARLOS_REGION_HA set or absent; it runs no chronyc command and adds no billed series. `TestAdmissionFixedOptIn` explicitly covers switch-on with CARLOS_REGION_HA off and proves startup refusal with zero tenant starts.
+
+The immutable root-owned group marker is authoritative for group protection. It must agree with the existing `CARLOS_BOX_REFERENCE=group` line (`internal/hostenv/hostenv.go:132-141`); marker-without-group-line or group-line-without-marker is a startup/configuration refusal with a closed gate, never a fallback to fixed mode. Group configuration always installs the closed gate, even when either admission or CARLOS_REGION_HA flag is absent/false, then refuses that invalid configuration; a group cannot disable admission by losing the capability flag.
-**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 shared tenant dispatch, check it before front-path exclusions/ForwardTarget or other per-request work for a tenant route, including verified hops, authenticated door calls and tunnel deliveries (frontForwardHA alone skips these at `forwardha.go:148`). **I4/R1/S1:** fixed admission is enabled only by the exact root-owned `CARLOS_GROUP_ADMISSION=1` switch (add it to hostenv OptionalKeys); absent/0 means no admission callback/State, no P3 role reader and no P3 publication fields. Pin `TestAdmissionFixedOptIn` and `TestAdmissionFlagshipUnchanged`: the switch-off fixed box retains HTTP/door/tunnel/worker/timer behavior, edges bytes and restart behavior even with CARLOS_REGION_HA set or absent. Group configuration is identified from its immutable root-owned marker and always installs the closed gate, even when either admission or CARLOS_REGION_HA flag is absent/false, 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.
+**Fixed-box route scope (P2-5/I4/T1):** classify routes before the generic tenant gate. On an opted-in fixed box, explicitly exempt `Platform` routes, the configured dev-console route and **all unit-backed routes**, including tenant unit-backed routes: these existing fixed services keep their current HTTP and root-adopt/systemd start/restart behavior so admission cannot remove console recovery access or falsely claim to gate `carlos-app@` starts. Admission still gates all other tenant dispatch and activator starts, including legacy exec tenants. Exempt routes gain no HA eligibility or new lease/start authority; booting edges withdrawal still applies. Group boxes retain the platform/Unit execution refusal in Task 2 and have no such exemption. Add `TestAdmissionFixedRouteScope` for console/platform/unit-backed HTTP plus root-adopt starts and an ordinary legacy exec refusal; record this scope and its temporary exec-tenant outage on the approval card.
+
+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/Retry-After and **no holder identity**; copy review must approve neutral startup wording (never reuse “waking elsewhere”, which falsely names a remote situation); 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. **T1/I4:** a same-instance managed restart is allowed only within the central maintenance transaction above; fixed boxes have no ASG. It rechecks all local startup facts/health before re-admission; the receipt avoids completing a nonexistent hook again. For an admitted member, receipt/config/SSM/S3 failure retains Standby for operator recovery, never hook ABANDON or forced replacement. A configuration change during an approved roll needs the operator to validate/rebind the original completed-launch receipt to the same iid/group/hook; never reuse it for another iid or fabricate a new launch acknowledgment. A replacement iid or changed group/hook cannot reuse it. Absent/bad receipt plus “no active hook” is **not success**: remain closed; first boot can time out/ABANDON, but admitted maintenance stays in Standby for 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 first-boot timeout/alarms handle it. Never run launch completion on the Standby restart path. 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 3 — implement state and adapter.** Enforce the switch-on/true-CARLOS_REGION_HA startup prerequisite and logged refusal above, including the fixed-opt-in negative test. 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/Retry-After and **no holder identity**; copy review must approve neutral startup wording (never reuse “waking elsewhere”, which falsely names a remote situation); 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 at persistent `/data/carlos/group-admission/receipt.json` (0700 carlos-owned directory, 0600 atomically replaced file, no symlink), 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. The path is writable under the edge's existing `/data` sandbox allowance and survives reboot; `/run/carlos` is not used for this receipt. Root may prepare the directory at boot but never reads or executes the receipt. **T1/I4:** a same-instance managed restart is allowed only within the central maintenance transaction above; fixed boxes have no ASG. It rechecks all local startup facts/health before re-admission; the receipt avoids completing a nonexistent hook again. For an admitted member, receipt/config/SSM/S3 failure retains Standby for operator recovery, never hook ABANDON or forced replacement. A configuration change during an approved roll needs the operator to validate/rebind the original completed-launch receipt to the same iid/group/hook; never reuse it for another iid or fabricate a new launch acknowledgment. A replacement iid or changed group/hook cannot reuse it. Absent/bad receipt plus “no active hook” is **not success**: remain closed; first boot can time out/ABANDON, but admitted maintenance stays in Standby for 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 first-boot timeout/alarms handle it. Never run launch completion on the Standby restart path. 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, process restart and reboot persistence, corrupt receipt, marker/reference mismatches and close during retry.
- [ ] **Step 5 — real production-path witnesses.** `TestPreAdmissionDirectAndHop` sends direct HTTP, verified forward, direct-public backhaul, authenticated door calls and tunnel deliveries 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 — T1 guard tests, pass and commit.** `TestGroupMaintenanceRestartGuard` drives actual apply/rollback/recovery/quiesce branches with missing/forged/reused/wrong-iid permit and proves zero stops/repoints; group unit repair cannot re-enable unattended update or Restart=always. `TestGroupSharedDependencyHealth` keeps an already-admitted process healthy through failed role/reconcile/edges/SSM reads, with zero process exits and no cleared startup acknowledgments. Fake-provider transaction tests prove the minimum/desired order, no replacement launch, no ExitStandby on timeouts/shared-read errors, restart closure and same-iid recovery. 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.
@@ -210,9 +251,9 @@ Region-host gains `mode` (`fixed` default or `group`), `box_count` (integer >=1,
**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.
+**Interfaces:** only opted-in fixed or immutable-marker group boxes extend the existing once/minute host metrics batch with clock and applicable group/admission samples, using the same PutMetricData call in the box's actual AWS region. Preserve each existing InstanceId-only memory/PSI datum byte-identically (name, dimensions, timestamp, unit and value); append group-dimension samples as separate datums, never replace or add dimensions to the original. `host_memory_low` must keep receiving its original series. Switch-off/flagship boxes run no chronyc command and publish exactly their previous PutMetricData input, with no new series; include that input in `TestAdmissionFlagshipUnchanged`. 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. **I1:** on that existing metrics cadence run the installed local `chronyc -c tracking` (absolute executable path, fixed args, no shell, 1s timeout, <=4KiB output), parse the signed system-time offset in seconds, require synchronized tracking and emit its absolute value. Pin the installed chrony CSV schema in parser fixtures; missing socket/command, malformed/nonfinite fields, unsynchronized status or timeout is unknown with diagnostics, never a fabricated 0. Root boot/readback verifies chrony; no S3/SSM call or separate clock loop. Command/report reference: [https://chrony-project.org/doc/4.4/chronyc.html](https://chrony-project.org/doc/4.4/chronyc.html); verify the deployed version's CSV format before wiring it.
+- [ ] **Step 1 — failing mock/adapter tests.** Pin every row below, missing-data behavior, target-group aggregation and metric namespace/region; test switch-off zero clock execution/unchanged PutMetricData and opted-in/group append-only samples with byte-identical InstanceId datums. 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. **I1:** on that existing metrics cadence run the installed local `chronyc -c tracking` (absolute executable path, fixed args, no shell, 1s timeout, <=4KiB output), parse the signed system-time offset in seconds, require synchronized tracking and emit its absolute value. Pin the installed chrony CSV schema in parser fixtures; missing socket/command, malformed/nonfinite fields, unsynchronized status or timeout is unknown with diagnostics, never a fabricated 0. Root boot/readback and Task 6 verify chronyc can run as carlos **inside the actual carlos-edge sandbox**, including its `RestrictAddressFamilies` and usable chrony socket or local UDP 323; no S3/SSM call or separate clock loop. Command/report reference: [https://chrony-project.org/doc/4.4/chronyc.html](https://chrony-project.org/doc/4.4/chronyc.html); verify the deployed version's CSV format before wiring it.
- [ ] **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.
@@ -255,10 +296,26 @@ The executable addendum must also resolve the held-lease-on-drain request path u
**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. **E1/S1:** before the later P3a implementation merge, read-plan the **entire dev root** against its proposed module revision (read-only, approved credentials), inspect JSON for ie/ie-b/uk/standby-ie drift and record exact source SHAs; the fixed roots track `?ref=main`, so checking only ingress is insufficient. Current main still denies data-bucket `s3:DeleteObject` at `infra/modules/region-host/main.tf:724`; branch `region-host-store-deny` commit `55157510` removes it. Never cherry-pick it here or assume it has merged. Refuse a full dev apply until its reviewed fix is on main, module sources have been refreshed/pinned and a new whole-root plan proves no restoration of the outage. Even after the fix, P3a uses a targeted **saved** plan limited to new ingress module/attachments (include dependencies in JSON review); apply that exact saved plan, not a new unscoped apply. If targeting pulls fixed SG/IAM/instance changes outside the exact allow-list, refuse. No `-target` bypass of the JSON gate. Any intentionally required fixed IAM change is a separate named approved diff, never incidental drift. 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.
+**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. **E1/S1:** before the later P3a implementation merge, read-plan the **entire dev root** against its proposed module revision (read-only, approved credentials), inspect JSON for ie/ie-b/uk/standby-ie drift and record exact source SHAs. Explicitly inventory existing fixed drift, including host-init.sh/user_data drift, without authorizing its apply; the fixed roots track `?ref=main`, so checking only ingress is insufficient. Current main still denies data-bucket `s3:DeleteObject` at `infra/modules/region-host/main.tf:724`; branch `region-host-store-deny` commit `55157510` removes it. Never cherry-pick it here or assume it has merged. Refuse a full dev apply until its reviewed fix is on main, module sources have been refreshed/pinned and a new whole-root plan proves no restoration of the outage. Even after the fix, P3a uses a targeted **saved** plan limited to new ingress module/attachments (include dependencies in JSON review). Attachment target IDs are literal input variables and AZs come from read-only instance data lookups, never fixed module outputs, so the closure excludes fixed instances/profiles/roles/SGs; apply that exact saved plan, not a new unscoped apply. If targeting pulls fixed SG/IAM/instance changes outside the exact allow-list, refuse. No `-target` bypass of the JSON gate. Any intentionally required fixed IAM change is a separate named approved diff, never incidental drift. 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 literal fixed target ids and their observed AZs 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, T1 maintenance min/desired/Standby/ExitStandby writes and root permit/recovery owners, 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. Record the whole-root fixed drift inventory and assert target AZs ⊆ ingress zones in both card and root precondition. Inventory each box's old/new CARLOS_REGION_HA and its private-dial/box-record/capability/relocate effects, old/new CARLOS_CHANGE_INDEX (enabling read changes record walks), exact config rollback, route-gate exemptions, exec-tenant restart outage, self-update hold/restore owner and restart-to-admission measurements (append actual timings before accepting the drill). 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; **E1/N1/S1:** use the whole-root read-plan and exact fixed-resource JSON gate above, not just a delete/replace check. The release owner prepares a reviewed private `scripts/configure-p3a-fixed.sh` step in the ordinary fixed roll: validate and atomically merge `CARLOS_REGION_HA=1`, `CARLOS_GROUP_ADMISSION=1`, `CARLOS_CHANGE_INDEX=read` and validated canonical region `ie` into `/etc/carlos/host.env` plus a root-owned `/etc/carlos/region-config.json`. Refuse the proposed configure operation before any write/restart unless CARLOS_REGION_HA parses true, and read back that prerequisite after delivery; keep CARLOS_REGION empty and preserve each box's exact CARLOS_POOLS and unrelated env. Use existing authenticated operator delivery, check owner/mode/no-symlink and config digests before restart. host.env may be root-owned **or agent-owned** (the dev pair uses `carlos:carlos 0600`, `scripts/bootstrap-box.sh:121-131`); require 0600 and verify the agent can read but cannot write it under `ProtectSystem=strict`. The region-config remains root-owned. Save exact old config, including previous CARLOS_REGION_HA/CARLOS_CHANGE_INDEX values, signed release identity and channel target for rollback.
+
+ Before either box opts in, the release owner holds unattended self-update on **both** boxes for the entire P3a window, using reviewed delivery that unit repair cannot undo; stage the release and roll one at a time, verifying the peer serves before each restart. Record and later restore the prior update settings. A blanket fixed-mode self-update change outside this pair/window is not authorized.
+
+ **No fixed user_data, IAM, SG or instance-type edit, no group marker and no `/etc/carlos/region-ingress.json` or nft table on leo/sophie.** Hairpin is excluded from P3a. Apply isolated ingress, deliver/roll admission settings one fixed box at a time, verify real arming/admission, then register target attachments.
+
+ Measure UTC restart-to-admission for each box and append both elapsed times to the approval card; do not restart the peer until the first is admitted and serving. **Five-minute bound:** if any box is not admitted within 5 minutes of its configure roll, the release owner immediately restores its exact old host.env/region config (switch-off) and restarts/verifies normal service **before any infrastructure change**, even if registration has not begun.
-- [ ] **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, T1 maintenance min/desired/Standby/ExitStandby writes and root permit/recovery owners, 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; **E1/N1/S1:** use the whole-root read-plan and exact fixed-resource JSON gate above, not just a delete/replace check. The release owner prepares a reviewed private `scripts/configure-p3a-fixed.sh` step in the ordinary fixed roll: atomically merge `CARLOS_GROUP_ADMISSION=1`, `CARLOS_CHANGE_INDEX=read` and validated canonical region `ie` into root-owned `/etc/carlos/host.env` plus a root-owned `/etc/carlos/region-config.json`; keep CARLOS_REGION empty and preserve each box's exact CARLOS_POOLS and unrelated env. Use existing authenticated operator delivery, check owner/mode/no-symlink and config digests before restart. Save old config and signed binary for rollback. **No fixed user_data, IAM, SG or instance-type edit, no group marker and no `/etc/carlos/region-ingress.json` or nft table on leo/sophie.** Hairpin is excluded from P3a. Apply isolated ingress, deliver/roll admission settings one fixed box at a time, verify real arming/admission, then register target attachments. Sophie remains serve despite also running the dev console. If this config delivery or first consumer acknowledgment is unavailable, refuse 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. **Rollback (E1/S1):** on failed acceptance, the infrastructure operator first deregisters/removes only P3a fixed-target attachments via the approved targeted saved plan, verifies both TGs contain no fixed targets and waits 30s drain; normal DNS/EIPs remain owned by the fixed modules. The release owner then restores the saved signed binary and exact old host.env/region config (switch omitted), restarts one fixed box at a time and verifies normal public host/version, console, pools, omission of P3 fields and healthy tenant service. P3a installed no hairpin state to undo. Only after that does the infrastructure owner remove the isolated NLB/listeners/TGs/SG and two **new** EIPs using the protected-resource cleanup procedure below. Failure during rollback halts further changes and alerts the named deployment owner; keep resources/state for diagnosis. The controller records every step; Paul's card names these owners and covers cleanup costs/duration.
+ Verify `chronyc -c tracking` succeeds under the actual edge User=carlos/systemd sandbox, recording the socket or UDP 323 access and synchronization; refuse clock-alarm acceptance if that cannot be demonstrated. Before public probes, verify each fixed target's AZ is enabled and neither TG reports a `NotInUse` target/reason; cross-zone alone is insufficient. Sophie remains serve despite also running the dev console. If this config delivery or first consumer acknowledgment is unavailable, refuse 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.
+
+ **Rollback (E1/S1):** rollback is **switch-off/config restoration**, justified by `TestAdmissionFlagshipUnchanged`; it does not require replacing the binary. The five-minute non-admission restore above happens immediately, before infrastructure changes. For other failed acceptance after registration, the infrastructure operator first deregisters/removes only P3a fixed-target attachments via the approved targeted saved plan, verifies both TGs contain no fixed targets and waits 30s drain; normal DNS/EIPs remain owned by the fixed modules. The release owner then restores exact old host.env/region config (switch-off), including previous CARLOS_REGION_HA/CARLOS_CHANGE_INDEX values, restarts one fixed box at a time and verifies normal public host/version, console, pools, omission of P3 fields and healthy tenant service.
+
+ If a binary rollback is needed, the **release owner repoints the signed release channel** to the saved verified release and rolls one box at a time; a local binary copy alone would be undone by adoption. Restore prior self-update settings only after both boxes are verified and the window closes. P3a installed no hairpin state to undo.
+
+ Only after that does the infrastructure owner remove the isolated NLB/listeners/TGs/SG and two **new** EIPs using the protected-resource cleanup procedure below. Failure during rollback halts further changes and alerts the named deployment owner; keep resources/state for diagnosis. The controller records every step; Paul's card names these owners and covers cleanup costs/duration.
- [ ] **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. **T1/I4 restart witness:** before any group restart, run the central maintenance transaction. Capture iid/membership/launch and termination activity counts. Roll the platform, attempt unattended self-update (must produce zero stop/repoint), then restart the admitted agent under Standby with both S3 and SSM black-holed. Drive tenant HTTP/door/tunnel/timer paths: zero acquire/start and no holder leak while admission is closed. Hold the outage **over 15 minutes**, beyond the 2×10s thresholds, 60s grace and operator wait; same iid must remain Standby, no termination, no replacement/extra launch, no new lifecycle completion. Lose the operator connection mid-transaction and resume by its durable record; loss cannot auto-exit Standby. Restore dependency access, re-admit with the same receipt and six real conditions, ExitStandby and restore min=desired=max=count; verify same iid serves again. Finally hang an admitted member **outside maintenance** and prove ordinary local-failure replacement still works. Repeat update-rollback/recovery permit checks; no successful shared-read/receipt probe may stand in for ASG state readback. 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 already-admitted disposable box: assert external health stays 200, same iid, zero replacement/termination activity, alarm/operator intervention and 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.
@@ -286,7 +343,7 @@ Logical API attempts including unsuccessful requests; SDK retries are transport
| 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 box-side increment. EventBridge→SNS notifications are event workload, no polling. |
+| Metrics | On opted-in/group boxes only, extend existing host **<=60 PutMetricData/h/box**, no additional call per metric; no S3. Append clock/group samples in the same batch, actual AWS region, preserving original InstanceId-only datums byte-identically. Switch-off boxes have zero chronyc executions and unchanged PutMetricData input/series. Console EligibleBoxes remains P2b's **<=60 calls/region/h** plus its separately budgeted verified observation reads; do not attribute its workload to P3's box-side increment. 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. |
@@ -324,7 +381,6 @@ This is a requirements inventory for the controller, not approved product wordin
| 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**. |
-
| P3-C8 | External health 503 condition name/text | Not admitted; no holder identity, and no suggestion that S3 loss terminates a member. **A1/I4**. |
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.
@@ -340,7 +396,7 @@ Implementation iteration uses named targeted tests above, `nice -n 19`, fake AWS
## 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. **P3b maintenance authority (T1):** approve or reject the exact §12.1 exception in “Restart authority”; no §10 change is requested. Without that exception, refuse the group activation and keep the visible fixed-target P3a slice separate. The implementation cannot silently lower min/desired.
+2. **P3b maintenance authority (T1), decided:** N-HA14 approves the exact §12.1 exception in “Restart authority”. P3b's plan writes it into the spec file; no §10 change is requested and no further ruling is needed. Scoped deployment approval must still name the operator-only Standby/min/desired writes; group boxes never self-update unattended.
3. **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.