Regional domains (#447): spec rev 4, ruling 5 and the R3 P2 fixes for Astra round 4 (final)
Narrow revision; every changed passage is marked "(rev 4)" and the header lists the sections. - Ruling 5a: heartbeats carry metrics.aliases_read (set by statusTick on a successful ListAliases, carried by CollectBox); false or absent is incomplete evidence: the PUT refuses at the barrier (after the floor test), the GET reports evidence-incomplete. Rev 3's alias-read limit removed. W13. - Ruling 5b: a regional row beats a real route at its own key (apex and star): Reload gives a deny entry, logged through logThrottled. carlos add refuses X / *.X when the claim reads as regional through deploymentReadSeam's store, and proceeds when it cannot read. W1 leg (i), W12. §6.7, §7.2-7.4, §10.5, §16 updated to match. - R3 P2-1: keys-only declared-ownership walk (provision.RecordHostDeclared) in the PUT; the PUT always holds lockAppHost; instance create rechecks the claim under the host exclusion in both create paths. W5, W11. - R3 P2-2: heldElsewhere dropped (subsumed by step 6 and §6.7); §11 recounted item by item. - R3 P2-3: W1 asserts the nil path map directly; the end-to-end mutation restores both the inherited map and path resolution. - R3 P2-4: only the P-dependent GETs are skipped for a two-label apex; *.X is always read. W5 two-label case. - §5 gains the R3 findings-resolved table; §14 census note updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/specs/2026-10-28-regional-domains-447-design.md+295 −52
Intent
<agent-message from="af17d5e1dbe1fd0b0"> #447 regional domains: design round 3 (the last) came back NOT READY with 2 P1 and 4 P2. As ruled, I've stopped without fixing. A fourth round needs Paul's go. No code has been written. Branch regional-domains-447, tip 1db58695 (pushed). origin/main is merged in at c6a5ba51. Paul's ruling 4 is recorded in the ledger, on #447 and in spec §2. Spec rev 3 is docs/superpowers/specs/2026-10-28-regional-domains-447-design.md; findings are in docs/superpowers/specs/CODEX-FINDINGS-regional-domains-447-R3.md. I checked the P1 citations and they hold. R3 resolved R2's path-map P1 and replaced-target P1, and did not raise the accepted stale-box limit. The two remaining P1s are on current binaries, outside that limit: 1. A failed alias read looks like "no aliases". When ListAliases fails, the agent logs it and still sends its heartbeat with no alias map (internal/host/agent.go:4480). The edges file is no backstop: it leaves out aliases whose DNS isn't pointing (edgesfile.go:648), but the edge still serves them (edge.go:1071). So a current box that still holds an ordinary alias from a detached claim passes the never-served check and the readiness check while it serves the old upstream. 2. A root hand route can take the regional catch-all's own key. The spec keeps "a real route wins at the same key", so `carlos add '*.shop.example.com'` on a current box beats the regional star entry. A request for alice.shop.example.com then reaches an unmarked upstream, possibly TCP to another region, and the gate does nothing. The four P2s, which would be fixed without a round: - an instance declared at the name but not yet provisioned escapes the collision check; - heldElsewhere adds a second deployment-wide read to the PUT; - W1's path-map mutation can't fail as written; - the overlap check skips *.X for a two-label apex. Options (posted on #447 and in the branch handoff): - A. A narrow round 4 on two local fixes. (a) The heartbeat says whether its alias read succeeded; the PUT and GET treat a failed or missing read as incomplete evidence. (b) A regional row beats a real route at its own key: Reload gives a deny entry and logs it, for the apex and the star alike. carlos add also refuses a host a regional claim holds when it can read the claims listing. Round 4 would review only these diffs and the P2 fixes. - B. Cut regional catch-alls (apex only) and apply fix (a). This is the smallest change, but the #447 consumer's user handles live under the catch-all, so it ships less than #447 asks for. - C. Park at rev 3. I recommend A: both fixes refuse up front and each lives in one place. Astra says refusing incomplete evidence removes the first P1 and cutting catch-alls removes the second; fix (b) is the alternative to that cut that keeps catch-alls. Nothing else needs Paul. To resume me, send his choice. My ledger is .superpowers/sdd/2026-10-28-regional-domains-447/progress.md. Scratch to delete at the finish is in /home/paulca/.cache/tmp/claude-1001/rd447/. </agent-message>
<task-notification> <task-id>af17d5e1dbe1fd0b0</task-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/c2acaf22-306d-491b-b2b6-addbf33b8e87/tasks/af17d5e1dbe1fd0b0.output</output-file> <status>completed</status> <summary>Agent "Controller: build regional domains #447" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>I've stopped again: design round 3, the last allowed, came back NOT READY with 2 P1 and 4 P2. As ruled, I wrote no fixes, so there's still no code. A fourth round needs Paul's go. **What I did after the go** - Recorded Paul's ruling 4 in the ledger, on #447 and in the spec. - Merged origin/main into the branch at c6a5ba51. The merge first failed on a leftover cherry-pick marker from the branch setup. I removed the two marker files from this worktree's own git directory. - The main checkout still has an empty `packed-refs.lock` dated 2026-10-28 that isn't ours, so every commit prints a lock error. The commits still land; I left the lock alone. - Had spec rev 3 written (7d830bea) and ran Astra round 3 on it. - The branch tip is 1db58695, pushed. **What round 3 found** It resolved round 2's path-map and replaced-target P1s and accepted the stale-box limit. I checked the citations for the two remaining P1s, and they hold. Neither depends on a stale box or an old binary: 1. **A failed alias read looks like "no aliases".** When a box can't read its aliases, its heartbeat goes out with no alias map (`internal/host/agent.go:4480`). A current box still holding an alias from a detached domain then passes both the never-served check and the readiness check, while it keeps serving the old target. 2. **A hand route can take the regional catch-all's own key.** The spec lets a real route win at the same key. So `carlos add '*.shop.example.com'` on a current box beats the regional entry, and requests under the catch-all bypass the guard. They could go to a TCP backend in another region. The four P2s would be fixed without another round: - an instance declared at the name but not yet set up escapes the collision check; - a helper adds a second deployment-wide read to each write; - one test's mutation check can't fail as written; - the overlap check misses `*.X` when the domain has only two labels. **Decision needed** (posted on #447 and in the branch handoff): - **A. A narrow round 4 on two local fixes.** The heartbeat says whether its alias read succeeded, and a failed read counts as incomplete evidence. A regional entry beats a real route at its own key, and `carlos add` refuses a name a regional domain holds. Round 4 would review only those changes and the P2 fixes. - **B. Cut regional catch-alls** and apply only the first fix. It's smaller, but the #447 consumer's user handles live under the catch-all, so it ships less than #447 asks for. - **C. Park the design** at rev 3. I recommend A. Both fixes refuse the case up front and each sits in one place. I've reported this to the root session. Send me Paul's choice to resume. The Astra job has finished and nothing is left running. The scratch folder is kept for the finish. Files are in `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/regional-domains-447/`: - `docs/superpowers/specs/2026-10-28-regional-domains-447-design.md` (spec rev 3) - `docs/superpowers/specs/CODEX-REVIEW-BRIEF-regional-domains-447-R3.md` - `docs/superpowers/specs/CODEX-FINDINGS-regional-domains-447-R3.md` - `.superpowers/sdd/2026-10-28-regional-domains-447/progress.md` (the ledger to resume from) Scratch to delete at the finish: `/home/paulca/.cache/tmp/claude-1001/rd447/`</result> <usage><subagent_tokens>172722</subagent_tokens><tool_uses>24</tool_uses><duration_ms>1849586</duration_ms></usage> </task-notification>
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 e56f85374..276643a5b 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,8 +1,8 @@ |
| -# Regional custom-domain placements (#447): design, rev 3 |
| +# Regional custom-domain placements (#447): design, rev 4 |
| -Status: design for agents, not member copy. Rev 3, author Claude Opus 5.5, |
| +Status: design for agents, not member copy. Rev 4, author Claude Opus 5.5, |
| 2026-10-29, branch `regional-domains-447` (origin/main merged at c6a5ba51). |
| -Citations are at c6a5ba51. |
| +Citations are at c6a5ba51 (the branch's later commits change only docs). |
| 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 |
| @@ -12,8 +12,20 @@ READY, 2 P1, 7 P2, 8 P3, resolved in rev 2. R2: Astra on rev 2 |
| 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. |
| +P2/P3 fixes. R3: Astra on rev 3 |
| +(`docs/superpowers/specs/CODEX-FINDINGS-regional-domains-447-R3.md`), NOT |
| +READY, 2 P1, 4 P2; the last authorised round, so work stopped and Paul gave |
| +ruling 5 (§2) and a fourth round. Rev 4 applies ruling 5 and the R3 P2 |
| +fixes and changes nothing else. Next: Astra round 4, final. |
| + |
| +Rev 4 changes, for a review scoped to them: header; §2 ruling 5; §5 R3 |
| +table; §6.2 the evidence bullet, steps 4, 5, 6 and "why it holds |
| +afterwards"; §6.3 instance create; §6.7 the `*.X` row, the skip rule and |
| +the root-route bullet; §7.2 last bullet; §7.3 the `Reload` bullet and the |
| +new `carlos add` bullet; §7.4; §8 `evidence-incomplete` and the limits |
| +paragraph; §10.3; §10.5 last paragraph; §11 PUT, instance create and |
| +`carlos add` rows; §13 W1, W5, W8, W11 and the new W12, W13; §14; §15 |
| +steps 3-5; §16. Each changed passage is marked "(rev 4)". |
| ## 1. Invariant |
| @@ -68,6 +80,17 @@ Rulings 1-3 are Paul's of 2026-10-28. |
| 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). |
| +5. (rev 4) Paul, 2026-10-29, relayed by platform-17, after R3 (the last |
| + authorised round): two fixes and a fourth, final round. |
| + - (a) The heartbeat says whether its alias read succeeded. A failed or |
| + missing read is incomplete evidence: the PUT refuses (§10.3) and the |
| + GET is not ready (§8). Field and wiring in §8; this replaces rev 3's |
| + "heartbeat alias-read gap" limit. Witness W13. |
| + - (b) A regional row beats a real route at its own key, apex and star |
| + alike: `Reload` gives a deny entry and logs it, throttled (§7.3). |
| + `carlos add` refuses a host a regional claim holds when it can read |
| + the claim, and proceeds when it cannot; the deny is the backstop |
| + (§7.3). Witnesses W1 leg (i), W12. |
| 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 |
| @@ -165,6 +188,17 @@ R2 (each through ruling 4): |
| | 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. | |
| +R3 (rev 4; the two P1s through ruling 5): |
| + |
| +| Finding | Resolution | |
| +|---|---| |
| +| P1-1 failed alias reads count as proof of no ordinary state | The heartbeat carries `aliases_read` (§8); false or absent refuses the PUT at the barrier (§10.3) and makes the GET `evidence-incomplete` (§8). The rev 3 limit is gone. W13. | |
| +| P1-2 a hand route replaces the regional wildcard on a current binary | A regional row takes its own key from a real route, apex and star: a deny entry, logged (§7.2, §7.3, §7.4). `carlos add` refuses such a host when it can read the claim (§7.3). §6.7 and §10.5 reworded. W1 leg (i), W12. | |
| +| P2-1 routes declared but not yet published | The PUT refuses any instance record at the host, provisioned or not, from a keys-only walk of every account's records (§6.2 steps 5-6). Instance create rechecks the claim under the host exclusion the PUT now always holds (§6.2 step 4, §6.3). W5, W11. | |
| +| P2-2 `heldElsewhere` exceeds the one-snapshot budget | Not called. Its route half is step 6's snapshot test and its instance catch-all half is §6.7's `*.P` GET, both stricter (§6.2 step 4). §11 recounted. | |
| +| P2-3 the path-map mutation cannot fail | W1 asserts the nil path map on the entry directly; the end-to-end mutation restores both the inherited map and path resolution for regional entries; leg (g) stays a signed hop through production wiring (§13). | |
| +| P2-4 the parent-depth shortcut skips `*.X` | Only the two P-dependent GETs are skipped when P has no interior dot; `*.X` is always read, any state, any body (§6.7). W5 adds a two-label apex. | |
| + |
| ## 6. Data shape, API and CLI |
| ### 6.1 Claim (`internal/domains/claims.go`) |
| @@ -227,14 +261,20 @@ already loads. The rule uses both. |
| 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`). |
| + `internal/status/snapshot.go:1058-1066`). (rev 4) It counts as evidence |
| + only when the same heartbeat says the read succeeded (`aliases_read`, |
| + §8); a fresh box whose heartbeat does not say so refuses the PUT at the |
| + barrier (§10.3). |
| - 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`. |
| + host (§6.3), (rev 4) rechecking the claim under the same host exclusion |
| + the PUT holds, so a create racing the PUT either is seen by the PUT's |
| + record walk or sees the regional claim. 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 |
| @@ -256,15 +296,41 @@ the `verify` answer (step 8) are as rev 2 and attach give them. |
| 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. |
| +4. (rev 4) `lockAppHost` (`lifetimes.go:174`: the app lock, then the |
| + hostname exclusion `lockHostname`, `lifetimes.go:160`) in every mode, |
| + not only when `lifetimesUnit`: instance create's claim recheck runs |
| + under that exclusion (§6.3), so the PUT must hold it in both modes. |
| + Then the console's regional mutex (§6.7). Read the claim with its ETag |
| + and apply the claim rule above. On create: `customDomainRefusal` (plan; |
| + it reads the console's own database, no bucket request). No |
| + `heldElsewhere` (`domaincatchall.go:146`, R3 P2-2): its route half |
| + (`deploymentRouteTaken`, a second deployment-wide fold, |
| + `apidomains.go:1575`) is step 6's snapshot test, which is stricter (no |
| + owner exemption, incomplete evidence refuses); its instance catch-all |
| + half (`catchallInstanceName`) refuses a name under another account's |
| + instance catch-all `*.P` only in some states, and §6.7's GET of |
| + `domains/*.P.json` refuses any claim there, whoever holds it. Neither |
| + half is needed and neither read is made. |
| 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. |
| + written. (rev 4) And the declared-ownership walk (R3 P2-1): new |
| + `provision.RecordHostDeclared(ctx, s, host) (bool, error)`, which lists |
| + record keys the way `readAllRecords` does (`knownAccounts`, then |
| + `listAppSubtree(…, "instances/")`, `internal/provision/reconcile.go:2619, |
| + 2891`) and matches each key's host through `ParseRecordKey`, reading no |
| + record body: a key at the host is ownership whatever the body says, |
| + provisioned or not. Strict: a listing error, an account manifest that |
| + does not read cleanly or a partial app listing is an error, and an error |
| + is 503, nothing written. Records under an account with no live manifest |
| + are invisible to it, as they are to the provisioning pass that would |
| + mint their routes (`ListAllRecordsStrict`'s stated blind spot), so they |
| + never become a route. Record keys are `<label>.<domain>` hosts |
| + (`provision.ValidHost`), so no record sits at `*.X`; only the host is |
| + matched. |
| 6. From that snapshot, with no owner exemption (R2 P2-1): |
| + - (rev 4) the walk found an instance record at the host, under any |
| + account and app, the caller's own included: 409; |
| - 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 |
| @@ -310,6 +376,28 @@ the `verify` answer (step 8) are as rev 2 and attach give them. |
| - 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. |
| + (rev 4, R3 P2-1) That check (`apiinstances.go:1507`) runs before any |
| + lock, and the record write (`:2101-2117`) comes later, so it is |
| + repeated under the hostname exclusion, immediately before the write: |
| + one claim GET, refused with the same bytes when the claim is regional. |
| + The existing per-host lock does not cover both today: the lifetime |
| + create holds it around the write only (`createRecordWithLifetime`, |
| + `lifetimes_create.go:47`, through `withAppHost`), and the legacy create |
| + holds only the app lock (`createRecordMarked`, `hostsused.go:561`). So |
| + the recheck goes in `createRecordWithLifetimeLocked` (both locks held; |
| + it also serves the seed door and the first-route attach, which §6.3 |
| + already refuses) and in `createRecordMarked`, which takes |
| + `lockHostname(rec.Host)` after its app lock (the lock table's order; |
| + both its callers, `apiinstances.go:2117` and `apiinstanceseed.go:89`, |
| + hold neither lock). With the PUT holding the same exclusion from its |
| + claim read to its write (§6.2 step 4), the two serialise per host: a |
| + record written first is in the PUT's walk (§6.2 step 6), and a claim |
| + written first is seen by the recheck. The host-claim create branch |
| + (`beginClaimCreate`, `apiinstances.go:2068`) runs only with |
| + `cfg.HostClaim` on (the shelved host-lifecycle claim) and is not |
| + changed; a route it, or a |
| + store-mode operator writing records directly, would mint meets the |
| + `Reload` deny (§7.3). |
| - Detach unchanged: it deletes the claim only, never an instance. |
| ### 6.4 Readers and scope |
| @@ -369,14 +457,19 @@ its first label), the only keys that can cover a regional name are `*.P` |
| |---|---| |
| | 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` | |
| +| An instance catch-all claim `*.X`: ordinary names in the regional star's namespace | GET `domains/*.X.json` (rev 4: any state, any body, and never skipped) | |
| | 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. |
| +(rev 4, R3 P2-4) When P has no interior dot (X has two labels, as |
| +`example.com` with P `com`), only the two GETs that depend on P are |
| +skipped, `domains/P.json` and `domains/*.P.json`, since no claim can exist |
| +at either (`NormalizeAliasHost`). The GET of `domains/*.X.json` depends only |
| +on X and is made on every PUT: `*.example.com` is a valid instance |
| +catch-all key (`claims.go:303`), and a body there that does not parse |
| +refuses like any other. The two snapshot rows cost no request and are |
| +never skipped. 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.** |
| @@ -395,7 +488,12 @@ whatever the mode. |
| 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. |
| + PUT sees it in the snapshot. (rev 4, ruling 5b) Afterwards: at the |
| + regional claim's own keys, X or `*.X`, `carlos add` refuses it when it |
| + can read the claim, and a current binary makes that key a deny entry |
| + whether or not the route exists (§7.3), so the route never serves; at |
| + `*.P` it does not cover X on a current binary (X's exact entry wins, |
| + §7.4) and is §10.5's limit on an old one. |
| 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). |
| @@ -462,8 +560,9 @@ through its own key, and §6.7 keeps every covering key away. Guard test: W2. |
| 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. §6.2 and §6.3 |
| - keep such a route from existing. |
| + (rev 4, ruling 5b) `Reload` gives that key a deny entry over the route, |
| + logged (§7.3); unlike an alias, a regional row is never shadowed. §6.2, |
| + §6.3 and `carlos add` (§7.3) keep such a route from being created. |
| ### 7.3 Edge (`internal/edge/edge.go`) |
| @@ -471,8 +570,15 @@ through its own key, and §6.7 keeps every covering key away. Guard test: W2. |
| `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: (rev 4, ruling 5b) if `m[row.Host]` is a route entry (present, not |
| + `alias`), the regional row beats it: the key gets a **deny** entry, for |
| + the apex and the star alike, and `e.logThrottled("regional-over-route |
| + "+row.Host, …)` (`edge.go:1193`: the first occurrence and every 300th, |
| + one counter per key, and the keys are bounded by the regional rows) |
| + names the host. The route's registry row is untouched; only its key in |
| + the upstream map is taken, so a request for X, or for a name the star |
| + `*.X` matches, never reaches the route's upstream, TCP or socket. |
| + 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 |
| @@ -500,6 +606,31 @@ through its own key, and §6.7 keeps every covering key away. Guard test: W2. |
| 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`. |
| +- (rev 4, ruling 5b) `carlos add` (`runAdd`, `cli.go:158`) refuses a host |
| + a regional claim holds, right after `addRail` (`cli.go:180`) and before |
| + the registry is opened: for a host `X`, the claim at `X`; for a host |
| + `*.Y`, the claim at `Y`. It refuses when that claim is regional |
| + (`Regional()`), and for `*.Y` whether or not the claim has `Catchall` |
| + yet, as the PUT tests the star (§6.2 step 6): a capability turned on |
| + later must not meet the route. How it reads: one `domains.GetClaim` of |
| + that key (claims are keyed by host, `ClaimKey`, so one object answers, |
| + no listing), through the store `deploymentReadSeam` returns |
| + (`cli.go:2004`): the deployment bucket from `CARLOS_DEPLOYMENT_BUCKET` |
| + with the default AWS credential chain, which on a box is its instance |
| + role, the role its alias pass lists `domains/` with; or |
| + `CARLOS_DEPLOYMENT_DIR`. It is the seam the same verb's nested-layout |
| + and daemon checks already use (`cli.go:241, 289`). When it cannot read: |
| + the seam gives no store (the variables unset, as in a root shell that |
| + has not loaded `host.env`, or no `CARLOS_RELEASE_PUBKEY`), or the GET |
| + fails other than not-found, it prints one line saying the check was |
| + skipped and proceeds, as those checks proceed on "no store". That is |
| + safe because a route at X or `*.X` never serves on a current binary |
| + that holds the regional row: `Reload` denies the key above. Every box |
| + derives the row on its first alias pass after the claim's creation |
| + (§7.2), and the row persists, so the only current box without it is one |
| + whose claim listing has failed on every pass since, the bucket-unreadable |
| + box §10.5 already bounds. The refusal saves an operator a route that |
| + would only 503. |
| ### 7.4 Precedence |
| @@ -508,7 +639,11 @@ route or alias beats a regional star; another box's exact name beats a local |
| 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). |
| +the GET reports `route-collision` if one appears anyway (§8). (rev 4, |
| +ruling 5b) "Beats" above is between different keys. At the same key a |
| +regional row beats a real route, apex and star alike: `Reload` makes the key |
| +a deny entry (§7.3). So a hand route at `*.X` never answers a name under a |
| +regional catch-all, and a route at X never answers X. |
| ### 7.5 Restart, unreadable claim, rollback, mode change |
| @@ -540,7 +675,10 @@ another's. |
| Three conditions apply to every region at once, for a regional claim: |
| -- `evidence-incomplete`: the snapshot is not `EvidenceComplete()`. |
| +- `evidence-incomplete`: the snapshot is not `EvidenceComplete()`, or |
| + (rev 4, ruling 5a) a fresh box's latest heartbeat has no `metrics` or |
| + does not say its alias read succeeded (`metrics.aliases_read` false or |
| + absent, below). |
| - `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 |
| @@ -555,10 +693,36 @@ Three conditions apply to every region at once, for a regional claim: |
| 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. 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. |
| +`no-address`. A replaced box has a new EIP, which the GET shows. |
| + |
| +(rev 4, ruling 5a) The alias read is reported, not assumed. Rev 3 stated |
| +a limit here: a heartbeat whose alias read failed omits the map |
| +(`agent.go:4480-4482` logs and leaves it nil), which read as no rows, while |
| +the edges file omits an alias whose DNS reading is not `pointing` |
| +(`internal/host/edgesfile.go:648`). That limit is gone: |
| + |
| +- Field. `status.BoxMetrics.AliasesRead bool`, JSON key `aliases_read`, |
| + `omitempty`, beside `Aliases` (`internal/status/snapshot.go:641`), and |
| + `status.Probes.AliasesRead bool` beside `Probes.Aliases` (`:150`). |
| +- Set. `statusTick` (`internal/host/agent.go:4480-4484`) sets |
| + `p.AliasesRead = true` in the branch where `reg.ListAliases()` returned |
| + no error, together with `p.Aliases`; the error branch leaves it false. |
| + Every box's heartbeat goes through it (a group box's too: |
| + `groupStatusTick`, `boxreference.go:124`, calls it). |
| +- Carried. `CollectBox` copies `p.AliasesRead` into `Metrics.AliasesRead` |
| + and adds `p.AliasesRead` to the condition that attaches `Metrics` |
| + (`snapshot.go:1119`), so a box whose only known fact is a successful |
| + read with no rows still publishes `"metrics":{"aliases_read":true}`. |
| + `BuildFleet` never copies `Metrics`, so the public feed is unchanged. |
| + `loadBoxesReport` (`status/fleet.go:303`) decodes it like any field. |
| +- Read. Evidence that a fresh box holds no ordinary row needs |
| + `b.Metrics != nil && b.Metrics.AliasesRead`. False, and absent (a |
| + failed read omits the key; a binary that predates the field never |
| + writes it; both decode to false), are incomplete evidence: the PUT |
| + refuses at the barrier (§10.3) and the GET reports |
| + `evidence-incomplete`. A box that fails the read every tick holds every |
| + regional PUT at 503 until it reads again, as an unreadable heartbeat |
| + does today. |
| ## 9. TLS |
| @@ -605,7 +769,15 @@ refuses, and an unread claim counts as regional. The override |
| 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 |
| +label, with its release. (rev 4, ruling 5a) Then, with every fresh box at |
| +or above the floor: a fresh box whose heartbeat does not say its alias read |
| +succeeded (`metrics.aliases_read` false or absent, §8): 503, as other |
| +incomplete evidence, nothing written. The floor test runs first so that a |
| +box on a binary that predates the field, which never sends it, is named by |
| +the 409. Steps 6 and 7 only refuse, so the PUT admits nothing until both |
| +pass, and step 6's alias-row test passing on a failed read admits nothing. |
| +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. |
| @@ -658,21 +830,30 @@ 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. |
| +(rev 4, ruling 5b) A root route at the regional claim's own key, X or |
| +`*.X`, is refused by a current `carlos add` that can read the claim and |
| +is a deny entry on every current binary holding the row (§7.3), so it |
| +matters only on an old binary (which ignores the table) or a box that has |
| +never derived the row (claims unreadable since creation), the same class |
| +and the same end as above. |
| ## 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. With B the edges files listed, H the heartbeats listed (at |
| -most 200, `status/fleet.go:217`) and R the app's instance records: |
| +box already makes, read once per change. Edges files are byte-identical; |
| +(rev 4) each heartbeat gains one key, `aliases_read` (§8), in the object it |
| +already writes. With B the edges files listed, H the heartbeats listed (at |
| +most 200, `status/fleet.go:217`), R the app's instance records, and (rev 4) |
| +A the deployment's accounts and K their apps: |
| | 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 | |
| +| PUT (rev 4, recounted for R3 P2-1 and P2-2) | (1) claim GET with ETag (step 4). (2) Overlap GETs (§6.7): `domains/*.X.json` always, plus `domains/P.json` and `domains/*.P.json` when P has an interior dot: 1 or 3. (3) Binding records (step 3): 1 LIST + R bodies, as `listRecords` makes them (plus each record's lifetime slot when lifetimes are on). (4) Declared-ownership walk (step 5): 1 LIST of `accounts/` + A manifest GETs, then 1 ListDirs of `apps/` + A ListDirs + K LISTs of `instances/`, keys only, no record bodies (on a store without bucket ListDirs, `listAppSubtree`'s fallback: the `apps/` listing). (5) One snapshot: edges 1 LIST + B GETs, heartbeats 1 ListMod (or LIST) + H GETs; collision, never-served, overlap, `aliases_read`, barrier and the response all read it. (6) On create, one DNS TXT lookup. Nothing else: no `heldElsewhere`, so no `DeploymentRoutes` fold, no `ForeignInstanceCatchall` GET and no catch-all app's records; `customDomainRefusal` reads the console's own database | 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 | |
| +| Instance create | as today (`hostClaimHolder` already reads the claim), (rev 4) plus one claim GET for the recheck under the host exclusion (§6.3) | as today | |
| +| `carlos add` on a box (rev 4) | 0 or 1 claim GET per run (§7.3); no polling | 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 | |
| @@ -709,11 +890,26 @@ edges-file writer, home-map fold and console server; listeners on 127.0.0.1. |
| 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. |
| + for `shop.example.com`, and A refuses: Tie unchanged. (rev 4, ruling 5b) |
| + (i) The exact-key collision on a current binary: B's registry gets a |
| + hand route at `*.shop.example.com` with `Addr` a counting TCP backend |
| + (the row `carlos add` writes when it cannot read the claim), and a hand |
| + route at `shop.example.com` the same way; after B reloads, |
| + `alice.shop.example.com` and `shop.example.com` at B answer 503 with |
| + zero accepts on the backend, zero dials and fills, Tuk unchanged, and |
| + B's log names each host once. |
| + (rev 4, R3 P2-3) Path-map assertion, direct: after A reloads with (f)'s |
| + row, A's upstream map has `paths == nil` on the `shop.example.com` entry |
| + while Tie's own entry still carries the `api` prefix. |
| Mutation check: with the `regionalGate` call removed, (c) records a dial |
| - 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. |
| + or (d) moves Tie; (rev 4) with both the serve entry keeping its target's |
| + path map and `lookupUpstreamPath`'s regional early return removed (the |
| + 1448 test back to `up.paths == nil`), (g)'s signed hop, still through |
| + production wiring, moves Tother (the kept map alone fails the direct |
| + assertion; the early return alone is redundant while the map is nil, so |
| + (g) stays 503); with `Reload`'s rev 3 "route |
| + wins" branch restored, (i) records an accept. 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 under any role; never |
| `*.apex` under role `home`; and, with `Wildcard`, `*.apex` as the |
| @@ -737,7 +933,15 @@ edges-file writer, home-map fold and console server; listeners on 127.0.0.1. |
| 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. |
| + `*.<parent>`: 409 each; an unreadable parent claim: 503. (rev 4) Declared |
| + ownership (R3 P2-1): an instance record at the host, committed and not |
| + yet provisioned (no route on any box, nothing in any edges file), under |
| + another account, and again under the caller's own app: 409 each; an |
| + account manifest that will not read during the walk: 503 and nothing |
| + written. Two-label apex (R3 P2-4): a PUT for `example.com` makes the |
| + `domains/*.example.com.json` GET and not the two at `com`; an instance |
| + catch-all claim at `*.example.com` in any state, and an object there that |
| + does not parse: 409 each; a GET error there: 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; a first-route attach on a |
| @@ -760,6 +964,8 @@ edges-file writer, home-map fold and console server; listeners on 127.0.0.1. |
| 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`. |
| + (rev 4) A fresh heartbeat with `aliases_read` false, and one without the |
| + key, give `evidence-incomplete` everywhere. |
| - 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. |
| @@ -775,7 +981,34 @@ edges-file writer, home-map fold and console server; listeners on 127.0.0.1. |
| 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. |
| + `shop.example.com` by the claim's own app 409s. (rev 4, R3 P2-1) The |
| + concurrent create, with lifetimes off and on: a hook holds an instance |
| + create at `shop.example.com` after its first claim check (no claim yet) |
| + and before its record write; the PUT runs to completion; the create then |
| + resumes and 409s at the recheck with no record written. Reversed: the |
| + hook holds the create inside the host exclusion after its record write; |
| + the PUT blocks on the exclusion, then 409s on the walk with no claim |
| + written. Lock-order checker (`lifetimeLockHook`) clean in both. |
| +- W12 (rev 4, ruling 5b) `TestAddRefusesARegionalHost`: with a DirStore |
| + holding the regional claim on `shop.example.com` (no `Catchall`) and |
| + `CARLOS_DEPLOYMENT_DIR` and `CARLOS_RELEASE_PUBKEY` set, `carlos add` |
| + refuses `shop.example.com` and `*.shop.example.com` and writes no row; |
| + it adds `alice.shop.example.com` and `*.example.com`. With the |
| + variables unset, and with the claim object unreadable, it prints the |
| + skipped-check line and adds the row, which W1 leg (i) shows is denied. |
| +- W13 (rev 4, ruling 5a) `TestFailedAliasReadIsIncompleteEvidence`, |
| + through the real `statusTick`, `CollectBox`, heartbeat store and console |
| + server: box B, current, holds a retained `route_aliases` row for |
| + `shop.example.com` whose DNS status is not `pointing` (so B's edges file |
| + omits it) and an alias read made to fail. B's heartbeat names a current |
| + release and has no `aliases_read`. A regional PUT for |
| + `shop.example.com`: 503, nothing written. With the read healthy the same |
| + PUT 409s on the listed row. With the claim written directly to the |
| + store, and B still holding the row, its read failing, reporting after |
| + `created_at`: the GET gives `evidence-incomplete`, never ready. A heartbeat decoded from a pre-field |
| + binary's JSON (no key) is judged the same as a failed read. Mutation |
| + check: with `aliases_read` ignored by the barrier, the first PUT writes |
| + the claim. |
| Locally, only touched packages with `-run`; CI runs the full gate. |
| @@ -785,9 +1018,15 @@ Likely in the root binary's scope (`go list -deps .`): `internal/edge` |
| (`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 |
| +`RegionalTarget`), `internal/host` (the region into the alias pass; rev 4: |
| +`statusTick` sets `aliases_read`), `internal/status` (rev 4: the |
| +`AliasesRead` probe and metrics field, which rev 3 expected not to |
| +change), and the root package (`domains_cli.go`, `system.go`; rev 4: |
| +`cli.go`'s `carlos add` claim check, which reads the bucket object |
| +`domains/<host>.json` through the existing deployment-store seam, not a |
| +local path). `internal/provision` gains `RecordHostDeclared`, called only |
| +by the console. `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"). |
| @@ -798,13 +1037,16 @@ decides each class (AGENTS.md "The census"). |
| 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. |
| + the instance catch-all parent rule; (rev 4) the heartbeat's |
| + `aliases_read`. W2, W3. |
| +4. Edge entries, the recheck, no path map and `regionalGate`; (rev 4) the |
| + deny over a real route at the same key and `carlos add`'s claim check. |
| + W1 with its mutation checks, W9, W10, W12. Its own Astra review |
| + (routing, backhaul, certificates; rule 3). |
| +5. PUT door with the never-served and overlap evidence, (rev 4) the |
| + declared-ownership walk and instance create's recheck under the host |
| + exclusion, the reverse-door scans, activation barrier, CLI write, GET |
| + readiness. W5, W8, W11, W13, 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. |
| @@ -820,4 +1062,5 @@ 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. |
| +root hand route on a box, (rev 4) beyond `carlos add`'s check of a regional |
| +claim's own keys (§7.3). |