carlos / platform Public

Regional domains (#447): spec rev 5, ruling 6 and the R4 P2 fix

Ruling 6 (Paul, 2026-10-29, relayed by platform-17): a regional claim's
wildcard and catch-all capabilities are fixed at creation. The PUT sets
them from its body (with the CNAME enabling gate and, for catch-all, the
descendant scan); SetClaimCapabilities and setDomainCapabilities refuse
any change on a regional claim with ErrRegionalClaim; the same values are
accepted with no write, audit or serial bump. A catch-all regional claim
therefore has its *.X row from its first derivation, so R4 P1's
transition case cannot arise (§7.2, §7.3, §10.5). Witness W14
TestRegionalClaimCapabilitiesAreFixed.

R4 P2 fix: the placements PUT reads PendingForHost(host, "") under the
host exclusion it holds and refuses while it is nonzero; a read error is
503. Instance create's claim recheck is pinned before BeginAllocation. W11
gains a failed record write followed by recovery; §11 counts the local
SQLite read.

Adds the R4 findings map, records ruling 6 and the round history (no
further design round), marks every changed passage "(rev 5)".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 75b6bf837a73163c10bf750af6f3634283e7a98e parent 9d6424e
1 file changed, +229 −40
  • docs/superpowers/specs/2026-10-28-regional-domains-447-design.md +229 −40

CI passed — run details

Intent

Human

<agent-message from="af17d5e1dbe1fd0b0"> #447 regional domains: final design round 4 came back NOT READY with 1 P1 and 1 P2. Per ruling 5 I've stopped; the cut options are below. No code has been written. Branch regional-domains-447, tip 9d6424e4 (pushed). Ruling 5 is recorded in the ledger, on #447 and in spec §2. Spec rev 4 is f809b79e. Findings are in docs/superpowers/specs/CODEX-FINDINGS-regional-domains-447-R4.md. I checked the citations and they hold. R4 resolved R3's failed-alias-read P1, plus the P2s on the budget, the W1 mutation and the two-label apex. What's left: - P1: the catch-all deny is missing while a capability change converges. Derivation writes the regional *.X row only when Wildcard && Catchall are on (spec §7.2). Take a current box that has derived regional apex X with catch-all off, and a root `carlos add '*.X'` hand route pointing at a TCP backend in another region. The carlos add check was skipped because the shell had no deployment variables. When the owner turns catch-all on (apidomains.go:740), that box serves alice.X from the hand route until it reads the change. Family: covering routes, carried from R3 P1-2. - P2: a pending lifetime allocation escapes the ownership walk. The allocation is persisted before the record (lifetimes_create.go:128), and recovery writes the record later (lifetimes_recovery.go:233). The fix is small: the PUT refuses while PendingForHost(host, "") is nonzero, under the host lock. Options for Paul (posted on #447 and in the branch handoff): - A. Refuse up front: a regional claim's capabilities are fixed when it is created. The capability door refuses wildcard or catch-all changes on a regional claim; to change them, detach and create again. The *.X row then exists from the first derivation, like the apex, so the transition can't happen. It's a one-line refusal plus a witness. - B. Astra's fix: always derive a *.X deny row for every regional claim, and serve there only once catch-all is derived on. This adds one more mechanism. - C. Cut regional catch-alls (apex only). This is Astra's named cut and the safest, but the #447 consumer's user handles live under the catch-all, so it ships less than #447 asks for. - D. Park at rev 4. My recommendation is A plus the P2 fix. Since no fifth design round was offered, I suggest the build's per-task Astra review of the edge and routing task checks both changes; rule 3 requires that review anyway. Send Paul's choice and say whether that per-task review stands in for a design re-check. My ledger is .superpowers/sdd/2026-10-28-regional-domains-447/progress.md. Scratch is in /home/paulca/.cache/tmp/claude-1001/rd447/. </agent-message>

Human

<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, as ruling 5 required: the final design round, round 4, came back NOT READY with 1 P1 and 1 P2. Paul now needs to choose a cut. There's still no code. **Before round 4:** I recorded ruling 5 in the ledger, on #447 and in spec §2. Spec rev 4 (f809b79e) applied it and fixed round 3's four P2s, and Astra reviewed only that change. The branch tip is 9d6424e4, pushed. **What round 4 found** (I checked the citations and they hold). It resolved round 3's failed-alias-read P1 and three of the four P2s. What's left: - **P1: catch-all switched on after creation.** A box only writes the regional `*.X` row when catch-all is on. Suppose a box has picked up the regional apex while catch-all was off, and a root `carlos add '*.X'` hand route exists there pointing at a backend in another region. The `carlos add` check is skipped when the shell has no deployment variables. If the owner then turns catch-all on, that box serves `alice.X` from the hand route until it reads the change. - **P2: pending allocations slip past the ownership check.** An instance allocation is saved before its record, and recovery writes the record later, so the check that looks only for existing records misses it. The fix is small: the regional write refuses while any allocation for that name is pending. **Decision needed** (posted on #447, in the branch handoff and sent to the root session): - **A. Fix capabilities at creation.** The capability door refuses wildcard or catch-all changes on a regional domain; to change them, the member detaches and creates it again. The `*.X` row then exists from the start, like the apex, so the transition case can't happen. This is a one-line refusal plus a test. - **B. Astra's fix.** Every regional domain gets a deny row at `*.X` from creation, and serving there starts only once catch-all is on. It adds one more mechanism. - **C. Cut regional catch-alls (apex only).** It's the safest, but the #447 consumer's user handles live under the catch-all, so it ships less than #447 asks for. - **D. Park the design** at rev 4. I recommend A plus the P2 fix. No fifth design round was offered, so I've proposed that the build's per-task Astra review of the edge and routing task check both changes; rule 3 requires that review anyway. The root session needs to confirm that this review is enough. Nothing is running. The scratch folder stays until 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 4) - `docs/superpowers/specs/CODEX-REVIEW-BRIEF-regional-domains-447-R4.md` - `docs/superpowers/specs/CODEX-FINDINGS-regional-domains-447-R4.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>194658</subagent_tokens><tool_uses>13</tool_uses><duration_ms>1208403</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 276643a5b..eeae59e1a 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,6 +1,6 @@
-# Regional custom-domain placements (#447): design, rev 4
+# Regional custom-domain placements (#447): design, rev 5
-Status: design for agents, not member copy. Rev 4, author Claude Opus 5.5,
+Status: design for agents, not member copy. Rev 5, author Claude Opus 5.5,
2026-10-29, branch `regional-domains-447` (origin/main merged at c6a5ba51).
Citations are at c6a5ba51 (the branch's later commits change only docs).
Round history: rev 1 (Astra/GPT-6, kept at
@@ -16,9 +16,23 @@ 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
+fixes and changes nothing else. R4: Astra on rev 4
+(`docs/superpowers/specs/CODEX-FINDINGS-regional-domains-447-R4.md`), NOT
+READY, 1 P1, 1 P2; the final round, so work stopped and Paul gave ruling 6
+(§2). Rev 5 applies ruling 6 and the R4 P2 fix and changes nothing else.
+No further design round: the build's per-task Astra review of the edge and
+routing task (§15 step 4) stands in for the design re-check.
+
+Rev 5 changes, for a review scoped to them: header; §2 ruling 6; §3 D9;
+§5 R4 table; §6.2 the opening paragraph, the "why it holds afterwards"
+bullet and steps 3, 4, 5, 6, 8 and 9; §6.3 the attach, `SetClaimCapabilities`
+and instance create bullets; §6.6; §6.7 the `Catchall` refusal bullet;
+§7.2 the desired-rows bullet; §7.3 the `carlos add` bullet; §10.5 last
+paragraph; §11 PUT and capability rows; §13 W5, W6, W11 and the new W14;
+§15 steps 2 and 5. Each changed passage is marked "(rev 5)". Rev 4's marks
+stay as they were.
+
+Rev 4 changes: 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
@@ -91,6 +105,25 @@ Rulings 1-3 are Paul's of 2026-10-28.
`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.
+6. (rev 5) Paul, 2026-10-29, relayed by platform-17, after R4 (the final
+ round, NOT READY, 1 P1, 1 P2). No further design round: the build's
+ per-task Astra review of the edge and routing task (§15 step 4) stands
+ in for the design re-check.
+ - (a) A regional claim's `Wildcard` and `Catchall` are fixed when it is
+ created: the PUT sets them from its body (§6.2 step 9). Every writer
+ refuses to change them on a regional claim: `domains.SetClaimCapabilities`
+ itself and its console caller `setDomainCapabilities` (§6.3); no
+ browser door writes them. Changing them means detach and create again.
+ A write of the same values is accepted and writes nothing (no audit,
+ no serial bump). Consequence: a regional claim with `Catchall` has its
+ `*.X` row from its first derivation, as the apex has its row, so R4
+ P1's transition (a box that derived the apex before `Catchall` was on)
+ cannot arise; a box lacking the star row is in the same
+ never-read-the-claim class as one lacking the apex row (§7.2, §7.3,
+ §10.5). Witness W14.
+ - (b) The R4 P2 fix: the PUT refuses while `PendingForHost(host, "")` is
+ nonzero, read under the host exclusion it already holds; a read error
+ fails closed (§6.2 steps 5-6). Witness W11's failed-write leg.
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
@@ -138,7 +171,9 @@ There is no global switch and nothing dormant.
- 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).
+ change mode a member detaches and creates again (§6.2). (rev 5, ruling 6)
+ The same holds for a regional claim's `Wildcard` and `Catchall`: fixed at
+ creation, changed only by detaching and creating again.
- D10. One eligibility predicate, `release.RegionalTarget`, decides a
target in derivation and again in `Reload` (§7.2, §7.3).
@@ -199,6 +234,14 @@ R3 (rev 4; the two P1s through ruling 5):
| 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. |
+R4 findings resolved (rev 5; the P1 through ruling 6, not through the
+review's proposed persistent star deny):
+
+| Finding | Resolution |
+|---|---|
+| P1-1 the wildcard deny is absent before a capability change converges | No capability change exists on a regional claim: `Wildcard` and `Catchall` are set by the PUT at creation and every writer refuses to change them (D9, §6.2 steps 4 and 9, §6.3). A catch-all regional claim has its `*.X` row from each box's first derivation, as the apex has its row, so the scenario (apex derived, `Catchall` later turned on, a hand route at `*.X` serving meanwhile) cannot arise; a box without the star row has never read the claim, the class §10.5 already bounds (§7.2, §7.3, §10.5). W14; W5 for capabilities at creation. |
+| P2-1 pending lifetime allocations escape the ownership walk | The PUT reads `PendingForHost(host, "")` under the host exclusion (step 5) and refuses with the neutral 409 while it is nonzero (step 6); a read error is 503, nothing written. Instance create's claim recheck sits before `BeginAllocation`, so a create it refuses leaves no allocation behind (§6.3). §11 counts the read (the console's own SQLite, no bucket request). W11 adds a failed record write followed by recovery. |
+
## 6. Data shape, API and CLI
### 6.1 Claim (`internal/domains/claims.go`)
@@ -236,7 +279,11 @@ R3 (rev 4; the two P1s through ruling 5):
`{"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.
+out except detach. (rev 5, ruling 6) The body may also carry `wildcard`
+and `catchall` (booleans, absent means false on create and unchanged on
+update). They take effect only when the PUT creates the claim; the PUT is
+the only writer that sets them on a regional claim, and nothing changes
+them afterwards.
**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
@@ -272,9 +319,12 @@ already loads. The rule uses both.
no covering catch-all can be created (§6.7); instance create refuses the
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`.
+ record walk or sees the regional claim; (rev 5, R4 P2-1) a create whose
+ record write failed after its allocation was persisted is seen by the
+ PUT's `PendingForHost` read (step 5), so no regional claim is written
+ while recovery still owes a record at the host. 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
@@ -296,12 +346,18 @@ 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.
+ (rev 5) `catchall` without `wildcard`: 422 with
+ `ErrCatchallNeedsWildcard`'s text, as the capability door answers.
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;
+ and apply the claim rule above. (rev 5, ruling 6) On update, a body
+ naming a `wildcard` or `catchall` that differs from the claim's: 409
+ with `ErrRegionalClaim`'s text, nothing written (the caller's own
+ claim, so this reveals nothing); naming the same values is accepted.
+ 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,
@@ -327,30 +383,61 @@ the `verify` answer (step 8) are as rev 2 and attach give them.
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.
+ matched. (rev 5, R4 P2-1) And the pending-operation read:
+ `s.store.PendingForHost(host, "")` (`lifetimes_store.go:345`), the count
+ `admit` (`lifetimes.go:192`) reads, of pending allocations, retirements
+ and migrations of the host. It runs under the host exclusion step 4
+ took, which every create, retirement, migration and recovery of the
+ host also takes, so no allocation can begin between this read and the
+ claim write. It reads the console's own SQLite (the tables exist with
+ lifetimes on or off, `store.go:425`), no bucket request. A read error:
+ 503, nothing written.
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;
+ - (rev 5, R4 P2-1) `PendingForHost` is nonzero: 409. A create that
+ persisted its allocation and then failed its record write has
+ released the locks with no record for the walk to find, and recovery
+ (`recoverAllocationLocked`, `lifetimes_recovery.go:161`) writes that
+ record later without passing the claim recheck. Refusing while the
+ operation is pending keeps the PUT from admitting a claim that
+ recovery would then collide with; a retry after recovery meets the
+ record in the walk, or, if recovery voided the allocation, passes;
- 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);
+ (the star is tested whether or not the claim has `Catchall`; (rev 5)
+ ruling 6 leaves no later capability flip for it to meet, and the test
+ stays unconditional because it costs nothing);
- 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.
+ - the overlap tests of §6.7: 409, or 503 on an unreadable claim;
+ - (rev 5, ruling 6) on create with `catchall`, the descendant scan
+ `setDomainCapabilities` runs when it turns `Catchall` on (§6.7): any
+ claim `<label>.<host>` regional or listed but unread, 409; a listing
+ error, 503. Creation is now the only moment a regional claim's
+ `Catchall` becomes true, so the scan moves here for it.
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.
+ (rev 5, ruling 6) And, whenever the write creates a claim or replaces a
+ pending one with `wildcard` true: the enabling gate
+ `setDomainCapabilities` runs on a false-to-true transition
+ (`apidomains.go:699-735`): no delegation zone, 422; a principal past
+ the failure budget (`wildFailTripped`), 429; `delegationCNAMEDelegated`
+ false, 422 (counted by `allowWildFail`). Nothing is written on any of
+ them. Without it the PUT would be a way round the CNAME gate.
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.
+ On create and on replacing a pending claim: `created_at` is now;
+ (rev 5, ruling 6) `Wildcard` and `Catchall` from the body (absent is
+ false), fixed for the claim's life. On update: `Route` kept if still
+ bound, else the first host by region; capabilities and `created_at`
+ kept (step 4 refused any change). Audit and `bumpSerial` only when
+ bytes changed, so an update naming the same capabilities and the same
+ set writes nothing.
10. The answer is the GET body, built from the step-5 snapshot and the
claim just written. No further reads.
@@ -359,9 +446,19 @@ the `verify` answer (step 8) are as rev 2 and attach give them.
- `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); 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.
+ schema-1 claim never gains placements. (rev 5, ruling 6) An attach
+ naming a bound host with `wildcard` or `catchall` reaches
+ `setDomainCapabilities` after the no-op (`apidomains.go:628`). Its other
+ call site, the route-less own-claim branch (`:504`), takes only a claim
+ whose `Route` is empty, which a regional claim never is (D2). There,
+ right after its claim read (`:669`) and before the enabling gate, a
+ regional claim whose resulting `(wildcard, catchall)` differs from the
+ claim's (the wildcard-off cascade included) is refused with
+ `ErrRegionalClaim` (409): no CNAME lookup, no `wildFail` count, no
+ write. The same values pass on to `SetClaimCapabilities`, which returns
+ `changed == false`, so no audit and no serial bump: accepted, nothing
+ written. `carlos deploy` re-attaching with the flags it was created with
+ keeps working.
- 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
@@ -370,7 +467,18 @@ the `verify` answer (step 8) are as rev 2 and attach give them.
- `SetClaimPaths` on a regional claim: `ErrRegionalClaim`.
- `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.
+ `:740`), runs the §6.7 scan when it turns `Catchall` on. (rev 5,
+ ruling 6) It refuses itself too, so the rule holds for every writer and
+ not only the HTTP door: in `claimRawSetClaimCapabilities`
+ (`claims.go:776`), after the owner gate and after the existing
+ same-values return (`:793`, `false, nil`, no write), a regional claim
+ returns `ErrRegionalClaim` before building `next`. It is the only
+ writer of the two fields on an existing claim (its doc comment,
+ `claims.go:769`); `SetClaimPlacements` sets them once, at creation
+ (§6.2 step 9). No browser door writes them: `appdomains.go` attaches and
+ detaches hostnames and instance catch-alls with no capability field, and
+ the host-claim paths refuse capabilities outright
+ (`errClaimAliasCapabilitiesUnsupported`, `claim_alias.go:198`).
- `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
@@ -389,9 +497,15 @@ the `verify` answer (step 8) are as rev 2 and attach give them.
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
+ hold neither lock). (rev 5, R4 P2-1) In `createRecordWithLifetimeLocked`
+ the recheck sits before `BeginAllocation` (`lifetimes_create.go:128`),
+ beside step 1's `admit` (`:81`), where nothing is yet durable: a refusal
+ after that point would leave a pending allocation that recovery
+ completes into the very record the recheck refused. 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
+ record written first is in the PUT's walk (§6.2 step 6), (rev 5) an
+ allocation persisted first whose record write failed is in the PUT's
+ `PendingForHost` count (§6.2 steps 5-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
@@ -436,7 +550,14 @@ carlos domains placements --app shop example.com --set ie=shop-ie.example.net --
```
`--set` gives the whole set and creates the claim if there is none.
-`docs/site/cli.md` names the subcommand.
+`docs/site/cli.md` names the subcommand. (rev 5, ruling 6) `--wildcard`
+and `--catchall`, the flags `carlos domains attach` already has, are sent
+only when given (`fs.Visit`, as attach does) and take effect on create;
+on an existing regional claim a differing value is refused (§6.2 step 4).
+
+```
+carlos domains placements --app shop example.com --set ie=shop-ie.example.net --set uk=shop-uk.example.net --wildcard --catchall
+```
### 6.7 Overlap with catch-alls (ruling 4)
@@ -477,7 +598,11 @@ claim on P with `Catchall` counts too: one rule, whatever the mode.
- 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.
+ `ClaimCache` (`claimcache.go:95`); a listing error refuses. (rev 5,
+ ruling 6) This path now serves schema-1 claims only: a regional claim's
+ `Catchall` cannot be turned on after creation (§6.3), so for a regional
+ P the same scan runs in the PUT when it creates the claim with
+ `catchall` (§6.2 step 6).
- 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
@@ -553,7 +678,12 @@ through its own key, and §6.7 keeps every covering key away. Guard test: W2.
`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).
+ (same per-box cap of 32). (rev 5, ruling 6) `Wildcard` and `Catchall`
+ never change on a regional claim, so the set of keys a claim desires is
+ fixed from its creation: a box's first derivation of a catch-all claim
+ writes `host` and `*.host` together, and no later pass adds or removes
+ the star. A box holding the apex row of a catch-all claim holds its star
+ row too.
- 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 kept row
@@ -610,9 +740,10 @@ through its own key, and §6.7 keeps every covering key away. Guard test: W2.
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
+ (`Regional()`), and for `*.Y` whether or not the claim has `Catchall`,
+ as the PUT tests the star (§6.2 step 6); (rev 5) ruling 6 leaves no
+ later capability flip, and the refusal stays because a route at `*.Y`
+ under a regional claim has no use. 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`
@@ -629,8 +760,14 @@ through its own key, and §6.7 keeps every covering key away. Guard test: W2.
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.
+ box §10.5 already bounds. (rev 5, ruling 6) For `*.X` the same holds,
+ which R4 P1 showed rev 4 could not claim: a catch-all regional claim had
+ `Catchall` from its creation, so a box that derived the apex derived the
+ star in the same pass (§7.2), and a box without the star row has never
+ read the claim, the apex's class. The case R4 P1 built, a box that
+ derived the apex while `Catchall` was off and serves a hand `*.X` route
+ until it reads the change, needs a change that no writer makes. The
+ refusal saves an operator a route that would only 503.
### 7.4 Precedence
@@ -835,7 +972,13 @@ matters only on an old binary and ends at that box's first adoption.
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.
+and the same end as above. (rev 5, ruling 6) That holds for the star as for
+the apex, because a regional claim's capabilities are fixed at creation
+(§7.2): no current box that has read the claim lacks a `*.X` row the
+claim desires. Changing capabilities is a detach and a fresh PUT, which
+makes a new claim. A box that holds rows kept from the old claim (listed
+but unreadable, §7.2) and has not read the new one has never read this
+claim either, so it is in the same class, with the same end.
## 11. Request budget
@@ -849,9 +992,10 @@ A the deployment's accounts and K their apps:
| Act | Reads | Writes |
|---|---|---|
-| 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 |
+| 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. (7) (rev 5, R4 P2-1) `PendingForHost`: one query on the console's own SQLite, no bucket request. (8) (rev 5, ruling 6) On create with `wildcard`: one DNS CNAME lookup (the enabling gate's); with `catchall`: the descendant scan, one `domains/` ListMod through `s.claims` plus a GET per key whose mod time moved (cold cache: one per claim). 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 |
+| (rev 5) A capability write on a regional claim | the claim GET the door already makes (`apidomains.go:669`), then `SetClaimCapabilities`' own claim GET only for the same values; refused changes make no DNS lookup | none |
| 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 |
@@ -941,9 +1085,16 @@ edges-file writer, home-map fold and console server; listeners on 127.0.0.1.
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.
+ does not parse: 409 each; a GET error there: 503. (rev 5, ruling 6)
+ Capabilities at creation: a create with `wildcard` and `catchall` writes
+ both true, and one with neither writes both false; `catchall` without
+ `wildcard`: 422, nothing written; `wildcard` with no delegation zone, or
+ with no delegating `_acme-challenge` CNAME: 422, nothing written; a
+ create with `catchall` while a claim `<label>.<host>` is regional, or
+ listed but unread: 409, and a failed listing 503.
- W6 wire: today's reader skips a schema-2 body; schema 1 round-trips
- byte-stable; `SetClaimCapabilities` keeps schema and list; attach naming
+ byte-stable; `SetClaimCapabilities` keeps schema and list on a schema-1
+ claim, and (rev 5) on a regional claim writes nothing (W14); 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
@@ -989,6 +1140,20 @@ edges-file writer, home-map fold and console server; listeners on 127.0.0.1.
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.
+ (rev 5, R4 P2-1) A failed record write followed by recovery, lifetimes
+ on: a hook fails the record write of an instance create at
+ `shop.example.com` after `BeginAllocation`, so the create returns with
+ the allocation pending and no record at the host. A regional PUT for
+ `shop.example.com`: 409 with the attach door's neutral bytes, no claim
+ written. Recovery (`recoverLifetimes`) then runs and writes the record;
+ the same PUT again: 409, now on the walk, no claim written. With
+ `PendingForHost` made to fail: 503, nothing written. And the recheck's
+ place: with the regional claim written first, an instance create at the
+ host 409s at the recheck and leaves `PendingForHost` at 0, and a
+ recovery run afterwards writes no record. Mutation check: with the
+ pending test removed, the first PUT writes the claim and recovery then
+ writes the colliding record; with the recheck moved after
+ `BeginAllocation`, the last leg's recovery writes a record.
- 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`
@@ -1009,6 +1174,26 @@ edges-file writer, home-map fold and console server; listeners on 127.0.0.1.
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.
+- W14 (rev 5, ruling 6) `TestRegionalClaimCapabilitiesAreFixed`, through
+ the real console server and DirStore: two regional claims made by the
+ PUT, `shop.example.com` with neither capability and `shop2.example.com`
+ with both, a counting resolver behind `delegationCNAMEDelegated`. Every
+ change is refused, both directions, at every writer: (a) the attach door
+ naming a bound host, with `wildcard:true` and with `wildcard:true,
+ catchall:true` for the first (on), and with `catchall:false` and with
+ `wildcard:false` (the cascade) for the second (off): 409 with
+ `ErrRegionalClaim`'s text, zero CNAME lookups, no `wildFail` count;
+ (b) the PUT update naming the same changes: 409; (c)
+ `domains.SetClaimCapabilities` called directly with each changed pair:
+ `ErrRegionalClaim`. After every refusal the claim object's bytes and
+ ETag are unchanged, the serial has not moved and no audit row is
+ written. The same values through each of (a), (b) and (c): accepted
+ (200, or `false, nil`), nothing written, no serial bump, no audit. The
+ route-less own-claim branch (`apidomains.go:504`) is shown unreachable
+ for a regional claim (its `Route` is never empty). Mutation check: with
+ `SetClaimCapabilities`' regional refusal removed, (c) writes; with the
+ door's early refusal removed, (a) makes a CNAME lookup for the first
+ claim before `SetClaimCapabilities` refuses. Each watched to fail once.
Locally, only touched packages with `-run`; CI runs the full gate.
@@ -1035,7 +1220,9 @@ decides each class (AGENTS.md "The census").
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, instance create
- included), team scope (§6.4). W4, W6.
+ included; rev 5: the recheck before `BeginAllocation`, and the
+ capability refusal in `SetClaimCapabilities` and `setDomainCapabilities`),
+ team scope (§6.4). W4, W6.
3. `release.RegionalTarget`, `regional_domains` and the derivation, with
the instance catch-all parent rule; (rev 4) the heartbeat's
`aliases_read`. W2, W3.
@@ -1046,7 +1233,9 @@ decides each class (AGENTS.md "The census").
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.
+ readiness; (rev 5) the `PendingForHost` refusal, and capabilities at
+ creation with their enabling gate and descendant scan. W5, W8, W11, W13,
+ (rev 5) W14 (its claims are made by the PUT), 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.