plans: P2a Opus review round 1 (NOT READY, 1 P1, 9 P2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+112
−0
docs/superpowers/plans/REVIEW-REGION-HA-P2-R1.md+112 −0
diff --git a/docs/superpowers/plans/REVIEW-REGION-HA-P2-R1.md b/docs/superpowers/plans/REVIEW-REGION-HA-P2-R1.md| new file mode 100644 |
| index 000000000..748b800a4 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/REVIEW-REGION-HA-P2-R1.md |
| @@ -0,0 +1,112 @@ |
| +# Review: region HA P2a plan, round 1 (Opus) |
| + |
| +The plan is NOT READY. It has one P1, nine P2s and eleven P3s. The P1 is in Task 1: the console's per-box rollout record for a host still takes one box's report at random, so the honest-display rule (C1) isn't met for born-HA hosts. I read the plan and the cited code at the base commit 79d9d6a2. The branch adds only the plan and the brief on top of it. Main's later advance to 06bc3d73 touches none of the plan's code anchors. I ran no tests or builds. |
| + |
| +## P1 |
| + |
| +**P1-1. Task 1: the rollout join still treats a host as belonging to one box, so the console shows contradictory box state for born-HA hosts. (C1)** |
| +- **Problem:** Task 1 adds `awake_box`/`awake_box_state` and leaves the existing per-box views alone. But the site spec §15's row "Hosts unique to one box" points at is the rollout join, not the remote fold. Its comment, "Hosts are assumed unique to one box. … the last platform box read wins", is at `internal/console/apiinstances.go:962`. The 2026-10-15 spec's row cited the same thing (`apiinstances.go:523-527`: "Hosts are unique to one box"). Under A13 every box adopts every HA record, and each box reports the host in `Rollout.Hosts`. So `foldRollout` (`apiinstances.go:1150-1186`) keeps whichever box's view was read last, whatever it says about awake. |
| +- **Evidence:** That view reaches: |
| + - the list API as `rollout{box, awake, serving, …}` (`apiinstances.go:1325,1332`; `rolloutView` at `:783-788`); |
| + - the instance detail page's Installed/Serving for every local row (`instancepage.go:298-299`, `app_instance.html:19-20`); |
| + - the CLI's serving/awake cells (`instances_cli.go:571-608`); |
| + - the retry door (`apiretry.go:90`). |
| + |
| + Separately, remote HA rows still take their health from `facts.host` (newest report wins, `remoteinstances.go:337-351`, `boxAwake` at `:466`). The plan's own table cites `apiinstances.go:1062,1182` as the gap, yet Task 1 never says what happens to them. The census table still marks the §15 row as done by Task 1. |
| +- **Failure scenario:** A born-HA host is awake on leo, and sophie (the last label read) adopts it asleep. `carlos instances list --json` returns `awake_box: "leo"` next to `rollout: {box: "sophie", awake: false, serving: ""}`. The detail page shows Serving "—". In the reverse case, a former holder's report up to 15 minutes old says awake while another box also reports awake. `awake_box_state` says conflict, but `rollout` names one box as awake and serving with no conflict. |
| +- **Fix:** For born-HA records, take the rollout view and the health word from the `haAwake` observation: |
| + - awake: that reporter's view; |
| + - conflict or unknown: no box, health unknown; |
| + - asleep: no awake box. |
| + |
| + Do this in the list, the detail page and the retry door. Or drop `rollout.box`/`awake` for HA records and say so. Add `TestHAAwakeBoxPageAndAPI` cases that assert the rollout and health agree. Correct the §15 census row. |
| + |
| +## P2 |
| + |
| +**P2-1. Task 1: the observation has no timestamp, and a stale holder can read as "No box reported awake". (C1)** |
| +- **Problem:** `haAwakeView{Box, State}` carries no report time. Task 5 Step 3 still requires "snapshot-age wording". A report counts as fresh for up to 15 minutes (`status.BoxStale`: 3 × `SnapshotPeriod` of 5 minutes, `internal/status/fleet.go:120-139`). The fold drops stale boxes but leaves `complete` true (`remoteinstances.go:263-264`). |
| +- **Failure scenario:** A box stops publishing status but may still hold the lease (for example, its S3 is black-holed). After 15 minutes, A2 "No box reported awake" asserts an absence that the evidence doesn't prove. Before that, A1 names the box with no age. |
| +- **Fix:** Add `At` to the view and a copy ID for the age. Treat a known region box whose report is stale, and whose last report named the host awake or transient, as `unknown`. |
| + |
| +**P2-2. Task 1: the single-instance API and CLI docs D1 aren't covered. (C1, copy)** |
| +- **Problem:** "page/detail/API agree" needs the single-record API too, but `handleAPIInstanceGet` returns `instanceGetRecord` (`apiinstances.go:1416,1427`). It reads no box reports and isn't in the interface. D1 says "HA instance lists identify the box last reported awake", but no CLI file changes. `instances_cli.go` is the root binary, which is census scope. |
| +- **Fix:** Add the fields to `instanceGetRecord` and count its cache-miss read in the budget. Either reword D1 to say the field is JSON only, or plan the CLI column with a census card. |
| + |
| +**P2-3. Task 3: the F1 test says "ordinary" creates, and the stamping exclusions are misstated. (C3, §6.1)** |
| +- **Problem:** The F1 test covers only "ordinary" creates. Spec §6.1 and §11 refuse any non-hibernating socket instance in an HA region, and `--from` doesn't pass through the HA gate (`seedfloor.go` has no HA check). The plan also says address-backed records keep "main's stamping exclusions", but `shouldStampHA` stamps them (`seedmove.go:47-48`). An address-backed instance defaults to non-hibernating (`provision.go:537-541`). So `HAData` would demand a data proof for a record with no data: F3 outside home, and a spurious F1 if the predicate isn't limited to socket routes. |
| +- **Fix:** Key F1 on `haRegion(effective region)`, instance kind, a socket upstream and not hibernating, for both plain and `--from` creates. Exclude address-backed records from `HAData` explicitly, and add both cases to the tests. |
| + |
| +**P2-4. Task 3: F3 is used both for a permanent cut and for a transient failure. (C3, copy)** |
| +- **Problem:** Non-home and pool HA creates are refused on purpose and will stay refused until P2b. They get 503 "Cannot check… Ask an operator to check the region's data access." A 503 invites retries, and no operator action can lift a deliberate cut. |
| +- **Fix:** Answer the cut with 409 and a new "not available yet in %s" copy ID. Keep 503 for a missing store or a failed listing, and add "Try again" as the old unsure message has. |
| + |
| +**P2-5. Task 3: F4 (no new standalone sidecars in HA regions) is an unruled departure from the spec. (C3, C4)** |
| +- **Problem:** Spec §11 admits standalone sidecars through the capacity gate. F4 refuses every standalone sidecar create in an HA-active region, including dev IE as soon as P2a ships. Main allows these today. This isn't one of the controller's three accepted defaults. |
| +- **Fix:** Record it as an accepted cut in the open questions and the switch-on notes, or drop it. |
| + |
| +**P2-6. Tasks 3–4: existing tests whose expectations must change aren't listed. (C3, witnesses)** |
| +- **Evidence:** |
| + - `ha_born_test.go:45` `TestCreateStampsBornHA` creates in "ie" while home is "", with no data bucket. That create will now get F3, but the plan lists the test as "Expected PASS". |
| + - `ha_born_test.go:205` `TestStaticRecordIsNotStampedAndDoesNotBlockAMove` moves a static record out of HA-active "ie" and asserts there is no HA refusal. Task 4 refuses legacy records in an HA-active source, so the plan has to decide whether static records are exempt. |
| + - The binary control case in `rootfs_test.go:588` `TestRootfsCreateIsNeverBornHA` needs a data store. |
| + - Fixtures have no `HibernateBucket`, so `leftoverCheckApplies` is false for every existing HA create. |
| +- **Fix:** List these tests and their new assertions, and decide the static-move ruling. |
| + |
| +**P2-7. Task 2: CNAME guidance in configured mode still leads to member EIPs. (C2)** |
| +- **Problem:** The steering hostname's records come from boxes' edges files (`internal/host/steering_loop.go`), not from `CONSOLE_REGION_INGRESS`. I3 says the CNAME "follows this deployment's regional ingress". Steering looks unarmed today (`view.go` DNSTargets comment), so this is latent. |
| +- **Fix:** In configured mode, offer only the A-record form unless steering publishes the ingress list. Or state that steering stays off and rewrite I3. |
| + |
| +**P2-8. Task 5: a switch-on precondition is missing. (C3)** |
| +- **Problem:** Home HA creates now need `HibernateBucket`, a non-nil `SeedData` (`cmd/console/main.go:444-450`) and `cfg.Region` equal to the HA region (`createleftovers.go:43-51`). Otherwise every HA create on that console gets F3 after release. |
| +- **Fix:** Add a verified console data-wiring check to the dev approval card and to the switch-on gate. |
| + |
| +**P2-9. Task 4: `apps place` refuses no-op records. (C3)** |
| +- **Problem:** "Reject active HA source/home" would refuse records whose region already equals the target. |
| +- **Fix:** Apply the rule only to records whose region changes. A record moving from a fleet into an HA-active home still refuses. |
| + |
| +## P3 |
| + |
| +These go on the follow-up list. |
| +- **Citation drift:** `createleftovers.go:40,64` are comments (the functions are at 43 and 69). `nocapacity.go:37,41` are off by one (38 and 42). `awsregionmetric.go:23` is blank. `apiinstances.go:2306` is the comment; the stamp is at 2308. |
| +- **Task 4:** "during its existing write recheck" implies changing `provision.SetRecordRegion`, which is census scope. The HA-region config is fixed for the process's life and the check runs under the app lock, so the pre-write check is enough. |
| +- **Task 4:** "HA record at begin" can't happen, because begin is create-only and seeds are never stamped. The flag check at upload and stopped is defensive only; say so. |
| +- **Task 3:** the file map lists `domainattach.go` but no change is described. |
| +- **Task 3:** the F2 relative key exposes a predecessor's object names, which are content SHA-256 hashes (`objects/<seq>-<sha>`). Name a fixed class instead (lock, files, replica, other). |
| +- **Task 3:** on a retry of an existing sidecar, F4 should come after the ordinary duplicate answer, as the global constraint already requires. |
| +- **Task 2:** an invalid `CONSOLE_REGION_INGRESS` stops the console from starting. Validate it before the roll. |
| +- **Task 2:** check that the console's `PLATFORM_EDGE_IPS` holds no member-only or platform-box EIP before switching on configured mode. |
| +- **Task 2:** changing the guidance text also changes legacy mode's wording; update `TestDomainGuidance` accordingly. |
| +- **Task 4:** import commit isn't refused, on main or in the plan. That's consistent with letting started operations finish, but note it in the door inventory. |
| +- **Copy deck:** A1 needs a variable for the age once P2-1 is fixed. |
| + |
| +## Door inventory (C3) |
| + |
| +- **Create doors:** |
| + - instance create (`apiinstances.go:1524`), including the `--from` (`apiinstanceseed.go:86,89`) and import-begin paths. Covered, subject to P2-3. |
| + - standalone sidecar (`apisidecars.go:223`, rail at `:394`). Covered by F4. |
| + - domain attach first route (`domainattach.go:253,679`). Always a static record, so no data check; the capacity gate is P2b's. |
| + - Rootfs, replica and static records keep main's exclusions. |
| +- **Move doors:** |
| + - offline start and stage (`apiinstancemove_offline.go:625,663` through `:505`); |
| + - the older move-request door (`apiinstancemove.go:422,427`); |
| + - the Phase-1 move-request door (`:574,583`); |
| + - `apps place` (`fleets.go:1023,1087,1129` through `placeAppTarget:783`). |
| + |
| + All are covered by Task 4. Cut, abort, resolve and the offline seal, flip, open and finish verbs continue operations already started. |
| +- **Import doors:** begin (`apiinstanceimport.go:119`), upload (`:391`), stopped (`:718`). Commit and abort are left open. |
| +- **Not region moves:** `apps region` moves nothing, and account move rewrites the console's own app record only. |
| + |
| +I found no missed door. No refusal comes after a write. P2a takes nothing from P1b-3a, so stopping rule 4 holds. |
| + |
| +## Budget (C6) |
| + |
| +The arithmetic checks out: |
| +- An empty home HA create adds one bounded LIST (+1L). |
| +- The existing leftover check stays at most 20 LISTs (`dbdoor.MaxLevel = 9`, two prefixes). |
| +- Index retries are bounded by `changeIndexAttempts = 4`. |
| +- The page reuses the request memo or the process-wide 60-second cache (`pageBoxReports`, `reqmemo.go:197`). |
| +- There is no new per-box polling. |
| + |
| +The only unbudgeted read is the single-instance API's (P2-2). |
| + |
| +**NOT READY** |
| \ No newline at end of file |