carlos / platform Public

Region HA P1b-1 plan rev 3.1: Astra round 3 READY AFTER FIXES; the drill's third-box outputs and tofu init

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 42f9f0910cd8c377aaaa73c3447d8ba7aba69704 parent 1f187ae
2 files changed, +31 −2
  • docs/superpowers/plans/2026-10-27-region-ha-p1b1-takeover.md +3 −2
  • docs/superpowers/plans/CODEX-PLAN-REGION-HA-P1B1-R3.md +28 −0

CI passed — run details

diff --git a/docs/superpowers/plans/2026-10-27-region-ha-p1b1-takeover.md b/docs/superpowers/plans/2026-10-27-region-ha-p1b1-takeover.md
index 661d8cc02..e27423e51 100644
--- a/docs/superpowers/plans/2026-10-27-region-ha-p1b1-takeover.md
+++ b/docs/superpowers/plans/2026-10-27-region-ha-p1b1-takeover.md
@@ -13,7 +13,7 @@
**Spec:** `docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md` (rev 6.1) §9.2, §9.4's "owner confirmed terminated" row (narrowed by N-HA9), and Paul's rulings below. P1a's plan, `docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md`, is the base this slice changes.
-**Status: rev 3, for Astra round 3 of 3 (final). A P1 in round 3 goes to Paul as a cut; no fourth round.**
+**Status: rev 3.1. Astra round 3 (final): READY AFTER FIXES; its one P2 (r3.1, the third box's outputs and `tofu init`) is fixed in Task 6 Step 2. Review closed.**
## Rulings
@@ -31,6 +31,7 @@ Task 1 writes both rulings into the spec.
|---|---|---|
| 1 | `CODEX-PLAN-REGION-HA-P1B1-R1.md` | NOT READY: 3 P1, 2 P2 |
| 2 | `CODEX-PLAN-REGION-HA-P1B1-R2.md` | NOT READY: 1 P1, 2 P2 |
+| 3 | `CODEX-PLAN-REGION-HA-P1B1-R3.md` | READY AFTER FIXES: 1 P2 (fixed in rev 3.1) |
| Finding | Disposition in rev 3 |
|---|---|
@@ -224,7 +225,7 @@ The table, in this order. Only the bold row is new:
Release and roll by the platform release recipe in the README and the roll-order rule (dev boxes, dev console, check; flagship only after this drill passes, with `CONSOLE_HA_REGIONS` unset there). Log every step with UTC times in the session's own roll log. Collect the observation points with `journalctl -u carlos-edge --since <t> | grep -E 'termfence: |holder terminated|taking the host over|restored \('` on each survivor.
- [ ] **Step 1: Pre-checks on dev.** On leo and sophie, from the agent's environment: `aws ec2 describe-instances --instance-ids <the other box's id> --region eu-west-1` answers (the role allows it). Both boxes run the new release; `agent: lease locks name this box` shows the iid. Every HA lock on dev carries `iid=`.
-- [ ] **Step 2: The third box.** In `platform-infrastructure/dev`, add `region-ie-c.tf`, a copy of `region-ie-b.tf` with `host_ie_c`, `carlos-dev-ie-c`, `carlos-dev-host-c`. Apply only that module (`tofu apply -target=module.host_ie_c`; a whole-root apply restarts every box). Bootstrap it as ie-b was, with `CARLOS_POOLS=hapair`, and check `hapair-a1`'s route is nested on it and its certificate is mirrored.
+- [ ] **Step 2: The third box.** In `platform-infrastructure/dev`, add `region-ie-c.tf`, a copy of `region-ie-b.tf` with `host_ie_c`, `carlos-dev-ie-c`, `carlos-dev-host-c`, and its outputs renamed `ie_c_eip` and `ie_c_instance_id` (referencing `module.host_ie_c`). Run `tofu init` (the new module) and `tofu validate`, read `tofu plan -target=module.host_ie_c`, then apply only that module (`tofu apply -target=module.host_ie_c`; a whole-root apply restarts every box). Bootstrap it as ie-b was, with `CARLOS_POOLS=hapair`, and check `hapair-a1`'s route is nested on it and its certificate is mirrored.
- [ ] **Step 3: Stop drill.** Wake `hapair-a1` on box C (requests through C only) and write a row. Read `lock.json`: C's owner, no marker. `aws ec2 stop-instances --skip-os-shutdown` C, and read `lock.json` again: unchanged. Probe through leo and sophie every 5 s until 5 minutes past the lock's `expires_at`. Expected: held until expiry, refused after (`stopped` in the describe lines); never taken; at most one `termfence: describe` line per 10 s per box.
- [ ] **Step 4: Takeover drill.** `aws ec2 start-instances` C and wait for its agent. Wake `hapair-a1` on C again (requests through C only), write rows w1 to w3, check `lock.json` is C's non-marker lock, then `aws ec2 terminate-instances --skip-os-shutdown` C, probing through leo and sophie every 5 s, and check `lock.json` is still C's. Expected: held until expiry; then `termfence: ... confirmed terminated (first evidence ...)`, `the holder ... is terminated (EC2) and its lease expired; taking the host over`, `HA lease acquired ... (holder terminated)`, `restored (no-marker)`; rows w1 to w3 present except at most the last second's (stream class). Record separately: the terminate call, the lock's `expires_at`, each survivor's first evidence, the take, `restored`, first 200. **Pass: no take before `expires_at`; first 200 within 1 minute after `expires_at`; no write lost before the last second.**
- [ ] **Step 5: Clean up.** `tofu destroy -target=module.host_ie_c` and delete `region-ie-c.tf` (one commit adding, one removing, or neither pushed: say which in the log). `hapair-a1` asleep behind a clean marker. Pools on leo and sophie stay.
diff --git a/docs/superpowers/plans/CODEX-PLAN-REGION-HA-P1B1-R3.md b/docs/superpowers/plans/CODEX-PLAN-REGION-HA-P1B1-R3.md
new file mode 100644
index 000000000..4b01d65fe
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-PLAN-REGION-HA-P1B1-R3.md
@@ -0,0 +1,28 @@
+- **r2.1 P1 — Resolved by N-HA9:** takeover now requires expiry; the early takeover rows and 60-second settle are removed.
+- **r2.2 P2 — Resolved:** finalization uses independent termination truth, passes visibility and expiry, and supplies confirmation and wake attempts before checking I5.
+- **r2.3 P2 — Resolved:** Task 2 specifies describe and first-evidence logs; Task 6 specifies their collection.
+
+Reviewed `region-ha-p1b1-takeover` at `1f187aeaf13ec5dac292629d0dcbcff99d18a7cb`. No files changed, subagents spawned, or tests run.
+
+No P1 findings.
+
+1. **P2 — Task 6, Step 2: complete the third-box configuration instructions.**
+
+ [Plan:227](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-p1b1/docs/superpowers/plans/2026-10-27-region-ha-p1b1-takeover.md:227) specifies copying `region-ie-b.tf` and changing three names. Those substitutions leave both output declarations named `ie_b_eip` and `ie_b_instance_id`, duplicating the declarations in the original file ([region-ie-b.tf:22](/home/paulca/amadan.net/carlos/platform-infrastructure/dev/region-ie-b.tf:22)). I verified this by applying the specified substitutions in memory.
+
+ **Failure scenario:** following the recipe produces duplicate output definitions, preventing configuration validation. After correcting those names, the newly added module also needs installation before apply; OpenTofu documents that step under `init`. [https://opentofu.org/docs/cli/commands/init/](https://opentofu.org/docs/cli/commands/init/)
+
+ **Fix:** explicitly rename the outputs to `ie_c_eip` and `ie_c_instance_id`, retain their references to `module.host_ie_c`, and run `tofu init` and validation before reviewing and applying the targeted plan.
+
+ **Fault family:** drill reproducibility and acceptance evidence.
+
+The remaining checks support the plan:
+
+- **Single writer:** the new row preserves expiry and requires termination evidence. Competing survivors remain serialized by the conditional write and reclassification loop ([legacytake.go:82](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-p1b1/internal/lease/legacytake.go:82)). Same-box recovery retains its startup-sweep and acquired-here checks.
+- **Evidence and identity:** the proposed predicate matches the relevant identity and state checks in `Verify`. Negative/error caching delays recovery without granting authority. Production identity becomes complete once and then remains stable; failed early wakes are removed so subsequent requests retry ([activator.go:1924](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-p1b1/internal/activator/activator.go:1924)).
+- **Restore:** acquisition preserves the old view. `restorePlain` passes it to `restoreHA`; no marker prevents local reuse. Database restore is followed by clean files restoration, including the file-based secrets and platform environment ([backend_exec.go:844](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-p1b1/internal/activator/backend_exec.go:844), [hawake.go:434](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-p1b1/internal/activator/hawake.go:434), [hawake.go:605](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-p1b1/internal/activator/hawake.go:605)).
+- **Simulation:** the proposed witnesses are catchable: hung-owner takeover violates the running-unit check; premature takeover is exposed by the late upload’s holder check; suppressed confirmation fails the independent final I5 check.
+
+No P3 findings. Fix the listed P2 without reopening this review.
+
+**READY AFTER FIXES**
\ No newline at end of file