plans: P2a plan rev 2 (answers Opus round 1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+150
−83
docs/superpowers/plans/2026-11-01-region-ha-p2-console.md+150 −83
diff --git a/docs/superpowers/plans/2026-11-01-region-ha-p2-console.md b/docs/superpowers/plans/2026-11-01-region-ha-p2-console.md| index a055c4a04..3c9054422 100644 |
| --- a/docs/superpowers/plans/2026-11-01-region-ha-p2-console.md |
| +++ b/docs/superpowers/plans/2026-11-01-region-ha-p2-console.md |
| @@ -8,19 +8,20 @@ |
| **Tech stack:** Go 1.26, console HTTP/API and Go templates, SQLite registry, existing S3 stores and bounded listings, existing CloudWatch adapter. No new service, dependency or polling loop on boxes. |
| -**Spec:** `docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md`, rev 6.1, especially §§4.4, 10–11, 14–16, 18–21. Authorities are this merged spec, AGENTS.md, and Paul's rulings on discussion #421 (`amadan discuss show 421`, read 2026-11-01). |
| +**Spec:** `docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md`, rev 6.1, especially §§4.4, 10–11, 14–16, 18–21. Authorities are this merged spec, AGENTS.md, and Paul's rulings on discussion #421 (`amadan discuss show carlos/platform 421`, read 2026-11-01). |
| -**Base:** amadan `origin/main` = **79d9d6a281c58c481e902c6e963b5479a016446a**, also this branch's starting HEAD. All code citations below are against that commit. Proposed files have no fabricated line numbers. Read the P1b-2 plan for format; read the final P1b-3a plan on `origin/region-ha-p1b3-placement` for boundaries only. Its interfaces are not implementation dependencies of P2a. |
| +**Revision:** 2, 2026-11-01; answers Opus round 1. This revision has not had an independent review. |
| -**Main advanced during drafting:** the shared origin/main ref moved to `06bc3d73e5ea6bc4ef5a141339a0de8187683186` (team-service design/reload-test and mobile-navigation changes). Its diff from the pinned base changes none of the P2 code anchors or interfaces used here. P1b-3a remains unmerged. Refresh main and those checks before implementation; this planning branch is not rebased or merged. |
| +**Citation base:** refreshed amadan `origin/main` on 2026-11-01: **65420a4d9e0d919743ea2e95e20b1a649605db3d**. Every existing-code citation below was re-read at that commit. The branch starts at `79d9d6a281c58c481e902c6e963b5479a016446a`; it is not rebased or merged here. Main's intervening team-service, navigation and edge-test changes do not change the cited code. Proposed interfaces and witnesses have destination paths but no invented source lines. P1b-3a is still unmerged; it supplies no executable dependency to P2a. |
| -**Status:** first draft, no independent review. Only this plan is committed in this session. |
| - |
| -## Rulings and invariants |
| +## Rulings |
| | Invariant / ruling | Design consequence | |
| |---|---| |
| | **C1, honest observation (§15)** | An adopted route is not an awake process. Display a box only from a fresh, tenant-matching, post-creation awake report; incomplete or contradictory evidence cannot establish absence or a unique holder. A snapshot is never lease authority. | |
| +| **Controller, P2-5 (C3/C4)** | **DROP F4.** Standalone sidecars in HA regions keep main’s behavior until P2b’s capacity gate. No new cut, no new HA stamp, no dependency on unfinished runtime work for P2a. | |
| +| **Controller, P2-6 (C3)** | A record with `rec.KindOrDefault() == "static"` is exempt from the new active-HA-region move refusal because it holds no instance data. This exemption does not override an immutable `rec.HA` flag or any existing seed/runtime/shape refusal. | |
| +| **Controller, accepted defaults (C3/C5)** | P2a ships in the next dev release after merge; P3 produces merged role and admission evidence before P2b; non-home and pool HA **data** creates stay refused for G3, with 409/new F5 copy. This does not authorize infrastructure mutations. | |
| | **C2, public ingress (§15)** | DNS instructions name configured regional ingress plus `PLATFORM_EDGE_IPS`, never group members' EIPs in configured-ingress mode. DNS guidance cannot widen proxy trust. | |
| | **C3, refuse before mutation (§§11,14)** | Unsupported shape, unknown data provenance and HA moves/imports fail before record, environment, domain claim, storage provisioning, staging or stop intent is written. Cleanup after a partial operation is not the refusal. | |
| | **C4, shared eligibility (H4, A20, §11)** | Capacity, readiness and create admission use one complete, verified observation and shared thresholds. Headroom is a create check only; waking an existing host must retain main's recovery path. | |
| @@ -38,7 +39,7 @@ |
| **P2b, outline only:** claim-free capacity/create eligibility, role writes and full readiness, plus any regional data-proof path needed to lift P2a's conservative create gate. Combining those with display changes would couple API authority, role consumption, a metric loop and boot/admission evidence in one review. Its dependencies and remaining acceptance are listed under **After P1b-3a merges**. Do not implement or review that outline as an executable plan. |
| -**Switch-on (rule 5):** Paul gets the console view and safer doors he requested for G3. P2a switches on in the **first dev release after its implementation merge**, with Task 5's scoped drill scheduled before landing. Snapshot attribution is active for born-HA records immediately; ingress uses the new configured list only when supplied; refusals apply to active HA regions and immutable HA records. No new feature flag. If that dev release/drill cannot be scheduled, retain implementation on its branch. P2b switches on at **G1**, after its merged dependencies and dev witness; keep it on branch without a scheduled G1 release. A planning commit has no runtime switch. |
| +**Switch-on (rule 5):** Paul gets the console view and safer doors he requested for G3. P2a switches on in the **first dev release after its implementation merge**, with Task 5's scoped drill scheduled before landing. Snapshot attribution is active for born-HA records immediately; ingress uses the new configured list only when supplied; refusals apply to active HA regions and immutable HA records. Switch-on also requires Task 5’s verified home data wiring and pre-roll ingress validation. No new feature flag. If that dev release/drill cannot be scheduled, retain implementation on its branch. P2b switches on at **G1**, after its merged dependencies and dev witness; keep it on branch without a scheduled G1 release. A planning commit has no runtime switch. |
| P2a alone finishes neither P2 nor G1. The current series finish line is **G3**: P1b-3, P2, P3 built, dev G1/G2 drills passed, first carloku.com region HA. G5 is the later routine box-swap goal; do not claim it from these doors. Each implementation session owns one stated slice and ends when it merges. This session ends at the local plan commit. |
| @@ -46,8 +47,9 @@ P2a alone finishes neither P2 nor G1. The current series finish line is **G3**: |
| | Round | Brief / findings | Verdict | Invariant / disposition | |
| |---|---|---|---| |
| +| 1 — Opus, 2026-11-01 | `docs/superpowers/plans/REVIEW-BRIEF-REGION-HA-P2-R1.md`; `docs/superpowers/plans/REVIEW-REGION-HA-P2-R1.md`; reviewed tip `e6cfc5bdce84bb94ad5a5f52772a65596ba1150a` | **NOT READY: 1 P1, 9 P2, 11 P3** | P1-1/C1 shared observation; P2-1–9/C1–C3,C6 answered in rev 2 below. P3 dispositions recorded below. No second round dispatched; the controller owns any round 2 within the same budget. | |
| -No P2 review has run. Preserve this table through splits and handoffs; P2a/P2b do not reset a review of the same change. Upstream history stays closed: spec three rounds, P1a three, P1b-1 three, P1b-2 three, dead-holder backoff three; P1b-3a two, final READY AFTER FIXES under N-HA12. Do not reopen those designs. |
| +Round budget used: **1 of 3**; rev 2 is the author’s response, not a READY verdict. Preserve this table through splits and handoffs; P2a/P2b do not reset a review of the same change. Upstream history stays closed: spec three rounds, P1a three, P1b-1 three, P1b-2 three, dead-holder backoff three; P1b-3a two, final READY AFTER FIXES under N-HA12. Do not reopen those designs. |
| Future briefs use `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`. Stop at the first round without P1, fix its P2s without reopening, put P3s on the branch follow-up list. A fourth round needs Paul's scoped go. Two consecutive rounds against the same invariant stop fixes and require Paul's refuse/cut/central-enforcement choice. Task reviews are limited to security, cache, root, termination, production storage, billing or redirect risk; other tasks receive whole-branch review. Census and newly changed security/root/termination/storage behavior still check final fixes inside that budget. No reviewer is dispatched here. |
| @@ -57,28 +59,28 @@ At 24 hours without a merge, or when stopping rule 1 or 2 triggers, the implemen |
| | P2 item | Verified main evidence | Disposition / invariant | |
| |---|---|---| |
| -| Born-HA switch and record stamp | `cmd/console/main.go:475`; `internal/console/seedmove.go:33,47`; `internal/console/apiinstances.go:2306` | Built by P1a. Preserve stamping and exclusions; never migrate on display or create. **N-HA7.** | |
| -| Moves of an immutable HA record | `internal/console/seedmove.go:64`; callers `apiinstancemove.go:427,583`, `apiinstancemove_offline.go:505`; `ha_born_test.go:116` | Built, including stage/start and both older doors. Do not build again. Missing: HA-active source/destination regions when `rec.HA` is false; Task 4. **C3.** | |
| -| App placement of HA records | `internal/console/seedmove.go:134`; `ha_born_test.go:143,247`; `fleets.go:881,955` | Built. Keep the strict read and under-write race protection. Extend only regional refusal gaps, without rewriting placement. **C3.** | |
| -| HA imports | `internal/console/seedmove.go:74`; `apiinstanceimport.go:119,391,718`; `ha_born_test.go:165,179` | Begin/upload/stopped refusals built; one-box seed restriction is `seedfloor.go:88`. Retain these; witness immutable HA record even after configuration is unset in Task 4. **C3/N-HA4.** | |
| +| Born-HA switch and record stamp | `cmd/console/main.go:476`; `internal/console/seedmove.go:33,47`; `internal/console/apiinstances.go:2308` | Built by P1a. Preserve main’s stamping (address-backed instances are stamped today) and exclusions; never migrate on display or create. **N-HA7.** | |
| +| Moves of an immutable HA record | `internal/console/seedmove.go:64`; callers `internal/console/apiinstancemove.go:427,583`, `internal/console/apiinstancemove_offline.go:505`; `internal/console/ha_born_test.go:116` | Built, including stage/start and both older doors. Do not build again. Missing: HA-active source/destination regions when `rec.HA` is false; Task 4. **C3.** | |
| +| App placement of HA records | `internal/console/seedmove.go:134`; `internal/console/ha_born_test.go:143,247`; `internal/console/fleets.go:881,955` | Built. Keep the strict read and under-write race protection. Extend only regional refusal gaps, without rewriting placement. **C3.** | |
| +| HA imports | `internal/console/seedmove.go:74`; `internal/console/apiinstanceimport.go:119,391,718`; `internal/console/ha_born_test.go:165,179` | Begin/upload/stopped refusals built; one-box seed restriction is `internal/console/seedfloor.go:88`. Retain these; witness immutable HA record even after configuration is unset in Task 4. **C3/N-HA4.** | |
| | HA staging fallback | `internal/activator/backend_exec.go:933–939` | Built: HA restore returns before legacy warm-copy/staging path. Test existing behavior, no backend edit. **I2/C3.** | |
| -| Leftover create rail | `internal/console/createleftovers.go:40,64,136`; `apiinstances.go:2252`; `apisidecars.go:394` | Built LTX-only rail; intentionally skips remote, pool and fleet data. Missing arbitrary host-prefix objects, files and lock; Task 3. **C3.** | |
| +| Leftover create rail | `internal/console/createleftovers.go:43,69,136`; `internal/console/apiinstances.go:2252`; `internal/console/apisidecars.go:394` | Built LTX-only rail; intentionally skips remote, pool and fleet data. Missing arbitrary host-prefix objects, files and lock; Task 3. **C3.** | |
| | Non-hibernating socket create | `internal/console/apiinstances.go:2182,2308` | Shape validation and HA stamp exist, but this boundary has no HA-specific non-hibernating socket refusal. Task 3. **C3/§6.1.** | |
| -| No capacity message/throttle | `internal/console/nocapacity.go:27,37,61,123` | Approved text, Retry-After 60 and per-console-process hourly page throttle already exist. Reuse, not rewrite. Current `roomIn`/chooser depend on claims (`:146,166`). P2b. **C4/C6.** | |
| +| No capacity message/throttle | `internal/console/nocapacity.go:31,38,67,125` | Approved text, Retry-After 60 and per-console-process hourly page throttle already exist. Reuse, not rewrite. Current `roomIn`/chooser depend on claims (`internal/console/nocapacity.go:146,166`). P2b. **C4/C6.** | |
| | Headroom/shared policy | `internal/host/headroom.go:13`; `internal/host/edgesfile.go:173,953,1238`; `internal/boxchoice/policy.go:16,63,83` | Existing free/total memory/disk, 15%/10%, age 15m/future 1m, timed publication. `headroom.apps` is absent on main. P2a reads none of it. **C4/rule 4.** | |
| -| Identity and live evidence | `internal/console/boxselect.go:147`; `reqmemo.go:218`; `internal/edgesfile/snapshot.go:160` | Reuse liveEdges and signed box identity verification in P2b; no roster/enrolment or ASG enumeration. Current verifier expects `BoxID`, whereas views identify `Box`; reconcile that explicitly at P2b planning. **C4.** | |
| -| Role doors/CLI | `internal/console/apiboxroles.go:55,115,159`; `authcli.go:554`; `system_roles.go:35,55` | Exist only as signed-roster box/group role writes, with old default/legacy vocabulary. No `control/box-roles` reader/producer on main; `internal/release/changeindex.go:72` has no role scope. Replace in P2b with a merged consumer, not enable these doors. **C5.** | |
| -| Capacity adapter/start | `internal/console/awsregionmetric.go:23,29,78`; `regioncapacity.go:99,121`; `hostclaimops.go:50–64`; `cmd/console/main.go:707` | Carlos/Region EligibleBoxes and one-minute runner exist, but only start inside claim recovery and count through claim executors. P2b moves start; no duplicate metric loop now. **C4/C6.** | |
| +| Identity and live evidence | `internal/console/boxselect.go:147`; `internal/console/reqmemo.go:218`; `internal/edgesfile/snapshot.go:160` | Reuse liveEdges and signed box identity verification in P2b; no roster/enrolment or ASG enumeration. Current verifier expects `BoxID`, whereas views identify `Box`; reconcile that explicitly at P2b planning. **C4.** | |
| +| Role doors/CLI | `internal/console/apiboxroles.go:55,115,159`; `internal/console/authcli.go:554`; `system_roles.go:35,55` | Exist only as signed-roster box/group role writes, with old default/legacy vocabulary. No `control/box-roles` reader/producer on main; `internal/release/changeindex.go:72` has no role scope. Replace in P2b with a merged consumer, not enable these doors. **C5.** | |
| +| Capacity adapter/start | `internal/console/awsregionmetric.go:25,30,58`; `internal/console/regioncapacity.go:99,121`; `internal/console/hostclaimops.go:50–64`; `cmd/console/main.go:707` | Carlos/Region EligibleBoxes and one-minute runner exist, but only start inside claim recovery and count through claim executors. P2b moves start; no duplicate metric loop now. **C4/C6.** | |
| | Full LB readiness | `internal/lbhealth/lbhealth.go:154`; `internal/edge/lbhealth.go:21`; spec §10 | Six local conditions built. Main has no claim-free remote admission/latch/hook-completion report on which a console can assert full readiness. P2b waits for P3; no remote health polling invented. **C5.** | |
| -| Snapshot attribution | `internal/console/remoteinstances.go:259,337`; `apiinstances.go:1062,1182,1251`; `view.go:726` | Fresh tenant/lifetime checks built, but newest report wins regardless of awake and local adopted routes bypass remote attribution. Task 1. **C1.** | |
| -| Ingress list | `cmd/console/main.go:1334`; `internal/console/server.go:1580,1632`; `view.go:199` | PLATFORM_EDGE_IPS plus every live box EIP today. No CONSOLE_REGION_INGRESS parser. Task 2. `authcli.go:1202` separately uses EdgeIPs for proxy trust: do not add ingress there. **C2.** | |
| +| Snapshot attribution and rollout | `internal/console/remoteinstances.go:259,337,459`; `internal/console/apiinstances.go:962,1133,1326,1415`; `internal/console/instancepage.go:298`; `internal/console/apiretry.go:90`; `internal/console/view.go:726` | `foldRollout` keeps a last-read box, `facts.host` a newest box, and local adopted rows bypass remote attribution. Task 1 replaces all HA rollout/health selection with one observation, including single GET and retry. **C1.** | |
| +| Ingress list | `cmd/console/main.go:1339`; `internal/console/server.go:1580,1632`; `internal/console/view.go:199` | PLATFORM_EDGE_IPS plus every live box EIP today. No CONSOLE_REGION_INGRESS parser. Task 2. `internal/console/authcli.go:1202` separately uses EdgeIPs for proxy trust: do not add ingress there. **C2.** | |
| -Paths omitted before a filename in this table share its last explicit directory. Exact ranges explain existing blocks; task file lists below are authoritative edit destinations. |
| +All existing-code paths and lines are pinned to the citation base above; task file lists below are authoritative edit destinations. |
| ## Global constraints |
| - **C1/security:** session, CSRF where applicable, owner/member byte-identical 404, fresh authentication last. Team/service scope remains the existing door's scope. No tenant name, host, bucket or box detail before authorization. |
| -- **C3/N-HA7:** `haRegion("")` resolves through HomeRegion. The immutable record flag remains effective with HARegions unset. Ordinary new data-prefix admission uses prospective `shouldStampHA(rec) && !seeded`; it does not widen HA to seed transports. Static/address-backed records, replicas, sidecars and rootfs keep main's stamping exclusions; never stamp them to make a test pass. |
| +- **C3/N-HA7:** `haRegion("")` resolves through HomeRegion. The immutable record flag remains effective with HARegions unset. `HAData := s.shouldStampHA(rec) && !seeded && rec.DerivesPaths()`; `DerivesPaths()` is exactly instance kind with `len(rec.AddrsOrDefault()) == 0` (`internal/provision/provision.go:487`). Address-backed instances keep main’s stamp but are explicitly outside HAData and F1. Static records, replicas, sidecars and rootfs keep main’s stamp exclusions. F1 also checks seeded socket creates; being unstamped does not exempt a socket from the shape rule. |
| - **C3:** preserve existing hosts-history, seed floor, rootfs, binding, private-storage and create-only CAS rails. An existence retry gets the door's ordinary duplicate response before examining its own live replica. |
| - **C4:** at least 15% free memory, 10% free disk, generation at most 15 minutes old and at most 1 minute ahead. Missing totals are not eligible. No headroom gate in edge, activator, restart, timer or ordinary wake paths. |
| - **C5/rule 4:** no assumed Apps, role, drained, booting, latch, hook or readiness wire field from an unmerged producer. The spec's contract is a requirement, not evidence that main publishes it. |
| @@ -98,11 +100,12 @@ Paths omitted before a filename in this table share its last explicit directory. |
| | File | Responsibility | |
| |---|---| |
| -| New `internal/console/haawake.go`, `haawake_test.go` | Pure tenant/lifetime-bounded awake reporter selection over existing appFacts. | |
| -| `internal/console/{remoteinstances.go,apiinstances.go,view.go,overview.go,instancepage.go}`; new `haawake_wiring_test.go`; existing templates and `instancecopy.go` | Shared API/page attribution, including locally adopted rows; copy keys. | |
| +| New `internal/console/haawake.go`, `haawake_test.go` | One tenant/lifetime-bounded HA observation with selected rollout, health and report time; retain stale hazard evidence in appFacts. | |
| +| `internal/console/{remoteinstances.go,apiinstances.go,view.go,overview.go,instancepage.go,apiretry.go}`; new `haawake_wiring_test.go`; existing templates and `instancecopy.go` | Shared observation adapters for list/single API, local/remote rows, detail and retry; copy keys. No adapter selects a box. | |
| +| `apimode.go`, `instances_cli.go`; `instances_rollout_test.go`, new `instances_ha_test.go` | Add decoded observation fields and `instances list --json`; use the server’s rollout and health without selection. Root census applies. | |
| | New `internal/console/regioningress.go`, `regioningress_test.go`; `cmd/console/main.go`, `main_test.go` | Strict configured-ingress parsing and startup wiring. | |
| -| `internal/console/{server.go,view.go,edgefold_test.go}` | DNS-only source selection; preserve legacy mode and proxy trust. | |
| -| New `internal/console/hacreate.go`, `hacreate_test.go`; `createleftovers.go`, `apiinstances.go`, `apisidecars.go`, `domainattach.go` | Pre-write shape/provenance refusals, using existing region/data/store types. | |
| +| `internal/console/{server.go,view.go,edgefold_test.go,server_test.go}` | DNS-only source selection; preserve legacy mode and proxy trust. | |
| +| New `internal/console/hacreate.go`, `hacreate_test.go`; `createleftovers.go`, `apiinstances.go`; existing `ha_born_test.go`, `rootfs_test.go` | Pre-write shape/provenance refusals and fixture corrections. Sidecar/domain handlers need no production edit in P2a; witness their unchanged doors. | |
| | `internal/console/{seedmove.go,apiinstancemove_offline.go,apiinstancemove.go,apiinstanceimport.go,fleets.go}`; new `hatransfers_test.go` | HA source/destination and immutable import refusal gaps. | |
| | New `internal/console/hap2_wiring_test.go` | Real handlers and store counters; no duplicate simulated admission algorithm. | |
| | `docs/site/cli.md` | Only accepted copy describing changed command behavior; no new top-level verb in P2a. | |
| @@ -111,62 +114,82 @@ Paths omitted before a filename in this table share its last explicit directory. |
| ### Task 1: Show the reported awake box on the dev console |
| -**Files:** create `haawake.go`, `haawake_test.go`, `haawake_wiring_test.go`; modify the attribution/view/template files in the file map. All paths in this task are under `internal/console/`. |
| +**Files:** create `internal/console/{haawake.go,haawake_test.go,haawake_wiring_test.go}`; modify the console attribution/retry/view/template files in the file map, plus root `apimode.go`, `instances_cli.go`, `instances_rollout_test.go`, new `instances_ha_test.go` and `docs/site/cli.md`. Console-only paths below are relative to `internal/console/`; root files are named explicitly. |
| + |
| +**Current consumers / C1:** last-read `boxJoin` rollout (`internal/console/apiinstances.go:962,1133,1182,1326`), single GET (`internal/console/apiinstances.go:1415,1425`), local detail (`internal/console/instancepage.go:298`), remote health (`internal/console/remoteinstances.go:337,459`), row health (`internal/console/overview.go:317`), retry (`internal/console/apiretry.go:90`) and CLI cells/decoder (`instances_cli.go:573,583,596`; `apimode.go:3337`). These are one invariant: no HA consumer may infer a unique awake reporter independently. |
| + |
| +**Interfaces:** extend existing `hostReport`/`fleetReports` in `remoteinstances.go` to retain per-box rollout candidates (including retry book/epoch/version), region, generation, freshness and stale awake/transient hazards **before** `foldFleetReports` drops stale boxes (`internal/console/remoteinstances.go:259,263`). Reuse the tenant check and existing `foldRollout` projection per individual box to retain rollout fields; never flatten HA candidates into `boxJoin.rollouts` first. Keep legacy `appFacts.host` behavior for non-HA callers. |
| + |
| +Produce one `type haObservation struct { Box, State string; At *time.Time; Rollout *rolloutView; Health string }` and `func (f appFacts) haObservation(rec provision.Record) haObservation` in `haawake.go`. This is the **only** HA decision function. It accepts existing cached report evidence, an injected observation time and home-region normalization carried by appFacts; it performs no I/O. Only records with `rec.HA` consume it, even when HARegions is unset. The function returns: |
| -**Interfaces:** consume `appFacts`, `hostReport`, `provision.Record` and the existing `remoteFacts` accessor. Produce `type haAwakeView struct { Box, State string }` and `func (f appFacts) haAwake(rec provision.Record) haAwakeView`. State is one of `awake`, `asleep`, `unknown`, `conflict`; only awake has a Box. Add additive API fields `awake_box,omitempty` and `awake_box_state,omitempty` to `instanceListRecord`, and `AwakeBox, AwakeBoxState string` on RouteView and InstanceRow, threaded through `overview.go:303` assembleInstanceRows into row/detail templates. These are observations, never stored in Record. Keep `served_by` as the existing adopted/routed set for compatibility; do not relabel it as the running owner. |
| +| Evidence after account/app and `report.at.After(rec.CreatedAt)` checks | State / projection (C1) | |
| +|---|---| |
| +| Two or more fresh awake candidates | `conflict`; empty Box, nil At/Rollout, `healthUnknown`. Never pick by label, read order or newest timestamp. | |
| +| Incomplete read; matching transient; missing process/tenant evidence; no matching report; or a known box in the effective region with a stale matching last-awake/transient report | `unknown`; empty Box, nil At/Rollout, `healthUnknown`. Stale evidence is retained only as a hazard, never an awake assertion. A stale holder plus fresh asleep adopters stays unknown. | |
| +| Complete evidence with exactly one fresh awake candidate and no uncertainty above | `awake`; that candidate’s Box, generation At and **entire** tenant/lifetime-checked Rollout (including Installed, Serving and retry fields). Health comes from that candidate’s process state using existing health vocabulary. | |
| +| Complete matching fresh, explicit asleep reports, no awake/transient/stale hazard | `asleep`; empty Box, nil Rollout, existing asleep health word. At is the oldest matching report used for this conclusion. No snapshot invents an awake box or an installed/serving build. | |
| + |
| +Do not use absence from Rollout.Hosts as explicit asleep. `status.BoxStale` remains the age rule (`internal/status/fleet.go:120,138`): 5-minute cadence, stale after 15 minutes, plus console cache age. At is snapshot generation in UTC RFC3339, never cache-load time; omit it where no conclusion has a valid generation. Age is calculated from At at rendering, not persisted as a ticking value. |
| -- [ ] **Step 1: Write failing tests.** `TestHAAwakeBoxIgnoresSleepingAdopters`: A awake and B newer/asleep still selects A; no adopted local row overrides it. `TestHAAwakeBoxTenantAndLifetime`: foreign/missing tenant, report at or before CreatedAt, stale snapshot and transient process cannot supply Box. `TestHAAwakeBoxAmbiguous`: two fresh awake boxes give conflict and no Box; no matching report, partial read or no known process state gives unknown; complete matching asleep reports with no awake/transient give asleep. Input order never changes the result; inputs stay immutable. |
| +Add additive `awake_box,omitempty`, `awake_box_state,omitempty`, `awake_box_at,omitempty` to **both** `instanceListRecord` and `instanceGetRecord`, and decoder fields on `apiInstanceRecord` (`apimode.go:3337`). In the single GET add HA-only `rollout,omitempty` and `health,omitempty` projections so it agrees with the list; leave non-HA GET’s shape alone. Carry the observation on RouteView and InstanceRow into row/detail templates. Keep `served_by` as the adopted/routed set. For HA records the selected observation also supplies rollout/health in existing fields: unknown/conflict/asleep must not expose a different `rollout.box`, awake flag or serving build. Clear HA `staged_version`/local version fallback where it would resurrect a discarded box’s Installed value. Preserve non-HA fields and behavior. |
| + |
| +- [ ] **Step 1: Write failing selection tests.** `TestHAAwakeBoxIgnoresSleepingAdopters`: leo awake, newer sophie asleep, and a platform-local asleep adopter always select leo’s rollout, Serving and generation. `TestHAAwakeBoxTenantAndLifetime`: foreign/missing tenant and reports at/before CreatedAt supply no Box or rollout/retry evidence. `TestHAAwakeBoxAmbiguous`: two awake reporters in either order yield conflict; incomplete, missing/transient and no process evidence yield unknown; explicit matching asleep evidence yields asleep with oldest At. `TestHAAwakeBoxStaleHolder`: advance the injected clock beyond 15 minutes while fresh asleep adopters remain; the old awake/transient reporter makes the result unknown, never A2. Test just before/after the stale boundary, timestamp serialization, unset HARegions and immutable inputs. |
| - [ ] **Step 2: Run** `nice -n 19 go test ./internal/console -run 'TestHAAwakeBox' -count=1`. Expected FAIL before implementation. |
| -- [ ] **Step 3: Implement C1 only in haAwake.** Reuse fleetReports' freshness and host's tenant/CreatedAt predicate; do not change `appFacts.host`'s version/alias selection globally. Apply the new observation to born-HA rows in both local and remote branches of `addRemoteRows`, the Instances list/detail and API. A locally adopted route carries no process evidence of its own. Keep all non-HA views unchanged. Label it as the last snapshot, not a live lock read. Copy IDs A1–A5. |
| -- [ ] **Step 4: Add/run** `TestHAAwakeBoxPageAndAPI`: the actual authorized page/detail/API agree on the same observation; stranger/team-out-of-scope get existing neutral answers, no foreign Box. `TestHAAwakeBoxNoExtraReads`: feed existing reports through the real accessor, render twice inside the cache TTL, assert no new S3 calls attributable to selection. Run Step 2 and `nice -n 19 go test ./internal/console -run 'TestRemoteFacts|TestInstanceGrouping|TestHAAwakeBox' -count=1`; expected PASS. |
| -- [ ] **Step 5: Commit** `region-ha p2a: show the last reported awake box`. This is the first implementation merge, including its dev-visible view and witness; no scaffold-only merge. |
| +- [ ] **Step 3: Implement C1 in one place.** `remoteFacts` supplies all HA candidates from `pageBoxReports`; defer source loading until authorized records are available, skip legacy status warming/join on all-HA lists, and reuse request-memo loads on mixed lists rather than loading the same reports twice; every HA adapter calls `facts.haObservation(rec)` or passes its result. Wire it into `instanceHealth` before counts/filtering and after any legacy metric/fleet fallback; `addRemoteRows` covers both local adopted and remote rows. `assembleInstanceRows` and Running-tab counts use its Health instead of metrics/boxAwake OR-inference (`internal/console/overview.go:194,317`). Detail consumes the same observation even on its remote branch, instead of suppressing all remote rollout or calling the weaker local join. The authorized single GET uses the same accessor after `readRecord`; snapshot failure yields a 200 with unknown observation, not a false absence. Retry retains the record it currently discards, uses the same selected Rollout for HA, then applies existing retryable/version/book/epoch checks; unknown/conflict/asleep produce existing refusal and **no grant or serial write**. Non-HA consumers keep loadRolloutJoin. No consumer may fall back from a nil HA Rollout to legacy `join.rollout` or `facts.host`. Copy requirements A1–A6. |
| +- [ ] **Step 4: Add production-wired witnesses.** `TestHAAwakeBoxPageAndAPI` drives authorized list page, local/remote detail, list API and single GET for awake/unknown/conflict/asleep; assert Box/At, health, Installed/Serving and retry eligibility agree. Test stranger/team-out-of-scope neutral answers and no foreign box leak. `TestHAAwakeBoxRetryUsesObservation`: contradictory/partial/stale evidence writes zero retries; a uniquely awake held reporter uses its own book and epoch, never the sleeping adopter’s. `TestHAAwakeBoxNoExtraReads` renders all HA consumers within TTL and verifies one shared load, not one per view; include a cold single GET and retry. A wiring guard rejects direct HA selection through `boxJoin.rollout`, `facts.host` or local metrics in these adapters. Run Step 2 plus `nice -n 19 go test ./internal/console -run 'TestRemoteFacts|TestInstanceGrouping|TestHAAwakeBox' -count=1`; expected PASS. |
| +- [ ] **Step 5: CLI JSON and census witness.** Current `runInstancesList` has no JSON flag (`instances_cli.go:741`); add `--json` and its reviewed help/usage, decode the three observation fields in `apimode.go`, and encode `{instances,truncated,total}` from the existing API client result. Keep all selection on the server; retain corrected rollout and health in JSON and ordinary table cells. JSON mode emits no table, hint or trailing prose. Do not add a box column. `TestInstancesHAJSON` drives actual API decoding and CLI output for four states, timestamp round-trip, old-server field omission and truncation metadata; `TestInstancesHARolloutCells` checks selected Serving and unknown/asleep dashes. Use fake console/auth and `carlosTestEnv` plus scratch cwd for any binary subprocess. Run `nice -n 19 go test . -run 'TestInstancesHA|TestInstancesRollout' -count=1`. Update `docs/site/cli.md` for the flag and JSON-only observation contract (D1/J1); these two root source files and their envelopes require a census card/reviewer before implementation merge. |
| +- [ ] **Step 6: Commit** `region-ha p2a: show the last reported awake box`. This is the first implementation merge, with its view, CLI JSON, witnesses and census approval together; no scaffold-only merge. |
| ### Task 2: Use configured regional ingress for DNS instructions |
| -**Files:** ingress parser/startup/source files from the file map; update accepted `domainGuidance` copy in `view.go` and CLI docs in the same task. |
| +**Files:** ingress parser/startup/source files from the file map, `internal/console/server_test.go` for `TestDomainGuidanceSteering` (`internal/console/server_test.go:1652`); update accepted `domainGuidance` copy in `view.go` and CLI docs in the same task. |
| **Interfaces:** `Config.RegionIngress []string` (DNS destinations only), plus `func ParseRegionIngress(raw string) ([]string, error)` in `internal/console/regioningress.go`, called by `cmd/console` startup. Format of **CONSOLE_REGION_INGRESS** for this plan is comma-separated IP literals (NLB's static EIPs), matching PLATFORM_EDGE_IPS's address vocabulary; tofu deployment wiring must supply the complete regional set. Trim, canonicalize IPv4/IPv6, de-duplicate in first-seen order. Empty/unset retains legacy behavior. Non-empty with any invalid item fails startup; never silently fall back to member EIPs. |
| -- [ ] **Step 1: Write failing tests.** `TestRegionIngressParsing`: blank legacy, whitespace, duplicate, IPv4/IPv6, invalid/hostname/URL/port rejected. `TestConfiguredIngressSuppressesMemberIPs`: in configured mode output is PLATFORM_EDGE_IPS followed by RegionIngress, deduplicated; no live-box fold even during S3 failure. Unset mode retains today's union and cache. `TestIngressDoesNotWidenProxyTrust`: new ingress alone does not make `trustsProxy` accept a peer; existing loopback and explicitly trusted EdgeIPs behave as before. |
| +- [ ] **Step 1: Write failing tests.** `TestRegionIngressParsing`: blank legacy, whitespace, duplicate, IPv4/IPv6, invalid/hostname/URL/port rejected. `TestConfiguredIngressSuppressesMemberIPs`: in configured mode output is PLATFORM_EDGE_IPS followed by RegionIngress, deduplicated; no live-box fold even during S3 failure. Unset mode retains today’s union and cache. `TestConfiguredIngressSuppressesSteering` sets SteeringHost and tests apex/subdomain guidance contains only A records to the configured union, never a CNAME. Update `TestDomainGuidance` for every changed legacy sentence as well as the configured branch. `TestIngressDoesNotWidenProxyTrust`: new ingress alone does not make `trustsProxy` accept a peer; existing loopback and explicitly trusted EdgeIPs behave as before. |
| - [ ] **Step 2: Run** `nice -n 19 go test ./internal/console -run 'TestRegionIngress|TestConfiguredIngress|TestIngressDoesNotWidenProxyTrust' -count=1`; expected FAIL. |
| -- [ ] **Step 3: Implement C2.** Parse at console startup, before NewServer/listener. Do not merge RegionIngress into Config.EdgeIPs: `authcli.go:1210` uses that as authority. In configured mode `edgeIPs` returns the static DNS union without `foldedEdgeIPs`; all callers of `dnsTargets` inherit it. Preserve apex A-record versus subdomain CNAME behavior, with accepted neutral ingress wording I1–I5; do not promise the console discovers NLB addresses. Validate proposed ingress against deployment outputs before enabling it. In the deployment recipe require the agents' existing PLATFORM_EDGE_IPS to recognize that same public set before any NLB cut-over; console instructions alone cannot change their DNS verdict. |
| +- [ ] **Step 3: Implement C2.** Parse at console startup, before NewServer/listener. Do not merge RegionIngress into Config.EdgeIPs: `internal/console/authcli.go:1210` uses that as authority. In configured mode `edgeIPs` returns the static DNS union without `foldedEdgeIPs`; all callers of `dnsTargets` inherit it. In configured mode suppress `SteeringHost` in dnsTargets: offer only A-record guidance for apexes **and subdomains**, even if steering is armed. `internal/host/steering_loop.go:126` builds steering from edges files, not RegionIngress; no CNAME may promise configured ingress until a later merged steering producer uses that list. Unset mode retains main’s steering behavior. Use reviewed I1/I2/I5, with I3/I4 restricted to legacy mode; do not promise the console discovers NLB addresses. Validate the complete proposed ingress with this parser **before rolling** the console, since invalid nonempty input stops startup. Verify console PLATFORM_EDGE_IPS contains only intended public ingress, with no member-only/platform-box EIP, before enabling configured mode. In the deployment recipe require the agents' existing PLATFORM_EDGE_IPS to recognize that same public set before any NLB cut-over; console instructions alone cannot change their DNS verdict. |
| - [ ] **Step 4: Add/run** `TestRegionIngressStartupWiring` in `cmd/console/main_test.go` using injected getenv/parser input; no real process or credentials. Run Step 2 plus `nice -n 19 go test ./cmd/console -run TestRegionIngress -count=1` and `nice -n 19 go test ./internal/console -run 'TestEdgeFold|TestDomainGuidance' -count=1`. Expected PASS; configured mode makes **zero** fold reads, and no network address is looked up during parsing. |
| - [ ] **Step 5: Commit** `region-ha p2a: use regional ingress in DNS guidance`. |
| ### Task 3: Refuse unsafe HA creates before any side effect [own review: security/storage gate] |
| -**Files:** new `internal/console/hacreate.go`, `hacreate_test.go`; modify createleftovers/apiinstances/apisidecars/domainattach files as listed. |
| +**Files:** new `internal/console/hacreate.go`, `hacreate_test.go`; modify `createleftovers.go`, `apiinstances.go`, `ha_born_test.go`, `rootfs_test.go`. No sidecar/domain handler edit is needed for the dropped F4. |
| + |
| +**Interfaces / C3:** `func (s *Server) haCreateShapeRefusal(rec provision.Record) *doorRefusal` returns F1/400 iff `s.haRegion(rec.Region) && rec.KindOrDefault() == "instance" && len(rec.AddrsOrDefault()) == 0 && !rec.HibernateOrDefault()`. This applies equally to plain and `--from` creates, before their paths split; an unstamped seed is not exempt. Use effective region after home/placement normalization, not raw request input. Address-backed records default non-hibernating (`internal/provision/provision.go:537`) and are outside this predicate. |
| -**Interfaces:** produce `func (s *Server) haCreateShapeRefusal(rec provision.Record) *doorRefusal` and `func firstHALeftover(ctx context.Context, st release.Store, prefix string) (relative string, err error)`. `firstHALeftover` uses existing `release.PageLister.ListPage(ctx,prefix,"",1)`, where prefix is `activator.HibernatePrefix(cfg.HibernatePrefix,host)+"/"`. Missing bounded-list support is an error, never a fallback to unbounded List. Add `HAData bool` to leftoverCreate: the ordinary instance caller sets it from `s.shouldStampHA(rec) && !seeded` before the final stamp; seed/import creates retain their existing separate transport rails and never receive an HA stamp. Consume `SeedData` only when it is the configured home data store at bucket root (`server.go:548`); never use the deployment Releases store or derive a new bucket client from an unverified edges field. |
| +Add `HAData bool` to leftoverCreate, set exactly to `s.shouldStampHA(rec) && !seeded && rec.DerivesPaths()` before stamping (`internal/console/seedmove.go:47`; `internal/console/apiinstances.go:2308`). This explicitly excludes Addr **and** Addrs instances from prefix proof while preserving their existing stamp; seed/import, static, replica, sidecar and rootfs exclusions remain. `firstHALeftover(ctx, st, prefix) (class string, err error)` uses `release.PageLister.ListPage(ctx,prefix,"",1)` for `activator.HibernatePrefix(cfg.HibernatePrefix,host)+"/"`. Missing bounded listing is an error. Classify the first key into fixed `lock`, `files`, `replica` or `other`; return no raw key, object SHA, contents or bucket. Use SeedData only at the configured home data-bucket root (`internal/console/server.go:551`). |
| -- [ ] **Step 1: Write failing tests.** `TestHACreateShapeBeforeWrites`: HA-active ordinary socket instance with Hibernate false rejects 400; normal hibernating instance passes this shape check; non-HA/static/address route behavior remains main's. `TestHACreatePrefixObjects`: one object each at lock.json (legacy, corrupt or another-lifetime marker), files/0/manifest, a sealed trio object, each LTX level, and an unknown predecessor key all reject 409 and name only the relative leftover. A sibling prefix never matches. Refuse every existing lock rather than inventing an exception for an unallocated new lifetime. Empty prefix passes. No object body/secret/bucket name reaches the response. |
| +- [ ] **Step 1: Write failing tests.** `TestHACreateShapeBeforeWrites`: plain **and --from** HA socket creates with Hibernate false get F1/400 before writes; normal hibernating socket proceeds to its existing rails; non-HA, static and Addr/Addrs-backed shapes retain main behavior. `TestHACreatePrefixObjects`: lock.json (legacy/corrupt/other lifetime), files/0/manifest, sealed object, each LTX level and an unknown key all get F2/409 with only a fixed class; empty/sibling prefixes pass. No hash/key/bucket/body appears in JSON or HTML. Address-backed creates get no F1 or HA prefix listing, including remote/pool cases. |
| - [ ] **Step 2: Run** `nice -n 19 go test ./internal/console -run 'TestHACreate' -count=1`; expected FAIL. |
| -- [ ] **Step 3: Implement C3.** Add the shape check after ValidateShape and effective region resolution, before any mutation. Reorder `leftoverReplicaRefusal` entry: only `!c.HAData && !leftoverCheckApplies(...)` may take the old early return. Then read record existence, return ordinary duplicate/read failures, and for c.HAData require authoritative local coordinates before the bounded entire-host-prefix check. Thus remote HA creates cannot skip the gate through the existing early return. Run the proof before the old LTX rail; preserve old move-staging LTX protection. A duplicate retry returns today's duplicate response without inspecting its own data. Missing store, unsupported bounded listing, listing error and a stamped region or pool whose data this console cannot authoritatively inspect get 503 **before writes** (F3); a found object gets 409/F2; no IAM expansion or best-effort acceptance. Static first-route attach creates no data, so no data-prefix check, but its capacity gate remains P2b. |
| +- [ ] **Step 3: Implement C3 before mutation.** Add F1 after ValidateShape (`internal/console/apiinstances.go:2182`) and effective-region resolution, before env binding/seed dispatch. In `leftoverReplicaRefusal` (`internal/console/createleftovers.go:136`), only `!c.HAData && !leftoverCheckApplies(...)` may take the old early return. Read record existence first; return ordinary duplicate/read failures before any new data proof or placement cut. For HAData, a non-home effective region or nonempty pool gets **F5/409**, the deliberate G3 cut, with no Retry-After or operator-access remedy. For home, unpooled HAData, require HibernateBucket, non-nil SeedData, and normalized record region equal to cfg.Region so `leftoverCheckApplies` can prove authority (`internal/console/createleftovers.go:43`). Missing/mismatched wiring, unsupported bounded listing or listing failure gets **F3/503** with retry wording; a predecessor object gets F2/409. Perform the bounded whole-prefix proof before the existing LTX/move-staging rail; retain that rail. The create-time proof is no reservation; keep first-wake’s empty-prefix proof. No IAM expansion, speculative bucket clients or unbounded LIST fallback. |
| - **Deliberate cut / C3:** P2a can prove emptiness only for `leftoverCheckApplies(region,pool)` plus non-nil SeedData. Other HA data creates remain refused until P2b has a reviewed regional proof path. This includes an opaque pool even if an operator knows it happens to share a bucket. Existing hosts continue to wake. Do not make sidecars HA: the main sidecar stamp exclusion and unfinished duty ownership remain; until the merged sidecar runtime/eligibility is available, refuse new standalone sidecars in HA-active regions with F4. P2b must finish §11's sidecar create behavior before calling P2 complete. No change to co-spawn sidecars or existing records. |
| + **Controller ruling / C3/C4:** standalone sidecars retain main’s success/duplicate/LTX behavior and remain unstamped in HA regions (`internal/console/apisidecars.go:394`; `internal/console/ha_born_test.go:84`). **F4 is dropped.** First-domain static creates also retain main’s behavior (`internal/console/domainattach.go:253,679`); no HAData check. P2b adds the shared §11 capacity gate to those doors. Existing-host wakes remain outside create admission. |
| -- [ ] **Step 4: Write/run** `TestHACreateUninspectableRefusesBeforeWrites` and `TestHACreateDuplicatePrecedesReplica`: home/remote/pool, unchanged non-HA fleet placement, missing PageLister, S3 failure, private-storage app, --from/import requests and lifetime-on/off paths. Plain prospective born-HA creates use the new proof; --from remains on its existing seed-floor/leftover transport and stays unstamped. Exercise actual handlers and count protected writes: zero record/lifetime registration, claim, env binding, grant/provision, serial/index or staging writes on refusal. Explicit HA import refusal takes precedence over this data-proof gate; do not replace seed-floor or existing seed transport with this ordinary-create proof. Keep the born-HA path's first-wake empty-prefix proof; the create-time observation is not a reservation against concurrent writers. Update `ha_born_test.go:84` to preserve --from/ordinary stamping checks while asserting the deliberate active-HA standalone-sidecar refusal (and no HA stamp), and keep a successful non-HA sidecar stamping-exclusion witness. Supply an empty bounded home data store to successful ordinary HA fixtures; never disable the new gate to get a pass. Run Step 2 and `nice -n 19 go test ./internal/console -run 'TestCreateStampsBornHA|TestSeedsAndSidecarsAreNeverStampedHA|TestLeftover|TestCreateRefuses|TestCreateAllows|TestCreateSkips|TestCreateRetry' -count=1`. Expected PASS with old non-HA cases unchanged. |
| +- [ ] **Step 4: Wire refusal witnesses.** `TestHACreateUninspectableRefusesBeforeWrites` covers remote/pool F5/409 separately from home missing-store/missing PageLister/list error F3/503, private storage and lifetime-on/off. `TestHACreateDuplicatePrecedesReplica` covers existing instance and sidecar retries before data checks/cuts, preserving each door’s main duplicate text. Exercise actual handlers: refused requests write zero record/lifetime/claim/env/store-grant/provision/serial/index/staging mutations. --from stays on seed-floor/leftover transport without stamp, but F1 applies; import’s active-HA refusal precedes seed data work. Non-HA fleet behavior stays unchanged. |
| + |
| + **Existing fixtures whose setup/expectations change (P2-6 / C3):** `TestCreateStampsBornHA` (`internal/console/ha_born_test.go:45`) currently creates explicit ie with no home/data wiring: split remote ie into F5/409/no writes, then set HomeRegion=ie and coherent cfg.Region/normalized record region, HibernateBucket and empty bounded SeedData for successful explicit-home and empty-home stamps. Keep non-HA/off-switch assertions. `TestSeedsAndSidecarsAreNeverStampedHA` (`internal/console/ha_born_test.go:84`) gets the same home wiring for its plain-create control; preserve its successful HA standalone sidecar and seed exclusions. `TestStaticRecordIsNotStampedAndDoesNotBlockAMove` (`internal/console/ha_born_test.go:205`) keeps no HA refusal for static moves, adds destinations into HA, and supplies home data wiring to its binary stamp control. `TestRootfsCreateIsNeverBornHA` (`internal/console/rootfs_test.go:588`) changes its rootfs release fixture to hibernating so the successful create still proves no HA stamp, explicitly checks that the original non-hibernating socket shape now gets F1/400, and wires the empty home store for its binary control. Main’s `unplacedRootfsApp` ships Hibernate=false (`internal/console/rootfs_test.go:465,468`); no runtime exception is hidden in F1. Never set HAData=false or bypass a gate to rescue fixtures. Run Step 2 plus `nice -n 19 go test ./internal/console -run 'TestCreateStampsBornHA|TestSeedsAndSidecarsAreNeverStampedHA|TestStaticRecordIsNotStamped|TestRootfsCreateIsNeverBornHA|TestLeftover|TestCreateRefuses|TestCreateAllows|TestCreateSkips|TestCreateRetry' -count=1`; expected PASS. |
| - [ ] **Step 5: Commit** `region-ha p2a: refuse unsupported HA creates before writes`. |
| ### Task 4: Close regional move/import refusal gaps [own review: production storage] |
| -**Files:** transfer files in the file map; new `internal/console/hatransfers_test.go`. Preserve main's existing P1a tests. |
| +**Files:** transfer files in the file map; new `internal/console/hatransfers_test.go`. Preserve main’s P1a and provision CAS protections; no change to `provision.SetRecordRegion`. |
| -**Interfaces:** add `func (s *Server) haTransferRegion(rec *provision.Record, to string) string` in `seedmove.go`: return the display region which blocks, in priority order immutable HA record's source, active HA source, active HA destination, else empty. Use existing home normalization and approved `haMoveSentence`. Extend import refusal to take both the record flag and destination region; update all three callers consistently. The record flag remains authoritative even when the configuration is unset. |
| +**Interfaces / C3:** `func (s *Server) haTransferRegion(rec *provision.Record, to string) string` in `seedmove.go` normalizes source/target with existing home helpers. In order: immutable `rec.HA` blocks from its source, irrespective of HARegions; normalized no-op returns empty; `rec.KindOrDefault() == "static"` returns empty (no instance data); otherwise active HA source blocks, then active HA destination, else empty. The static exemption is only from the new regional refusal and cannot bypass existing seed/runtime/shape restrictions. For apps place, evaluate **only records whose normalized Region differs from target**, then apply this helper; pass that changed-record set to the HA preflight instead of main’s whole-app placeHABlock; keep main’s immutable-HA CAS rule intact. Extend `refuseHAImport` to `(w, rec *provision.Record)` and test `rec.HA || s.haRegion(rec.Region)` at each caller (`internal/console/apiinstanceimport.go:119,391,718`). Begin constructs an unstamped record, so its flag check is defensive; upload/stopped may encounter a flag if configuration has changed or a record was restored. |
| -- [ ] **Step 1: Write failing tests.** `TestHAMixedMoveRegionsBeforeWrites`: HA→legacy, legacy→HA, HA→HA, legacy record in an HA-active source, home represented as empty and as its code; source flag true with HARegions unset; both offline stage and start. Assert 409 names the blocking region and no OfflineStart, stage journal, stop, hold, instance/env/control mutation. A legacy→legacy case preserves its result. `TestHAImportFlagSurvivesSwitchOff`: HA record at begin/upload/stopped refuses even when HARegions is unset; active-region false-flag imports continue to refuse; non-HA import behavior is unchanged. |
| +- [ ] **Step 1: Write failing tests.** `TestHAMixedMoveRegionsBeforeWrites`: HA→legacy, legacy→HA, HA→HA, legacy record in active HA source, both home spellings, flag true with HARegions unset; offline stage/start plus legacy and Phase-1 doors. Assert 409 names blocking region and no OfflineStart/stage journal/stop/hold/env/control mutation. `TestHAImportFlagSurvivesSwitchOff` tests immutable HA at upload/stopped after switch-off; begin’s active-region check and defensive flag predicate are explicit separate cases, not a claim begin can load an existing HA record. Non-HA imports retain main behavior. |
| - [ ] **Step 2: Run** `nice -n 19 go test ./internal/console -run 'TestHAMixedMove|TestHAImportFlag' -count=1`; expected FAIL. |
| -- [ ] **Step 3: Implement C3 centrally.** Call the transfer rule after request region syntax/ownership checks and before `offlineClaimEvidence`, manifest/fleet work or writes in `offlineBeginChecks`; move the evidence read later if needed. Recheck a staged move when it starts, as main already does. Apply the same refusal to legacy/Phase-1 initiation so an alternative door cannot bypass it. Preserve abort/revert/finish cleanup of already-started operations; never strand a stopped legacy host by globally rejecting recovery verbs. Apply the rule to `carlos apps place` before manifest/registry writes and during its existing write recheck, including a legacy app returning to HA-active home. `placeAppTarget` (`fleets.go:783,817`) accepts only home (`target == ""`) or fleet/<name>, not arbitrary region codes: normalize home and reject active HA source/home before `SetAppPlacementContext` (`:928`); do not invent a regional apps-place API. Retain P1a's HARecord CAS refusal, seed/rootfs restrictions and strict read. |
| -- [ ] **Step 4: Add/run** `TestHAPlaceRegionsBeforeWrites`, `TestHATransferCleanupStillWorks` and main's `TestMoveDoorsRefuseHAHostBeforeAnyWrite|TestMoveRefusalNamesTheHomeRegion|TestImportRefusedIntoHARegionInOneBoxRegion|TestImportUploadAndStoppedRefusedInHARegion|TestPlaceRefusedForAppWithHAHost|TestPlaceRefusesAnHARecordCreatedBetweenItsScans`. Verify no rejection of authorized cleanup and no capability advertisement for unavailable HA moves. The activator HA staging bypass is an existing regression witness, not a new implementation task. Expected PASS. |
| +- [ ] **Step 3: Implement C3 centrally.** In `offlineBeginChecks` (`internal/console/apiinstancemove_offline.go:505`), validate syntax/ownership and run the helper before claim evidence, manifest/fleet work or writes; stage and start share it. Apply it to older and Phase-1 initiation (`internal/console/apiinstancemove.go:427,583`). Preserve cleanup/recovery of already-started operations. In `placeAppTarget` (`internal/console/fleets.go:783`), target is home (`""`) or `fleet/<name>` only (`internal/console/fleets.go:817`). Under the existing account/app locks (`internal/console/fleets.go:856,857`), examine changed-region records from the strict read and refuse before SetAppPlacementContext (`internal/console/fleets.go:928`) or manifest/registry writes. A fleet→HA-home data move refuses; a home→same-home or same-fleet record does not acquire a new HA-region refusal. Config is immutable for process lifetime and the app lock spans checks/writes, so no new shared-package recheck is needed. Keep existing SetRecordRegion HA/seed/rootfs CAS checks and their races (`internal/provision/provision.go:1040,1042,1049`); they already apply only when the raw region changes. Avoid a cosmetic empty-home↔home-code rewrite on an immutable HA record: skip SetRecordRegion for normalized no-op records, rather than weakening the shared CAS. No-op records must not trigger either the preflight or write-time HA refusal; changed records still do. |
| +- [ ] **Step 4: Add/run** `TestHAPlaceRegionsBeforeWrites` for both changed-region refusals and no-op/mixed no-op-plus-moving records, explicit/empty home equality, fleet→HA-home, static-only place and data-plus-static app. `TestHATransferStaticExemption` covers the exact static predicate in every initiation family and confirms an immutable HA flag still refuses. `TestHATransferCleanupStillWorks` covers cut/abort/resolve, offline seal/flip/open/finish, and import **commit/abort**, all continuing started operations. Run `nice -n 19 go test ./internal/console -run 'TestHAMixedMove|TestHAImportFlag|TestHAPlace|TestHATransfer|TestStaticRecordIsNotStamped|TestMoveDoorsRefuseHAHostBeforeAnyWrite|TestMoveRefusalNamesTheHomeRegion|TestImportRefusedIntoHARegionInOneBoxRegion|TestImportUploadAndStoppedRefusedInHARegion|TestPlaceRefusedForAppWithHAHost|TestPlaceRefusesAnHARecordCreatedBetweenItsScans' -count=1`; expected PASS. HA restore’s existing early return (`internal/activator/backend_exec.go:936`) stays a regression witness, with no backend edit. |
| - [ ] **Step 5: Commit** `region-ha p2a: refuse HA transfers at both region boundaries`. |
| ### Task 5: Production-wiring witness, dev console drill and landing gate |
| **Files:** new `internal/console/hap2_wiring_test.go`; implementation branch's drill evidence. No infrastructure change is part of this task without the scoped approval below. |
| -- [ ] **Step 1: Write/run** `TestHAP2ProductionDoors` and `TestHAP2RequestBudget`, using NewServer's real auth/router, real record/store wrappers and a low-level S3 counting transport. Count rejected instance, standalone sidecar, first-domain route, move, stage, place and import mutations, including private storage and lifetime modes. Display tests drive a platform-local adopted route plus the two existing report snapshots; no fake replica-to-awake inference. Assert accepted copy IDs at actual response/template/alert sinks. New targeted commands: `nice -n 19 go test ./internal/console -run 'TestHAP2|TestHAAwakeBox|TestHACreate|TestHAMixedMove|TestHAImportFlag|TestHAPlace|TestHATransfer|TestRegionIngress|TestConfiguredIngress|TestIngressDoesNotWidenProxyTrust' -count=1`. Expected PASS. Temporarily omitting each production gate must make its corresponding witness fail; do not add production mutation switches. |
| -- [ ] **Step 2: Prepare dev approval card.** Read the private deployment root to identify actual account/region/resources. Name dev console, leo/sophie/hapair, exact test app/account/host/domain/prefixes, release/roll/restarts, temporary instance/alias writes, ingress configuration, cost cap, duration and rollback/cleanup/verification. No guessed account IDs, new IAM, NLB, DNS or group resource changes. Get scoped approval before live mutation; a later NLB drill needs a separate expanded scope. This planning task grants none. |
| -- [ ] **Step 3: Dev visible witness.** Use the built console binary, record version/UTC times. With a born-HA host awake on one peer and adopted/asleep on the other/platform registry, capture Instances row/detail/API: exactly the reporter, with snapshot-age wording. Sleep it; after the normal report/cache interval show no reported awake box. Unknown/duplicate reporters are exercised locally, without fabricating dev files. State the normal five-minute snapshot cadence and 60-second console cache separately; report load failures as unknown. Neither is a guaranteed live-state bound. Do not promise immediate sleep tracking or trigger fresh box polls. |
| +- [ ] **Step 1: Write/run** `TestHAP2ProductionDoors` and `TestHAP2RequestBudget`, using NewServer's real auth/router, real record/store wrappers and a low-level S3 counting transport. Count refused instance/move/stage/place/import mutations, including private storage and lifetime modes. Separately witness successful HA standalone-sidecar and first-domain static creates retaining main behavior, ordinary duplicate precedence and no HAData/F4 rail. Their capacity gates are P2b, not unimplemented P2a refusals. Display tests drive a platform-local adopted route plus the two existing report snapshots through list/single API, pages, CLI JSON and retry; no fake replica-to-awake inference. Assert accepted copy IDs at actual response/template/alert sinks. New targeted commands: `nice -n 19 go test ./internal/console -run 'TestHAP2|TestHAAwakeBox|TestHACreate|TestHAMixedMove|TestHAImportFlag|TestHAPlace|TestHATransfer|TestRegionIngress|TestConfiguredIngress|TestIngressDoesNotWidenProxyTrust' -count=1`. Expected PASS. Temporarily omitting each production gate must make its corresponding witness fail; do not add production mutation switches. |
| +- [ ] **Step 2: Prepare dev approval card.** Read the private deployment root to identify actual account/region/resources. Name dev console, leo/sophie/hapair, exact test app/account/host/domain/prefixes, release/roll/restarts, temporary instance/alias writes, ingress configuration, cost cap, duration and rollback/cleanup/verification. Verify **before the roll** that the effective console HomeRegion and cfg.Region match the HA home after normalization, HibernateBucket is nonempty and is the intended regional data bucket, and SeedData is non-nil at that bucket’s root (startup construction: `cmd/console/main.go:444,446,449`; admission: `internal/console/createleftovers.go:43`). Record the pre-roll store/config identity and read-only bounded empty-prefix check through the console’s store seam; local built-console handler witnesses cover zero writes and explicit/empty-home aliases. After scoped approval, confirm a disposable home create succeeds with the rolled binary; that success changes records and is part of the approved drill, never a read-only preflight. Missing wiring blocks switch-on; do not roll a configuration that makes every home create F3. Run the ingress parser on the exact proposed env first and check PLATFORM_EDGE_IPS for member-only/platform-box EIPs. No guessed account IDs, new IAM, NLB, DNS or group resource changes. Get scoped approval before live mutation; a later NLB drill needs a separate expanded scope. This planning task grants none. |
| +- [ ] **Step 3: Dev visible witness.** Use the built console binary, record version/UTC times. With a born-HA host awake on one peer and adopted/asleep on the other/platform registry, capture Instances row/detail, list/single API and CLI JSON: exactly the reporter’s rollout/Serving, generation At and age. Exercise retry locally using the same selected book/epoch; unknown/conflict writes zero grants. Sleep it; after complete fresh explicit asleep reports and the cache interval, show no reported awake box with the oldest report’s age. A missing/stale prior awake/transient report must show unknown instead. Unknown/duplicate reporters are exercised locally, without fabricating dev files. State the normal five-minute snapshot cadence and 60-second console cache separately; report load failures as unknown. Neither is a guaranteed live-state bound. Do not promise immediate sleep tracking or trigger fresh box polls. |
| - [ ] **Step 4: Dev refusal/ingress witness.** Configured ingress equals approved existing dev public destinations (no pretending an NLB exists). Inspect DNS guidance/API and ensure member-only addresses disappear from configured mode. Validate agent DNS acceptance using existing tooling/config, without changing production DNS. Use approved never-woken throwaway names to demonstrate unsupported shape and mixed-region/import refusals before any app/control write. Prefix fixtures/counters stay local unless approval explicitly permits disposable data objects. Do not exhaust dev headroom; no kill/terminate/hang is necessary for P2a. Clean all resources/processes started by this task and restore configuration within the approval. |
| - [ ] **Step 5: Census and review** as below; one whole-P2a branch review plus only risk-sized own-task reviews, within stopping budget. Record exact tip and evidence; no claims of P2b readiness or G1/G3 acceptance. |
| - [ ] **Step 6: Implementation landing only.** Once targeted checks pass, run repo-required `go build ./...`, `go vet ./...`, `make test`, whole-tree formatting gate once; darwin/amd64, windows/amd64 and linux/arm64 compiles with CGO_ENABLED=0, explicit scratch output, arm64 binary below 64,000,000 bytes. A later authorized session pushes/describes the branch on amadan, requires green CI on its full tip, squash-merges with `-expect`, and reads main's CI. No push/merge or those suites in this plan-drafting session. |
| @@ -178,15 +201,57 @@ Paths omitted before a filename in this table share its last explicit directory. |
| | Remaining slice / invariant | Exactly what must be on main first | Outline and acceptance to turn into tasks later | |
| |---|---|---| |
| | App-spread input, **H4/C4** | P1b-3a's actual owned-awake `headroom.apps` publisher, missing/stale semantics and its merged shared policy | If console choice needs app spread, inventory its independent PlacementView/BoxChoice decoder/conversion and preserve the merged ownership/count semantics. Main's current numeric capacity count does **not** require Apps; do not invent that dependency for EligibleBoxes. Do not implement or mirror 3a's proposed types now. | |
| -| Claim-free role object and CLI, **C5/A12** | The box-side role consumer/publication and scope watcher, owned by P3 per the final P1b plans, merged against spec §4.4 | Desired `control/box-roles/<ref>.json` = {role,by,at}; own override then `@region-<code>` default then serve. Only serve/drain/platform accepted; unknown fails closed. Operator API replaces roster path; CLI uses `carlos system box role <ref|@region-code> <role>`. Stop directing operators to roster groups/default/legacy. Exact-ref resolution from verified identity, no ambiguous label fallback. One-object conditional write, role scope index, audit and read-back distinguish requested/applied; never report drained on save. Per-box override may restore serve under a drain default, so test and display precedence explicitly. Region default covers replacement boxes. No claims or ASG enrollment. Unknown target/conflict/read failure refuses before write. | |
| +| Claim-free role object and CLI, **C5/A12** | The box-side role consumer/publication and scope watcher, owned by P3 per the final P1b plans, merged against spec §4.4 | Desired `control/box-roles/<ref>.json` = {role,by,at}; own override then `@region-<code>` default then serve. Only serve/drain/platform accepted; unknown fails closed. Operator API replaces roster path; CLI uses `carlos system box role <ref\|@region-code> <role>`. Stop directing operators to roster groups/default/legacy. Exact-ref resolution from verified identity, no ambiguous label fallback. One-object conditional write, role scope index, audit and read-back distinguish requested/applied; never report drained on save. Per-box override may restore serve under a drain default, so test and display precedence explicitly. Region default covers replacement boxes. No claims or ASG enrollment. Unknown target/conflict/read failure refuses before write. | |
| | Role rollout/admission readiness door, **C5/§10** | P3's actual booting/admission, role acknowledgement, drained completion and full-health observation; P1b-3b consumer/latch prerequisite merged | Operator API + API-backed CLI show desired/effective role, observed time, blockers, drained status and the source of evidence. Missing/stale/partial/malformed/unknown versions yield not ready, never empty-is-ready. Drain forwards and remains healthy; platform never an LB target; booting acquires no tenant lease. Full predicate is latch plus all six lbhealth conditions: host.env, first reconcile, initial role publication, termination consumer started, map/key, certificates and heartbeat/refresh checks. Hook completed before serving publication, grace 60s, initial hook timeout 15m. No console TCP/HTTP/S3 reachability poll and no fabricated ready field on an old box. Runtime/P3 owns the health truth. | |
| | EligibleBoxes and create admission, **C4/C6** | Merged role/admission producers above and shared eligible-serving semantics; no dependency on Apps for a count | Rewrite `regioncapacity.go`/`nocapacity.go` to use verified live edges and actual effective roles, no ClaimAuthority/host actors. Same one-observation helper for metric/readiness and instance/standalone-sidecar/first-domain-route admission. Exclude booting/drain/platform/drained, wrong placement/bucket/fingerprint, incompatible capability, stale generations/liveness, unverified identities and insufficient 15%/10% totals. Distinguish pool-specific create set from regional metric's serving set; never require shared pool for a legitimate named pool. Refuse 503 + approved no-capacity text + Retry-After 60 before **any** env binding/domain claim/store/lifetime registration; zero eligible on complete evidence pages at most once/region/hour/console process. Incomplete evidence refuses temporarily without a no-capacity page or zero metric. Existing-host wakes are outside the gate. | |
| | Metric start/routing, **C4/C6** | Previous row's actual count helper and trusted deployment region-coordinate source | Start once from console serve when CARLOS_REGION_METRICS=cloudwatch, independent of HostClaim and its worker; remove old nested start. Keep one-minute cadence, Carlos/Region, EligibleBoxes, Region=placement-code, in that region's CloudWatch. Use configured HA region universe so vanished/all-stale regions still publish zero on a complete read; do not enumerate only surviving files. Missing/partial reads omit only unprovable datapoints and log failure/recovery; alarms treat missing as breaching (eligible below box_count 25m). Resolve AWS region from trusted configuration/verified identity, never unverified majority or file-controlled endpoints. Measure/cache shared observations rather than adding a second per-minute read for every caller. | |
| -| Lift conservative create cuts, **C3** | A merged, reviewed region/pool data-emptiness authority reachable solely through console/API, and P1b-3b's standalone-sidecar runtime ownership | Plan the smallest bounded request-driven proof using existing rights, or keep that region/pool refused. No cross-bucket IAM expansion hidden in a console plan; independently scope any needed infrastructure approval. Witness lock/files/LTX across regions, switch-off imports and all writer doors. Then enable §11 standalone sidecar admission through the shared eligibility helper without changing HA stamping. Required before claiming full P2/G3 for a region needing these creates. | |
| +| Lift conservative create cuts, **C3** | A merged, reviewed region/pool data-emptiness authority reachable solely through console/API; controller approval to lift the deliberate G3 cut | Plan the smallest bounded request-driven proof using existing rights, or keep that region/pool refused. No cross-bucket IAM expansion hidden in a console plan; independently scope any needed infrastructure approval. Witness lock/files/LTX across regions, switch-off imports and all writer doors. Standalone sidecars keep main’s behavior until the separate P2b shared capacity gate lands, without changing HA stamping. Non-home/pool HA data creates remain deliberately unavailable for G3; lifting that cut is later work, not a hidden G3 prerequisite. | |
| | Integrated G1/G2 witness, **I4/C5** | P1b-3a + 3b + P3 merged and executable P2b built | Drill per-box override/region-default replacement, applied-role acknowledgement, drain forwarding, non-admitted boot refusal and no target platform; loss of eligible capacity trips the existing metric/alert without withholding existing wakes. Use P3's scoped group/termination approval. Report readiness and budget at exact built tip. G2 fault/traffic/hairpin drills remain series acceptance, not a P2a claim. | |
| The P1b-3a merge alone does not release the role/readiness/metric dependencies. No new API endpoint spelling, admission wire field, scope reader or producer implementation is fixed here against P3's unmerged work. This order lets P3 settle those interfaces once; P2b plans against the merged result. P2b's executable plan must include its complete CLI docs and copy deck before review. |
| +## P2a door inventory (C3) |
| + |
| +| Door / current main anchor | P2a behavior and witness | |
| +|---|---| |
| +| Instance create, including --from/import dispatch: `internal/console/apiinstances.go:1524`; `internal/console/apiinstances.go:2297,2302`; record writes `internal/console/apiinstanceseed.go:86,89` | Task 3 F1 covers both plain/--from sockets; HAData proof covers prospective plain socket HA only. Imported creates retain the stronger import refusal. Counter witness covers every protected write. | |
| +| Standalone sidecar create: `internal/console/apisidecars.go:223,394` | Main success/duplicate/LTX rail retained, no F4. Task 3/5 success and exclusion witnesses; shared capacity gate is P2b. | |
| +| First-domain static create: `internal/console/domainattach.go:253,679` | Static, no HAData check and no new P2a cut. Task 5 success/exclusion witness; shared capacity gate is P2b. | |
| +| Offline stage/start: `internal/console/apiinstancemove_offline.go:625,663,505` | Both use Task 4 source/destination check before claim/stage/stop writes; staged start rechecks. | |
| +| Legacy/Phase-1 move request: `internal/console/apiinstancemove.go:422,427,574,583` | Same Task 4 rule; no alternative-door bypass. Existing cut/abort/resolve stay open. | |
| +| Apps place API/browser callers: `internal/console/fleets.go:1041,1105,1154` → `internal/console/fleets.go:783` | Only changed-region records enter Task 4’s HA preflight; unchanged records skip write-time region mutation. Existing app/rootfs/seed/hosts-history rails remain. | |
| +| Import begin/upload/stopped: `internal/console/apiinstanceimport.go:119,391,718` | Region refusal at begin; immutable flag plus region refusal at upload/stopped; flag check at begin is defensive. | |
| +| Import commit/abort: `internal/console/apiinstanceimport.go:761,874`; offline recovery/finish verbs | No new HA refusal for already-started operations. Task 4 cleanup witness covers these explicitly. | |
| +| Apps region / account move | Not data/instance placement doors: apps region changes no record region; account move rewrites console metadata. No new HA transfer gate. | |
| + |
| +## Round 1 dispositions |
| + |
| +Source anchors below are at the refreshed citation base. Task/step references identify the revised interfaces, tests and production-wired witnesses; these are plan changes, not claims that runtime tests have run. P3 numbering follows the review’s eleven bullets in order. All eleven were cheap enough to take in this revision; none starts another review round. |
| + |
| +| Finding / invariant | Current-main file:line | Rev 2 disposition and witness | |
| +|---|---|---| |
| +| **P1-1 / C1** | `internal/console/apiinstances.go:962,1133,1326`; `internal/console/instancepage.go:298`; `internal/console/apiretry.go:90`; `internal/console/remoteinstances.go:337,459` | **Answered, Task 1 Steps 1–6:** one HA observation supplies selected rollout, health, Box and At to list/detail/single GET/CLI JSON/retry, including local rows. Nil rollout never falls back to a different box. Page/API/CLI/retry witnesses cover newer sleeping adopter and conflict. §15 census corrected. | |
| +| **P2-1 / C1** | `internal/console/remoteinstances.go:263`; `internal/status/fleet.go:120,138` | **Answered, Task 1:** At plus report-age requirement A1/A6; retain stale matching awake/transient hazard before filtering. Clock-boundary test prevents stale-holder→asleep inference; display five-minute cadence, 15-minute freshness and cache separately. | |
| +| **P2-2 / C1,C6** | `internal/console/apiinstances.go:1415,1425`; `apimode.go:3337,4184`; `instances_cli.go:741` | **Answered, Task 1 Steps 4–5:** single GET fields/projection, actual CLI JSON flag/decoder, D1 JSON-specific docs, root census and cold GET budget. Test old-server omission and timestamp round-trip; no invented existing JSON flag. | |
| +| **P2-3 / C3** | `internal/console/seedmove.go:47`; `internal/console/apiinstances.go:2182,2308`; `internal/provision/provision.go:487,495,537` | **Answered, Task 3:** exact F1 predicate applies to plain/--from; exact HAData predicate excludes Addr/Addrs. Address-backed stamp preserved without false data proof. Rootfs non-hibernating fixture updated explicitly; test both accepted hibernating and refused non-hibernating sockets. | |
| +| **P2-4 / C3** | `internal/console/createleftovers.go:43,136` | **Answered, Task 3 Steps 3–4:** permanent non-home/pool cut F5/409, no Retry-After or access-repair suggestion; transient home data failure F3/503 with retry wording. Counter tests distinguish them before writes; G3 cut recorded in Rulings. | |
| +| **P2-5 / C3,C4** | `internal/console/apisidecars.go:394`; `internal/console/ha_born_test.go:84` | **Controller ruling applied, Tasks 3/5:** DROP F4, preserve successful HA standalone sidecars and duplicates with no stamp. Capacity gate waits for P2b; no new cut. | |
| +| **P2-6 / C3** | `internal/console/ha_born_test.go:45,84,205`; `internal/console/rootfs_test.go:588`; `cmd/console/main.go:446,449` | **Answered, Task 3 Step 4 / Task 4:** explicit fixture setup/changed expectations for all four tests; coherent home Region/HibernateBucket/SeedData. Exact static predicate exempt from new regional refusal, immutable HA and existing rails retained; static move/place witness. | |
| +| **P2-7 / C2** | `internal/host/steering_loop.go:126`; `internal/console/server.go:1566`; `internal/console/view.go:199` | **Answered, Task 2:** configured mode suppresses SteeringHost and offers A-only guidance for apex/subdomain, even with steering armed. Legacy CNAME stays legacy. Test no CNAME/member EIP in configured mode. | |
| +| **P2-8 / C3** | `cmd/console/main.go:446,449`; `internal/console/server.go:551`; `internal/console/createleftovers.go:43` | **Answered, Task 5 Step 2 and switch-on:** verify configured home coordinates, HibernateBucket and non-nil root SeedData before roll; bounded read-only prefix proof/local zero-write evidence. Missing wiring blocks activation; approval card records exact deployment inputs. | |
| +| **P2-9 / C3** | `internal/console/fleets.go:865,881,928,955`; `internal/provision/provision.go:1040,1042` | **Answered, Task 4:** filter normalized no-op records before HA preflight and skip their region rewrite; fleet→HA-home still refused. Tests cover all-no-op and mixed changed/unchanged apps; retain shared CAS protection for real moves. | |
| +| **P3-1 / citation accuracy** | `internal/console/createleftovers.go:43,69`; `internal/console/nocapacity.go:38,42`; `internal/console/awsregionmetric.go:25,30`; `internal/console/apiinstances.go:2308` | **Taken:** corrected these and every other cited line against the refreshed main commit, including review’s drifted rollout/CLI references. Proposed files retain no fabricated lines. | |
| +| **P3-2 / C3,census** | `internal/console/fleets.go:856,857,928`; `internal/provision/provision.go:1040` | **Taken, Task 4:** fixed process config plus app lock permit console pre-write regional check; no new SetRecordRegion regional policy/recheck. Keep its existing HA CAS test. | |
| +| **P3-3 / C3** | `internal/console/apiinstanceimport.go:111,119,391,718` | **Taken, Task 4:** begin is create-only/unstamped; immutable flag defense belongs to helper plus upload/stopped tests, not an impossible existing-HA begin fixture. | |
| +| **P3-4 / C3,scope** | `internal/console/domainattach.go:253,679` | **Taken:** remove domainattach.go from Task 3 edits; retain unchanged-static success witness in Task 5/door inventory. | |
| +| **P3-5 / C3,disclosure** | `internal/console/createleftovers.go:136` | **Taken, Task 3:** firstHALeftover returns fixed lock/files/replica/other class; F2 never includes object key or SHA. Response tests assert no leak. | |
| +| **P3-6 / C3** | `internal/console/apisidecars.go:394,405` | **Resolved by DROP F4:** no sidecar refusal to order; main duplicate still precedes its LTX check. Retry witness retained. | |
| +| **P3-7 / C2** | `cmd/console/main.go:1339` | **Taken, Tasks 2/5:** run proposed parser on exact nonempty ingress env before console roll; invalid input must not become a rollout outage. | |
| +| **P3-8 / C2** | `internal/console/server.go:1580`; `internal/console/authcli.go:1210` | **Taken, Tasks 2/5:** inspect console PLATFORM_EDGE_IPS for member/platform-only EIPs before configured-mode switch-on; never add RegionIngress to proxy trust. | |
| +| **P3-9 / C2,copy** | `internal/console/server_test.go:1652`; `internal/console/view.go:199` | **Taken, Task 2:** inventory all changed legacy wording and update TestDomainGuidanceSteering plus configured guidance assertions. | |
| +| **P3-10 / C3,recovery** | `internal/console/apiinstanceimport.go:761,874` | **Taken, Task 4:** door inventory and cleanup witness explicitly keep commit/abort open for begun imports. | |
| +| **P3-11 / C1,copy** | `internal/console/remoteinstances.go:229` | **Taken, Task 1:** A1 carries box+age; A6 carries age+UTC generation. At is report time, not this cache-load time. | |
| + |
| ## S2 §8 / spec §15 disposition census |
| | Spec §15 row | Owner / result | |
| @@ -195,7 +260,7 @@ The P1b-3a merge alone does not release the role/readiness/metric dependencies. |
| | Seed import / seedfloor | Keep one-box restriction and P1a begin/upload/stopped refusals; P2a pins switch-off record behavior. P5 owns N-box import. | |
| | CheckOneBoxRegion | Claim-only and inert: no new caller, no cleanup prerequisite. | |
| | Warm cache | P1a's HA restore/keep path built; P2a changes nothing. | |
| -| Hosts unique to one box | P2a Task 1: report awake snapshot or none/unknown, with tenant/lifetime checks and ambiguity refusal. | |
| +| Hosts unique to one box | P2a Task 1 replaces the actual last-box rollout join (`internal/console/apiinstances.go:962,1133,1326`), local/detail and remote-health bypasses with **one** HA observation; list, detail, single GET, CLI JSON and retry consume its rollout/health/At. Conflict/unknown has no rollout; asleep has no awake box. **C1.** | |
| | EIP list | P2a Task 2: configured ingress plus explicit EdgeIPs; legacy mode retained until deployment supplies complete ingress. | |
| | Forwarding dial | P1b-2 plus main's dead-holder backoff built; private-address selection unchanged. P2 is no forwarding redesign. | |
| | consoleBoxLabel | Holds: console remains on platform box. No move onto the tenant group. | |
| @@ -209,14 +274,16 @@ Logical AWS API attempts, including unsuccessful calls. SDK transport retries ar |
| | P2a path/event | Increment over main | |
| |---|---| |
| -| Awake reporter selection/API/page mapping from existing reports | **0G/0P/0L/0D**. Use the same request/report cache. A page gaining reports where it previously read none must charge the ordinary cache miss below; no claim that source loading is free. | |
| -| Shared status cache miss, H report objects | Existing `ceil(H/1000)L + H*G`; cache success 60s, failure 10s; at most one load in flight. Not a timer or per-box loop. Repeated pages inside TTL add 0. | |
| +| Shared HA selection and API/page/CLI projection from already-loaded reports | **0G/0P/0L/0D**. Use the same request/report cache. A page gaining reports where it previously read none must charge the ordinary cache miss below; no claim that source loading is free. | |
| +| Shared status cache miss, H report objects | Source cost `max(1,ceil(H/1000))L + H*G`; cache success 60s, failure 10s; at most one load in flight. Not a timer or per-box loop. Repeated HA reads inside TTL add 0. | |
| +| HA single-instance GET, cold then warm | **New read versus main:** at most `max(1,ceil(H/1000))L + H*G` for a cold status cache, **0 new status reads** inside TTL; existing record/edges reads stay charged separately. Three report objects cost 1L+3G per cold load. Failure/partial loads count attempted pages/GETs, hold 10s and return unknown. Selection does not add identity/role/lease reads. | |
| +| HA list/detail/retry sharing and bursts | Use pageBoxReports for HA source loading, never a second loadRolloutJoin just to select HA. Skip legacy warming/join on all-HA lists; mixed lists retain their existing non-HA join costs and reuse request-memo report loads where present. Count those separately: the observation adds no second read of reports already loaded in that request. Concurrent HA consumers share one in-flight status load per console, independent of user/tab count; count every post-TTL refill. CLI JSON is the same list request, no follow-up GET per row. | |
| | Configured ingress parsing/render | **0 S3**. In configured mode eliminate the old DNS fold reads; do not credit savings to pay for another loop. Unset mode keeps the existing fold. | |
| -| HA shape/unsupported placement/sidecar or transfer/import regional check | **0 new S3**; local flags and already-read record. Refusal: **0 protected P/D/index mutations**. | |
| +| HA shape/unsupported placement or transfer/import regional check | **0 new S3** for the predicates; local flags and already-read record (the data rail’s existence read is below). Refusal: **0 protected P/D/index mutations**. | |
| | Home HA data create prefix proof | **+1 bounded L**, maximum one result, **0G/0P/0D**, no body or lock GET. Existing duplicate record read is reused. Error costs its attempted L and no writes. | |
| | Existing LTX rail when still reached | Main's up to **20 L** for two prefixes × levels 0–9 (`internal/dbdoor/coords.go:29`), plus its existing record GET. P2a total rail bound **1G+21L** on a successful empty check, before unchanged create writes. Early first-object refusal uses **1G+1L**. No scan over files/objects or pagination is added. | |
| -| HA create duplicate | Existing **1G**, no new L; ordinary duplicate answer. | |
| -| Remote/opaque-pool HA data proof unavailable | **0 new S3**: F3, no speculative bucket client or unbounded cross-region scan. | |
| +| HA create duplicate | **1G**, reused when main already checked; now also required before a remote/pool F5 that main skipped; no new L; ordinary duplicate answer. | |
| +| Remote/opaque-pool HA data proof unavailable | **0 data S3**: F5/409 after the record-existence GET (new if main skipped its rail), no speculative bucket client or unbounded cross-region scan. | |
| | P2a role/edges/control mutations | **0**: P2a writes no role objects, index scopes or publication files. Ordinary successful create's record/lifetime/env/serial/index writes retain main's budget. | |
| Example: 1,000 empty home HA data-create checks add **1,000 LISTs = $0.005** over the existing rail. Quiet P2a adds **0 S3/box/hour** and **0 S3/console/hour**. Additional view traffic pays existing request-cache misses; it creates no background reader. Main's per-box §18 baseline remains roughly **3,300–3,500/hour**, not a new allowance. |
| @@ -231,42 +298,42 @@ This is the complete **intent/deck for P2a**, with **draft** words for Luna to r |
| | ID | Destination / context | Draft / required content | |
| |---|---|---| |
| -| A1 | Instances row/detail label; snapshot rather than current lease | Last reported awake on | |
| -| A2 | Born-HA, complete matching asleep evidence | No box reported awake | |
| -| A3 | Missing/stale/partial/transient observation | Cannot confirm the awake box | |
| -| A4 | Contradictory fresh awake reporters, no unique box | More than one box reported awake | |
| -| A5 | Row/detail help; include normal five-minute report and one-minute cache limits | Box snapshots update about every five minutes. The console caches them for up to one minute. | |
| -| I1 | `domainGuidance`, no steering; variables host, addresses | Point an A record for %s at %s. Checks run every few minutes. | |
| -| I2 | Apex guidance after I1 | An apex domain cannot use a CNAME. These addresses are the public ingress for this deployment. | |
| -| I3 | Subdomain guidance with steering; host, steering hostname | Point a CNAME for %s at %s so it follows this deployment's regional ingress. | |
| -| I4 | Optional A-record alternative to I3; addresses | An A record at %s also works, without latency-based routing between regions. | |
| -| I5 | Invalid configured ingress startup failure; safe invalid token only | CONSOLE_REGION_INGRESS must contain comma-separated IP addresses. Invalid entry: %s. | |
| -| F1 | Non-hibernating socket create, 400; region | %s has high availability turned on. Socket instances must allow hibernation. | |
| -| F2 | Predecessor object, 409; host, relative key; no bucket, contents or secret | %s still has data from an earlier instance at %s. Choose another address, or ask an operator to inspect it. | |
| -| F3 | Missing authoritative emptiness proof, 503; display region only | Cannot check this instance's data in %s. Nothing was created. Ask an operator to check the region's data access. | |
| -| F4 | Standalone-sidecar create in active HA region, 409; region | Standalone sidecars are not available in %s while high availability is turned on. | |
| -| D1 | CLI docs behavior paragraph, no new command | HA instance lists identify the box last reported awake. This is a snapshot, not a live ownership check. Creates may be refused before any data is written when their shape or region cannot be checked. | |
| -| D2 | Deployment configuration docs in existing CLI page; comma-separated ingress | CONSOLE_REGION_INGRESS lists the deployment's public regional IP addresses. The console uses these and PLATFORM_EDGE_IPS in DNS instructions. Supply every region before switching it on. | |
| -| D3 | CLI move/import behavior paragraph | Offline moves into or out of an HA region and imports into it are unavailable. Existing operations can still be cleaned up. | |
| -| Reuse N1 | `nocapacity.go:37`, approved no-capacity 503, P2b | Reuse exactly: “No box in %s has room right now. Try again in a few minutes.” Retry-After 60. | |
| -| Reuse N2/N3 | `nocapacity.go:41`, approved page subject/body, P2b | Reuse existing noCapacityAlert outputs exactly; one shared throttle, successful-send reservation and retry-on-failure semantics. | |
| -| Reuse M1/M2 | `seedmove.go:52,57`, P1a-approved move/import refusals, Task 4 | Reuse haMoveSentence/haImportSentence verbatim, substituting the blocking display region. | |
| -| Reuse E1/E2 | Ordinary duplicate/read/error answers from createleftovers' caller, Task 3 | Keep instance/sidecar-specific main messages; no global replacement. | |
| +| A1 | Instances row/detail awake snapshot; variables box and age | Draft intent: name the last reported awake box **and its report age**, with no live-owner claim. Format is driven by Box and At together. | |
| +| A2 | Complete matching fresh asleep evidence only | No box reported awake; include A6’s observation age. Never use for stale-holder/partial evidence. | |
| +| A3 | Missing/stale/partial/transient observation | Cannot confirm the awake box. | |
| +| A4 | Contradictory fresh awake reporters | More than one box reported awake; no selected box/rollout. | |
| +| A5 | Row/detail help | Explain five-minute normal snapshot cadence, 15-minute freshness threshold and up-to-one-minute console cache separately; none guarantees live state. | |
| +| A6 | Row/detail report age; variables age and UTC generation | Draft intent: when the selected snapshot was generated, as age plus accessible UTC time. For asleep, oldest matching snapshot; no timestamp invented for unknown/conflict. | |
| +| I1 | Configured ingress for every host, or legacy without steering; host, addresses | A-record instruction to the complete public ingress union; checks every few minutes. | |
| +| I2 | Configured ingress apex help | Apex cannot CNAME; these are public ingress addresses. No claim of latency routing from A records. | |
| +| I3/I4 | **Legacy only**, unset RegionIngress; host, steering hostname, addresses | Retain legacy steering CNAME recommendation and A-record alternative, naming healthy edges rather than configured regional ingress. Inventory changed legacy wording and update `internal/console/server_test.go:1652`. | |
| +| I5 | Invalid configured ingress startup failure; safe invalid token only | Comma-separated IP literal requirement and invalid entry; validate before the roll. | |
| +| F1 | Plain or --from non-hibernating socket create, 400; region | %s has high availability turned on. Socket instances must allow hibernation. | |
| +| F2 | Predecessor data, 409; host and fixed class only | Describe earlier instance data, naming only lock/files/replica/other; choose another address or request operator inspection. No raw key/content hash. | |
| +| F3 | Home wiring/listing failure, 503; display region | Cannot check this instance’s data in %s. Nothing was created. Try again. Persistent failures may require an operator to check home data access. | |
| +| F5 | Deliberate non-home/pool HA data-create cut, 409; display region | Draft: HA data creates for this placement are not available yet in %s. Use the console’s home region without a pool. No retry/access-repair suggestion or Retry-After. | |
| +| F4 | **Dropped by controller (P2-5)** | No replacement string or new standalone-sidecar refusal. | |
| +| J1 | `instances list --json` flag help/usage; `instances_cli.go:741` | Print the instance result as JSON, including observed HA snapshot fields; no extra text on stdout. | |
| +| D1 | `docs/site/cli.md`, instances list flag/JSON behavior | Document `--json`, `{instances,truncated,total}`, awake_box/state/at, timestamp/age and snapshot limits. Only JSON/page shows box attribution; the ordinary CLI table uses corrected Serving/Health and adds no box column. Creates can refuse before writes. | |
| +| D2 | CLI deployment configuration docs | Explain RegionIngress plus PLATFORM_EDGE_IPS, full public ingress set, configured A-only guidance, pre-roll validation and no member/platform-only EIPs. | |
| +| D3 | CLI move/import behavior | HA data moves/imports unavailable; static-kind records exempt only from the new regional move refusal; existing immutable-HA and other rails remain; started operations can finish/clean up. | |
| +| Reuse N1 | `internal/console/nocapacity.go:38`, approved P2b no-capacity 503 | Reuse exactly: “No box in %s has room right now. Try again in a few minutes.” Retry-After 60. | |
| +| Reuse N2/N3 | `internal/console/nocapacity.go:42`, approved P2b page subject/body | Reuse noCapacityAlert outputs exactly; shared throttle and send-failure semantics. | |
| +| Reuse M1/M2 | `internal/console/seedmove.go:52,57`, P1a-approved transfer refusals | Reuse haMoveSentence/haImportSentence verbatim, substituting blocking display region. | |
| +| Reuse E1/E2 | Existing duplicate/read answers (`internal/console/apiinstances.go:2265,2266`; `internal/console/apisidecars.go:405,406`) | Keep door-specific main messages and existing retry refusal words; no replacement error copy. | |
| P2b's controller must inventory before implementation: role vocabulary/usage, saved-versus-applied result, invalid/unknown ref/region, read/CAS/write failures, operator audit, readiness label/each blocker/stale/incomplete/unsupported producer, metric startup/failure/recovery, no-capacity alert subject/body, regional proof refusal, and every changed CLI help/doc line. Those have no final destination/interface yet, so this is a **separate outline deck**, not invented executable strings. Do not implement P2b until its merged-input plan and complete approved deck exist. No new user-facing prose logs, empty states, tooltips or docs may escape that inventory. |
| ## Census and verification notes |
| -Plan-only Markdown is outside root census: no proposal/overlay or re-pin now. P2a aims to touch only cmd/console, internal/console/templates and docs, outside the root dependency census. Still run `make census-card` on the implementation diff: helpers in shared packages are not exempt merely because the new caller is the console. Do not touch `internal/release`, `internal/host`, `internal/edgesfile` or CLI root to avoid a review; if needed, record it and include actual changed units/envelopes. |
| +Plan-only Markdown is outside root census: no proposal/overlay or re-pin now. P2a changes console/templates/docs plus **root-binary `apimode.go` and `instances_cli.go`** for the CLI decoder/JSON output. Those root files, changed functions/types and whole-file envelopes need independent census approval; the plan does not claim a console-only exemption. Run `make census-card` on the implementation diff: helpers in shared packages are not exempt merely because the new caller is the console. Do not move selection into `internal/release`, `internal/host` or `internal/edgesfile` to avoid a review; if needed, record it and include actual changed units/envelopes. |
| For any in-scope execution change: tab-separated CLAIMS per unit with new read or none; `make census-propose NAME=region-ha-p2a CLAIMS=<owned-file>` (P2b gets its actual slice name), targeted census/scope/J4/rebase checks, and independent cross-family unit/envelope verdict at exact tip on #280. The reviewer decides every class; no census escalation to Paul. Role scope/shared release/CLI changes in P2b are expected census surface, including whole-file envelopes and tests. The record-write 9B8 censuses are separate: run relevant changed console writer inventories, and only re-pin a demonstrated digest change. Preserve production provenance and security ordering in final P2 fixes. |
| Drafting verification: compare every proposed executable dependency to base main; cross-check §15 disposition table, budget arithmetic, copy destinations and Task 1's observable first merge; `git diff --check`; check the requested file is the only staged change; subject under 80 characters and a blank line before trailer. No go suite, dev drill or runtime acceptance is claimed by this plan commit. |
| -## Open questions for Paul and handoff |
| +## Accepted defaults and handoff |
| -- **Before P2a implementation landing:** schedule the first dev release/drill scope. Recommend the next dev release, with existing born-HA hosts and local prefix fixtures; no flagship configuration change. |
| -- **Before P2b planning:** confirm which merged P3 change owns role/admission observations; recommend P3 produces them first, P2b consumes actual main. A final unmerged plan is not a substitute. Capacity itself does not wait for Apps; it waits for honest serving/admission evidence. |
| -- **Before any non-home/pool HA create activation:** is that required for the first G3 region? Recommend keeping it refused until a scoped authoritative prefix-proof path is merged. That work is required for full P2 coverage wherever the console cannot inspect the destination; do not hide it behind P1a's first-wake refusal. |
| +The three former questions are settled by the controller’s Rulings table: next dev release after P2a merge, P3 produces role/admission evidence before P2b, and non-home/pool HA data creates remain F5/409 for G3. Task 5 still requires a concrete scoped dev approval card and verified wiring before live mutation/switch-on. These are implementation gates, not reopened design questions. |
| -No spec redesign or new N-HA ruling is requested by P2a. P3/3b, migration, P4/P5/P6 and storage fencing stay with their owners. The local planning handoff is: main-only work in five P2a tasks, deferred P2b requirements explicitly gated, no independent review, no production edit, no push, no running process. Splitting the change does not reset its budget or start a new finish-line clock. |
| +This session revises and commits only this plan. P3/3b, migration, P4/P5/P6 and storage fencing stay with their owners. Round 1 found 1 P1/9 P2/11 P3; rev 2 answers them without claiming a new independent verdict. No production edit, push, subagent or reviewer dispatch, full suite, or running process. Splitting the change does not reset review history or the finish-line clock. |