carlos / platform Public

spec: account subdomain URL is canonical where set

Paul approved the design with one change: where an account has a
subdomain, every platform surface links to and reports the name URL.
The sqid URL keeps serving; CARLOS_HOST is unchanged (follow-up).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev cf7884abe8a152a2afea390e1c9e73d6838e16a8 parent ac8dd14
1 file changed, +60 −9
  • docs/superpowers/specs/2026-11-11-account-subdomains-design.md +60 −9

CI passed — run details

Intent

Human

Go ahead. I think where vanity subdomains are allowed ... they should be the _default_ rather than the sqid, so that's what e.g. links should link to and the console should answer as canonical for apps where they're set.

Attributed to this commit: 22.7 g CO₂e (2,443,872 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 47f5f1acb..15a0ded01 100644
--- a/docs/superpowers/specs/2026-11-11-account-subdomains-design.md
+++ b/docs/superpowers/specs/2026-11-11-account-subdomains-design.md
@@ -1,7 +1,7 @@
# Account subdomains: `<app>.<name>.<apps-domain>` beside `<app>.<sqid>.<apps-domain>`
**Date:** 2026-11-11
-**Status:** draft for Paul's approval, branch `design-account-name-hosts`.
+**Status:** approved by Paul 2026-11-11 (with the canonical-URL change in §2 and §4.8), branch `design-account-name-hosts`.
Astra builder check done (`CODEX-FINDINGS-account-subdomains-builder-check.md`;
all five questions answered in this revision).
@@ -39,8 +39,11 @@ under the name too, with no further step:
| `team1.bdq.apps.example.com` (an instance) | `team1.harbour.apps.example.com` |
| an app created next week, `blog.bdq...` | `blog.harbour...` the moment its route exists |
-Nothing about identity changes. The sqid stays in bucket paths, CLI flags,
-logs and the sqid URLs, which keep working.
+Once set, the name URL is the app's URL: every link the platform shows or
+sends points there, and the console and API give it as the app's URL
+(Paul, 2026-11-11: "they should be the default rather than the sqid"). The
+sqid URL keeps serving underneath. Nothing about identity changes: the
+sqid stays in bucket paths, CLI flags, logs and records.
## 3. Goals, non-goals, anti-goals
@@ -52,6 +55,8 @@ logs and the sqid URLs, which keep working.
account can attach anything under it.
- New apps and instances are covered automatically; nothing per app to
keep in sync.
+- Where an account has a subdomain, the name URL is canonical: the
+ platform links to it and reports it as the app's URL everywhere (§4.8).
**Non-goals**
@@ -63,8 +68,13 @@ logs and the sqid URLs, which keep working.
takes the account and the name, and does not care why it was granted).
- Replacing the sqid as identity anywhere (paths, flags, records,
manifests).
-- Redirecting the sqid URL to the name URL. Both serve; an app that wants
- one canonical host sets it itself.
+- Redirecting the sqid URL to the name URL. Both serve. The sqid URL may
+ already be pinned in webhooks, OAuth callbacks and bookmarks, and a
+ redirect would break POSTs to it. A redirect option can come later.
+- Changing `CARLOS_HOST` in the app's environment. It stays the route
+ host (the sqid host), because the activator and storage treat it as the
+ route's identity (`internal/activator/backend_exec.go`). Telling apps
+ their canonical host is a follow-up (§9).
- More than one subdomain per account.
**Anti-goals** (failure even if it works)
@@ -249,9 +259,33 @@ same as other aliases. The builder confirms both on each deployment type
### 4.8 Surfaces
-- `carlos accounts subdomain set|remove|show` (§4.3).
-- `carlos apps` and the console app page list the subdomain URL first
- when the account has one, the sqid URL second.
+- `carlos accounts subdomain set|remove|show` (§4.3). `set` waits until
+ one name host answers over TLS (the wildcard is usually issued within a
+ minute) and says so; if it is still issuing when the wait ends, it says
+ that instead of failing.
+
+**The name URL is canonical.** The console gets one function,
+`canonicalHost(host)`: for a host `<prefix>.<sqid>.<apps-domain>` of an
+account with a subdomain it returns `<prefix>.<name>.<apps-domain>`, and
+otherwise the host unchanged. Every place the platform shows, returns or
+sends an app's URL goes through it, so the rule lives in one place:
+
+- API responses that carry an app or instance URL (`url` and similar
+ fields). The CLI prints what the API returns, so `carlos apps`,
+ `carlos instances`, deploy and ship output follow without CLI changes
+ wherever the URL comes from the API. Any CLI path that builds a URL
+ itself is changed to ask the API or apply the same rule.
+- Console app, instance and account pages: the name URL is the link; the
+ sqid URL is shown second, labelled as the permanent address.
+- Emails and notifications that link to an app.
+- Agent-facing output (skills, `/start` demo text) where it names an app
+ URL.
+
+The builder inventories these call sites first (grep for where route
+hosts become `https://` links) and the plan lists them. A custom domain
+keeps whatever precedence it has today: the name URL replaces the sqid
+URL, never a custom domain. Removing the subdomain flips every surface
+back to the sqid URL on the next read.
- The account settings page shows the subdomain (read-only for members;
set and remove for operators).
- Refusals name the rule that refused (taken, reserved, sqid-shaped and
@@ -318,5 +352,22 @@ it ships in; there is no switch (§4.3).
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).
+- Both URLs serve; no redirect. The name URL is canonical on every
+ platform surface (Paul's decision), the sqid URL serves underneath
+ (my call, §3).
+- `CARLOS_HOST` stays the sqid host; apps learn their canonical host in
+ a follow-up (§9).
+- The name URL replaces the sqid URL but never outranks a custom domain
+ (§4.8).
- Every route under the sqid is mirrored, instances included (§4.4).
+
+## 9. Follow-ups (not in this spec)
+
+- **Telling apps their canonical host.** A new variable beside
+ `CARLOS_HOST` (say `CARLOS_PUBLIC_HOST`) carrying `canonicalHost`, so
+ an app that builds absolute links (emails, OAuth redirects) uses the
+ name. It changes the environment, so assigning a name would restart the
+ account's apps; that cost needs its own decision.
+- **Optional redirect** from the sqid URL to the name URL (GET/HEAD only),
+ per account.
+- **Paid self-serve names** on shared platforms (§3).