region HA G3-B10: answer Astra plan round 2 (I-B10, Retry-After)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+8
−2
docs/superpowers/plans/2026-11-05-region-ha-g3-b10.md+6 −0docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md+2 −2
CI passed — run details
diff --git a/docs/superpowers/plans/2026-11-05-region-ha-g3-b10.md b/docs/superpowers/plans/2026-11-05-region-ha-g3-b10.md| index e34be6613..f9dd692ad 100644 |
| --- a/docs/superpowers/plans/2026-11-05-region-ha-g3-b10.md |
| +++ b/docs/superpowers/plans/2026-11-05-region-ha-g3-b10.md |
| @@ -12,6 +12,7 @@ Plan, 2026-11-05. Spec: `2026-10-26-region-ha-without-claims-design.md` §23 (ad |
| | R2 | Controller: the scope lives in `CONSOLE_HA_CAPACITY_CONFIG` (`regions.<code>.ha_pools`), the document that already names the region's data bucket. No new env var. | |
| | R3 | Controller: create-path gates move to `haCreate(region, pool)`; transfer gates (moves, seed `--from`, import, placement changes, `haTransferRegion`, `refuseHAImport`, `apiplacements.go`) stay on `haRegion` (N-HA4). | |
| | R4 | Controller: a scoped region's proof (home or not) is two bounded LISTs (one key each) of whole prefixes in the config-named bucket, not the LTX level walk: stricter, one path, and the console holds no litestream client for remote buckets (Astra A2). | |
| +| R7 | Astra r2: A6 (P1, same family as A2) answered by invariant I-B10, enforced in one place (the observation) with a seeded witness; A7 (Retry-After) accepted. Prefix sameness is a card precondition: no box reports its prefix, and box changes are out of scope. | |
| | R6 | Astra r1: A1 (prefix needs the activator config), A2 (configured bucket, also at home), A3 (`--from` unchanged), A4 (invalid config is 503, not F5), A5 (F1 by predicate) accepted. | |
| | R5 | Controller: new or changed refusal sentences name regions by label (`offlinePlace`), not code. The no-room sentence (`nocapacity.go`) is in a touched file, so its "ie" is fixed too. One Luna pass, applied verbatim. | |
| @@ -42,6 +43,8 @@ Files: `internal/console/createleftovers.go`, `internal/console/server.go`, `cmd |
| - `haScopeInvalid`: 503 with the existing `haCapacityUnknownRefusal` sentence and `Retry-After: 60`, before F5 and before any LIST (A4). |
| - unscoped region: today's code unchanged (F5 for non-home or pooled; home proof). |
| - scoped region (home or not): `cfg.HibernateBucket == ""` is 503 `unsure` (A1: the prefix is unknown). Store = `HADataStores[region code]`; nil or not a `PageLister` is 503 `unsure`. `firstHALeftover(store, HibernatePrefix(cfg.HibernatePrefix, host)+"/")`, then `firstHALeftover(store, "moves/<host>/")` (use `activator.MovesPrefix`). Either error is 503; any key is 409 naming the class (reuse `firstHALeftover`'s class for the first; staging is "replica"). Log errors with the host; never return the bucket name. `SeedData` and `dbReplica` are not used on this path (A2). |
| +- [ ] I-B10 (A6): `func (o *HACapacityObservation) MixedStorage(region string, now time.Time) (key string, mixed bool)`: true when any non-malformed, fresh (generation within `boxchoice.MaxEdgesAge`) file whose placement equals the region's (`""` for home, as `scope` computes it) reports a valid `data_bucket` or `data_bucket_region` differing from the config's coordinates. `requireHACreateCapacity`, for a scoped region's HA create only, refuses with `haCapacityUnknownRefusal` and `haCapacityRetryAfter: 60` when the observation is mixed, before `Decide`; log the key. Unscoped regions are untouched. |
| +- [ ] A7: both leftover-refusal response sites (`apiinstances.go` ~2314, `apisidecars.go` ~447) call `setNoCapacityRetryAfter(w, ref)` before `jsonError`, so the proof's config-unavailable 503 carries `Retry-After: 60`. |
| - [ ] The duplicate read at `apiinstances.go` ~2281 and `apisidecars.go` ~418 must still run for every scoped HAData create before capacity (it does when `leftoverCheckApplies` is false; check the home scoped case too). |
| - [ ] Sentences: `unsure` and the F5 sentence name the region by label. F5's text is otherwise unchanged (approved copy). |
| @@ -61,6 +64,9 @@ Through the real handlers (`POST /api/cli/apps/<acct>/<app>/instances`, sidecar |
| - [ ] F1 (A5): direct `haCreateShapeRefusal` predicate test with `Hibernate=false` for scoped `us` pool `ha` (refused), pool "" (nil), unscoped `ie` (refused). Through HTTP: a sidecar create in pool `ha` on a non-hibernating sidecar manifest is 400 "high availability sidecars must allow hibernation."; unpooled in `us` is not. |
| - [ ] Move into `us` and out of `us` of a legacy record, and seed import into `us`: still refused with the existing sentences. Seed `--from` keeps main's behaviour (`TestSeedsRemainLegacyAndSidecarsBornHA` unchanged) (A3). |
| - [ ] Dev shape (`ie` home, `CONSOLE_HA_REGIONS=ie`, no `ha_pools`): existing `ha_born_test.go`, `hacreate_test.go`, `hacreatecapacity_test.go`, `sidecar_ha_test.go` pass unmodified; a pooled `ie` HAData create still gets F5. |
| +- [ ] I-B10 witness: two fresh boxes placed `us`, both serving pool `ha`, one on the configured bucket and one on another bucket (and separately another bucket region): pool `ha` create is 503 capacity-unknown with `Retry-After: 60`, zero writes; a stale mismatched file does not block; unscoped `ie` with a mismatched box behaves as on main. |
| +- [ ] I-B10 seeded simulation (one test, fixed seeds, ~500 iterations, under 2 s): random sets of edges files (placement, bucket, bucket region, pools, freshness, malformed) for a scoped `us`; assert that whenever `requireHACreateCapacity` returns nil for pool `ha`, every fresh well-formed file placed `us` has the configured bucket and bucket region. Mutation check: dropping the MixedStorage call must fail it (record in the ledger, then restore). |
| +- [ ] A7 witness: the A4 invalid-config 503 through the instance and sidecar handlers carries `Retry-After: 60`. |
| - [ ] Store builder test: config with `us` (bucket, region) and `ie` home yields one store for `us`, none for home, with the configured bucket and region. |
| Run: `nice -n 19 go test ./internal/console -run 'HA|Leftover|Sidecar|Capacity|Rootfs' -count=1` and `go test ./cmd/console -run <builder test> -count=1`. `go vet ./internal/console ./cmd/console`. GOOS=darwin and windows `go build ./...`. |
diff --git a/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md b/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md| index a1cebf78b..931808288 100644 |
| --- a/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md |
| +++ b/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md |
| @@ -799,10 +799,10 @@ None. |
| - the hibernate prefix is the console's own, from its activator configuration. If that configuration did not load (no `HibernateBucket`), the prefix is unknown and the create answers 503 before any LIST; |
| - the console's role needs `s3:ListBucket` on that bucket for prefixes `instances/*` and `moves/*` (G3 card item 3; for a scoped home region, the existing grant on its own bucket). This build adds no IAM. |
| -The region's boxes must use the console's hibernate prefix; the G3 card checks it on the US box. As in P2a, the proof reserves nothing and first wake still proves an empty prefix. Unscoped regions keep P2a's home proof and F5 unchanged. |
| +**Invariant I-B10: the proof and every box that could run the record share one storage location.** The configured bucket is where the console looks; reconcile admits a record on any box of its region and pool. So a scoped HA data create is refused (the capacity-unknown 503, `Retry-After: 60`) while any fresh, well-formed edges file placed in that region reports a `data_bucket` or `data_bucket_region` other than the config's. The check lives in one place (the capacity observation, consulted by the create door's capacity step) and logs the box's key. Boxes do not report their hibernate prefix, so the prefix half of I-B10 is an operator precondition: the region's boxes use the console's hibernate prefix, and the G3 card checks it on the US box and in the group config. As in P2a, the proof reserves nothing and first wake still proves an empty prefix. Unscoped regions keep P2a's home proof and F5 unchanged. |
| **Unchanged (N-HA4).** Offline moves, seed import and placement changes into or out of an HA region stay refused region-wide, scoped or not, for legacy hosts as well as HA ones. Seed `--from` keeps its existing rules (`seedPlacementRefusal`, never stamped), as on main. |
| **Dev.** Dev's IE entry carries no `ha_pools`, so dev behaves exactly as today: plain home creates are born HA, pooled and non-home HA data creates get F5, and existing records (hapair-a1) keep their immutable flag. |
| -**Review budget.** One Astra review of this addendum with its plan, at most three rounds (stopping rules). Round 1 (A1-A5, NOT READY) is answered in this text: the scoped proof always uses the configured bucket (A2), needs the activator prefix (A1), `--from` is unchanged (A3), and an invalid config is a 503 (A4). |
| +**Review budget.** One Astra review of this addendum with its plan, at most three rounds (stopping rules). Round 1 (A1-A5, NOT READY) is answered in this text: the scoped proof always uses the configured bucket (A2), needs the activator prefix (A1), `--from` is unchanged (A3), and an invalid config is a 503 (A4). Round 2 (A6, A7) adds I-B10's storage gate and the Retry-After header on the proof's 503s. |