carlos / platform Public

region HA G3-B10: I-B10 fails closed on stale files (Astra r3, 8a3d302)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 7c5ed5877f657f19ed90936505fb155783e2ae22 parent 5815bf8
2 files changed, +5 −4
  • docs/superpowers/plans/2026-11-05-region-ha-g3-b10.md +4 −3
  • docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md +1 −1

CI passed — run details

Intent

Attributed to this commit: 80.2 g CO₂e (7,861,143 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-g3-b10, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

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 f9dd692ad..60ae20116 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). |
+| R8 | Astra r3 (round 3 of 3): A6 still P1 (stale files). 8a3d302's answer (for Paul): fail closed, any age; refusal names region label and the mismatched box; no fourth plan round; Opus reviews check the gate specifically; sidecars stay in. |
| 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. |
@@ -43,7 +44,7 @@ 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.
+- [ ] I-B10 (A6, R8): `func (o *HACapacityObservation) MixedStorage(region string) (box string, mixed bool)`: true when any non-malformed file, **of any age**, 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; `box` is that file's box reference (from its key, as the observation names boxes elsewhere). It must not depend on `available(now)` freshness of that file. `requireHACreateCapacity`, for a scoped region's HA create only, refuses 503 with `haCapacityRetryAfter: 60` before `Decide`, with a NEW sentence naming the region label and the box (draft: "%s has a box on a different data bucket (%s). Nothing was created. An operator must fix or retire that box."; the controller's Luna pass sets the final text). Log the edges key too. 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).
@@ -64,8 +65,8 @@ 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).
+- [ ] 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 with the I-B10 sentence (region label, box) and `Retry-After: 60`, zero writes; an admitted box whose edges file has gone stale (stopped publishing) still blocks; once its file is rewritten matching or deleted, the create succeeds; a plain `us` create is unaffected; 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 well-formed file placed `us`, of any age, has the configured bucket and bucket region (or does not report them). 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.
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 931808288..922d518c1 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,7 +799,7 @@ 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.
-**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.
+**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 create is refused (503, `Retry-After: 60`) while any well-formed edges file placed in that region, **whatever its age**, reports a valid `data_bucket` or `data_bucket_region` other than the config's (Astra round 3: a box whose publication has stopped may still reconcile and wake records). The block clears only when that file is rewritten matching, or deleted when the box retires. The refusal names the region by its label and the mismatched box, so an operator can find it. The check lives in one place (the capacity observation, consulted by the create door's capacity step). Plain creates and unscoped regions are untouched (agent manager 8a3d302 for Paul, 2026-11-05). 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.