carlos / platform Public

Regional domains (#447): spec rev 3, Paul's ruling 4 applied for Astra round 3 of 3

Ruling 4 (2026-10-29, relayed by root session platform-17): option A plus
two local fixes.
- No live conversion: a regional claim is born regional. The PUT creates
  it or replaces a pending claim; it never converts a verified schema-1
  claim, and refuses while any fresh box publishes the host or *.host
  under role home or lists host, *.host or *.parent among its alias rows
  (heartbeat Metrics.Aliases). The GET adds a settling reason until every
  fresh box reports after created_at. single_route is cut.
- Overlap with catch-alls refused both ways, with the exact one-label
  "covers" rule: parent catch-all claims, instance catch-alls on *.parent
  and *.host, published *.parent; reverse doors (catchall flip, instance
  catch-all attach) scan the claim listing; instance create refuses a
  regional host.
- Regional entries carry no path map; the gate reads the Host's own entry.
- release.RegionalTarget is the one eligibility predicate, in derivation
  and again in edge Reload against its own route snapshot; a failure is a
  deny entry.
- The stale old-binary box is stated as a limit (section 10.5) with its
  bound.
R2 P2 fixes: no owner exemption on the collision test and incomplete
evidence refuses; one shared snapshot per PUT and a rewritten request
budget. R2 P3: wildcard publication wording. New witnesses W10, W11 and
W1 legs (f)-(h).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 7d830bead96fbc7fcc9dc309552a01a36be2ec30 parent c6a5ba5
1 file changed, +537 −195
  • docs/superpowers/specs/2026-10-28-regional-domains-447-design.md +537 −195
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
index 05db66e45..e56f85374 100644
--- a/docs/superpowers/specs/2026-10-28-regional-domains-447-design.md
+++ b/docs/superpowers/specs/2026-10-28-regional-domains-447-design.md
@@ -1,35 +1,48 @@
-# Regional custom-domain placements (#447): design, rev 2
+# Regional custom-domain placements (#447): design, rev 3
-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.
+Status: design for agents, not member copy. Rev 3, author Claude Opus 5.5,
+2026-10-29, branch `regional-domains-447` (origin/main merged at c6a5ba51).
+Citations are at c6a5ba51.
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).
+READY, 2 P1, 7 P2, 8 P3, resolved in rev 2. R2: Astra on rev 2
+(`docs/superpowers/specs/CODEX-FINDINGS-regional-domains-447-R2.md`), NOT
+READY, 4 P1, 2 P2, 1 P3; stopping rule 2 applied (old-binary exclusion and
+cross-region isolation, two rounds running), work stopped and the choice
+went to Paul, who gave ruling 4 (§2). Rev 3 applies ruling 4 and the R2
+P2/P3 fixes. Next: Astra round 3 of 3, the last (AGENTS.md stopping rules
+1-2). A fourth round needs Paul's go.
## 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).
+instance bound to its own region and hosted on that box, judged against the
+routes it is serving now, 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 a regional name (§7.1) and no catch-all that covers one may exist
+beside it (§6.7).
Enforced in one place: `Edge.regionalGate` in `internal/edge/edge.go`
-`ServeHTTP`, called directly after `lookupUpstreamPath` (line 1677) and
+`ServeHTTP`, called directly after `lookupUpstreamPath` (line 1675) 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
+catch (1689-1695), and the miss arm's door `Owner` dial, `serveAssetFar` and
+`e.backhaul` (1696-1737). The gate is decided on the request's Host, before
+any path is selected (§7.3). Structural rules cover a box with no entry:
+regional names are never published under a dial-capable role (§7.1), no
+covering catch-all may coexist with a regional name (§6.7), a name is
+regional only if it never served as an ordinary alias (§6.2), and a binary
+that predates the feature cannot read the claim (schema 2, §6.1). What the
+floor cannot reach is stated as a limit (§10.5). Guard test: W1
`TestRegionalNameNeverLeavesItsRegion` with its mutation check (§13).
-## 2. Rulings (Paul, 2026-10-28, fixed) and switch-on
+## 2. Rulings (fixed) and switch-on
+
+Rulings 1-3 are Paul's of 2026-10-28.
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`,
@@ -41,14 +54,28 @@ predates the feature cannot read the claim (schema 2, §6.1). Guard test: W1
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.
+4. Paul, 2026-10-29, relayed by the root session platform-17, after R2
+ (stopping rule 2): option A plus two local fixes.
+ - No live conversion. Regional mode only for a domain that has never
+ served as an ordinary alias (§6.2).
+ - Refuse overlap with ordinary catch-alls in both directions: a regional
+ name under an ordinary catch-all parent is refused, and turning on a
+ catch-all (or creating a catch-all claim or route) above a regional
+ name is refused (§6.7).
+ - Regional entries carry no path map (§7.3).
+ - Reload rechecks each target with the derivation's own test: one shared
+ eligibility predicate, applied in derivation and in edge `Reload`
+ against the route snapshot `Reload` builds from; a failed check gives
+ a deny entry (§7.2, §7.3).
+ - The stale-box / old-binary gap is stated as a limit (§10.5).
+
+Switch-on (rule 5). A member creates one custom domain in regional mode
+(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, created 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
@@ -56,9 +83,9 @@ switch and nothing dormant.
`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.
+- D2. Schema 2 for a regional claim, with `Route` equal to one bound host
+ from its first write. Schema 2 makes every reader that predates it skip
+ the claim (`claims.go:449,705`), so an old binary never derives from it.
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`).
@@ -70,10 +97,11 @@ switch and nothing dormant.
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.
+- D4. Regional names are never published in edges files under a
+ dial-capable role. The apex is not published at all; the star appears
+ only as the cert-only `wildcard` entry (§7.1).
- D5. A box's region is the code its provisioning reconciler scopes by
- (`ReconcileConfig.Region`, `internal/provision/reconcile.go:487`, from
+ (`ReconcileConfig.Region`, `internal/provision/reconcile.go:44`, from
`CARLOS_REGION`, `""` for the home), the value its edges file publishes as
`placement`. Stored codes use it; the console normalises input with
`homeRegionIn`.
@@ -84,37 +112,58 @@ switch and nothing dormant.
- 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.
+- D9. Born regional (ruling 4). The PUT creates a regional claim, or
+ replaces a pending one that never derived anything; it never converts a
+ verified schema-1 claim, and nothing converts a regional claim back. To
+ change mode a member detaches and creates again (§6.2).
+- D10. One eligibility predicate, `release.RegionalTarget`, decides a
+ target in derivation and again in `Reload` (§7.2, §7.3).
## 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. |
+| 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, rechecked at every reload (§7.3); 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). `Reload` rechecks tenancy, region and backend against the live route (§7.3), so a reused host under another owner is denied. |
| 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). |
+| Hand-run `carlos system apply` floor | An old binary cannot read the claim, and a box fresh at creation holds no ordinary row for the name (§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). |
+| Paths, first-route, static, TCP, fleet, sidecar, tunnel and replica targets | Refused up front (§6.2) and by the predicate (§7.2). |
+| Live single-to-regional conversion, and rev 2's `single_route` (regional back to single in place) | Ruling 4 (D9). Detach, then attach or create. |
+| Path maps on regional entries | Ruling 4 (§7.3). |
+| Refusing a root `carlos add '*.<parent>'` on a box | A root act on one box, outside every console door; bounded in §10.5. |
+
+Kept on purpose: schema 2. It is cheap, and the only rule that keeps an old
+binary from deriving anything from a regional claim.
-Kept on purpose: schema 2. It is cheap, and the only rule that covers an old
-binary that slips past the floor.
+## 5. Findings resolved
-## 5. R1 findings resolved
+R1: 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.3. 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: re-cited at c6a5ba51. P3-7 `""` as a
+JSON key: §6.1 (list). P3-8 attach repoint: §6.3.
-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.
+R2 (each through ruling 4):
+
+| Finding | Resolution |
+|---|---|
+| P1-1 schema 2 does not undo persisted serving state | No conversion (D9, §6.2): the PUT refuses any claim that may have served, and refuses while any fresh box publishes or holds an ordinary row for the name; the GET waits for every fresh box to report after creation (§8). What still escapes is the stale old box, stated in §10.5. Witnesses W5, W8. |
+| P1-2 inherited paths erase the marker | Regional entries are built with no path map and the gate reads the Host's own entry (§7.3). W1 legs (f), (g). |
+| P1-3 an unpublished name still matches an ordinary wildcard | Overlap refused in both directions, with the exact one-label "covers" rule (§6.7). W5, W11, and W1 leg (h) for the hop backstop. |
+| P1-4 retained rows bind a replacement or remote upstream | `release.RegionalTarget` in derivation and in `Reload` on the same route snapshot; a failed check is a deny entry (§7.2, §7.3). W10. |
+| P2-1 `deploymentRouteTaken` exempts the owner | The PUT tests the snapshot directly, no exemption, incomplete evidence refuses (§6.2 step 6). W5. |
+| P2-2 budget omits helper reads | One snapshot per PUT, shared; budget counts claim GETs, record bodies, update preflight and promotion separately (§11). |
+| P3-1 wildcard publication wording | §7.1, D4, W2. |
## 6. Data shape, API and CLI
@@ -139,45 +188,128 @@ repoint: §6.3.
`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
+ for"; 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.
+ readers that must branch: `aliases.go:407` (plain alias), `aliases.go:619`
+ (wildcard primary), `teamdoors.go:234`, `claim_alias.go`,
+ `domaincatchall.go`, `apex.go:193` (`hostClaimHolder`, §6.3),
+ `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.
+`PUT /api/cli/apps/{account}/{app}/domains/{host}/placements` with
+`{"placements":[{"region":"uk","host":"shop-uk.example.net"}, ...]}`, the
+whole set. It creates a regional claim or replaces the set on the caller's
+own regional claim. There is no other way into regional mode, and no way
+out except detach.
+
+**Which claims it accepts (the never-served rule).** The console has no
+record of where a name has served, and ruling 4 allows no new history
+store. It has two things: the claim's own state, and the snapshot this door
+already loads. The rule uses both.
+
+- The claim. Accepted: no claim; the caller's own pending claim; another
+ owner's pending claim that `AttachClaimProven`'s rule lets a proven
+ caller take (`claims.go:510`, the rule at 551-566: expired, or the caller proves control
+ now); the caller's own regional claim (update). Refused: a verified
+ schema-1 claim, the caller's own included (it may have served as an alias
+ or a first route, and nothing can show it did not; the member detaches
+ and creates again), and another owner's verified claim (the attach door's
+ neutral 409 bytes). A pending claim never derived a row on any binary
+ since #215 (`aliases.go:400`), so replacing it is not a conversion. The
+ write is a fresh body: nothing of a replaced pending claim survives.
+- The evidence (step 6 below). The claim alone does not cover the name's
+ history before its current claim: an ordinary claim detached minutes ago
+ whose rows some box still holds, or the name derived as `<label>.<parent>`
+ from an instance catch-all. So the door refuses while any fresh box's
+ edges file publishes the host or `*.<host>` under role `home`, or any
+ fresh box's heartbeat lists the host, `*.<host>` or `*.<parent>` among
+ its `route_aliases` rows. `Metrics.Aliases` is every row on the box,
+ published or not (`internal/host/agent.go:4480-4484`,
+ `internal/status/snapshot.go:1058-1066`).
+- Why it holds afterwards. Once the regional claim exists, no ordinary row
+ for its names can appear on a current binary: attach on it is a no-op or
+ `ErrRegionalClaim` (§6.3); instance catch-all derivation skips a listed
+ name (`aliases.go:197`) and treats a regional parent as not held (§6.7);
+ no covering catch-all can be created (§6.7); instance create refuses the
+ host (§6.3). So the evidence can only shrink, and the GET's settle rule
+ (§8) waits until every fresh box has reported after `created_at`.
+
+This is the simplest rule that is enforceable at one door from data already
+read: one branch on the claim plus three lookups in a snapshot the door
+needs anyway. Attach keeps setting `Route` on ordinary claims; a regional
+claim is written only here.
+
+**Order.** The steps run in attach's order: the evidence refusals come
+after every gate that can refuse first (`apidomains.go:516-569`), and every
+refusal in step 6 uses the attach door's neutral 409 bytes, so the door
+reveals nothing about other tenants' names. The barrier's 409 (step 7) and
+the `verify` answer (step 8) are as rev 2 and attach give them.
+
+1. `domainsGate`; `apiPerson` (no service role); `refuseTemporary`,
+ `refuseControlPlane`.
+2. `NormalizeAliasHost`; refused unless `domainHostPolicy` is `hostOpen` and
+ not `directAppsDomainHost` (platform and reserved names, and direct
+ apps-domain aliases, which cannot carry capabilities).
+3. Bindings: 1 to 8; region through `homeRegionIn`; the host is 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.
+4. `lockAppHost` when `lifetimesUnit`, as detach does; then the console's
+ regional mutex (§6.7). Read the claim with its ETag and apply the claim
+ rule above. On create: `customDomainRefusal` (plan) and `heldElsewhere`
+ (instance catch-all reservations), as attach runs them.
+5. One snapshot: `edgesfile.ReadSnapshot` and `status.LoadBoxesComplete`,
+ joined by `edgesfile.JoinLive`. A read error, `!EvidenceComplete()`, no
+ fresh box, or a fresh heartbeat with no `metrics` object: 503, nothing
+ written.
+6. From that snapshot, with no owner exemption (R2 P2-1):
+ - any fresh file publishes the host or `*.<host>` under role `home`
+ (route or alias): 409. This is the real-route collision test and the
+ published half of the never-served test, unconditional and exact
+ (the star is tested whether or not the claim has `Catchall`, since a
+ later capability flip must not meet it);
+ - any fresh heartbeat lists the host, `*.<host>` or `*.<parent>` in
+ `Metrics.Aliases`: 409;
+ - the overlap tests of §6.7: 409, or 503 on an unreadable claim.
+7. The activation barrier on the same heartbeats (§10.3).
+8. Proof, whenever the write creates a claim or replaces a pending one:
+ `domainProver` (`domainpolicy.go:275`), nil with proof off. Unproven
+ with proof on: 409 carrying the `verify` record, as attach's answer
+ does; nothing is written. The PUT never writes a pending claim.
+9. `domains.SetClaimPlacements` (new): create-only Put on no claim, CAS on
+ the ETag otherwise; a conflict answers 409. Schema 2, `Pending` false.
+ On create and on replacing a pending claim: `created_at` is now,
+ `Wildcard` and `Catchall` false (set later through attach, §6.3). On
+ update: `Route` kept if still bound, else the first host by region;
+ capabilities and `created_at` kept. Audit and `bumpSerial` only when
+ bytes changed.
+10. The answer is the GET body, built from the step-5 snapshot and the
+ claim just written. No further reads.
### 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).
+ bound host is a no-op (`carlos deploy` re-attaches every run); any other
+ route returns `ErrRegionalClaim` (409). It never writes schema 2, so a
+ schema-1 claim never gains placements. Capabilities on a regional claim
+ are set through attach naming a bound host, which reaches
+ `setDomainCapabilities` after the no-op.
+- First-route attach on a regional host: every first-route path reads the
+ claim and refuses `ErrRegionalClaim` before it declares a record (the
+ plain path writes the claim at `domainattach.go:230` before the record at
+ `:260`; `attachFirstRouteWithLifetime` and `attachClaimFirstRoute` are
+ held to the same order).
- `SetClaimPaths` on a regional claim: `ErrRegionalClaim`.
-- `SetClaimCapabilities` unchanged: `next := *cur` keeps schema and list.
+- `SetClaimCapabilities` keeps schema and list (`next := *cur`). Its one
+ console caller, `setDomainCapabilities` (`apidomains.go:663`, write at
+ `:740`), runs the §6.7 scan when it turns `Catchall` on.
+- `AttachInstanceCatchall`: refused when the parent is regional, and by the
+ door's §6.7 scan.
+- Instance create: `hostClaimHolder` (`apex.go:193`) refuses a host whose
+ claim is regional, for every app including the claim's own, so no real
+ route of a regional name is minted after the PUT.
- Detach unchanged: it deletes the claim only, never an instance.
### 6.4 Readers and scope
@@ -206,64 +338,160 @@ claim as not found. Works for every alias claim:
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`.
+`no-address`, `evidence-incomplete`, `settling`, `route-collision` (§8).
### 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.
+`--set` gives the whole set and creates the claim if there is none.
+`docs/site/cli.md` names the subcommand.
+
+### 6.7 Overlap with catch-alls (ruling 4)
+
+**Covers.** A key `*.Z` covers a name N exactly when N is one DNS label
+followed by `.Z`. That is the rule both lookups apply: `lookupIn`
+(`edge.go:1366-1376`) and `homeMap.lookupHome` (`homemap.go:1009-1023`)
+try `"*" + host[i:]` with `i` the first dot. So `*.example.com` covers
+`shop.example.com` but not `example.com` or `a.shop.example.com`. A regional
+claim on X has the names X and, with `Catchall`, every one-label name under
+X (key `*.X`), except names that have their own exact entry, which win by
+precedence and are not regional (§7.4). With P the parent of X (X without
+its first label), the only keys that can cover a regional name are `*.P`
+(covers X) and `*.X` (covers the names under X).
+
+**What may not coexist with a regional claim on X**, and how each is seen:
+
+| Source of a covering key | Evidence |
+|---|---|
+| A claim on P with `Catchall` (any schema): its `*.P` row (`aliases.go:645`) | GET `domains/P.json` |
+| An instance catch-all claim `*.P`: derived `<label>.P` names, X among them before X's own claim existed | GET `domains/*.P.json` (any state, any body) |
+| An instance catch-all claim `*.X`: ordinary names in the regional star's namespace | GET `domains/*.X.json` |
+| Anything else publishing `*.P` dial-capable, including a hand route | the snapshot: a fresh file with `*.P` under role `home` |
+| A stale `*.P` row left by an earlier catch-all | the snapshot: a fresh heartbeat listing `*.P` |
+
+The three GETs are skipped when P has no interior dot, since no claim can
+exist there (`NormalizeAliasHost`). A GET error other than not-found
+refuses (503). A regional claim on P with `Catchall` counts too: one rule,
+whatever the mode.
+
+**Where each refusal sits.**
+
+- The PUT, step 6 (§6.2): every row of the table, on every PUT.
+- Turning `Catchall` on for any claim P (`setDomainCapabilities`, the false
+ to true transition only): refused when any claim `<label>.P` is regional
+ or listed but unread. Evidence: `s.claims.ListWithUnread`, the console's
+ `ClaimCache` (`claimcache.go:95`); a listing error refuses.
+- Instance catch-all attach on `*.P` (`attachInstanceCatchall`,
+ `domaincatchall.go:80`, both the API door `apidomains.go:403` and the
+ browser door `appdomains.go:60`): refused when P's claim is regional
+ (`claimRawAttachInstanceCatchall` already reads it, `claims.go:293`) and
+ when any claim `<label>.P` is regional or unread (the same scan).
+- Box side, for a race or a hand-written claim: `deriveInstanceAliases`
+ treats a regional parent as not held (`aliases.go:158`), so the catch-all
+ is inert.
+- No console door creates a deployment route named `*.<anything>`: instance
+ hosts are `<label>.<domain>`. Only a root `carlos add` on a box can; the
+ PUT sees it in the snapshot, and afterwards it is §10.5's limit.
+
+Races between these doors and the PUT are closed by one in-process mutex
+held from evidence to write (the console is one process per deployment).
+If two writes did interleave, current binaries still keep the name in
+region: a box with the regional entry answers the name by exact precedence
+before any star, and a hop that reaches it is refused (§7.3).
+
+Platform zones. Platform and reserved names are refused (step 2). The
+platform's own wildcard parents are certificate parents only
+(`currentHosts`, `edge.go:1235`; `CARLOS_WILDCARD_DOMAINS`): the upstream
+map and edges files hold platform routes by exact name, so no platform zone
+is a lookup key. A `*.<zone>` key that did exist would be a claim or a
+route, and the table above catches it.
## 7. Serving
-### 7.1 Never published
+### 7.1 Never published under a dial-capable role
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.
+`route_aliases` and `wildcard_domains`, never `regional_domains`. The apex
+has no publication under any role. `*.<apex>` has no dial-capable (`home`)
+publication: `catchallServed` (711-718) reads only `route_aliases`. Where a
+box holds a target and the claim has `Wildcard`, `*.<apex>` is published as
+the cert-only `wildcard` entry (719-766), which the fold reads as not
+dialable (`homemap.go:829`, `dial: h.Role == edgeRoleHome`); that entry is
+required for certificate distribution (§9). The target's own instance host
+is published as today. 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
+through its own key, and §6.7 keeps every covering key away. 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).
+ DEFAULT '', account, app, region, created_at)`, created like
+ `route_aliases` (`registry.go:760-765`), wholly pass-owned, hashed by
+ `Fingerprint` so the edge reloads, with list, upsert and delete on the
+ remote registry too. `region` is the deriving box's region (D5).
+- The shared predicate, `release.RegionalTarget(rt registry.Route, account,
+ app, region string) bool`, in `internal/release` beside `RouteAccount`
+ (`adopt.go:1363`), which it uses. `internal/release` already imports
+ `internal/registry`, and both `internal/domains` and `internal/edge`
+ import `internal/release`, so neither gains a cycle. True only when:
+ `rt.Status == "ready"`; `RouteAccount(rt) == account` and
+ `rt.App == app`; `rt.Kind` is `""` or `"instance"`; `rt.Provisioned`;
+ not `IsSidecar()`; not `Replica`; not fleet-placed
+ (`registry.FleetPlacement(rt.Region)`); `rt.Tunnel == ""`;
+ `rt.Socket != ""`; `rt.Region == region`.
+- `ReconcileAliasesReport` takes the box's region, passed by
+ `aliasPassReporting` (`internal/host/agent.go:1172`). In the claims loop,
+ right after the `Pending` skip (`aliases.go:400`), 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
+ `release.RegionalTarget(byHost[t], c.Account, c.App, boxRegion)`;
+ otherwise `t = ""`. Desired rows: `host -> t`, and `*.host -> t` with
+ `Wildcard && Catchall`, each carrying the claim's account and app and
+ `boxRegion`. 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).
+ the pass reports incomplete (the `deriveInstanceAliases` rule). A kept row
+ is a hostname and the identity it was judged with, nothing more: `Reload`
+ judges it again (§7.3).
- 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.
+ `Reload` lets the route win there, logged, as for aliases. §6.2 and §6.3
+ keep such a route from existing.
### 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).
+- `upstream` (413-456) gains `regional` (`regionalServe` or
+ `regionalDeny`) and `regionalKey` (the row's host, a bounded log key).
+- `Reload`, after the alias fold (1067-1084), reads `ListRegional` (an
+ error aborts the reload, as every registry read there does). For each
+ row: if `m[row.Host]` is a route entry (present, not `alias`), the route
+ wins, logged. Otherwise the entry is **serve** only if all hold:
+ `row.Target != ""`; the route `rt` for `row.Target` is in the `routes`
+ slice this same `Reload` read (714); `release.RegionalTarget(rt,
+ row.Account, row.App, row.Region)`; `up := m[row.Target]` is present and
+ is neither `alias`, `platformAlias` nor `viaTunnel`. A serve entry is a
+ copy of `up` with `paths = nil`, `alias = true`, `platformAlias = false`,
+ `regional = regionalServe`. Anything else is a **deny** entry (zero
+ route, nil proxy, `regional = regionalDeny`). The entry replaces any alias
+ entry of the same key: a stale alias row never outranks a regional row.
+ Because every route change moves `Fingerprint` and reloads, the recheck
+ runs on the routes being served, whether the claim is readable or not
+ (R2 P1-4).
+- No path map. A serve entry never inherits the target's `paths`, which
+ the path fold (1009-1025) put on `m[row.Target]`. `lookupUpstreamPath`
+ returns early for a regional entry (its `up.paths == nil` test at 1448
+ becomes `up.paths == nil || up.regional != 0`), so the entry
+ `regionalGate` sees is always the Host's own, before any path is
+ selected. The login re-resolution (1790) calls the same function and gets
+ the same entry back. A prefixed request, hopped or not, is judged as the
+ regional host and never reaches an unmarked upstream.
- `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
@@ -277,27 +505,28 @@ Guard test: W2.
`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.
+regional star (arm 1); a regional exact entry beats any local star above it.
+A regional apex cannot collide with another claim (one claim per host); a
+real route of that name is refused at the PUT and at instance create, and
+the GET reports `route-collision` if one appears anyway (§8).
+
+### 7.5 Restart, unreadable claim, rollback, mode change
+
+- Restart: rows persist in SQLite; the first `Reload` (at construction,
+ `edge.go:479`) judges each row against the routes it reads (§7.3).
+- Fresh box, empty registry: a miss, and no dial target exists (§7.1,
+ §6.7): the unknown-host answer.
+- Unreadable claim: rows kept (§7.2) and rechecked at every reload. 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.
+ table. It holds no ordinary row for the name (§10.4), so it answers
+ unknown host and publishes nothing; other boxes are unaffected. On
+ re-upgrade its next pass reconciles the table.
+- No mode change in place (D9). Detach removes the regional rows on each
+ box's next pass; until then those boxes answer 503 for the name, which is
+ no longer regional.
-## 8. Addresses (ruling 1)
+## 8. Addresses (ruling 1) and readiness
The GET makes one edges read (`edgesfile.ReadSnapshot`) and one heartbeat
load (`status.LoadBoxesComplete`), joined as `edgesfile.JoinLive` joins
@@ -307,12 +536,29 @@ equals the region code and whose `hosts` holds the target under role
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.
+another's.
+
+Three conditions apply to every region at once, for a regional claim:
+
+- `evidence-incomplete`: the snapshot is not `EvidenceComplete()`.
+- `route-collision`: a fresh file publishes the host or `*.<host>` under
+ role `home` without the alias mark.
+- `settling`: a fresh box's latest heartbeat was generated before the
+ claim's `created_at`, or lists the host or `*.<host>` in
+ `Metrics.Aliases`, or a fresh file publishes either under role `home` as
+ an alias. This is the end of the never-served rule (§6.2): the member
+ points DNS once every fresh box has reported after creation with no
+ ordinary row for the name. It costs at most one `SnapshotPeriod` (5
+ minutes, `status/fleet.go:120`) after creation. It compares box clocks
+ with the console's; NTP skew is far below the period.
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.
+`no-address`. A replaced box has a new EIP, which the GET shows. A
+heartbeat whose alias read failed omits the map (`agent.go:4480-4482`
+logs and leaves it nil), which reads as no rows; the next tick corrects it,
+and a published row is still seen in the edges file.
## 9. TLS
@@ -335,57 +581,108 @@ balancer (`internal/host/awsaddr.go:12-17`, A1-12), so that region shows
`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
+build: v0.31.0 unless main has moved. 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
+wherever the rootfs floor is: the door's preflight
+(`apisystemupdate.go:424`), promotion (`hostactivation.go:204`) and
+rollback (`hostactivation.go:259`). Both judges run on the one pointer
+read, so the returned ETag covers exactly what was judged. The claims are
+read only when `RegionalFloorAllows` is false (installed at or above the
+floor, candidate below it or unparseable); 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.
+`regionalReadyRefusal(boxes, complete)` on every PUT, mirroring
+`rootfsReadyRefusal` (`rootfs.go:188`) but judging the heartbeats the PUT
+already loaded (§6.2 step 5) instead of loading its own. 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.
+The override, the update gate's automatic `.prev` restore and a hand-run
+apply each put an old binary on a box that was fresh when the claim was
+created. That old binary cannot read the claim and ignores the table. It
+also holds no ordinary row for a regional name: the PUT refused while any
+fresh box listed or published one (§6.2), and none can be created since
+(§6.2 "why it holds afterwards", §6.7). So it misses the name, dials
+nothing (no box publishes it or a covering key), and fails closed. While a
+schema-2 claim exists, its alias pass reports incomplete on every pass
+(`relevantDropped`, `aliases.go:305-341`), which withholds its asset-cache
+blocks until it is upgraded.
+
+### 10.5 Limit: a stale box on an old binary
+
+The case. A box is offline (no fresh heartbeat) when the regional claim is
+created. Before that, it held an ordinary row for the name: an alias row
+from an earlier claim on the same host, detached since, or a `*.<parent>`
+row from a catch-all turned off since. It returns running a binary below
+the floor.
+
+Why the floor does not reach it. The barrier and the PUT's evidence count
+fresh boxes only, so an offline box contributes nothing, and nothing can
+refuse a box for being absent without refusing every deployment that has
+one. The promotion gate stops the channel moving below the floor; it does
+not change a binary already installed on a box that was not running. On
+return, `New` reloads (`edge.go:479`) and serves persisted `route_aliases`
+rows (1067-1084) before any pass; the old binary skips the schema-2 claim,
+and a pass whose claim listing fails returns before cleanup
+(`aliases.go:369`). Its edges file may republish the row
+(`internal/host/edgesfile.go:641-678`, only while its DNS reading is
+`pointing`).
+
+The bound. The box serves the name only from an instance on itself, for
+requests that reach it. A cross-region path needs a box with no regional
+entry to backhaul to it: a current box with the entry answers the name by
+exact precedence and never backhauls it (§7.4), and refuses hops for it, so
+only a box without the entry yet (an empty registry, or a current box
+before its first pass since the claim was created) or another stale old box
+can. It ends at whichever comes first: the old binary's first successful
+alias pass, which deletes the row because no claim desires it
+(`aliases.go:686-692`), or the box's first adoption, which moves it to the
+channel head, at or above the floor while the claim exists. In practice
+seconds to minutes; at worst, as long as the box can neither list claims
+nor adopt, which is a box that cannot read its bucket. A fleet box (not
+counted by the barrier, §10.3) is in the same class. A root
+`carlos add '*.<parent>'` on a box after the PUT is a route, which no alias
+pass deletes: a current binary outranks it by exact precedence, so it
+matters only on an old binary and ends at that box's first adoption.
## 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`.
+byte-identical. With B the edges files listed, H the heartbeats listed (at
+most 200, `status/fleet.go:217`) and R the app's instance records:
+
+| Act | Reads | Writes |
+|---|---|---|
+| PUT | claim GET; up to 3 overlap claim GETs (§6.7); records: 1 LIST + R bodies, as `listRecords` makes them (plus each record's lifetime slot when lifetimes are on); one snapshot: edges 1 LIST + B GETs, heartbeats 1 ListMod (or LIST) + H GETs. Collision, never-served, overlap, barrier and the response all read this one snapshot. On create, one DNS TXT lookup | claim PUT and the existing serial bump, only when bytes change |
+| GET | claim GET; one snapshot as above | none |
+| `Catchall` turned on; instance catch-all attach | as today, plus one `domains/` ListMod through `s.claims`, and a GET per key whose mod time moved (cold cache: one per claim in the deployment) | as today |
+| Instance create | as today (`hostClaimHolder` already reads the claim) | as today |
+| System update crossing the floor | door preflight: one ListMod through `s.claims` (+ GETs as above); promotion: another | as today |
+| Rollback crossing the floor | one ListMod (+ GETs as above) | as today |
+| Update or rollback not crossing the floor | none | as today |
## 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
+in host.env), and releases and alias rows 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
@@ -395,33 +692,56 @@ 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.
+ `shop.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 `shop.example.com` and
+ `alice.shop.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
+ `shop.example.com` and `*.shop.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. (f) A's registry carries a `route_paths`
+ row on Tie's host (`api` to Tother, a ready route of the same account on
+ A): `GET shop.example.com/api/x` at A moves Tie, never Tother, and a
+ login POST with `next=/api/x` resolves to the regional entry. (g) A
+ signed hop to A for `shop.example.com/api/x`: 503, Tie and Tother
+ unchanged. (h) A fresh B (empty registry) whose home map holds an
+ old-binary-shaped file publishing `*.example.com` as `home` on A dials A
+ for `shop.example.com`, 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.
+ or (d) moves Tie; with the serve entry keeping its target's path map,
+ (g) moves Tother. Each 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`.
+ target publishes the target host; never the apex under any role; never
+ `*.apex` under role `home`; and, with `Wildcard`, `*.apex` as the
+ cert-only `wildcard` entry, which must be present.
- 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.
+ claim; a row on every box; a target only where `RegionalTarget` holds; an
+ unreadable claim keeps rows; detach deletes them; an instance catch-all
+ under a regional parent derives nothing.
- 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.
+ replica, fleet, static and sidecar targets; platform hostname; service
+ credential; CAS conflict; an unchanged write bumps no serial. Claim
+ states: no claim creates; own pending is replaced; own verified schema 1
+ (alias, and first route) 409s; proof on and no TXT gives 409 with
+ `verify` and writes nothing. Evidence: an already-owned regional claim
+ with a real route at the host, and at `*.<host>`, published by another
+ box: 409 (no owner exemption); a heartbeat listing the host as an alias
+ row: 409; one edges file unreadable, one heartbeat unreadable, a fresh
+ heartbeat with no edges file, a fresh heartbeat with no `metrics`: 503
+ and nothing written. Overlap: a parent claim with `Catchall`; an
+ instance catch-all `*.<parent>`; an instance catch-all `*.<host>`; a
+ file publishing `*.<parent>` as `home`; a heartbeat listing
+ `*.<parent>`: 409 each; an unreadable parent claim: 503.
- 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.
+ byte-stable; `SetClaimCapabilities` keeps schema and list; attach naming
+ a bound host is a no-op and another route 409s; a first-route attach on a
+ regional host 409s with no record written.
- W7 floor, mirroring `rootfsfloor_test.go`, `rootfs_test.go:317` and
`layoutintent_test.go:143,157`: `TestRegionalFloorAllows`,
`TestRegionalFloorRefusesBeforeReservation`,
@@ -431,39 +751,60 @@ edges-file writer, home-map fold and console server; listeners on 127.0.0.1.
`TestRegionalFloorBindsTheJudgedPointer`,
`TestRegionalFloorUnreservedRollbackKeepsTheOverride`,
`TestRegionalFloorCountsAnUnreadClaim`,
+ `TestRegionalFloorReadsNoClaimsWhenNotCrossing`,
`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.
+ ready; incomplete evidence makes none ready; a fresh heartbeat older than
+ `created_at`, or listing the host as an alias row, gives `settling`
+ everywhere; a published real route at the host gives `route-collision`.
- 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.
+- W10 `TestRegionalEntryRechecksItsTarget`: A serves `shop.example.com`
+ from Tie; the claim's GET then fails, so the pass keeps the row. Each leg
+ rewrites Tie's route row and reloads, and expects 503 with Tie unchanged:
+ (a) another account's route at Tie's host; (b) `Tunnel` set; (c) fleet
+ placement; (d) another region; (e) `Replica`; (f) `Socket` empty with an
+ addr. Restoring the row serves again. Mutation check: with
+ `RegionalTarget` replaced by a presence test in `Reload`, (a) serves.
+- W11 `TestCatchallRefusedOverARegionalName`: with `shop.example.com`
+ regional, turning `Catchall` on for `example.com` 409s; with a claim
+ under `example.com` listed but unread, it refuses; a failed listing 503s;
+ instance catch-all attach on `*.example.com` and on `*.shop.example.com`
+ 409s from the API and browser doors; instance create at
+ `shop.example.com` by the claim's own app 409s.
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").
+(`Reload`, `regionalGate`, `lookupUpstreamPath`), `internal/domains` (claim
+shape, derivation, instance catch-all parent rule), `internal/registry`
+(table, fingerprint, remote methods), `internal/release` (floor constant,
+`RegionalTarget`), `internal/host` (the region into the alias pass), and the
+root package (`domains_cli.go`, `system.go`). `internal/edgesfile` and
+`internal/status` 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.
+2. Claim shape, the reader audit, writer rules (§6.3, instance create
+ included), team scope (§6.4). W4, W6.
+3. `release.RegionalTarget`, `regional_domains` and the derivation, with
+ the instance catch-all parent rule. W2, W3.
+4. Edge entries, the recheck, no path map and `regionalGate`. W1 with its
+ mutation checks, W9, W10. Its own Astra review (routing, backhaul,
+ certificates; rule 3).
+5. PUT door with the never-served and overlap evidence, the reverse-door
+ scans, activation barrier, CLI write, GET readiness. W5, W8, W11, 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.
@@ -475,7 +816,8 @@ The branch merges once, after the whole-branch review.
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.
+rule changes); paths on regional names; static, TCP, fleet, sidecar, tunnel
+and replica targets; converting a claim between modes in place; 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; refusing a
+root hand route on a box.