carlos / platform Public

Regional custom-domain placements (#447): spec rev 2 and the Opus round-1 review of rev 1

Opus R1 (docs/superpowers/reviews/OPUS-REVIEW-regional-domains-447-R1.md):
independent read of rev 1 against main 803c6800. NOT READY: 2 P1 (no
serving address; no old-binary exclusion), 7 P2 (reconcile collision opens
a backhaul arm, hops not refused on the receiving side, no apex cert
admission, team scope through Route, lifetime binding, startup serving
gate, witness cannot see a dial), 8 P3. Counts as design round 1 of 3.

Spec rev 2 (docs/superpowers/specs/2026-10-28-regional-domains-447-design.md)
honours Paul's three rulings (EIP addresses from edges files, a release
floor mirroring the rootfs floor, platform capability only) and resolves
every R1 finding. One invariant enforced at Edge.regionalGate before every
backhaul and asset-fill arm; regional names are never published in edges
files; schema 2 makes old readers fail closed. Cuts the new edges-file
role, digests, lifetime binding, the probe, the startup gate and the
delete/move refusals.

Rev 1 and its review brief move from implementation/ to
docs/superpowers/reviews/ as history.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev be2faede8723a29e44db619c1205da10431046c6 parent 1608de4
4 files changed, +719 −0
  • docs/superpowers/reviews/OPUS-REVIEW-regional-domains-447-R1.md +238 −0
  • implementation/REVIEW-BRIEF-custom-domain-placements-447.md => docs/superpowers/reviews/REVIEW-BRIEF-custom-domain-placements-447-rev1.md +0 −0
  • implementation/custom-domain-placements-447.md => docs/superpowers/reviews/custom-domain-placements-447-rev1.md +0 −0
  • docs/superpowers/specs/2026-10-28-regional-domains-447-design.md +481 −0
diff --git a/docs/superpowers/reviews/OPUS-REVIEW-regional-domains-447-R1.md b/docs/superpowers/reviews/OPUS-REVIEW-regional-domains-447-R1.md
new file mode 100644
index 000000000..d59dd11d2
--- /dev/null
+++ b/docs/superpowers/reviews/OPUS-REVIEW-regional-domains-447-R1.md
@@ -0,0 +1,238 @@
+# Opus review: regional custom-domain placements (#447), design round 1
+
+Reviewer: Claude Opus 5.5, 2026-10-28. Independent cross-family read of rev 1
+(author Astra/GPT-6, zero completed rounds), now kept as history at
+`docs/superpowers/reviews/custom-domain-placements-447-rev1.md`.
+Code read: branch `regional-domains-447`, base main 803c6800.
+Fixed and not re-argued: Paul's three rulings of 2026-10-28 (EIP addresses,
+release floor, platform capability only). This read counts as round 1 of 3.
+
+Every citation below was opened and checked at 803c6800. Rev 1's own
+citations are accurate in substance; line numbers have drifted since its
+base a9536235 (P3-6).
+
+## P1
+
+### P1-1. §6 and §9.1: no member-visible serving address, so the feature cannot be used
+
+- Problem: rev 1 refuses to name any address a member may point latency DNS
+ at ("if none exists, that is a blocking product gap") and leaves it as a
+ prerequisite. Without it the #447 ask 3 has no answer and no customer DNS
+ can be built, so a merged capability would serve nobody.
+- Evidence: `internal/console/apiregions.go:42-48` returns code, armed,
+ aws_region, name and label only. The address already exists in data the
+ console reads: `internal/edgesfile/edgesfile.go:91` (`File.EIP`) and
+ `internal/edgesfile/snapshot.go:31` (`PlacementView.EIP`), written by
+ `internal/host/edgesfile.go:260` from `readPublicIP` (`internal/host/agent.go:3650`),
+ which is the instance's associated `aws_eip.host`
+ (`infra/modules/region-host/main.tf:580`).
+- Failure: the branch merges and no member can route a region's traffic to
+ the box that holds that region's instance.
+- Fix: Paul's ruling 1. The placements GET reports, per region, the EIPs of
+ the fresh boxes whose edges file publishes the bound target, read from the
+ edges snapshot the console already reads. No AWS call, no infra read.
+- Fault family: member-visible serving address contract.
+- Resolved in rev 2 §8.
+
+### P1-2. §7: no mechanism keeps old serving binaries out, and activation is told to refuse without one
+
+- Problem: rev 1 requires "the deployment's supported admission mechanism"
+ to stop an older binary arriving or rolling back while regional claims
+ exist, names none, and says to refuse activation if it cannot be
+ enforced. As written, regional mode is never enabled.
+- Evidence: the mechanism exists for rootfs. `internal/console/rootfsfloor.go:49-72`
+ (`rootfsFloorGate`, `rootfsFloorJudge`), its callers
+ `internal/console/apisystemupdate.go:424` and `internal/console/hostactivation.go:204,259`,
+ the activation-time barrier `internal/console/rootfs.go:188-250`
+ (`rootfsReadyRefusal`, `status.LoadBoxesComplete`, missing release counts
+ as below), and `internal/release/layoutintent.go:230,262-269`.
+- Failure: the PUT can never pass its own activation rule; or, if an
+ implementer drops the rule, an old binary that rolls back mid-life is
+ unaccounted for.
+- Fix: Paul's ruling 2, mirrored on the rootfs floor, plus schema 2 so an
+ old binary that arrives anyway (stale box returning, override, the update
+ gate's automatic `.prev` restore, which bypasses every floor) cannot read
+ the claim and fails closed.
+- Fault family: old-binary exclusion (mixed versions).
+- Resolved in rev 2 §10.
+
+## P2
+
+### P2-1. §5.1: "refused at reconcile" on a real-route collision opens a backhaul arm
+
+- Problem: rev 1 says a regional claim colliding with a real public route is
+ refused at mutation AND reconcile. Refusal at reconcile, read as "derive
+ nothing", leaves every box without a local entry for the name, while the
+ box holding the real route publishes it as `home`. Every other box then
+ backhauls the regional name to that box.
+- Evidence: every route row publishes `Role: "home"`
+ (`internal/host/edgesfile.go:592`); a miss takes `e.backhaul`
+ (`internal/edge/edge.go:1732`), which dials `homeMap.Home`
+ (`internal/edge/homemap.go:983-1031`).
+- Failure: the #447 consumer's current first-route claim is exactly a real
+ route under the apex. If any box still carries that route while the claim
+ is regional, uk traffic is backhauled to the ie box.
+- Fix: reconcile never drops the regional entry. Each box keeps its serve or
+ deny entry; a real route wins only on the box that holds it (the Reload
+ rule for aliases, `edge.go:1072-1075`), and the mutation door refuses the
+ collision up front (`deploymentRouteTaken`, `internal/console/apidomains.go:1574`).
+- Fault family: core invariant (no cross-region serving or backhaul).
+- Resolved in rev 2 §7.2 and §6.2.
+
+### P2-2. §5: the receiving side is not told to refuse a hop for a regional name
+
+- Problem: rev 1 only stops senders. A verified hop that arrives at the box
+ holding a region's target (sent by a box with a stale home map, or before
+ it has read the regional claim) would be served there.
+- Evidence: an accepted hop that matches a local entry falls through to
+ normal dispatch (`internal/edge/edge.go:1689` skips arm 1 for `hopped`,
+ and the hop refusal at 1697 sits inside the `!ok` branch only).
+- Failure: a write that landed in uk is executed by ie's instance.
+- Fix: the edge's regional guard answers 503 to any verified hop whose host
+ resolves to a regional entry, serve or deny.
+- Fault family: core invariant.
+- Resolved in rev 2 §7.3.
+
+### P2-3. §6: certificate admission for the apex has no mechanism
+
+- Problem: rev 1 publishes regional names under a new role "ignored by old
+ readers" and says the apex can "qualify for the existing bounded
+ certificate machinery". The issuer admits a name only through
+ `deploymentHost` = `Allowed` (this box's map) or `KnownHost` (another box's
+ file). The fold drops unknown roles and refuses cert-only roles on exact
+ keys, so a housekeeper with no local target never orders the apex.
+- Evidence: `internal/edge/edge.go:1291-1317,1346`; `internal/edge/homemap.go:809-828`
+ (`default: continue`; exact-key cert-only refused); `internal/edge/certsync.go:197-210`;
+ the warm reads `e.current()` (`internal/edge/certwarm.go:718-723`).
+- Failure: the apex serves no certificate in any region unless the
+ housekeeper happens to host a target.
+- Fix: every box derives an entry for every regional claim (the bound target
+ where it is local, a deny entry otherwise) in its own map, so `Allowed`
+ and the warm admit the apex on the housekeeper with no edges-file change.
+ The wildcard parent keeps the existing delegated path (cert-only
+ `wildcard` role, `internal/host/edgesfile.go:748-766`).
+- Fault family: certificate authority boundary.
+- Resolved in rev 2 §9.
+
+### P2-4. §4: keeping Route nonempty lets a team credential act on the whole regional claim
+
+- Problem: rev 1 keeps `Route` as one of the targets "for compatibility" and
+ denies team roles only on the new placements route. The existing team
+ scope test admits a claim on its `Route` alone, and the detach and get
+ doors are team-reachable.
+- Evidence: `internal/console/teamdoors.go:229-242` (`inScopeClaim` checks
+ `c.Route` only); `internal/console/authcli.go:866,868`
+ (`svcrole.Allow(Publish, Instance)`, `scopeDomainHost`) and the attach
+ door's team check `internal/console/apidomains.go:548-556`.
+- Failure: a team credential scoped to the ie instance detaches the claim,
+ taking every region down.
+- Fix: `inScopeClaim` treats a regional claim as out of scope.
+- Fault family: credential scope (team reach).
+- Resolved in rev 2 §6.4.
+
+### P2-5. §4: binding by judged lifetime makes the door depend on the lifetimes cutover
+
+- Problem: "Bindings require lifetime support; refuse unjudged/legacy
+ targets". Judged lifetimes exist only when the console unit is in
+ `cutoverOn`, and route rows carry incarnations only with lifetimes on.
+- Evidence: `internal/console/lifetimes.go:127-130`; `internal/host/edgesfile.go:593`.
+- Failure: on any deployment not cut over, every PUT refuses: the feature is
+ unusable there (P1 on such a deployment). Where it works it adds lifetime
+ plumbing through the claim, registry and edge for no safety gain: a
+ recreated instance under the same host is the same account and app, and a
+ foreign reuse is refused by the reconcile's account/app check.
+- Fix: bind by host; the box serves a binding only when the host is a local
+ ready route of the claim's account and app in the box's own region.
+- Fault family: binding identity.
+- Resolved in rev 2 §4 (Cuts) and §7.2.
+
+### P2-6. §5: gating all public serving at startup on the claim set widens the blast radius
+
+- Problem: "Fresh startup with incomplete policy evidence must gate public
+ serving until the applicable policy set is known." That makes every
+ tenant on a booting box wait on a successful claims listing.
+- Evidence: the edge serves from the persisted registry at the first
+ `Reload` (`internal/edge/edge.go:713`), and the alias pass runs on its own
+ loop (`internal/host/agent.go:1170-1182`).
+- Failure: a bucket blip at boot keeps a box from serving any tenant.
+- Fix: not needed once regional names are never published with a dial
+ role. A box with no entry for the name finds no dial target and answers
+ unknown host; the persisted table covers restarts.
+- Fault family: availability at boot (over-built guard).
+- Resolved in rev 2 §7.1 and §7.5.
+
+### P2-7. §8: the counter witness cannot show that removing the guard dials anywhere
+
+- Problem: rev 1's witness blocks the local target and asserts 503 with zero
+ backhaul calls. Its own design publishes regional names under a non-dial
+ role, so with the guard removed there is no dial target either: the
+ witness fails on status only and never shows the guard stopping a dial.
+- Evidence: `Home` and `ExactHome` require `h.dial`
+ (`internal/edge/homemap.go:996-1031`).
+- Failure: a later change that reorders the arms passes the witness.
+- Fix: seed the fixture with an old-binary-shaped edges file that names the
+ regional apex as `home`, and add a verified-hop leg to the target box.
+ Removing the guard then moves a counter and records a dial.
+- Fault family: witness strength.
+- Resolved in rev 2 §13.
+
+## P3
+
+- P3-1. §1, §9.5: switch-on is tied to the consumer's migration and merge to
+ "an agreed activation window". Ruling 3 makes the capability usable by any
+ member once the release is rolled; it is per claim, not dormant. Rev 2 §2.
+- P3-2. Tenant names, account code and hosts throughout rev 1 (§1-§3, §4
+ example). House rule: neutral names. Rev 2 uses shop and example.com and
+ "the #447 consumer".
+- P3-3. §5: "stop serving uncertain bindings" on an unreadable claim turns a
+ read blip into a 503 in every region. Keep the rows as they were, the
+ `deriveInstanceAliases` precedent (`internal/domains/aliases.go`, its doc
+ comment on a failed label count). Rev 2 §7.5.
+- P3-4. §5: cache keys carrying lifetime and policy revision. The response
+ cache keys on the requested host, as for an alias repoint today; a repoint
+ between two local instances of one app is not a region crossing. Cut.
+- P3-5. §7: does not say that an old box's alias pass reports incomplete on
+ every pass while a schema-2 claim exists (`relevantDropped`,
+ `internal/domains/aliases.go:305-311`), which withholds that box's
+ asset-cache blocks (`internal/host/agent.go:1170-1182`). Acceptable under
+ the floor; stated in rev 2 §10.
+- P3-6. Citation drift: `aliases.go:372` is now the routes listing; the
+ plain-alias half is at `aliases.go:407`. `edge.go:1675` is two lines above
+ the lookup (1677). `claims.go:440,689` are the function heads; the schema
+ checks are at 449 and 705.
+- P3-7. §4: the placements map keyed by region code puts the home's code
+ "" in a JSON key. Rev 2 stores a list of {region, host}.
+- P3-8. §4: "Attach must refuse to silently repoint one". `carlos deploy`
+ re-attaches on every run (`internal/domains/claims.go:585`), so a blanket
+ refusal breaks deploys. An attach naming a bound host is a no-op; any
+ other route refuses. Rev 2 §6.3.
+
+## Simplification candidates (recommend cutting)
+
+1. The edges-file publication of regional names under a new role, and the
+ reader changes it forces (home-map fold, steering decoder, `edgesfile`
+ election and route folds, console served-by joins, asset publication).
+ Not publishing them at all is safer (no dial target can exist) and
+ changes no reader.
+2. The dedicated policy table's digest, lifetime and revision columns, and
+ the desired-state digest returned to verification. A plain derived table
+ (host, target, account, app) is enough.
+3. The per-region authenticated probe and the observed-digest readiness
+ protocol. Safety does not depend on convergence evidence; the GET reports
+ readiness from edges files and heartbeats the console already reads.
+4. The fresh-startup serving gate (P2-6).
+5. Refusing member deletion and moves of a bound target. The box serves only
+ a target that is local and bound to its own region, so a deleted or moved
+ target makes that region 503, which the GET shows.
+6. `--file` and `--wait` on the CLI; a client-supplied ETag. Repeated
+ `--set REGION=HOST` and a server-side CAS on the server's own read cover
+ it.
+7. A hand-run `carlos system apply` floor. An old binary here cannot read
+ the claim and leaves no state the new binary cannot repair.
+8. Same-region proxying (rev 1 already excluded it; keep it out).
+
+## Verdict
+
+NOT READY. Two P1s (P1-1, P1-2), both resolved by Paul's rulings in rev 2.
+Seven P2s, all resolved in rev 2's text. P3s are folded in where they cost a
+line; none starts a round.
diff --git a/implementation/REVIEW-BRIEF-custom-domain-placements-447.md b/docs/superpowers/reviews/REVIEW-BRIEF-custom-domain-placements-447-rev1.md
similarity index 100%
rename from implementation/REVIEW-BRIEF-custom-domain-placements-447.md
rename to docs/superpowers/reviews/REVIEW-BRIEF-custom-domain-placements-447-rev1.md
diff --git a/implementation/custom-domain-placements-447.md b/docs/superpowers/reviews/custom-domain-placements-447-rev1.md
similarity index 100%
rename from implementation/custom-domain-placements-447.md
rename to docs/superpowers/reviews/custom-domain-placements-447-rev1.md
diff --git a/docs/superpowers/specs/2026-10-28-regional-domains-447-design.md b/docs/superpowers/specs/2026-10-28-regional-domains-447-design.md
new file mode 100644
index 000000000..05db66e45
--- /dev/null
+++ b/docs/superpowers/specs/2026-10-28-regional-domains-447-design.md
@@ -0,0 +1,481 @@
+# Regional custom-domain placements (#447): design, rev 2
+
+Status: design for agents, not member copy. Rev 2, author Claude Opus 5.5,
+2026-10-28, branch `regional-domains-447` from main 803c6800. Citations are
+at that commit.
+Round history: rev 1 (Astra/GPT-6, kept at
+`docs/superpowers/reviews/custom-domain-placements-447-rev1.md`): zero
+completed rounds. R1: the independent Opus read of rev 1
+(`docs/superpowers/reviews/OPUS-REVIEW-regional-domains-447-R1.md`), NOT
+READY, 2 P1, 7 P2, 8 P3, all resolved here. Next: Astra, round 2 of at most
+3 (AGENTS.md stopping rules 1-2).
+
+## 1. Invariant
+
+**A regional name is never served from, or backhauled to, another region,
+including after a restart, with the claim unreadable, or after a rollback.**
+Concretely: a box holding the claim's entry answers the name only from the
+instance bound to its own region and hosted on that box, and otherwise
+answers 503 without backhauling, asset-filling or dialling; a box that
+receives a hop for a regional name answers 503; a box with no entry finds no
+dial target, because no box publishes one (§7.1).
+
+Enforced in one place: `Edge.regionalGate` in `internal/edge/edge.go`
+`ServeHTTP`, called directly after `lookupUpstreamPath` (line 1677) and
+before every arm that leaves the box: exact-home backhaul and far asset
+catch (1689), and the miss arm's door `Owner` dial, `serveAssetFar` and
+`e.backhaul` (1696-1738). Two structural rules cover a box with no entry:
+regional names are never published with any role (§7.1), and a binary that
+predates the feature cannot read the claim (schema 2, §6.1). Guard test: W1
+`TestRegionalNameNeverLeavesItsRegion` with its mutation check (§13).
+
+## 2. Rulings (Paul, 2026-10-28, fixed) and switch-on
+
+1. The stable per-region address is each box's EIP as its edges file
+ publishes it (`internal/edgesfile` `File.EIP`, from `aws_eip.host`,
+ `infra/modules/region-host/main.tf:580`). The placements GET reports, per
+ region, the EIPs of the boxes that serve the bound target (§8).
+2. A release floor modelled on the rootfs floor keeps old binaries out
+ (§10): while any regional claim exists, a system channel at or above the
+ floor never moves below it without an explicit override; enabling
+ regional mode refuses unless every fresh box is at or above the floor.
+3. Scope is the platform capability. The #447 consumer's migration (its relay
+ to socket instances, lifting H24 for it, its DNS) is a later, separate go.
+
+Switch-on (rule 5). A member gets one verified custom domain (apex, plus its
+one-label catch-all if it has one) served in each chosen region by that
+region's instance of the same app, never backhauled, with the addresses to
+point latency DNS at. Asked for by #447. Usable as soon as the release
+carrying it is rolled: regional mode is per claim, set by its owner, and the
+PUT refuses until every fresh box runs the floor release. There is no global
+switch and nothing dormant.
+
+## 3. Decisions
+
+- D1. Bind the domain explicitly to one ordinary instance per region, a
+ `placements` list on the claim. Not `role=replica`, which has its own key
+ rules (`internal/activator/instancekey.go:280`, `replicaKeyGate`) and no
+ primary binding. Instances keep their own identity, storage and backups.
+- D2. Schema 2 for a regional claim, with `Route` kept equal to one bound
+ host. Schema 2 makes every reader that predates it skip the claim
+ (`claims.go:449,705`), so an old binary fails closed however it arrived.
+ A nonempty `Route` keeps every first-route branch off by construction:
+ the attach short-cuts (`apidomains.go:446,502`) and the record-retiring
+ detach branches (`apidomains.go:1034,1047`, `domainattach.go:374,386`).
+ The readers that would misuse `Route` branch explicitly (§6.1, §6.4).
+- D3. Every box derives an entry for every regional claim, in a new
+ registry table `regional_domains`, naming this box's bound target or none.
+ Not in `route_aliases`: every existing alias reader (edges-file writer,
+ DNS readings, asset inputs, instance catch-all) then fails closed by not
+ seeing it. In `route_aliases`, the writer's catch-all loop
+ (`internal/host/edgesfile.go:711-766`) would publish `*.<host>` as a dial
+ target.
+- D4. Regional names are never published in edges files, under any role.
+ No dial target can exist anywhere, and no edges-file reader changes.
+- D5. A box's region is the code its provisioning reconciler scopes by
+ (`ReconcileConfig.Region`, `internal/provision/reconcile.go:487`, from
+ `CARLOS_REGION`, `""` for the home), the value its edges file publishes as
+ `placement`. Stored codes use it; the console normalises input with
+ `homeRegionIn`.
+- D6. One bound instance per region. Every other box, including another in
+ the same region, answers 503. No same-region proxy.
+- D7. Placements are written by a person only. The team scope test treats a
+ regional claim as out of scope (R1 P2-4).
+- D8. The promotion floor applies only while a regional claim exists (the
+ ruling's words), so rollback stays free until someone uses the feature.
+ The activation barrier runs on every regional PUT.
+
+## 4. Cuts
+
+| Cut | Why |
+|---|---|
+| A new edges-file role for regional names, and the readers it forces to change (home-map fold, steering, `edgesfile` election and folds, served-by joins, asset publication) | Not publishing is safer and touches no reader (D4). |
+| Digest, lifetime and revision columns; a digest returned to the client | A box's entry is a pure function of the claim and its own routes; safety does not need them. |
+| Binding by judged lifetime | Needs the lifetimes cutover (`console/lifetimes.go:127`) or the door refuses everywhere (R1 P2-5). A recreated same-host instance is the same account and app; a foreign reuse fails the reconcile tenancy check. |
+| Authenticated per-region probe; observed-digest readiness | The GET reads readiness from edges files and heartbeats (§8). |
+| Startup gate on public serving | Covered structurally (§7.5); rev 1's gate made every tenant wait on a claims listing at boot (R1 P2-6). |
+| Refusing delete or move of a bound instance | A box serves only a local target bound to its own region, so a deleted or moved target makes that region 503, which the GET shows. Five delete and move doors stay untouched. |
+| `--file`, `--wait`, client ETag | Repeated `--set REGION=HOST`; the server CASes on its own read. |
+| Hand-run `carlos system apply` floor | An old binary cannot read the claim and leaves nothing to repair (§10.4). |
+| Same-region proxy; several instances per region | D6. |
+| Cache key changes on repoint; far asset cache | Same as an alias repoint today; unpublished names have no far declaration. |
+| A "region armed" check on the PUT | The target's record carries its region, accepted at create. |
+| Paths, first-route, static, TCP, fleet, sidecar and replica targets | Refused up front (§6.2). |
+
+Kept on purpose: schema 2. It is cheap, and the only rule that covers an old
+binary that slips past the floor.
+
+## 5. R1 findings resolved
+
+P1-1 address: §8. P1-2 old binaries: §10, D2. P2-1 reconcile collision:
+§7.2 (entries always written), §6.2 (refused up front). P2-2 hops: §7.3.
+P2-3 apex certificate: §9. P2-4 team scope: §6.4, D7. P2-5 lifetimes: §4,
+§7.2. P2-6 startup gate: §4, §7.5. P2-7 witness: §13 W1 legs (c) and (d).
+P3-1 switch-on: §2. P3-2 tenant names: none here. P3-3 unreadable claim:
+§7.2. P3-4 cache keys: §4. P3-5 old-box incomplete passes: §10.4. P3-6
+citation drift: fixed. P3-7 `""` as a JSON key: §6.1 (list). P3-8 attach
+repoint: §6.3.
+
+## 6. Data shape, API and CLI
+
+### 6.1 Claim (`internal/domains/claims.go`)
+
+```json
+{"schema": 2, "host": "example.com", "account": "<sqid>", "app": "shop",
+ "route": "shop-ie.example.net", "wildcard": true, "catchall": true,
+ "placements": [{"region": "", "host": "shop-ie.example.net"},
+ {"region": "uk", "host": "shop-uk.example.net"}],
+ "created_at": "...", "created_by": "..."}
+```
+
+- `type Placement struct{ Region, Host string }` and `Claim.Placements`
+ (`json:"placements,omitempty"`), declared so every converge round-trips it
+ (the rule at `claims.go:48-61`). `Regional()` is `len(Placements) > 0`;
+ `PlacementFor(region) string`.
+- `ValidPlacements`: 1 to 8 entries, unique regions, unique hosts, each host
+ passes `NormalizeAliasHost` and is not under `.sidecar.internal`, `Route`
+ is one of them, no `Paths`, not `Instances`, not `Pending`.
+- Readers accept schema 1, and schema 2 only when `Regional()` and
+ `ValidPlacements` hold; anything else is skipped as today. Above 2 is
+ still refused. Single mode stays schema 1 with no placements.
+- Every file that parses a Claim is audited ("Rules this repo has paid
+ for"; today 30 non-test files match
+ `grep -rln 'domains\.Claim\b\|GetClaim\|ListClaims\|ClaimCache'`). Each
+ ignores placements safely or branches on `Regional()` first. Known `Route`
+ readers that must branch: `aliases.go:407` (plain alias), `aliases.go:608`
+ (wildcard primary), `teamdoors.go:234-237`, `claim_alias.go`,
+ `domaincatchall.go`, `AttachClaimProven`'s converge.
+
+### 6.2 PUT door (`internal/console`, new `apiplacements.go`)
+
+`PUT /api/cli/apps/{account}/{app}/domains/{host}/placements` with exactly
+one of `{"placements":[{"region":"uk","host":"shop-uk.example.net"}]}` (the
+whole set) or `{"single_route":"shop-ie.example.net"}`.
+
+Order: `domainsGate`; `apiPerson` (the route admits no service role);
+`refuseTemporary`, `refuseControlPlane`; `NormalizeAliasHost`; a platform
+hostname refused (`domainHostPolicy`); `lockAppHost` when `lifetimesUnit`, as
+detach does; read the claim with its ETag. Absent or another owner's: the
+attach door's neutral 409 bytes. Pending, with `Paths`, or first-route
+(`Route == ""`): refused. Each binding: region through `homeRegionIn`; the
+host must be an instance record of this account and app (`listRecords`)
+with `Region` equal to the binding's, `KindOrDefault() == "instance"`,
+`Role == ""`, not fleet-placed. Unknown and foreign hosts get identical
+bytes. Collision: `deploymentRouteTaken` (`apidomains.go:1574`) for the host
+and, with a catch-all, for `*.<host>`. Then the activation barrier (§10.3).
+Then `domains.SetClaimPlacements` (new): CAS on the ETag read under the
+lock, a conflict answers 409; `Route` is kept if bound, else the first host
+by region. Audit and `bumpSerial` only when bytes changed. The answer is the
+GET body.
+
+`single_route` is validated as attach validates a named route and writes
+schema 1, no placements, that `Route`. No barrier: it leaves regional mode.
+
+### 6.3 Other writers
+
+- `AttachClaimProven` on the caller's own regional claim: a route that is a
+ bound host is a no-op (`carlos deploy` re-attaches every run,
+ `claims.go:585`); any other route returns `ErrRegionalClaim` (409).
+- `SetClaimPaths` on a regional claim: `ErrRegionalClaim`.
+- `SetClaimCapabilities` unchanged: `next := *cur` keeps schema and list.
+- Detach unchanged: it deletes the claim only, never an instance.
+
+### 6.4 Readers and scope
+
+- `teamView.inScopeClaim` (`teamdoors.go:229`): a regional claim is out of
+ scope, so a team credential gets not-found bytes on get, detach and attach.
+- `domainItem` (`apidomains.go:1261`) adds `"mode":"regional"`; readiness
+ for such a claim lives in the placements GET.
+
+### 6.5 GET door
+
+`GET /api/cli/apps/{account}/{app}/domains/{host}/placements`, registered
+like `GET .../domains/{host}` (`authcli.go:866`), so a team sees a regional
+claim as not found. Works for every alias claim:
+
+```json
+{"host": "example.com", "mode": "regional", "route": "shop-ie.example.net",
+ "catchall": true,
+ "placements": [
+ {"region": "ie", "target": "shop-ie.example.net", "ready": true,
+ "boxes": [{"box": "<label>", "eip": "203.0.113.10",
+ "aws_region": "eu-west-1", "release": "v0.31.0"}]},
+ {"region": "uk", "target": "shop-uk.example.net", "ready": false,
+ "reason": "no-serving-box", "boxes": []}]}
+```
+
+The home region shows by its name. Single mode has one entry, the route's.
+Reasons are JSON values, not copy: `no-serving-box`, `below-floor`,
+`no-address`, `evidence-incomplete`.
+
+### 6.6 CLI (`domains_cli.go`; syntax only, copy goes in the deck)
+
+```
+carlos domains placements --app shop example.com
+carlos domains placements --app shop example.com --set ie=shop-ie.example.net --set uk=shop-uk.example.net
+carlos domains placements --app shop example.com --single shop-ie.example.net
+```
+
+`--set` gives the whole set. `docs/site/cli.md` names the subcommand.
+
+## 7. Serving
+
+### 7.1 Never published
+
+The edges-file writer (`internal/host/edgesfile.go`) reads `routes`,
+`route_aliases` and `wildcard_domains`, never `regional_domains`, so no box
+publishes a regional apex or `*.<apex>` under any role. The target's own
+instance host is published as today. A regional claim's wildcard parent
+appears only under the cert-only `wildcard` role, because `catchallServed`
+(711) reads `route_aliases`. An old binary skips the schema-2 claim and
+derives nothing. So `Home`, `ExactHome`, `Owner` and `AssetsFor`
+(`homemap.go:983-1110`) never return a dial target for a regional name.
+Guard test: W2.
+
+### 7.2 Derivation (`internal/domains/aliases.go`, `internal/registry`)
+
+- Table `regional_domains(host TEXT PRIMARY KEY, target TEXT NOT NULL
+ DEFAULT '', account, app, created_at)`, created like `route_aliases`
+ (`registry.go:763`), wholly pass-owned, hashed by `Fingerprint` so the
+ edge reloads, with list, upsert and delete on the remote registry too.
+- `ReconcileAliasesReport` takes the box's region (D5), passed by
+ `aliasPassReporting` (`internal/host/agent.go:1170`). In the claims loop,
+ right after the `Pending` skip, a regional claim is handled and
+ `continue`s: the plain-alias, paths and instance catch-all halves never
+ see it.
+- `t := PlacementFor(boxRegion)` stays only if `byHost[t]` is ready, has the
+ claim's account and app, is socket-backed with kind instance (`""` reads
+ as instance), is not a replica, sidecar or fleet-placed route, and has
+ `Region == boxRegion`. Otherwise `t = ""`. Desired rows: `host -> t`, and
+ `*.host -> t` with `Wildcard && Catchall`. Every box writes rows for every
+ regional claim. A `Wildcard` regional claim derives its `wildcard_domains`
+ row only where `t != ""` (same per-box cap of 32).
+- Undesired rows are deleted, except rows whose claim is listed but
+ unreadable this pass (dropped, not not-found): they stay as they were and
+ the pass reports incomplete (the `deriveInstanceAliases` rule).
+- A real route of the same name on this box: the row is still written, and
+ `Reload` lets the route win there, logged, as for aliases.
+
+### 7.3 Edge (`internal/edge/edge.go`)
+
+- `upstream` gains `regional` (`regionalServe` or `regionalDeny`) and
+ `regionalKey` (the row's host, a bounded log key).
+- `Reload`, after the alias loop (1067-1085): for each row whose key no real
+ route holds, a present `m[target]` gives that entry with `alias = true`
+ and `regionalServe`; anything else gives a deny entry (zero route, nil
+ proxy).
+- `regionalGate(w, r, host, up, ok, hopped)`: not ok or not regional, no-op.
+ A star match (`!servesExactly(host)`), not hopped, for which
+ `ExactHome(host)` names another box: no-op, so arm 1 serves that distinct
+ exact name, which is never regional (§7.1). A hop: 503, serve or deny.
+ Deny: 503. Serve: no-op, then the normal path (gate, meter, cache, wake,
+ upgrades) on the target's upstream. Door callers get the same answers.
+- The 503 has `Retry-After: 2`, as `staleHopRefusal`, and a log throttled
+ by `regionalKey`.
+
+### 7.4 Precedence
+
+`lookupIn` is unchanged: exact first, then the one-label star. A local exact
+route or alias beats a regional star; another box's exact name beats a local
+regional star (arm 1). A regional apex cannot collide with another claim
+(one claim per host); a real route of that name is refused at the PUT and
+wins only on its own box.
+
+### 7.5 Restart, unreadable claim, rollback, switch
+
+- Restart: rows persist in SQLite; the first `Reload` serves them.
+- Fresh box, empty registry: a miss, and no dial target exists (§7.1): the
+ unknown-host answer.
+- Unreadable claim: rows kept (§7.2). Detach: rows deleted on every box.
+- One box rolled back below the floor: it skips the claim and ignores the
+ table, so it answers unknown host and publishes nothing; other boxes are
+ unaffected. On re-upgrade its next pass reconciles the table.
+- Single to regional: until a box reads the regional claim it treats the
+ name as the alias it was. The previous home deletes its alias row and
+ writes its regional row in one pass, so from then on it refuses hops for
+ the name (§7.3), even while its edges file still lists the alias for up
+ to one publication interval. The member points DNS after the GET says
+ ready.
+
+## 8. Addresses (ruling 1)
+
+The GET makes one edges read (`edgesfile.ReadSnapshot`) and one heartbeat
+load (`status.LoadBoxesComplete`), joined as `edgesfile.JoinLive` joins
+them. A placement's serving boxes are the fresh boxes whose file `placement`
+equals the region code and whose `hosts` holds the target under role
+`home`. A box counts when its heartbeat release is at or above the floor
+and its `eip` is nonempty; `ready` means at least one counts. `boxes` lists
+each with `eip`, the file's `region` as `aws_region` (the key
+`apiregions.go` uses) and release. No region's readiness stands in for
+another's; incomplete evidence makes every entry not ready.
+
+Limits, stated not solved: a box under region HA publishes its own current
+public address, and none once the region's EIP has moved to the load
+balancer (`internal/host/awsaddr.go:12-17`, A1-12), so that region shows
+`no-address`. A replaced box has a new EIP, which the GET shows.
+
+## 9. TLS
+
+- Apex: every box holds an entry (serve or deny), so `Allowed`
+ (`edge.go:1291`) admits it on the housekeeper too, and the warm
+ (`certwarm.go:718`) orders it after its DNS gate (every answer in the edge
+ set). The CA's HTTP-01 request reaches whichever box DNS names, which
+ answers through the existing read-through. No edges-file change.
+- Catch-all: the existing delegated DNS-01 wildcard. Target boxes derive the
+ `wildcard_domains` row and publish the parent cert-only (§7.1); every box
+ loads the mirrored PEM through `WildcardParents`. `Allowed` refuses `*.`
+ keys and invented one-label names, so they drive no orders.
+- No new issuance authority: entries exist only for verified claims.
+
+## 10. Floor (ruling 2)
+
+### 10.1 Constant
+
+`release.RegionalDomainsFloor` in `internal/release/layoutintent.go`, beside
+`RootfsLifecycleFloor` (230); `RegionalFloorAllows(installed, candidate)`
+shaped like `RootfsFloorAllows` (262); `RegionalFloorOverrideFlag =
+"allow-below-regional-floor"`. The value is assigned at the end of the
+build: v0.31.0 unless main has moved (latest tag v0.30.2). Pinned by
+`TestRegionalDomainsFloorIsPinned`.
+
+### 10.2 Promotion gate (console)
+
+`regionalFloorJudge` beside `rootfsFloorJudge` (`rootfsfloor.go:62`), called
+wherever the rootfs floor is: `apisystemupdate.go:424` and
+`hostactivation.go:204,259`. Both judges run on the one pointer read, so the
+returned ETag covers exactly what was judged. It applies only while a
+regional claim exists, read through `s.claims.ListWithUnread`: a listing
+error refuses, and an unread claim counts as regional. The override
+(`allow_below_regional_floor` on system update and rollback; CLI flags at
+`system.go:295,576`) is logged.
+
+### 10.3 Activation barrier
+
+`regionalReadyRefusal(ctx)` on every PUT that writes placements, mirroring
+`rootfsReadyRefusal` (`rootfs.go:188`): `status.LoadBoxesComplete` over the
+platform's heartbeats. An error, incomplete evidence or no fresh box: 503. A
+fresh box below the floor (a missing or unparseable release counts as
+below): 409 naming the first by label, with its release. Every platform box
+counts, not one region: every edge must hold the deny entry. Fleet boxes are
+out: a fleet-placed target is refused, and an old fleet box fails closed
+through schema 2.
+
+### 10.4 What escapes the floor, and why that is safe
+
+A box stale at activation that returns old, the override, the update gate's
+automatic `.prev` restore, and a hand-run apply all bypass the floor. Each
+leaves an old binary that cannot read the claim, so it fails closed (§7.5).
+While a schema-2 claim exists, that box's alias pass reports incomplete on
+every pass (`relevantDropped`, `aliases.go:305-311`), which withholds its
+asset-cache blocks until it is upgraded.
+
+## 11. Request budget
+
+No new per-box polling and no new objects. Per box per pass: zero new
+requests; a regional claim is one more key in the `domains/` ListMod every
+box already makes, read once per change. Edges files and heartbeats are
+byte-identical. Per PUT: claim GET and PUT, the existing serial bump, one
+app record listing, one heartbeat load and one edges read (each a LIST plus
+one GET per box). Per GET: claim GET, one edges read, one heartbeat load.
+Per system update or rollback: one `domains/` ListMod through the console's
+`ClaimCache`.
+
+## 12. Provider boundary
+
+The core reads `eip`, `region` and `placement` from edges files, which each
+box writes from its address source (the IMDS adapter, or `CARLOS_PUBLIC_IP`
+in host.env), and releases from heartbeats. No AWS SDK call, no read of
+`infra/`, no DNS change. `aws_region` is relayed as published, as
+`apiregions.go` does. DNS is the member's.
+
+## 13. Witnesses
+
+Production wiring throughout: the real edge, registry, reconcile pass,
+edges-file writer, home-map fold and console server; listeners on 127.0.0.1.
+
+- W1 `TestRegionalNameNeverLeavesItsRegion`. Box A (home, named ie) and box
+ B (uk) on one DirStore bucket, each with a counting target (Tie, Tuk);
+ `example.com` regional with a catch-all. Hooks count `backhaulTo` dials,
+ far asset fills and dial targets returned by `Home` and `ExactHome`.
+ (a) GET and POST to `example.com` and `alice.example.com`: at A only Tie
+ moves, at B only Tuk. (b) Tuk not ready, then removed: B answers 503,
+ zero dials and fills, Tie unchanged. (c) B's home map seeded with an
+ old-binary-shaped A file naming `example.com` and `*.example.com` as
+ `home`: still 503, zero dials. (d) A correctly signed hop to A for both
+ names: 503, Tie unchanged. (e) B restarted from the same registry with the
+ claim unreadable: still 503. A fresh B (empty registry) with (c)'s map
+ dials A, and A refuses: Tie unchanged.
+ Mutation check: with the `regionalGate` call removed, (c) records a dial
+ or (d) moves Tie. Watched to fail once, noted in the task's review notes.
+- W2 `TestEdgesFileNeverPublishesRegionalNames`: a box serving a bound
+ target publishes the target host, never the apex or `*.apex` under any
+ role, and the parent only as `wildcard`.
+- W3 derivation: no `route_aliases` or `route_paths` row from a regional
+ claim; a row on every box; a target only where local, ready, same tenant
+ and same region; an unreadable claim keeps rows; detach deletes them.
+- W4 scope: `inScopeClaim` refuses a regional claim; a team credential
+ scoped to a bound instance gets not-found bytes on DELETE.
+- W5 PUT: unknown and foreign targets give identical bytes; region mismatch;
+ replica, fleet, static and sidecar targets; pending; first-route; `Paths`;
+ platform hostname; real-route collision; service credential; CAS
+ conflict; an unchanged write bumps no serial.
+- W6 wire: today's reader skips a schema-2 body; schema 1 round-trips
+ byte-stable; `SetClaimCapabilities` keeps schema and list; attach naming a
+ bound host is a no-op and another route 409s.
+- W7 floor, mirroring `rootfsfloor_test.go`, `rootfs_test.go:317` and
+ `layoutintent_test.go:143,157`: `TestRegionalFloorAllows`,
+ `TestRegionalFloorRefusesBeforeReservation`,
+ `TestRegionalFloorLeavesAChannelAloneWithoutRegionalClaims`,
+ `TestRegionalFloorLeavesAChannelBelowItAlone`,
+ `TestRegionalFloorOverrideIsPartOfTheRequest`,
+ `TestRegionalFloorBindsTheJudgedPointer`,
+ `TestRegionalFloorUnreservedRollbackKeepsTheOverride`,
+ `TestRegionalFloorCountsAnUnreadClaim`,
+ `TestSystemDoorsRefuseBelowTheRegionalFloor`, and
+ `TestPlacementsRefusesWithABoxBelowTheFloor` (409 names the box; a missing
+ release counts as below; incomplete heartbeats 503; a stale box ignored).
+- W8 GET: ready only from a fresh box in that region, at the floor,
+ publishing the target and an EIP; one ready region never makes another
+ ready; incomplete evidence makes none ready.
+- W9 TLS: `Allowed` is true for the apex on a box with only a deny entry,
+ false for `*.apex` and an invented one-label name; the housekeeper's warm
+ set includes the apex.
+
+Locally, only touched packages with `-run`; CI runs the full gate.
+
+## 14. Census expectation
+
+Likely in the root binary's scope (`go list -deps .`): `internal/edge`
+(`Reload`, `regionalGate`), `internal/domains` (claim shape, derivation),
+`internal/registry` (table, fingerprint, remote methods), `internal/release`
+(floor constant), `internal/host` (the region into the alias pass), and the
+root package (`domains_cli.go`, `system.go`). `internal/edgesfile` should
+not change; `internal/console` is out of scope. No new root read of an
+agent- or tenant-writable path is intended; the reviewer decides each class
+(AGENTS.md "The census").
+
+## 15. Build order
+
+1. The GET and the CLI read, for every existing alias claim: region, serving
+ box, EIP. The first change anyone can see (rule 6).
+2. Claim shape, the reader audit, writer rules (§6.3), team scope (§6.4).
+ W4, W6.
+3. `regional_domains` and the derivation. W2, W3.
+4. Edge entries and `regionalGate`. W1 with the mutation check, W9. Its own
+ Astra review (routing, backhaul, certificates; rule 3).
+5. PUT door, activation barrier, CLI write. W5, W8, the barrier half of W7.
+6. Promotion floor and override flags. W7.
+7. Copy deck (help, refusals, docs page) and its Luna pass;
+ `docs/site/cli.md`; assign the floor constant; census.
+
+The branch merges once, after the whole-branch review.
+
+## 16. Out of scope
+
+The #447 consumer's migration (relay to socket instances, H24, DNS);
+same-region proxy or failover; several instances per region; replica wording
+and semantics (#447 ask 4: placements use ordinary instances, so no replica
+rule changes); paths on regional names; static, TCP, fleet, sidecar and
+replica targets; publishing a region HA load balancer's address; automatic
+DNS; far asset cache and purge for regional names; refusing delete or move
+of a bound instance.