plans: P1b-3b Opus review round 2 (NOT READY)
2 P1 (P1-A recurs the R1 I3 evidence-ageing family: stopping rule 2; P1-B new: coverage gate couples consumer lifecycle to tenant records), 2 P2, 4 P3. R1: 7 addressed, 1 partial, 2 addressed with new fault.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+72
−0
docs/superpowers/plans/REVIEW-REGION-HA-P1B3B-R2.md+72 −0
diff --git a/docs/superpowers/plans/REVIEW-REGION-HA-P1B3B-R2.md b/docs/superpowers/plans/REVIEW-REGION-HA-P1B3B-R2.md| new file mode 100644 |
| index 000000000..cdff68747 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/REVIEW-REGION-HA-P1B3B-R2.md |
| @@ -0,0 +1,72 @@ |
| +# Review: region HA P1b-3b plan, round 2 of 3 |
| + |
| +Reviewer: Claude Opus 5.5, independent. Plan rev 2 (412a67f5), brief `REVIEW-BRIEF-REGION-HA-P1B3B-R2.md` (1ce5733a). Code at origin/main (c6304f2d; `git fetch` today shows later main commits, none touching the cited files). Authorities as in round 1. |
| + |
| +**Verdict: NOT READY** (2 P1, 2 P2, 4 P3). |
| + |
| +**Stopping rule 2 triggers.** P1-A is the round-1 P1 family again: **I3, post-import duty authority depends on ageing termination evidence**. The window is narrower than in round 1, but it is still a P1. Per rule 2, do not write a third fix. Take the refuse / cut / one-enforced-invariant choice to Paul (options under P1-A). P1-B is a new family, introduced by rev 2's answer to round-1 P2-1/P2-4: a coverage refusal gating the consumer lifecycle. My round-1 P2-1 suggested "refuse to start the consumer", so part of that fault came from my own advice. |
| + |
| +## Round-1 dispositions |
| + |
| +| R1 | Status | Note | |
| +|---|---|---| |
| +| P1-1 | **PARTIAL** | The central finalizer (plan §"One authority rule", steps 1-5) closes the normal path: the lock is rewritten to the adopter's unclean marker within about 15-35 min of termination, well inside EC2's retention. The finalizer itself still needs fresh EC2 proof for held hosts, so P1-A remains. | |
| +| P1-2 | **ADDRESSED** | Once finalized, every adopted host's lock names its adopter, so the adopter's later departure scan matches it. E→D→F and +48h witnesses are required (B2 `TestHAAdoptAuthority`, B5). | |
| +| P2-1 | **ADDRESSED, new fault** | It is refused, but at the consumer lifecycle. That creates P1-B. | |
| +| P2-2 | **ADDRESSED** | The HRW candidate set comes from per-host home entries, as main `wakeplacement.go:157-174` builds it. I checked that `edgesfile.go:590-611` publishes home entries for every ready, hibernating, non-sidecar route, so never-woken hosts are covered. | |
| +| P2-3 | **ADDRESSED** | Durable `ha_box_identities`, a bounded walk of the immutable records, and "missing edges never means irrelevant". | |
| +| P2-4 | **ADDRESSED, new fault** | Via full-scope receivers only. That is part of P1-B. | |
| +| P2-5 | **ADDRESSED** | `ReplaceHAWake` under a new lease installs the S3 wake state exactly. Revision CAS applies only to adoption. | |
| +| P2-6 | **ADDRESSED** | Dependency named. Citations `main.tf:693-694,719-728`, `variables.tf:47` and `carlos-edge.service:18` verified. | |
| +| P2-7 | **ADDRESSED** | The source read and the full walk must both start after confirmation. This adds up to the 30 min backstop +10% (`release/changewatch.go:17`), which P1-A depends on. | |
| + |
| +All seven R1 P3s were taken. Citations spot-checked: `release.go:24` (412 → nil) is real and the step-4 readback handles it correctly, and `host/changeindex.go:147,167` and `hasamebox.go:79-104` check out. |
| + |
| +## Finalizer check (brief "Round 2 specifics") |
| + |
| +- **Pre-expiry take:** none. Held locks wait strictly past expiry, and the take goes through `DecideAcquire`, where equality counts as held. A released marker needs no wait. |
| +- **Wake or restore a tenant:** none. It reads only the manifest/wake object and installs the wake state through the registry. No DB, files or secrets, and no start. |
| +- **Race with a live holder:** a visitor takeover (box E) changes the lock, the restriction callback refuses, and the finalizer reclassifies to Superseded. Sound. |
| +- **Race with a second adopter:** on fixed per-box queues both survivors finalize. The loser's restriction sees the winner's marker and returns Superseded with no basis. Sound. |
| +- **Crash between acquire and marker:** the lock names the scanner. After a restart, same-box recovery (`hasamebox.go:79-104`: nested containment, startup sweep, empty slice) can retake and release it after expiry. Delay at most 15 min. Sound. |
| +- **A 412 that returns nil:** handled by the readback. |
| +- **Lost timer:** none found on the normal path. The under-lease manifest re-read catches a late publication. |
| + |
| +## P1 |
| + |
| +**P1-A — The held-host finalizer still depends on EC2 evidence that ages out (I3, the round-1 family; I4 for the host).** Plan §"One authority rule" step 2 ("Confirmation comes from the shared confirmer while fresh; no relaxed proof"); B5 fairness assumption ("initial confirmation before EC2 forgets"); Open questions ("failure to obtain the **initial** termination proof … must be reported"). |
| +For a held host, step 2's take requires `Proofs.OwnerTerminated` (`hafresh/acquire.go:112-115`) → `Confirmer.Terminated`. That proof is an in-process cache: 24 h positive (`confirm.go:16`), and EC2 forgets the instance in about 1 h (`confirm.go:15`, refusal at `:38-39`). The plan's assumption covers only the *initial* confirmation, not the later finalization. Several paths the plan itself creates delay finalization past the window: |
| +- `scope_refused` suspension, which is unbounded and needs an operator to rearm. The plan does not say whether `wait_expiry` / `imported_pending_authority` hosts count as "already admitted HA-host transactions" that finish during suspension. |
| +- The qualifying-inventory wait of up to about 33 min for a host first seen in the fresh pass, followed by a process restart (a release roll, or the host.env restart this very plan requires for the queue URL). |
| +- An S3 or registry outage lasting more than about 1 h, followed by a restart. |
| + |
| +In each case the host's lock names D, expired, forever. No box, including visitor wakes anywhere, can take it, and its duties never run. That is the round-1 P1-1 symptom on a narrower path. The plan's own journal already stores a describe-verified "verified evidence time", but explicitly refuses to use it ("no durable-cache substitute"). |
| +Options for Paul under rule 2: |
| +1. **One enforced invariant:** a durable record of describe-proven termination (iid + account + region + state, from `SameAccountTerminated`). It is safe because terminated is a terminal state, and only the HA acquire's `OwnerTerminated` proof consumes it. Enforce it in `Confirmer` alone, with I6 restart/+48h/suspension witnesses. |
| +2. **Refuse up front:** before suspending or stopping, a departure must finish every held-host finalization, so suspension never strands authority. A restart over 1 h still leaves a residual gap, which must be stated as an operator fault with an operator "confirm terminated" door. |
| +3. **Cut:** declare held-host recovery after a missed window an operator action, and say so in §19 acceptance. |
| + |
| +**P1-B — The coverage gate couples consumer Started/Running to tenant-controlled records and to pool configuration (new family: A1/I3/I4, tenant boundary; brief item 3).** §"T scope gate" (plan :35-39); Started "after … a passing coverage gate" (:156); B3 `CheckCoverage`. |
| +1. **Tenant-triggered region-wide effect.** Any member who creates or enables a native sidecar in the home scope (`console/apisidecars.go:223,598`, ordinary doors) makes *every* receiver in that scope stop its lifecycle. That suspends termination recovery for all other tenants' HA instances, which is an I3 loss across tenants. After the next restart Started never closes, so under P3 (:285, :310 "If … first consumer acknowledgment is unavailable, refuse before registration") fixed boxes are refused registration after a roll and group boxes never complete their launch hook. One tenant action turns into region unavailability. |
| +2. **Conflicts with P3's dev topology.** P3 plans "group boxes configured for **hapair only**, so they cannot adopt the shared dev tenant population" (P3 plan :25). Rev 2 refuses any receiver if "any regional born-HA record is outside the receiver's normal reconcile eligibility" (:35). Born-HA records exist in the shared dev scope, so every hapair-only group box is refused. P3b's admission becomes impossible, and the departure work P3 relies on never runs. |
| +3. **Dev activation.** Any existing legacy native sidecar in the dev home scope blocks T, and therefore P3a, permanently, because S "still refuses any legacy native sidecar" (:39). Neither the plan nor the card inventories dev for this. |
| +4. **Done semantics conflict.** The plan says P3 will "close admission before invoking Stop or reacting to Done" (:158), while P3 says startup acknowledgments "remain latched until local shutdown" (P3 :108). With a coverage-driven Stop, the two contracts disagree. |
| + |
| +*Fix direction* (it does not reopen N-HA11): keep Started/Running purely a consumer-lifecycle fact, as the R1 brief required. Move coverage to per-departure completion. Since the finalizer now rewrites every adopted lock, "complete" can be proved by locks: a rescan of the complete pre-filter inventory finds no lock whose owner or releaser is D. Any receiver can check that, so a partial-pool receiver imports what it serves and acks once the rescan shows zero D-matches. No attribution to another box from missing edges is needed. Refuse legacy native sidecars at the **record-creation doors** in HA-active scopes (the S direction). Handle pre-existing ones with an activation-time operator preflight and a C8 alert per departure, never a lifecycle stop: they are unidentifiable either way, so blocking completion recovers nothing. |
| + |
| +## P2 |
| + |
| +**P2-1 — The rearm action is unspecified.** "Rearming requires an explicit configuration/activation action" (:39) names no door, setting or command, and no test drives it. If P1-B keeps any suspension, specify the operator door, its authorization and the witness for it. |
| + |
| +**P2-2 — No bound on Started's startup wait.** Started now waits for a complete two-family inventory (:156). Give the startup bound: the first full reconcile of both families, and whether the change-index skip can defer the first full walk to the 30 min backstop. P3's restart-to-admission budget needs that number, beside the 20 s first long poll. |
| + |
| +## P3 |
| + |
| +- **P3-1:** the dev account has unrelated EC2 terminations (CI workers, root runner). Each one triggers the unknown-iid walk (`ceil(B/1000)L` + unverified GETs) on every box. Keep a durable negative cache of proven-unrelated iids (terminated iids never return) and add an expected-churn line to the budget. |
| +- **P3-2:** the finalizer's take on a held host logs as a "holder terminated" takeover and can raise the existing takeover alarm (`activator/hatakeover.go:34-38`). Tag finalizer takes so the alarm and metrics do not count them as visitor takeovers. |
| +- **P3-3:** step 3's "if an earlier staged digest still matches, avoid a second wake-object GET" should compare the manifest's wake entry digest, not the local staged rows. State that explicitly in the witness. |
| +- **P3-4:** `Superseded` accepts a "remote" subsequent releaser. Name the validation: parsed HA marker, ref/iid bound in `ha_box_identities`, lifetime equal to the current record, generation greater than the observed one. Otherwise it is untestable. |
| + |
| +## Budget |
| + |
| +The per-event formula `(U+E+N+4A+W+Q)G + 2A P` checks out (600 G + 40 P = $0.00044 at N=500, A=W=20). Quiet stays at 0 S3 and about 180 receives/h. No new polling. |