| 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. |