carlos / platform Public

plans: P2a Opus review round 3, final (READY AFTER FIXES, 1 P2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev bac9e20ece10123f83df41f60877a286f3cf378e parent a5f585b
1 file changed, +80 −0
  • docs/superpowers/plans/REVIEW-REGION-HA-P2-R3.md +80 −0
diff --git a/docs/superpowers/plans/REVIEW-REGION-HA-P2-R3.md b/docs/superpowers/plans/REVIEW-REGION-HA-P2-R3.md
new file mode 100644
index 000000000..c2117abda
--- /dev/null
+++ b/docs/superpowers/plans/REVIEW-REGION-HA-P2-R3.md
@@ -0,0 +1,80 @@
+# Review: region HA P2a plan, round 3 of 3 (rev 3 at a5f585b3, code at origin/main 65420a4d)
+
+I read the brief, both earlier reviews and the whole plan. I checked the plan's claims against an extracted copy of origin/main 65420a4d. That commit is the plan's citation base. Of the 40 or so file:line citations I checked, all but two land where the plan says (see P3-5). Main's later changes after the branch base 79d9d6a2 don't touch any cited code. I edited no files, ran no tests and spawned no agents. One thing to report: at the start I ran `git fetch -q origin`, which can update remote-tracking refs. origin/main was already 65420a4d, so it most likely changed nothing. My scratch copy is deleted.
+
+## Earlier-round dispositions
+
+**Round 1**
+- **P1-1 (C1):** cut by ruling (N-HA13).
+- **P2-1 (C1):** cut by ruling (N-HA13).
+- **P2-2 (C1, C6):** cut by ruling (N-HA13).
+- **P2-3 (C3):** resolved. F1 and HAData match the code (`seedmove.go:47`, `provision.go:487,537`), and address-backed records are excluded.
+- **P2-4 (C3):** resolved. The deliberate cut is F5/409 and the temporary failure is F3/503.
+- **P2-5 (C3, C4):** resolved. F4 is dropped, and sidecars keep main's behaviour.
+- **P2-6 (C3):** resolved. All four fixtures are listed with their new wiring. No other test sets `HARegions`.
+- **P2-7 (C2):** resolved. Configured mode drops `SteeringHost` inside `dnsTargets`, so the guidance, the `records` and the app-facing `deployment` block (`domainstate.go:294`) all follow.
+- **P2-8 (C3):** resolved. The wiring check is on the Task 4 card and blocks switch-on.
+- **P2-9 (C3):** resolved. There is a small gap about records that appear during the walk (P3-4).
+
+**Round 2**
+- **P1-A (C1, C6):** cut by ruling (N-HA13). The plan doesn't touch `deploywatch.go` or the rollout join.
+- **P2-A, P2-B, P2-C, P2-D (C1):** cut by ruling (N-HA13).
+- **P2-E (C2):** resolved at the placements door. The domain list and settings pages it reaches have a new P2 (P2-1 below).
+- **P2-F (C3):** resolved. F1 now requires `rec.Runtime == ""`.
+- **P2-G (witnesses, C3):** resolved. The plan records that the dev setting is unset, names the pooled `hapair` host, names a new unpooled home host, and puts the switch window, the stamp that can't be undone and the rollback on the card.
+
+No remaining task changes how main displays HA records. Nothing in P2a depends on P1b-3a (stopping rule 4 holds). There is no new per-box polling.
+
+## P1
+
+None.
+
+## P2
+
+**P2-1. Task 1: the domain list, single GET and settings pages have no stated failure mode for the new target reads, and a deleted target becomes a permanent "try again". (C2, C6)**
+- **Task:** 1, the placements paragraph: "Apply the same authorized-target check at domain list/single GET/settings sinks", plus "Unreadable/missing target evidence gets the existing neutral temporary refusal". Budget row: "8C+S target GETs".
+- **Problem:**
+ 1. The domain list (`apidomains.go:1338-1420`) is one response covering every claim of the app. It is also the door apps poll for the `deployment` block. The plan's only failure rule for a target read is the placements door's 503. Applied as "the same check", one unreadable or deleted target would fail the whole list.
+ 2. A target record that no longer exists is not temporary. On main, a deleted target gets `no-serving-box`. In configured mode, any placement in a region that isn't HA-active needs a record read. So a claim whose instance was deleted would answer "could not check every server just now. try again in a few minutes." (`apiplacements.go:44`) for ever.
+ 3. The S single-mode target reads at the list pages do nothing useful. Single-mode rows use `domainGuidance`, which configured mode already restricts to the safe union. Only regional claims carry the RD-44/RD-46 text (`apidomains.go:1450-1462`, `domainstate.go:176-177`). The plan also doesn't say what happens to a single-mode HA row's structured `records`.
+- **Failure scenario:** On a configured console, an app has one regional claim whose `uk` instance was deleted. `carlos domains placements` answers "try again" for ever. If the implementer copies that rule into the list page, `carlos domains list` and the app's own poll fail for every domain of the app, not only that one.
+- **Fix:**
+ - At list, single GET and settings, a failed target read degrades only that row: I6 or main's text, never an error for the whole response.
+ - A missing record (`ErrNotExist`) carries no HA flag to honour. Fall through to the active-region check, and then to main's view.
+ - Keep 503 only for read errors.
+ - Drop the S single-mode reads at the list pages, and keep `domainGuidance` and `records` for single-mode rows.
+ - Add a test with a regional claim that has a deleted target and a failing target read, on the list and on placements.
+ - State a per-hour figure for the 8C reads at the app poll rate.
+
+## P3 (follow-up list)
+
+1. **Task 1, placements PUT "current targets" (C2).** Checking the current claim's targets is not needed for safety, because the PUT renders only the new set. It also has two side effects:
+ - It traps a user who wants to drop an HA region from their own regional claim.
+ - When the current claim is another owner's pending claim being taken over, the refusal hints at whether that owner's target is HA. That is a small existence oracle.
+
+ Limit the check to the proposed set, or to the caller's own verified regional claim.
+2. **Task 1, unconfigured mode (C2).** Legacy guidance is correct only while there are no group boxes. Spec §12.1 gives group boxes "an auto-assigned public IPv4", which the fold would then offer as a DNS target. Record in the P3 handoff that `CONSOLE_REGION_INGRESS` must be set before any group box publishes an edges file. Also say "before setting CONSOLE_REGION_INGRESS" rather than only "before NLB cut-over" for the agents' `PLATFORM_EDGE_IPS` check.
+3. **Task 4, Step 2 wording (C3).** "Normalized HomeRegion=IE and cfg.Region agree" could lead an operator to set `CARLOS_REGION=ie` on the console. Home records store region `""`, and `leftoverCheckApplies` compares raw `region == cfg.Region` (`createleftovers.go:43-51`). On the home console that means `CARLOS_REGION` must stay empty. Say so explicitly.
+4. **Task 3, apps place walk (C3).** The walk lists keys again after the preflight (`fleets.go:937-955`). State that a record missing from the preflight set still takes `SetRecordRegion`, so its CAS refuses it. Otherwise an implementer could treat it as a no-op and skip it. `TestPlaceRefusesAnHARecordCreatedBetweenItsScans` depends on this.
+
+ Also note that skipping no-op records leaves a legacy record stored as `"ie"` uncanonicalised when its app is placed at home. Main would have rewritten it to `""`.
+5. **Citation drift.** `placementsUnreadableMsg` is at `apiplacements.go:44`, not `:46` (Reuse I7). The GET handler is at `:81`, not `:83`.
+6. **Copy deck.** I6 is used for both the domain `Guidance` field and the state `Detail` field. On one row that shows the same sentence twice. Give the detail its own short ID.
+
+ The root CLI help (`domains_cli.go:55-58`, `domainsPlacementsUsage`) still promises "the addresses to point DNS at". The plan deliberately leaves root code alone, so D2 should note this mismatch.
+7. **F1 and imports (C3).** F1 runs before the create door hands off to `createImport`. A non-hibernating import into an HA region now gets F1/400 instead of C2/409. Both refuse before any write, so this is a note for D3 and the import tests, not a safety issue.
+
+## Checks by area
+- **C1:** no task changes main's HA display. Task 1 reads records and configuration only, never a snapshot, and treats nothing as lease authority.
+- **C2:** configured mode keeps `RegionIngress` out of `cfg.EdgeIPs`, and `trustsProxy` (`authcli.go:1202-1215`) still reads only `cfg.EdgeIPs`. The fold is reached only through `edgeIPs` (`server.go:1580-1587`), so configured mode makes no fold reads.
+- **C3 doors:**
+ - Create: instance create covering plain, `--from` and import begin (`apiinstances.go:1524`), the standalone sidecar (`apisidecars.go:223`) and first-domain static (`domainattach.go:253,679`).
+ - Move: offline start and stage through `offlineBeginChecks` (read-only, `:505-530`), the legacy move (`apiinstancemove.go:422`), the Phase-1 move (`:574`) and apps place (`fleets.go:1041,1105,1154` → `:783`).
+ - Import: begin, upload and stopped (`apiinstanceimport.go:119,391,718`). Commit and abort stay open for started imports.
+
+ No door is missed. I found no write before the new checks: the code before `ValidateShape` and the leftover rail only reads.
+- **C6:** the arithmetic holds. `ListPage` with limit 1 is one ListObjectsV2 call (`store.go:1087-1097`), `MaxLevel` is 9, and the console role has unconditional ListBucket on its own data bucket (`infra/modules/region-host/main.tf:174`). The only gaps are the list-page reads in P2-1.
+- **Witnesses:** they are wired through the real handlers, and every cited existing test exists. The dev drill can be run, provided the card confirms that the hacheck manifest has no pool and that the console's data wiring is in place.
+- **Census:** `domains_cli_test.go` is a test file, so it is outside root scope (`go list` GoFiles only). The rest of the change is console, startup and docs, all out of scope. The notes are complete.
+
+**READY AFTER FIXES**
\ No newline at end of file