carlos / platform Public

spec: account subdomains, settle Astra's builder-check questions

Namespace enforced on the boxes (foreign claims under a held name are
inert), remove refuses while hand-attached names remain, Platform app
URLs are mirrored, the ReservePlatformDomains blanket entry is skipped,
and names get the sqid's DNS and certificate behaviour exactly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 2eb62f9de124f2fc8d83a0fc0284602b660e703c parent 55ac0dd
3 files changed, +85 −19
  • docs/superpowers/specs/2026-11-11-account-subdomains-design.md +62 −19
  • docs/superpowers/specs/CODEX-FINDINGS-account-subdomains-builder-check.md +14 −0
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-account-subdomains.md +9 −0

Intent

Human

<task-notification> <task-id>bcmepym0d</task-id> <tool-use-id>toolu_01XH4XExqN5fiyKgyaDocnd7</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/709ac745-ee81-4971-97b8-321e18b19cf6/tasks/bcmepym0d.output</output-file> <status>failed</status> <summary>Background command "Run Astra builder check on the spec" failed with exit code 1</summary> </task-notification>

Human

<task-notification> <task-id>bwtywu8bh</task-id> <tool-use-id>toolu_01EC5addj3RKQQSKJ2XfywTN</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/709ac745-ee81-4971-97b8-321e18b19cf6/tasks/bwtywu8bh.output</output-file> <status>completed</status> <summary>Background command "Rerun Astra builder check with fixed paths" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 10.1 g CO₂e (1,031,605 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-account-name-hosts, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/specs/2026-11-11-account-subdomains-design.md b/docs/superpowers/specs/2026-11-11-account-subdomains-design.md
index b6c4bfea2..9944d8036 100644
--- a/docs/superpowers/specs/2026-11-11-account-subdomains-design.md
+++ b/docs/superpowers/specs/2026-11-11-account-subdomains-design.md
@@ -111,12 +111,27 @@ A name is one DNS label: the account-name shape in `slugname.go`
4. **The deployment stands on it.** `domainHostPolicy` says
`hostReserved` for `<name>.<apps-domain>` or for a probe host under it
(covers the steering host, tunnel host, console hosts and demo hosts).
- `CONSOLE_DENY_DOMAINS` entries covering it refuse it too.
+ `CONSOLE_DENY_DOMAINS` entries covering it refuse it too. With
+ `ReservePlatformDomains` on, `reservedDomains` lists the whole apps
+ domain, which would refuse every name; this door skips that one blanket
+ entry, the way `denyEntries(…, exemptAppsDomain=true)` already does for
+ `CONSOLE_APPS_DOMAIN_ALIAS_ACCOUNTS`, and keeps every other entry.
5. **Something already lives there.** Any claim held by another account,
or any route in the deployment, at `<name>.<apps-domain>` or under it.
Same-account claims are fine (they become exact names inside the
account's own namespace, §4.4).
+**The race with ordinary attaches.** Rule 5 is checked before the
+namespace claim is written, and a foreign attach of `x.<name>...` is a
+different bucket key, so both can pass their checks at once. That is
+closed where it is served, not at the doors: a box derives **nothing**
+from a claim under a held namespace whose account is not the namespace's
+account (§4.4). Whichever write lands second, the namespace wins on every
+edge, and the losing claim is inert. The console also re-lists claims
+under the name after writing the namespace claim and reports any foreign
+one it finds to the operator, so the inert claim is visible rather than
+silent.
+
The console suggests the account's name when it fits these rules. The
subdomain is a separate value from the account name, because account names
are non-unique by design, can be renamed, and auto-minted personal
@@ -132,9 +147,12 @@ person, never an app token. The CLI is
- **Set** checks §4.2, then writes the claim create-only. An account that
already has a subdomain is refused; changing it is remove then set.
-- **Remove** deletes the claim (etag-conditional). The derived names stop
- serving on the next alias pass. The name is free again at once. Only an
- operator can take it next, so reuse is always a deliberate choice.
+- **Remove** is refused while the account still holds exact claims or
+ routes under the name (`blog.harbour...` attached by hand), and the
+ refusal lists them. Otherwise it deletes the claim (etag-conditional),
+ the derived names stop serving on the next alias pass, and the name is
+ free again at once. Only an operator can take it next, so reuse is
+ always a deliberate choice.
- **Account deletion** leaves the claim in place. It stays held by the
tombstoned account, its routes are gone so it derives nothing, and an
operator can remove it afterwards.
@@ -146,14 +164,22 @@ deployment, and nothing changes until an operator sets a subdomain.
`domains.ReconcileAliases` gains a pass beside `deriveInstanceAliases`.
For each namespace claim (account `A`, name `N`), and for each route on
-this box that is provisioned, non-sidecar, belongs to `A`, and whose host
-is `<prefix>.<Sqid A>.<apps-domain>`, it derives the alias row
-`<prefix>.<N>.<apps-domain>` → that route's host.
-
-The precedence rules are the instance catch-all's, unchanged:
-
-- An exact claim on the derived name wins, whoever holds it. That lets
- the account attach `blog.harbour...` to a different app if it wants.
+this box that is `Provisioned` **or** `Platform` (the app URLs minted by
+`mintedRoute` are `Platform` and not `Provisioned`), is not a sidecar or
+replica row, has account column `A`, and whose host is
+`<prefix>.<Sqid A>.<apps-domain>`, it derives the alias row
+`<prefix>.<N>.<apps-domain>` → that route's host. `<prefix>` may be more
+than one label (canary hosts); those get whatever certificate their sqid
+twin gets (per-host today, §4.6).
+
+The precedence rules are the instance catch-all's, with one addition:
+
+- An exact claim on the derived name held by `A` wins. That lets the
+ account attach `blog.harbour...` to a different app if it wants.
+- An exact claim anywhere under `<N>.<apps-domain>` held by any other
+ account derives nothing at all, in this pass and in the plain alias
+ pass. This is the one place the namespace is enforced (§4.2, the
+ race), and it is logged once per claim.
- A real route on this box, or one any live box publishes, wins.
- A listing failure keeps the existing derived rows for that pass instead
of dropping them.
@@ -198,11 +224,22 @@ back to per-host, the same as sqids.
### 4.7 DNS
-No new records. The apps domain's wildcard (`*.<apps-domain>`) already
-answers `shop.harbour.<apps-domain>`, because a DNS wildcard covers every
-name below it that has no node of its own. The builder confirms this on
-each deployment type (§4 of the instance catch-all spec lists them),
-including any that publish per-account records instead of one wildcard.
+No new records, and no new DNS behaviour: a name gets exactly what a sqid
+gets. The apps domain's wildcard (`*.<apps-domain>`) answers
+`shop.harbour.<apps-domain>` as it answers `shop.bdq.<apps-domain>`.
+
+The known wildcard hazard applies to both alike. Any record at an exact
+name under `harbour.<apps-domain>`, including the
+`_acme-challenge.harbour.<apps-domain>` TXT that wildcard issuance
+publishes while it validates, makes `harbour.<apps-domain>` an empty
+non-terminal, and while it exists siblings stop matching `*.<apps-domain>`
+(RFC 4592; written up in
+`2026-10-01-nearest-region-default-design.md` §13.1). Sqid parents have
+lived with the challenge window since wildcard certs shipped; this spec
+does not fix it for either, and any later fix must cover both. Derived
+names are never handed to the steering converger as exact records, the
+same as other aliases. The builder confirms both on each deployment type
+(§4 of the instance catch-all spec lists them).
### 4.8 Surfaces
@@ -229,7 +266,8 @@ unprotected.
- **A member tries to take a name:** no door. Only the operator door
writes namespace claims.
-- **Another account attaches `x.harbour...`:** refused by §4.5.
+- **Another account attaches `x.harbour...`:** refused by §4.5, and if
+ it races the assignment, inert on every box (§4.4).
- **An app token sets a subdomain:** refused; the door needs a person.
- **A name equal to a future sqid:** refused by §4.2 rules 1-2.
- **A name over infrastructure:** refused by §4.2 rules 3-4.
@@ -267,6 +305,11 @@ it ships in; there is no switch (§4.3).
- The subdomain is its own value, not the account name (§4.2).
- Sqid-shaped names need 7+ letters (§4.2 rule 2).
- Operator-only, no switch, available on every deployment (§4.3).
-- Remove frees the name at once; no tombstone (§4.3).
+- Remove frees the name at once; no tombstone. It refuses while the
+ account still has hand-attached names under it (§4.3).
+- The namespace is enforced on the boxes, not by locking the doors: a
+ foreign claim under a held name is inert (§4.2, §4.4).
+- Names get the sqid's DNS and certificate behaviour exactly, including
+ the existing `_acme-challenge` wildcard window (§4.7).
- Both URLs serve; no redirect (§3).
- Every route under the sqid is mirrored, instances included (§4.4).
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-account-subdomains-builder-check.md b/docs/superpowers/specs/CODEX-FINDINGS-account-subdomains-builder-check.md
new file mode 100644
index 000000000..d0d88b754
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-account-subdomains-builder-check.md
@@ -0,0 +1,14 @@
+1. **Must assigning a namespace exclude concurrent foreign attachments, or is the instance catch-all’s race behavior acceptable?**
+ A namespace claim and `x.<name>.<apps-domain>` occupy different bucket keys. Both requests can pass their checks before either writes; create-only writes do not prevent both succeeding. The catch-all design explicitly accepts this race, and §4.4 preserves its rule that the foreign exact claim wins. That conflicts with the promise that no other account can attach inside the namespace. The answer determines whether the plan needs coordinated writes across namespace assignment and existing attachment paths. See [the catch-all’s race policy](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/docs/superpowers/specs/2026-10-05-instance-catchall-design.md).
+
+2. **What should removal do with exact claims and real routes created inside the named namespace?**
+ §§4.2 and 4.4 permit same-account exact claims, but deleting the namespace claim does not delete those independent claims or their routes. They can keep serving, and §4.2 then prevents assigning the name to another account—contrary to “free again at once.” Should removal refuse until these are detached, remove them too, or preserve them and make reuse conditional? This changes the removal workflow, its destructive effects, and the reassignment guarantees. Ordinary aliases are derived independently in [ReconcileAliasesReport](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/domains/aliases.go:414).
+
+3. **Which reservation rules should namespace assignment override on deployments with `ReservePlatformDomains` enabled?**
+ §4.2 requires rejecting a name when `domainHostPolicy` returns `hostReserved`, but [reservedDomains](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/apidomains.go:153) reserves the entire apps domain in that configuration. Every candidate therefore fails, despite §4.3 making the feature available on every deployment. Namespace assignment needs an explicit exception policy: whether it bypasses the blanket apps-domain reservation, and how that interacts with operator deny entries. That determines both the admission checks and which deployments can use the feature.
+
+4. **Should the mirror include existing `Platform` routes that are not `Provisioned`, and deeper canary hosts?**
+ §4.4’s filter excludes platform URLs created by [mintedRoute](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/domains/reconcile.go:1139), which sets `Platform: true` but leaves `Provisioned` false. Those include the app URLs the design promises to mirror. “Every route under the sqid” also potentially includes canary names with multiple prefix labels, which one account wildcard certificate cannot cover. The answer changes the eligible route set, certificate requirements, and whether the console may safely advertise a named URL for every app.
+
+5. **If existing DNS cannot serve the new namespace, should assignment refuse, require operator setup, or provision DNS records?**
+ §4.7’s “no new records” assumption does not hold universally. An existing node beneath `harbour.<apps-domain>` can stop the outer wildcard covering its siblings; the repository already documents this failure in [the nearest-region design](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/docs/superpowers/specs/2026-10-01-nearest-region-default-design.md:974). Wildcard certificate issuance itself publishes `_acme-challenge.harbour.<apps-domain>`, creating such a node while validation runs. Deployments using per-account DNS records also need coverage for the new name. The answer determines whether DNS management and cleanup belong in this plan, or whether assignment needs a readiness gate and a narrower deployment contract.
\ No newline at end of file
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-account-subdomains.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-account-subdomains.md
new file mode 100644
index 000000000..fc5910f9c
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-account-subdomains.md
@@ -0,0 +1,9 @@
+You are a talented Go engineer who works on this repository (the CARLOS platform, a bucket-as-control-plane deployment platform). You've been handed a design document and asked to put together a plan to build what it describes. You will not be able to talk to the person who wrote it.
+
+Read docs/superpowers/specs/2026-11-11-account-subdomains-design.md. You may read any code in this repository to check its claims (start with internal/domains/claims.go, internal/domains/aliases.go, internal/console/domainpolicy.go, internal/console/apidomains.go, internal/edge/wildcard.go, and docs/superpowers/specs/2026-10-05-instance-catchall-design.md). Do not edit any file.
+
+Report only the questions you'd still need answered before you could plan this well: places where you'd have to guess and a wrong guess would matter, including places where the document's claims about the existing code are wrong. For each, give the question and why the answer changes the plan. Rank them by importance.
+
+Skip anything the document explicitly leaves to the builder (its section 7), and anything you could reasonably decide yourself. Skip nitpicks about wording.
+
+If nothing important is left, say "nothing important left".