carlos / platform Public

plan+spec: account subdomains rev 2 after Astra round 1

Namespace enforcement moves from the boxes to the console doors (one
ownership predicate, unread keys count as held, re-read after assign).
Fixes the census, CLI parity, response shapes, fingerprint, infra
check and test selectors. Settings page is read-only this slice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 29e9de4a893732d9b200799a0abe6ce0f3623597 parent 3343b85
3 files changed, +348 −158
  • docs/superpowers/plans/2026-11-11-account-subdomains.md +189 −124
  • docs/superpowers/plans/CODEX-FINDINGS-account-subdomains-plan-R1.md +88 −0
  • docs/superpowers/specs/2026-11-11-account-subdomains-design.md +71 −34

Intent

Human

Ok, proceed.

Human

<task-notification> <task-id>bfe6vbhpo</task-id> <tool-use-id>toolu_01QjacdYgHmEFv1Gv3GDdMq2</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/709ac745-ee81-4971-97b8-321e18b19cf6/tasks/bfe6vbhpo.output</output-file> <status>completed</status> <summary>Background command "Run Astra round-1 review of the plan" completed (exit code 0)</summary> </task-notification>

diff --git a/docs/superpowers/plans/2026-11-11-account-subdomains.md b/docs/superpowers/plans/2026-11-11-account-subdomains.md
index 195276c59..df7d02d27 100644
--- a/docs/superpowers/plans/2026-11-11-account-subdomains.md
+++ b/docs/superpowers/plans/2026-11-11-account-subdomains.md
@@ -1,4 +1,4 @@
-# Account Subdomains Implementation Plan
+# Account Subdomains Implementation Plan (rev 2)
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
@@ -9,15 +9,21 @@ platform shows that URL as the app's URL.
**Architecture:** A namespace claim (`domains/*.<name>.<apps-domain>.json`,
`AccountNamespace: true`) is the only new record. Boxes derive alias rows
from it in `ReconcileAliasesReport` and publish held names to a small
-registry table the edge reads for wildcard parents. The console extends its
-namespace checks, adds one operator door, and routes every displayed app
-URL through `canonicalHost`.
+registry table (part of the registry fingerprint) that the edge reads for
+wildcard parents. The console owns namespace enforcement: one ownership
+predicate used by every door that mints a host under the apps domain, an
+operator-only door with a re-read after writing, and `canonicalHost` on
+every display site.
**Tech Stack:** Go, SQLite registry, bucket (`release.Store`), console
templates.
**Spec:** `docs/superpowers/specs/2026-11-11-account-subdomains-design.md`
-(approved 2026-11-11). Section numbers below (§4.2 and so on) are the spec's.
+rev 2 (approved 2026-11-11). Section numbers (§4.2 and so on) are the spec's.
+
+**Review history:** Astra round 1 on a3261cd4, NOT READY (9 P1, 6 P2),
+findings in `CODEX-FINDINGS-account-subdomains-plan-R1.md`; resolutions at
+the end of this plan. This is round 2 of 3.
## Global Constraints
@@ -27,33 +33,36 @@ templates.
- Every user-facing string goes through copy review (Task 1) before it is
written into a file. No em dashes in copy. Console pages get the UX pass
(AGENTS.md) in the same review.
-- Tests run locally are targeted: `go test ./<pkg> -run <Name>`. No full
+- Tests run locally are targeted: `go test ./<pkg> -run '<Regex>'`. No full
suites, no `-race` sweeps locally; CI on amadan runs the rest.
- `GOCACHE` stays at its default.
- Commit subjects under 80 characters; body after a blank line.
-- `CARLOS_HOST` and `apexHost(sqid, app)` are identity and do not change.
- Only display sites use `canonicalHost`.
+- Identity never changes: `CARLOS_HOST`, `apexHost(sqid, app)`, probe
+ targets (`watchOrigin`, `importVerifyTarget`), instance detail paths,
+ logs, restart/update form actions and `mailPushURL` keep the sqid host.
+ Only display sites use `canonicalHost` / `public_host`.
- Name rules (§4.2), copied exactly: label shape
`^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$`; refuse hyphens at positions 3
and 4; refuse `domains.ValidSqid(name) && len(name) < 7`; refuse
`domains.IsReservedSqid(name)`.
+- Census digests are reviewed, never blessed: a changed digest means
+ reading the source it pins.
## Review Focus
1. **Name set on an account with no routes yet.** Nothing is derived and no
wildcard is ordered; the first app created afterwards answers under the
name with no further step. (Task 3 test.)
-2. **HA app in the account.** The name must reach the HA ingress map like
- an exact claim does, or HA apps silently miss the name. (Task 3 test.)
-3. **Operator types `Harbour ` or `harbour.apps.test`.** Trim and lowercase;
- anything that is not then a bare label is refused with the shape reason.
- (Task 2 test.)
+2. **HA app in the account.** The name reaches the HA ingress map like an
+ exact claim does. (Task 3 test.)
+3. **Operator types `Harbour ` or `harbour.apps.test`.** Trim and
+ lowercase; anything that is not then a bare label is refused with the
+ shape reason. (Task 2 test.)
4. **Box without `PLATFORM_APPS_DOMAIN`.** The namespace pass derives
nothing and does not fail the alias pass. (Task 3 test.)
5. **Subdomain removed.** Console pages and API answers flip back to the
- sqid host on the next read after the claim cache refreshes, never show
- a name that no longer serves for longer than one cache interval.
- (Task 6 test.)
+ sqid host on the next read: the door resets the claim cache, which has
+ no TTL, so nothing else refreshes it. (Task 6 test.)
---
@@ -65,21 +74,27 @@ templates.
- [ ] **Step 1: Draft every string** the later tasks need, each with an ID:
- CLI: `set` success, `set` still-issuing note, `remove` success, `show`
- with and without a name, usage line.
+ with a name (name, host, foreign names under it) and without, usage
+ lines for `subdomain`, `set`, `remove`, `show`.
- Refusals (one each): bad shape; sqid-shaped and shorter than 7;
- reserved label; held by another account (names nothing about that
- account); infrastructure name; something already lives there (lists
- hosts); account already has a subdomain; remove refused while
- hand-attached names remain (lists them); not a platform operator.
- - Console: account settings row label and its two states; app page
- label for the sqid URL ("permanent address" wording).
+ reserved label; held by another account (names nothing about it);
+ infrastructure name; something already lives there (lists hosts);
+ account already has a subdomain; a claim could not be read (try
+ again); set rolled back after the re-read (lists what it found);
+ remove refused while hand-attached names remain (lists them); not a
+ platform operator; host claims are on.
+ - Attach refusal for a host under another account's subdomain (domain
+ attach, first-route attach, instance create).
+ - Console: account settings row label and its two states (read-only);
+ app/instance page label for the sqid URL ("permanent address" wording);
+ the canary success message (`server.go` ~:6597) if its wording changes.
- [ ] **Step 2: UX pass** on the account settings row and the app/instance
pages showing two URLs (dashboardy, state first, little reading).
-- [ ] **Step 3: Run copy review** (copy-review skill) and wait for Paul's
- edits; apply them verbatim to the record with `approved_by`/`approved_on`.
-- [ ] **Step 4: Commit** the record.
-
-Later tasks use only approved strings by ID.
+- [ ] **Step 3: Run copy review** (copy-review skill), wait for Paul's
+ edits, apply them verbatim to the record with `approved_by`/`approved_on`.
+- [ ] **Step 4: Commit** the record. Later tasks use only approved strings
+ by ID, and Task 6 adds `approved_account_subdomains_copy_test.go`
+ (pattern: `approved_copy_test.go`, `checkApprovedCopy`).
### Task 2: The namespace claim in `internal/domains`
@@ -87,153 +102,180 @@ Later tasks use only approved strings by ID.
- Modify: `internal/domains/claims.go` (Claim field, attach/detach)
- Create: `internal/domains/namespace.go`
- Test: `internal/domains/namespace_test.go`
-- Modify: `internal/provision/plan9_b8_census_test.go`,
- `internal/provision/regional_domains_447_census_test.go` (new writers)
+- Create: `internal/provision/account_subdomains_census_test.go` (a census
+ overlay chained after `regional_domains_447_census_test.go`, adding each
+ new writer ONCE; follow how that file re-pins and appends)
+- Modify: `internal/host/group_names_test.go` (name-producer inventory:
+ the `Claim` field list ~:259 and producer bodies ~:238)
+- Create: `docs/superpowers/notes/census-proposal-account-subdomains.md`
+ if `TestPlan14RootReadCensus` reports changed envelopes
**Interfaces:**
- Produces:
- `Claim.AccountNamespace bool` with tag `json:"account_namespace,omitempty"`.
- `func NamespaceHost(name, appsDomain string) string` → `"*." + name + "." + appsDomain`.
+ - `func ParseNamespaceKey(key, appsDomain string) (name string, ok bool)`
+ (inverse of `ClaimKey(NamespaceHost(...))`; used to treat unread keys
+ as held).
- `func NormalizeSubdomain(raw string) (string, bool)` (trim, lowercase, shape).
- - `type SubdomainRefusal string` with constants `SubdomainShape`,
+ - `type SubdomainRefusal string`, constants `SubdomainShape`,
`SubdomainSqidShaped`, `SubdomainReserved` (used here) and
- `SubdomainHeld`, `SubdomainInfrastructure`, `SubdomainOccupied`,
- `SubdomainAccountHasOne` (used by Task 5).
- - `func SubdomainRuleRefusal(name string) SubdomainRefusal` ("" when allowed; §4.2 rules that need no store: shape, `xn--`, sqid-shaped under 7, reserved).
+ `SubdomainHeld`, `SubdomainUnreadable`, `SubdomainInfrastructure`,
+ `SubdomainOccupied`, `SubdomainAccountHasOne`, `SubdomainRolledBack`
+ (used by Tasks 5-6).
+ - `func SubdomainRuleRefusal(name string) SubdomainRefusal` ("" when
+ allowed; the rules that need no store).
- `func AttachAccountNamespace(ctx, s release.Store, name, appsDomain, account, createdAt, createdBy string) (created bool, err error)`.
- `func DetachAccountNamespaceAt(ctx, s release.Store, name, appsDomain, account, etag string) (bool, error)`.
- - `func AccountNamespaces(claims []Claim, appsDomain string) (byName map[string]string, byAccount map[string]string)` — name→sqid and sqid→name from claims with `AccountNamespace` set, not pending, shape-valid.
+ - `func AccountNamespaces(claims []Claim, appsDomain string) (byName, byAccount map[string]string)`
+ from claims with `AccountNamespace` set, not pending, shape-valid.
- [ ] **Step 1: Write failing tests** in `namespace_test.go`:
- - `TestSubdomainRuleRefusal`: table — `harbour` "", `market` → `SubdomainSqidShaped`, `marketx` "" (7 letters), `dev`/`edge`/`www` → `SubdomainReserved`, `ab--x` and `xn--a` → `SubdomainShape`, `-a` → `SubdomainShape`, `shop2` "".
+ - `TestSubdomainRuleRefusal`: `harbour` "", `market` → `SubdomainSqidShaped`, `marketx` "", `dev`/`edge`/`www` → `SubdomainReserved`, `ab--x` and `xn--a` → `SubdomainShape`, `-a` → `SubdomainShape`, `shop2` "".
- `TestNormalizeSubdomain`: `" Harbour "` → `("harbour", true)`; `"harbour.apps.test"` → `("", false)`.
- - `TestAttachAccountNamespaceIsCreateOnly`: two attaches of `harbour` by `bdq` then `bcd` on `release.NewDirStore(t.TempDir())`: first `created=true`, second `created=false, err=nil`, `GetClaim` still says `bdq`; body has `Host "*.harbour.apps.test"`, `AccountNamespace true`, empty `App`, `Route`.
- - `TestDetachAccountNamespaceNeedsEtagAndAccount`: wrong account → false; stale etag → false; right → true and claim gone.
- - `TestAccountNamespacesSkipsPendingAndOtherKinds`: an instance catch-all on another parent and a pending namespace claim are not in either map.
- - `TestOldBinaryShapeDerivesNothing`: decode a namespace claim into a struct copy without the field (or assert `Route==""`, `!Instances`, `!Wildcard`) — documents §4.1's additive rule.
-- [ ] **Step 2: Run** `go test ./internal/domains -run 'Subdomain|AccountNamespace|OldBinaryShape'` — expect FAIL (undefined).
-- [ ] **Step 3: Implement.** Model the attach on `claimRawAttachInstanceCatchall` (`claims.go:448`): `getClaimETag`, `s.Put(ctx, ClaimKey(host), body, "")`, no retry needed beyond its CAS handling. Detach models `claimRawDetachClaimAt` (`claims.go:840`) with `release.DeleteIfMatch`. Exported wrappers call `release.WithAppMutation(ctx, s, account, "", "domains.AttachAccountNamespace", …)`; confirm the console's `RunAppMutation` accepts an empty app (add a test if it branches on it).
-- [ ] **Step 4: Add the two new `claimRaw*` writers to both census inventories** with their digests (the census tests fail and print the digest; review the source before pinning it).
-- [ ] **Step 5: Run** the Step 2 command plus `go test ./internal/provision -run 'Census'` — expect PASS.
-- [ ] **Step 6: Commit** `domains: account namespace claim (#subdomains T2)`.
+ - `TestAttachAccountNamespaceIsCreateOnly`: attach `harbour` by `bdq` then by `bcd` on `release.NewDirStore(t.TempDir())`: first `created=true`, second `created=false, err=nil`, `GetClaim` still `bdq`; body `Host "*.harbour.apps.test"`, `AccountNamespace true`, empty `App` and `Route`.
+ - `TestDetachAccountNamespaceNeedsEtagAndAccount`: wrong account → false; stale etag → false; right → true, claim gone.
+ - `TestAccountNamespacesSkipsPendingAndOtherKinds`: an instance catch-all and a pending namespace claim are in neither map.
+ - `TestParseNamespaceKey`: round-trips `ClaimKey(NamespaceHost("harbour","apps.test"))`; an instance catch-all key on a two-label parent and an ordinary claim key → not ok.
+- [ ] **Step 2: Run** `go test ./internal/domains -run 'Subdomain|AccountNamespace|ParseNamespaceKey'` — FAIL (undefined).
+- [ ] **Step 3: Implement.** Attach models `claimRawAttachInstanceCatchall` (`claims.go:448`): `getClaimETag`, then `s.Put(ctx, ClaimKey(host), body, "")`. Detach models `claimRawDetachClaimAt` (`claims.go:840`) with `release.DeleteIfMatch`. **Do not wrap in `release.WithAppMutation`**: the record is account-level, the host-claim mutation boundary refuses an empty app (`hostops/app_mutation_runner.go:58`, `mutation_classifier.go:118`), and the console door refuses while host claims are on (Task 6). Say so in a comment on the exported functions.
+- [ ] **Step 4: Censuses.** Run `go test ./internal/provision -run 'TestPlan9B8RecordWriteCensus|TestPlan14RootReadCensus'` and `go test ./internal/host -run 'TestGroupNameClassCensus|TestGroupNameProducerCensusScope'`. Add the two writers once in the new overlay, update the name-producer inventory for the new `Claim` field, and if the root-read census reports changed envelopes write the census proposal note. The reviewer for Task 2 rules on it (not Paul).
+- [ ] **Step 5: Run** Steps 2 and 4 — PASS.
+- [ ] **Step 6: Commit** `domains: account namespace claim (subdomains T2)`.
### Task 3: Boxes derive the names
**Files:**
-- Modify: `internal/domains/aliases.go` (`AliasReport`, `ReconcileAliasesReport`)
-- Create: `internal/domains/namespacealiases.go` (`deriveNamespaceAliases`)
-- Modify: `internal/registry/registry.go` (new table `account_namespaces`)
-- Modify: `internal/host/agent.go` (`aliasPassReportingComplete` ~:1480: set `AliasReport.AppsDomain` from `PLATFORM_APPS_DOMAIN`, the same source as `domainsTickConfig` ~:3835)
-- Test: `internal/domains/namespacealiases_test.go`, `internal/registry/registry_test.go`
+- Modify: `internal/domains/aliases.go` (`AliasReport` input, `ReconcileAliasesReport`)
+- Create: `internal/domains/namespacealiases.go`
+- Modify: `internal/registry/registry.go` (table `account_namespaces`, `Fingerprint` ~:3977)
+- Modify: `internal/host/agent.go` (`aliasPassReportingComplete` ~:1480: set `AliasReport.AppsDomain` from the same source `domainsTickConfig` uses ~:3835)
+- Test: `internal/domains/namespacealiases_test.go`, `internal/registry/registry_test.go`, `internal/edge/storedoor_test.go`
**Interfaces:**
-- Consumes: Task 2's `AccountNamespaces`, `NamespaceHost`.
+- Consumes: Task 2's `AccountNamespaces`, `ParseNamespaceKey`.
- Produces:
- `AliasReport.AppsDomain string` (input).
- - registry: table `account_namespaces(name TEXT PRIMARY KEY, account TEXT NOT NULL)`, `func (r *Registry) SetAccountNamespaces(m map[string]string) error` (replace whole set), `func (r *Registry) ListAccountNamespaces() (map[string]string, error)`. Follow the `wildcard_domains` pattern (`registry.go:837-861`).
- - `func deriveNamespaceAliases(held map[string]string, appsDomain string, routes []registry.Route, byHost map[string]registry.Route, deploymentRoutes map[string]bool, exact map[string]bool, desired map[string]bool, reg *registry.Registry, now func() time.Time, rep *AliasReport) (incomplete bool)`.
-
-Rules (§4.4), in this order:
-1. Before the claim loop (~:455) build `held` (name→sqid) from the listed claims. In the loop, before `deriveHAIngressAliases` (~:499), skip any claim whose host is `<x>.<name>.<apps>` or `<name>.<apps>` for a held name with a different `Account`; log once per claim (reuse the `sayInstanceCatchallOnce` pattern).
-2. After `deriveInstanceAliases` (~:782-789) and before the removal sweep (~:790), call `deriveNamespaceAliases`. Eligible route: `(rt.Provisioned || rt.Platform) && !rt.IsSidecar() && !rt.Replica && release.RouteAccount(rt) == sqid` and host ends `"." + sqid + "." + appsDomain` with a non-empty prefix. Derived name: prefix + `"." + name + "." + appsDomain`.
-3. Skip a derived name that has an exact claim (listed, any holder), a local route, or a deployment route.
-4. For each HA route in `rep.HAIngressRoutes` of the account under the sqid, add `rep.AliasIngress[derived] = rt` unless the name is taken (same checks as `deriveHAIngressAliases`'s `add`).
-5. Cap: share `maxInstanceAliases` by counting into the same budget (return the count from `deriveInstanceAliases` or pass a pointer); overflow logged.
-6. `reg.SetAccountNamespaces(held)` once per pass; on a listing failure keep existing rows and the existing table (return incomplete).
+ - registry table `account_namespaces(name TEXT PRIMARY KEY, account TEXT NOT NULL)` following `wildcard_domains` (`registry.go:837-861`); `func (r *Registry) SetAccountNamespaces(m map[string]string) error` (replace whole set), `func (r *Registry) ListAccountNamespaces() (map[string]string, error)` (name → sqid). Its contents are part of `Registry.Fingerprint`, so a change reloads the edge.
+ - `func deriveNamespaceAliases(held map[string]string, appsDomain string, routes []registry.Route, byHost map[string]registry.Route, listed map[string]bool, deploymentRoutes map[string]bool, desired map[string]bool, budget *int, reg *registry.Registry, now func() time.Time, rep *AliasReport) (incomplete bool)`.
+
+Rules (§4.4):
+1. After `deriveInstanceAliases` (~:782-789), before the removal sweep (~:790). Eligible route: `(rt.Provisioned || rt.Platform) && !rt.IsSidecar() && !rt.Replica && release.RouteAccount(rt) == sqid`, host ends `"." + sqid + "." + appsDomain`, non-empty prefix. Derived name: prefix + `"." + name + "." + appsDomain`.
+2. Skip a derived name that has an exact claim key in `listed` (any holder), a local route, or a deployment route.
+3. HA: for each HA route in `rep.HAIngressRoutes` that is eligible, set `rep.AliasIngress[derived] = rt` unless taken (the checks in `deriveHAIngressAliases`'s `add`, `aliases.go:1045`).
+4. Cap: one budget of `maxInstanceAliases` shared with `deriveInstanceAliases` (change it to take and decrement `*int`); overflow logged once.
+5. Unread namespace bodies: a listed key that `ParseNamespaceKey` accepts but whose claim is not in `claims` (dropped/unread) keeps that name's existing alias rows (mark them desired) and its existing `account_namespaces` row; the pass returns incomplete.
+6. `SetAccountNamespaces` once per pass with `held` plus the kept unread rows.
7. Empty `appsDomain`: derive nothing, write nothing, not incomplete.
-- [ ] **Step 1: Write failing tests** (helpers from `instancecatchall_test.go` and `aliases_test.go`: `aliasRegWith`, `putClaim`, `addInstance`, `aliasMap`, `reconcile`):
- - `TestNamespaceDerivesEveryAccountRoute`: routes `shop.bdq.apps.test` (Provisioned), `site.bdq.apps.test` (Platform only), `team1.bdq.apps.test` (instance) → aliases `shop/site/team1.harbour.apps.test` pointing at their sqid hosts.
- - `TestNamespaceSkipsOtherAccountsSidecarsReplicas`: route `x.bcd.apps.test`, a sidecar and a replica row under `bdq` → no alias.
- - `TestNamespaceExactClaimAndRoutesWin`: exact claim `shop.harbour.apps.test` by `bdq` on another app → that claim's row, not the derived one; a real route at a derived name → no alias.
- - `TestForeignClaimUnderHeldNameIsInert`: claim `x.harbour.apps.test` by `bcd` with a Route → no alias row, no HA ingress entry, no wildcard row, no path rows.
+- [ ] **Step 1: Write failing tests.** Add a helper in the test file, `reconcileNS(t *testing.T, s release.Store, reg *registry.Registry, appsDomain string) *AliasReport`, that calls `ReconcileAliasesReport` with a report carrying `AppsDomain` (the existing `reconcile` helper passes no report). For read failures, wrap the store and fail the method the claim cache actually calls (`ListMod` when the store has it, then the per-key `Get`), not only `List`.
+ - `TestNamespaceDerivesEveryAccountRoute`: `shop.bdq.apps.test` (Provisioned), `site.bdq.apps.test` (Platform only), `team1.bdq.apps.test` (instance) → `shop/site/team1.harbour.apps.test` aliases to their sqid hosts.
+ - `TestNamespaceSkipsOtherAccountsSidecarsReplicas`.
+ - `TestNamespaceExactClaimAndRoutesWin`.
- `TestNamespaceNoRoutesThenFirstRoute` (Review Focus 1).
- - `TestNamespaceHAIngress` (Review Focus 2): HA route `shop.bdq.apps.test` in `rep.HAIngressRoutes` → `rep.AliasIngress["shop.harbour.apps.test"]` set.
+ - `TestNamespaceHAIngress` (Review Focus 2).
- `TestNamespaceWithoutAppsDomain` (Review Focus 4).
- - `TestNamespaceRemovedDropsRows`: delete claim, reconcile → rows gone, `ListAccountNamespaces` empty.
- - `TestNamespaceKeepsRowsWhenListingFails` (use `listFailStore`).
+ - `TestNamespaceRemovedDropsRows`: rows and table row gone.
+ - `TestNamespaceKeepsRowsWhenListingFails`.
+ - `TestNamespaceKeepsRowsWhenClaimBodyUnread`: listing has the key, `Get` fails → rows and table row kept, report incomplete.
+ - `TestNamespaceSharesInstanceCap`: instance aliases plus namespace aliases never exceed `maxInstanceAliases` (set via a test hook).
- `TestCanaryHostIsMirrored`: `c1.shop.bdq.apps.test` → `c1.shop.harbour.apps.test`.
- - registry: `TestAccountNamespacesRoundTrip` (set, list, replace with smaller set).
-- [ ] **Step 2: Run** `go test ./internal/domains -run 'Namespace|ForeignClaimUnderHeld|CanaryHostIsMirrored'` and `go test ./internal/registry -run AccountNamespaces` — expect FAIL.
-- [ ] **Step 3: Implement** as specified above.
-- [ ] **Step 4: Run** the Step 2 commands plus `go test ./internal/domains -run 'InstanceCatchall|Alias'` — expect PASS (existing catch-all and alias tests unchanged).
+ - registry: `TestAccountNamespacesRoundTrip`, `TestAccountNamespacesChangeFingerprint`.
+ - storedoor: `TestStoreDoorReturnsOwnNamespaceClaim`: through the fleet store door, account `bdq`'s fleet reads `domains/*.harbour.<apps>.json` held by `bdq`; `bcd`'s fleet does not get its body.
+- [ ] **Step 2: Run** `go test ./internal/domains -run 'Namespace|CanaryHostIsMirrored'`, `go test ./internal/registry -run 'AccountNamespaces'`, `go test ./internal/edge -run 'StoreDoorReturnsOwnNamespaceClaim'` — FAIL.
+- [ ] **Step 3: Implement.**
+- [ ] **Step 4: Run** Step 2 plus `go test ./internal/domains -run 'InstanceCatchall|Alias'` — PASS.
- [ ] **Step 5: Commit** `domains: boxes derive account subdomain aliases (T3)`.
### Task 4: Edge wildcard parents for names
**Files:**
-- Modify: `internal/edge/wildcard.go` (`parentsFor`, `refresh`), `internal/edge/edge.go` (wire the reader beside `ListWildcardDomains` ~:939)
-- Test: `internal/edge/wildcard_parents_test.go`
+- Modify: `internal/edge/wildcard.go` (`parentsFor` :203, `refresh` :276, the registry reader beside `ListWildcardDomains` :939)
+- Test: `internal/edge/wildcard_parents_test.go`, `internal/edge/wildcard_test.go`
**Interfaces:**
-- Consumes: Task 3's `Registry.ListAccountNamespaces`.
-- Produces: `func parentsFor(staticAndDelegated []string, appsDomain string, hosts []string, names map[string]string) []string`, where `names` maps sqid → name.
+- Consumes: Task 3's `Registry.ListAccountNamespaces` (name → sqid) and its fingerprint.
+- Produces: `func parentsFor(staticAndDelegated []string, appsDomain string, hosts []string, names map[string]string) []string`, `names` keyed sqid → name (invert at the call site).
-`hosts` comes from `deploymentHosts`, which excludes attached aliases, so the derived hosts are not in it. Name parents therefore come from the sqid hosts: for each host `<app>.<sqid>.<apps>` that yields a sqid parent, also add `<name>.<apps>` when `names[sqid]` is set. Invert `ListAccountNamespaces` (name → sqid) at the call site.
+`hosts` comes from `deploymentHosts`, which excludes attached aliases, so derived hosts are not in it. Name parents come from sqid hosts: for each host `<app>.<sqid>.<apps>` that yields a sqid parent, also add `<name>.<apps>` when `names[sqid]` is set. Read failures keep the last good names, as the delegated reader does.
-- [ ] **Step 1: Write failing tests** in `wildcard_parents_test.go`:
+- [ ] **Step 1: Write failing tests:**
- `TestParentsForAddsHeldName`: hosts `shop.bdq.apps.test`, names `{bdq: harbour}` → parents include `bdq.apps.test` and `harbour.apps.test`.
- - `TestParentsForNoNameNoExtraParent`: names empty → only `bdq.apps.test`.
- - `TestParentsForNameWithoutRoutes`: names `{bdq: harbour}`, no `bdq` hosts → no `harbour` parent (no certificate for an empty namespace).
- - `TestRefreshKeepsLastGoodNamesOnReadError` (mirror the delegated last-good test).
-- [ ] **Step 2: Run** `go test ./internal/edge -run 'ParentsFor|RefreshKeepsLastGoodNames'` — FAIL.
+ - `TestParentsForNoNameNoExtraParent`.
+ - `TestParentsForNameWithoutRoutes`: no `bdq` hosts → no `harbour` parent.
+ - `TestRefreshKeepsLastGoodNamesOnReadError`.
+ - `TestNamespaceChangeRefreshesParentsOnRemoteOnlyEdge`: an edge whose only `bdq` route is remote (home map host) gets the `harbour` parent after `SetAccountNamespaces` and reload, and drops it after removal.
+- [ ] **Step 2: Run** `go test ./internal/edge -run 'ParentsFor|RefreshKeepsLastGoodNames|NamespaceChangeRefreshesParents'` — FAIL.
- [ ] **Step 3: Implement**; update every `parentsFor` caller and test call.
- [ ] **Step 4: Run** Step 2 plus `go test ./internal/edge -run 'Wildcard'` — PASS.
- [ ] **Step 5: Commit** `edge: wildcard certificate for account subdomains (T4)`.
-### Task 5: Console namespace policy
+### Task 5: Console namespace enforcement
**Files:**
- Create: `internal/console/subdomains.go`
-- Modify: `internal/console/domainpolicy.go` (`appsNamespace`, `otherAccountsNamespace`, `domainProofExempt`, `firstRouteOutsideNamespace`)
-- Test: `internal/console/subdomains_test.go`, extend `domainproof_test.go`
+- Modify: `internal/console/domainpolicy.go` (`appsNamespace`, `otherAccountsNamespace`, `domainProofExempt`, `firstRouteOutsideNamespace`), and every host-minting door found in Step 1
+- Test: `internal/console/subdomains_test.go`, `internal/console/domainproof_test.go`
**Interfaces:**
-- Consumes: Task 2's `AccountNamespaces`, `SubdomainRuleRefusal`, `NormalizeSubdomain`.
+- Consumes: Task 2's `AccountNamespaces`, `ParseNamespaceKey`, `SubdomainRuleRefusal`.
- Produces:
- - `func (s *Server) accountSubdomains(ctx context.Context) (byName, byAccount map[string]string, err error)` from `s.claims.List(ctx, s.cfg.Releases)`.
- - `appsNamespace(host)` returns the sqid for a held name label too. On a list error it returns the label unchanged when sqid-shaped and "" otherwise; callers that refuse on lookup failure keep doing so (`otherAccountsNamespace` refuses a non-sqid label under the apps domain when the list failed).
- - `func (s *Server) subdomainRefusal(ctx context.Context, account, name string) (reason domains.SubdomainRefusal, conflicts []string)` adding the store rules: `SubdomainHeld` (any account sqid via `AccountAnyBySqid`, or another namespace claim), `SubdomainInfrastructure` (`domainHostPolicy` says `hostReserved` for `<name>.<apps>` or `probe.<name>.<apps>`, evaluated with `reservedDomains(true)`/`platformDomains(true)` so the blanket apps-domain entry is skipped and every other entry kept), `SubdomainOccupied` with `conflicts` = hosts of other accounts' claims and any deployment routes at or under `<name>.<apps>`, `SubdomainAccountHasOne`.
-
-- [ ] **Step 1: Write failing tests** (use `attachFixture` for store-backed cases, `platformFixture` for policy):
- - `TestSubdomainRefusalRules`: table over every reason above plus allowed `harbour`.
- - `TestSubdomainRefusalWithReservePlatformDomains`: `ReservePlatformDomains: true` → `harbour` allowed; `edge` refused; a `DenyDomains` entry `harbour.oncarlos.com` → `SubdomainInfrastructure`.
+ - `func (s *Server) namespaceOwner(ctx context.Context, label string) (owner string, held bool, err error)`: sqid label → the sqid; a held name → its account; a listed-but-unread namespace key → `held=true, owner=""`; read error → `err`. Reads `s.claims.ListWithUnread`.
+ - `appsNamespace` / `otherAccountsNamespace` use it. `otherAccountsNamespace` returns true (refuse) when `err != nil`, when `held && owner == ""`, or when `held && owner != account`.
+ - `func (s *Server) subdomainInfrastructure(name string) bool`: true when `<name>.<apps>` or `probe.<name>.<apps>` is denied by `reservedDomains` with only the synthetic apps-domain entry removed (not `denyEntries(…, true)`), or by `platformDomains(false)` (operator deny entries give `hostPlatform`).
+ - `func (s *Server) subdomainRefusal(ctx context.Context, account, name string) (domains.SubdomainRefusal, []string)` covering every §4.2 rule: `SubdomainRuleRefusal`; `SubdomainHeld` (`AccountAnyBySqid(name)`, or another account's namespace claim); `SubdomainUnreadable`; `SubdomainInfrastructure`; `SubdomainOccupied` with the hosts of other accounts' claims and any deployment routes at or under `<name>.<apps>`; `SubdomainAccountHasOne`.
+
+- [ ] **Step 1: List the doors.** From the callers of `appsNamespace`, `otherAccountsNamespace`, `firstRouteOutsideNamespace` and `domainHostPolicy`, plus `handleAPIInstanceCreate` and the route-create doors, list every door that can put a host under the apps domain. Write the list into the commit body. Each must refuse a host under another account's subdomain.
+- [ ] **Step 2: Write failing tests** (use `attachFixture` for store-backed cases, `platformFixture` for policy):
+ - `TestSubdomainRefusalRules`: one row per reason plus allowed `harbour`.
+ - `TestSubdomainInfrastructure`: steering host label `edge` → true; `ReservePlatformDomains: true` alone → `harbour` false; a `DenyDomains` entry `harbour.oncarlos.com` → true; a `DenyDomains` entry naming the apps domain itself → true for every name (operator chose to deny it).
- `TestOtherAccountsNamespaceCoversHeldName`: `bdq` holds `harbour`; attach of `x.harbour.oncarlos.com` by another account → `hostReserved`; by `bdq` → allowed and proof-exempt.
- - `TestRemovedNameStopsProtecting`: detach, reset cache → other account's attach is no longer refused by the namespace rule.
- - `TestFirstRouteUnderHeldName`: a first-route attach of `blog.harbour.oncarlos.com` by another account → refused; by `bdq` → allowed.
-- [ ] **Step 2: Run** `go test ./internal/console -run 'SubdomainRefusal|OtherAccountsNamespaceCoversHeldName|RemovedNameStopsProtecting|FirstRouteUnderHeldName|AppsDomainNamespaces|DomainHostPolicyMatrix'` — new ones FAIL.
-- [ ] **Step 3: Implement.**
-- [ ] **Step 4: Run** Step 2 — all PASS (existing matrix and namespace tests unchanged).
-- [ ] **Step 5: Commit** `console: account subdomains are the account's namespace (T5)`.
+ - `TestUnreadNamespaceRefusesEveryone`: the key is listed, its body fails to read → attach under `marketx` refused for `bdq` and for others; assignment of `marketx` → `SubdomainUnreadable`.
+ - `TestRemovedNameStopsProtecting`.
+ - `TestFirstRouteUnderHeldName`.
+ - `TestInstanceCreateUnderHeldName`: instance host under another account's name refused.
+- [ ] **Step 3: Run** `go test ./internal/console -run 'SubdomainRefusalRules|SubdomainInfrastructure|OtherAccountsNamespaceCoversHeldName|UnreadNamespaceRefusesEveryone|RemovedNameStopsProtecting|FirstRouteUnderHeldName|InstanceCreateUnderHeldName|AppsDomainNamespaces|DeletedAccountsNamespace|DomainHostPolicyMatrix'` — new ones FAIL.
+- [ ] **Step 4: Implement.**
+- [ ] **Step 5: Run** Step 3 — all PASS.
+- [ ] **Step 6: Commit** `console: account subdomains are the account's namespace (T5)`.
### Task 6: Console door and canonical URLs
**Files:**
-- Create: `internal/console/apisubdomain.go`
+- Create: `internal/console/apisubdomain.go`, `internal/console/canonical.go`
- Modify: `internal/console/routedecls.go` (three entries beside `POST /api/cli/accounts/{account}/plan` ~:982, `Kind: kindCLI, Allow: svcrole.Set{}`)
-- Modify: route fixtures: `internal/console/testdata/claim-routes.txt`, `claim_invariant_fixtures_test.go`, `claim_invariant_probes_{read,nonapp}_test.go`, `svcroutes_test.go`
-- Create: `internal/console/canonical.go`
-- Modify display sites: `server.go` ~:6860 (`appRow.URL`), `ladder.go` :154/:252, `flow.go` :203, `instancepage.go` :293-314, `apilinks.go` :126, `homelink.go` :152, `demo_claim_page.go` :179, `demo_claim_auth.go` :502, `demo_claim_status_page.go` :42, `templates/account_settings.html` (Identity table), `app_instance.html`, `app_overview.html`
-- Modify API answers the CLI prints: add `PublicHost string json:"public_host,omitempty"` beside `Host` at `apiinstances.go` ~:1575, `apiroutes.go` ~:53, `apistatusinstances.go` ~:74
+- Modify route fixtures: `internal/console/testdata/claim-routes.txt`, `claim_invariant_fixtures_test.go`, `claim_invariant_probes_{read,nonapp}_test.go`, `svcroutes_test.go`
+- Modify display sites (each through `canonicalHost`): `server.go` ~:6860 (`appRow.URL`) and ~:6597 (canary success message), `ladder.go` :154/:252, `flow.go` :203, `instancepage.go` :293-314, `templates/app_instances.html` :85 and its handler, `app_instance.html`, `app_overview.html`, `apilinks.go` :126 (`linkPublicationURL`), `homelink.go` :152, `demo_claim_page.go` :179, `demo_claim_auth.go` :502, `demo_claim_status_page.go` :42, `templates/account_settings.html` (read-only Identity row)
+- Modify API answers: add `PublicHost string json:"public_host,omitempty"` to `instanceListRecord` (`apiinstances.go` ~:181), `instanceGetRecord`, `apiRecordView` (~:1430) and the route answer at `apiroutes.go` ~:53. Not the create request at ~:1575.
+- Create: `internal/console/approved_account_subdomains_copy_test.go`
- Test: `internal/console/apisubdomain_test.go`, `internal/console/canonical_test.go`
**Interfaces:**
-- Consumes: Task 2 attach/detach, Task 5 `subdomainRefusal`, `accountSubdomains`.
+- Consumes: Task 2 attach/detach, Task 5 `subdomainRefusal`, `namespaceOwner`.
- Produces:
- - Doors `GET|POST|DELETE /api/cli/accounts/{account}/subdomain`. Gate: `cliUser` (person), then `platformOperator(addr)` (not `store.IsOperator`), then `AccountBySqid`, 404 otherwise, like `accountPlanDoor` (`apiaccountplan.go:45`). POST body `{"name": "..."}`; answers `{"name": "...", "host": "*.harbour.<apps>", "foreign": [...]}`. After a successful write, re-list claims under the name and return any foreign ones in `foreign` (§4.2 race). DELETE refuses with `conflicts` while the account holds exact claims or routes under the name (§4.3). `s.claims.Reset()` after either write.
- - `func (s *Server) canonicalHost(ctx context.Context, host string) string` (§4.8 rule; unchanged host on any error).
- - `mailPushURL` (`mailpush.go:648`) and probe URLs stay on the identity host.
+ - `GET|POST|DELETE /api/cli/accounts/{account}/subdomain`. Gate: `cliUser` (person), `platformOperator(addr)` (not `store.IsOperator`), then the account: `AccountBySqid` for POST, `AccountAnyBySqid` for GET and DELETE (tombstoned accounts). Refuse every method while `cfg.HostClaim` is on.
+ - POST `{"name": "..."}`: `subdomainRefusal`, attach, then re-read; if a foreign claim or route is now under the name or the account holds two names, detach its own claim and refuse with `SubdomainRolledBack` and the list. On success `{"name","host","foreign":[]}`.
+ - GET: `{"name","host","foreign":[hosts of other accounts' claims or routes under the name]}`.
+ - DELETE: refuse with the list while the account holds exact claims or routes under the name; else detach.
+ - After every effective POST or DELETE: `s.claims.Reset()` and `s.bumpSerial(ctx)` (as `domaincatchall.go:163`). Refused and no-op requests do neither.
+ - `func (s *Server) canonicalHost(ctx context.Context, host string) string` (§4.8; unchanged host on any error).
- [ ] **Step 1: Write failing tests:**
- - `TestSubdomainDoorOperatorOnly`: member owner of `bdq` → 404; app token → refused; ops owner → 200; `CARLOS_SYSTEM_OPERATORS` address → 200.
- - `TestSubdomainDoorSetShowRemove`: set, show, set again → `SubdomainAccountHasOne`, remove, show empty.
- - `TestSubdomainDoorReportsForeignClaim`: a foreign claim written under the name between check and write (inject via a store wrapper) → 200 with it in `foreign`.
+ - `TestSubdomainDoorOperatorOnly`: owner of `bdq` who is not an operator → 404; app token → refused; ops owner → 200; `SystemOperators` address → 200.
+ - `TestSubdomainDoorSetShowRemove`, including set twice → `SubdomainAccountHasOne`.
+ - `TestSubdomainDoorRollsBackOnRace`: a store wrapper writes a foreign claim under the name right after the namespace `Put` → refused `SubdomainRolledBack`, namespace claim gone.
+ - `TestSubdomainDoorRollsBackSecondName`: a second name for the same account appears after the write → rolled back.
+ - `TestSubdomainShowListsForeign`.
- `TestSubdomainRemoveRefusedWhileHandAttached`.
+ - `TestSubdomainRemoveForDeletedAccount`: tombstone `bdq`; GET and DELETE work; POST → 404.
+ - `TestSubdomainDoorRefusedWithHostClaim`.
+ - `TestSubdomainWritesBumpSerial`: effective POST/DELETE bump; refused POST does not.
- `TestCanonicalHost`: `shop.bdq.oncarlos.com` → `shop.harbour.oncarlos.com`; `c1.shop.bdq…` → `c1.shop.harbour…`; custom domain unchanged; account without a name unchanged.
- - `TestAppsPageLinksToName`: render the apps page for `bdq` with a name; the link is the name URL and the sqid URL appears as the approved "permanent address" label.
- - `TestInstanceAnswerCarriesPublicHost`.
+ - `TestAppsPageLinksToName`, `TestInstanceListLinksToName`.
+ - `TestInstanceAnswersCarryPublicHost`: list, get and record view; `host` unchanged.
- `TestRemovedNameFlipsDisplayBack` (Review Focus 5).
-- [ ] **Step 2: Run** `go test ./internal/console -run 'SubdomainDoor|SubdomainRemove|CanonicalHost|AppsPageLinksToName|PublicHost|FlipsDisplayBack|ClaimConsoleMutationInvariant|SvcRoutes'` — FAIL.
+ - `TestApprovedAccountSubdomainsCopy`.
+- [ ] **Step 2: Run** `go test ./internal/console -run 'SubdomainDoor|SubdomainShow|SubdomainRemove|SubdomainWritesBumpSerial|CanonicalHost|LinksToName|CarryPublicHost|FlipsDisplayBack|ApprovedAccountSubdomainsCopy|TestClaimConsoleMutationInvariant|TestEveryCLIDoorNamesItsRoles'` — FAIL.
- [ ] **Step 3: Implement**, using approved copy IDs from Task 1.
- [ ] **Step 4: Run** Step 2 — PASS.
- [ ] **Step 5: Commit** `console: subdomain door; name URL is canonical (T6)`.
@@ -242,22 +284,45 @@ Rules (§4.4), in this order:
**Files:**
- Create: `accounts_subdomain.go`, `accounts_subdomain_test.go` (repo root)
-- Modify: `accounts.go` :85-88 (add `raw("subdomain", op, runAccountsSubdomain)`), `testdata/clireg-golden.jsonl`
-- Modify display sites to print `public_host` when present and keep probing `host`: `deploy.go` :1684/:1752, `deploywatch.go` :584-595, `canary.go` :661, `instances_import.go` :469
+- Modify: `accounts.go` :85-88: `subdomain` as a branch node with `set`, `remove`, `show` children (not a raw leaf), operator-scoped like `plan`
+- Modify: `testdata/clireg-golden.jsonl` (`go test . -run TestCLIGolden -record`), `parity/cli.tsv` plus its documentation, then `make parity-doc`
+- Modify: `apimode.go` ~:3387 (`apiInstanceRecord.PublicHost`), and display sites that print a host: `instances_cli.go` ~:751 (table), `deploywatch.go` :584-595 (printed lines only), `canary.go` :661, `deploy.go` :1752 if it prints. `watchOrigin` (`deploy.go:1684`) and `importVerifyTarget` (`instances_import.go:460`) stay probes on `host`.
**Interfaces:**
- Consumes: Task 6 doors and `public_host`.
-- Produces: `carlos accounts subdomain set --account <sqid> <name>`, `remove --account <sqid>`, `show --account <sqid>`, modelled on `accounts_plan.go` (`requirePlanAPISession`, `sess.getJSON`/`postJSON`/`deleteJSON`). `set` then polls `https://<derived host of any one app>/` with a TLS handshake every 5 s for up to 120 s; prints the approved success line, or the approved still-issuing line at timeout (exit 0).
+- Produces: `carlos accounts subdomain set --account <sqid> <name>`, `remove --account <sqid>`, `show --account <sqid>`, modelled on `accounts_plan.go` (`requirePlanAPISession`, `sess.getJSON`/`postJSON`/`deleteJSON`). `set` then polls one derived host with a TLS handshake every 5 s for up to 120 s and prints the approved success or still-issuing line (exit 0 either way). Watch targets carry `display` and `probe` hosts separately.
-- [ ] **Step 1: Write failing tests** with an `httptest` console: `TestAccountsSubdomainSet`, `TestAccountsSubdomainSetRefusalPrintsReason`, `TestAccountsSubdomainRemoveListsConflicts`, `TestAccountsSubdomainShow`, `TestDeployWatchPrintsPublicHostProbesHost`, golden update via the golden test's update flag.
-- [ ] **Step 2: Run** `go test . -run 'AccountsSubdomain|DeployWatchPrintsPublicHost|CliregGolden'` — FAIL.
-- [ ] **Step 3: Implement.**
-- [ ] **Step 4: Run** Step 2 — PASS. Also `GOOS=darwin go vet .` and `GOOS=windows go vet .` (cross-compile gate).
+- [ ] **Step 1: Write failing tests** with an `httptest` console: `TestAccountsSubdomainSet`, `TestAccountsSubdomainSetRefusalPrintsReason`, `TestAccountsSubdomainRemoveListsConflicts`, `TestAccountsSubdomainShowListsForeign`, `TestInstancesTablePrintsPublicHost`, `TestDeployWatchPrintsPublicHostProbesHost`.
+- [ ] **Step 2: Run** `go test . -run 'AccountsSubdomain|PrintsPublicHost|TestCLIGolden|TestCLIProjection'` — FAIL.
+- [ ] **Step 3: Implement**; record the golden file; update `parity/cli.tsv`; `make parity-doc`.
+- [ ] **Step 4: Run** Step 2 — PASS. Then `GOOS=darwin go vet .` and `GOOS=windows go vet .` (cross-compile gate).
- [ ] **Step 5: Commit** `cli: carlos accounts subdomain (T7)`.
### Task 8: Review, merge, dev witness
-- [ ] **Step 1:** Whole-branch review by Astra and Fable (security gate, namespace trust boundary), round budget per AGENTS.md stopping rules.
+- [ ] **Step 1:** Whole-branch review by Astra and Fable (namespace trust boundary, census), round budget per AGENTS.md stopping rules.
- [ ] **Step 2:** Push, CI green on amadan, squash merge with `-message` and `-expect`.
-- [ ] **Step 3:** Release and dev roll only with Paul's go. Witness on dev (§6): set a name on a test account; load an existing app and an instance through it; create a new app and load it through the name; confirm `*.<name>` certificate; second account's attach of `x.<name>…` refused; console and `carlos instances` show the name URL; remove; names stop serving and pages flip back.
+- [ ] **Step 3:** Release and dev roll only with Paul's go. Witness on dev (§6): set a name on a test account; load an existing app and an instance through it; create a new app and load it through the name; confirm the `*.<name>` certificate; a second account's attach of `x.<name>…` refused; console and `carlos instances` show the name URL; remove; names stop serving and pages flip back.
- [ ] **Step 4:** Record the witness on the branch discussion; update memory.
+
+---
+
+## Round 1 resolutions (Astra, `CODEX-FINDINGS-account-subdomains-plan-R1.md`)
+
+| # | Sev | Resolution |
+|---|-----|-----------|
+| 1 | P1 | Accepted, design changed (spec rev 2 §4.2): enforcement moved to the console; boxes no longer judge ownership. Every host-minting door uses one predicate (T5 Step 1). Residual race stated and visible. |
+| 2 | P1 | Accepted: unread namespace keys count as held, refusing everyone (T5); boxes keep rows and table on unread bodies (T3 rule 5). Tests inject at `ListMod`/`Get`. |
+| 3 | P1 | Resolved by #1: boxes need only their own account's namespace claim, which the store door returns (T3 storedoor test). |
+| 4 | P1 | Accepted: no `WithAppMutation`; the door refuses while host claims are on (T2 Step 3, T6). |
+| 5 | P1 | Accepted: `account_namespaces` is in `Registry.Fingerprint` (T3); remote-only edge test (T4). |
+| 6 | P1 | Accepted: `subdomainInfrastructure` checks both tiers and removes only the synthetic apps-domain entry (T5). |
+| 7 | P1 | Accepted: `public_host` on the three response shapes and `apiInstanceRecord` (T6, T7). |
+| 8 | P1 | Accepted: one census overlay, name-producer inventory, census proposal with reviewer ruling (T2 Step 4). |
+| 9 | P1 | Accepted: branch node, `parity/cli.tsv`, `make parity-doc`, `TestCLIProjection` (T7). |
+| 10 | P2 | Accepted: GET/DELETE resolve tombstones (T6). |
+| 11 | P2 | Accepted: inventory completed; probes stay on identity (T6, T7, Global Constraints). |
+| 12 | P2 | Accepted: exact selectors, `-record`, `reconcileNS`, failure at `ListMod`, reader at `wildcard.go:939`. |
+| 13 | P2 | Accepted: re-read after write rolls back a second name (T6). |
+| 14 | P2 | Cut: settings page is read-only in this slice; set/remove via CLI (spec rev 2 §4.8). |
+| 15 | P2 | Accepted: `bumpSerial` on effective writes; cache has no TTL, the door resets it (T6, Review Focus 5). |
diff --git a/docs/superpowers/plans/CODEX-FINDINGS-account-subdomains-plan-R1.md b/docs/superpowers/plans/CODEX-FINDINGS-account-subdomains-plan-R1.md
new file mode 100644
index 000000000..14f3408f9
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-FINDINGS-account-subdomains-plan-R1.md
@@ -0,0 +1,88 @@
+Reviewed `a3261cd4f7e790b8468a9e5837c12e862b234cd0` against the approved spec and code. The checkout’s subsequent commit adds only the review brief. No files changed; no tests ran.
+
+1. **P1 — Task 3: the namespace guard does not cover every serving path.**
+ Skipping a claim inside the main loop does not remove it from the `claims` slice passed separately to `deriveInstanceAliases`. That function reconstructs parent ownership from the unfiltered slice ([aliases.go:129](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/domains/aliases.go:129), [aliases.go:782](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/domains/aliases.go:782)). A foreign parent and instance catch-all under a held name can therefore still derive aliases.
+
+ A racing first-route attach also creates an independent provision record ([domainattach.go:270](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/domainattach.go:270)); the edge serves ready routes without consulting namespace ownership ([edge.go:1044](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/edge/edge.go:1044)). Finally, `StartupNoRemoval` preserves existing foreign alias rows even after the new guard rejects their claims ([aliases.go:790](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/domains/aliases.go:790)).
+
+ **Fix:** apply one ownership predicate across all derivations and enforce it at serving time, including direct routes, retained rows, wildcard fallback and remote routing. Add witnesses for a racing first-route attach, foreign instance catch-all and restart with an existing foreign alias. **Fault family:** held namespaces must never serve another account.
+
+2. **P1 — Tasks 3 and 5: incomplete claim reads fail open.**
+ `ClaimCache.List` can return `nil` error while omitting claims whose bodies failed to read; it discards the unread information ([claimcache.go:80](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/domains/claimcache.go:80), [claimcache.go:173](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/domains/claimcache.go:173)). Consequently, a failed namespace GET can erase its protection, overwrite the registry table with a smaller set and allow foreign claims to derive. Checking only listing errors does not handle this.
+
+ Task 5 also explicitly preserves sqid-shaped labels on listing failure. For an allowed name such as `marketx`, the existing `otherAccountsNamespace` lookup finds no account with that sqid and returns false ([domainpolicy.go:186](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/domainpolicy.go:186)).
+
+ **Fix:** carry completeness through namespace reads; distinguish absence from unreadability, preserve established ownership and refuse uncertain admissions. Cover failed LIST and failed GET, including a seven-letter sqid-shaped name. **Fault family:** namespace ownership must not disappear on read failure.
+
+3. **P1 — Task 3: customer fleet boxes cannot see foreign namespace owners.**
+ The fleet store door lists every claim key but returns a claim body only to its owning account ([storedoor.go:957](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/edge/storedoor.go:957), [storedoor.go:979](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/edge/storedoor.go:979)). On account B’s fleet, account A’s namespace therefore never enters `AccountNamespaces`. B’s claim that raced assignment remains eligible for derivation there.
+
+ **Fix:** specify how every serving fleet learns the minimum authoritative namespace information, or conservatively refuses names beneath an opaque namespace key. Test through the actual store door with two accounts. **Fault family:** held namespaces must never serve another account.
+
+4. **P1 — Task 2: `WithAppMutation(account, "")` cannot perform these writes with host claims enabled.**
+ `RunAppMutation` resolves an app identity and refuses an empty result ([app_mutation_runner.go:58](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/hostops/app_mutation_runner.go:58)). Independently, the mutation classifier treats every `domains/` object as app-owned and rejects an empty `App` ([mutation_classifier.go:118](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/hostops/mutation_classifier.go:118), [mutation_classifier.go:265](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/hostops/mutation_classifier.go:265)). The planned DirStore tests bypass both restrictions.
+
+ **Fix:** design an explicit account-level namespace mutation classification and authorized write path; test set/remove through the enabled production boundary. Merely checking whether the runner branches on an empty app is insufficient. **Fault family:** mutation authority must match the record’s ownership scope.
+
+5. **P1 — Tasks 3–4: changing the namespace table does not trigger wildcard refresh.**
+ The plan adds storage methods but no fingerprint contribution. Existing wildcard tables explicitly participate in `Registry.Fingerprint` because refresh depends on reload ([registry.go:3977](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/registry/registry.go:3977)). On an edge with no local routes for the account, assigning its name changes only `account_namespaces`. Remote alias publication does not provide the missing wake: the home-map callback compares the platform-name set ([homemap.go:670](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/edge/homemap.go:670)).
+
+ **Failure:** a quiet remote edge—or the elected issuer—keeps its old parent set and fails to order or select the new wildcard until another event refreshes it.
+
+ **Fix:** fingerprint namespace contents and test assignment/removal on an edge whose only relevant route is remote. The existing certificate wrapper already selects by the original SNI ([wildcard.go:984](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/edge/wildcard.go:984)). **Fault family:** certificate configuration must reach every serving edge.
+
+6. **P1 — Task 5: the infrastructure refusal recipe contradicts the policy implementation.**
+ `DenyDomains` entries belong to `platformDomains`, so they produce `hostPlatform`, not the `hostReserved` result the plan checks ([apidomains.go:144](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/apidomains.go:144), [domainpolicy.go:98](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/domainpolicy.go:98)). The proposed test expecting `harbour.oncarlos.com` in `DenyDomains` to yield `SubdomainInfrastructure` fails under that recipe. Also, `denyEntries(..., true)` removes *every* covering apps-domain/ancestor entry, not just the synthetic blanket reservation ([apidomains.go:176](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/apidomains.go:176)).
+
+ **Fix:** explicitly preserve and check operator deny entries while excluding only the intended blanket reservation. **Fault family:** namespace assignment must preserve infrastructure reservations.
+
+7. **P1 — Tasks 6–7: `public_host` is added to the wrong instance shape and has no CLI decoder.**
+ `apiinstances.go:1575` is the create **request**, not an answer. Responses use `instanceListRecord`, `instanceGetRecord` and `apiRecordView` ([apiinstances.go:181](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/apiinstances.go:181), [apiinstances.go:1430](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/apiinstances.go:1430)). The CLI independently decodes these into `apiInstanceRecord`, which has no `PublicHost` field ([apimode.go:3387](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/apimode.go:3387)).
+
+ **Failure:** following the named edit leaves instance answers unchanged; the planned response test fails, and deploy output cannot consume the new value.
+
+ **Fix:** enumerate and populate the response annotations, update the CLI wire structs and carry the display host through watch targets while retaining identity hosts for operations. **Fault family:** canonical URL propagation across API boundaries.
+
+8. **P1 — Tasks 2–3 and 8: the census instructions cannot produce a green branch.**
+ Adding writers to both the base inventory and the regional overlay duplicates entries; that overlay explicitly panics when an addition already exists ([regional_domains_447_census_test.go:108](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/provision/regional_domains_447_census_test.go:108)). No task prepares the required root-read proposal, although changed source envelopes fail the census ([plan14_root_reads_test.go:677](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/provision/plan14_root_reads_test.go:677)). The host name-producer inventory also pins both producer bodies and the complete `Claim` field list ([group_names_test.go:238](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/host/group_names_test.go:238), [group_names_test.go:259](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/host/group_names_test.go:259)).
+
+ **Fix:** add each writer once through the inventory chain, update the name-producer inventory, and schedule census proposal and independent approval before the corresponding pass/merge assertions. **Fault family:** reviewed source and name-production coverage.
+
+9. **P1 — Task 7: the CLI projection is left stale.**
+ Adding a runnable command changes the projection, but the task never updates `parity/cli.tsv`. `TestCLIProjection` compares it directly with the command tree and fails ([cli_projection_test.go:42](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/cli_projection_test.go:42)).
+
+ **Fix:** register `subdomain` as a branch with `set`, `remove` and `show` children, add their parity coverage and documentation, then run `make parity-doc` and the relevant checks. The proposed raw leaf would also hide those dispatch words from the registry. **Fault family:** CLI command-tree and published-interface consistency.
+
+10. **P2 — Task 6: a deleted account’s namespace cannot be removed.**
+ The shared door uses `AccountBySqid`, which filters tombstones ([store.go:1341](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/store.go:1341)). After account deletion, DELETE therefore returns 404, contrary to spec §4.3’s operator cleanup path.
+
+ **Fix:** after operator authorization, permit show/remove to resolve tombstoned accounts through `AccountAnyBySqid`; keep assignment restricted appropriately. Add a deletion/removal test. **Fault family:** namespace lifecycle and release.
+
+11. **P2 — Tasks 6–7: the display inventory is incomplete and includes probe functions.**
+ Missing surfaces include the instance-list external link ([app_instances.html:85](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/templates/app_instances.html:85)), console canary success message ([server.go:6597](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/server.go:6597)) and `carlos instances` table ([instances_cli.go:751](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/instances_cli.go:751)). These continue displaying sqid hosts.
+
+ Conversely, the listed `watchOrigin` and `importVerifyTarget` construct actual probe destinations ([deploy.go:1684](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/deploy.go:1684), [instances_import.go:460](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/instances_import.go:460)).
+
+ **Fix:** complete the inventory and introduce separate display fields. Preserve identity in probes, instance detail paths, logs and restart/update form actions. **Fault family:** canonical presentation without changing operational identity.
+
+12. **P2 — Tasks 3, 6 and 7: several test instructions do not exercise their intended targets.**
+ `CliregGolden` does not match `TestCLIGolden`, whose recording flag is `-record` ([clireg_golden_test.go:30](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/clireg_golden_test.go:30)). `SvcRoutes` does not select the role-declaration test ([svcroutes_test.go:431](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/svcroutes_test.go:431)). The suggested `reconcile` helper passes no report and therefore cannot supply the new `AppsDomain` input ([instancecatchall_test.go:53](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/domains/instancecatchall_test.go:53)). The suggested `listFailStore` overrides `List`, while its embedded DirStore still supplies `ListMod`, which a non-nil claim cache prefers.
+
+ **Fix:** give exact test selectors, add a namespace-aware reconcile helper and inject failure into the method actually called. Also correct Task 4’s reader location: it is [wildcard.go:939](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/edge/wildcard.go:939), not `edge.go`. **Fault family:** verification must exercise the intended behavior.
+
+13. **P2 — Tasks 2 and 6: one name per account has no concurrency mechanism.**
+ Two operator requests assigning different names can both observe an empty account mapping and successfully create different namespace keys. Create-only storage protects each name, not the account-wide constraint; the existing CAS operates on the supplied claim key ([claims.go:491](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/domains/claims.go:491)).
+
+ **Fix:** specify serialization covering the account-level check and write, including the supported multi-console scope, and test simultaneous assignments. **Fault family:** one canonical namespace per account.
+
+14. **P2 — Task 6: account settings has no planned operator set/remove flow.**
+ Spec §4.8 requires member read-only display and operator controls. The plan supplies a display row and CLI API routes, but no browser handlers, form flow or corresponding copy. Existing settings mutations use browser forms with CSRF fields ([account_settings.html:25](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/templates/account_settings.html:25)).
+
+ **Fix:** include the operator controls, browser authorization/CSRF handling and layout review in Tasks 1 and 6. **Fault family:** approved console workflow coverage.
+
+15. **P2 — Task 6: namespace writes do not announce a convergence change.**
+ `s.claims.Reset()` only clears the console’s cache. Existing claim mutations call `s.bumpSerial(ctx)` so boxes reconcile promptly ([domaincatchall.go:163](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/domaincatchall.go:163)); alias reconciliation explicitly relies on serial bumps for its fast path ([aliases.go:265](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/domains/aliases.go:265)).
+
+ **Fix:** bump the serial after effective set/remove writes and test that no-op/refused writes do not bump it. Replace the plan’s “cache interval” assumption: `ClaimCache` has no TTL ([claimcache.go:32](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/domains/claimcache.go:32)). **Fault family:** successful writes must reach serving state promptly.
+
+**NOT READY**
\ No newline at end of file
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 39766f7de..7ac7fe60e 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:** approved by Paul 2026-11-11 (with the canonical-URL change in §2 and §4.8), 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`. Rev 2 (same day): namespace enforcement moved from the boxes to the console after Astra's plan review round 1 (§4.2).
Astra builder check done (`CODEX-FINDINGS-account-subdomains-builder-check.md`;
all five questions answered in this revision).
@@ -127,26 +127,46 @@ 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. With
+ `CONSOLE_DENY_DOMAINS` entries covering it refuse it too (those give
+ `hostPlatform`, not `hostReserved`, so the check reads both tiers). 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.
+ domain, which would refuse every name. This door drops exactly that one
+ synthetic entry and keeps every other one, including an operator deny
+ entry that names the apps domain or an ancestor. (It cannot reuse
+ `denyEntries(…, true)`, which drops every covering 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.
+**Where the namespace is enforced: the console, not the boxes.** Every
+console door that can put a host under the apps domain (domain attach,
+first-route attach, instance create, the operator's platform door) asks
+one predicate, "who owns the label under the apps domain?", and refuses a
+host under a name another account holds. Boxes do not judge ownership.
+(Rev 2: the first draft enforced it on the boxes. Astra's plan review
+showed that boxes on a customer fleet cannot read other accounts' claims,
+that an incomplete claim read would drop the protection, and that direct
+routes and retained rows bypass the alias pass. Console enforcement has
+none of those gaps.)
+
+- **Reads that fail refuse.** The predicate reads claims with
+ `ListWithUnread`. A claim key `domains/*.<label>.<apps-domain>.json`
+ whose body could not be read counts as held by an unknown account:
+ attaches under that label are refused for everyone, and assigning that
+ name is refused, until the read succeeds.
+- **The race.** 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. The assignment door therefore re-reads
+ after its write: if a foreign claim or route now sits under the name, or
+ the account now holds two names, it deletes its own claim and refuses
+ (listing what it found). What remains is an ordinary attach whose write
+ lands after that re-read, a window of one request's duration. On a
+ shared platform it cannot happen at all, because with
+ `ReservePlatformDomains` on no tenant can attach anything under the apps
+ domain. On a self-hosted deployment it is a race between the operator
+ and their own tenant, and it is visible: `show` lists any foreign name
+ under the subdomain, and the operator detaches it.
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
@@ -161,8 +181,10 @@ account or an address on `CARLOS_SYSTEM_OPERATORS`), and only from a
person, never an app token. The CLI is
`carlos accounts subdomain set|remove|show`.
-- **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.
+- **Set** checks §4.2, then writes the claim create-only, then re-reads
+ (§4.2, the race). An account that already has a subdomain is refused;
+ changing it is remove then set.
+- **Show** returns the name, its host and any foreign names under it.
- **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),
@@ -171,7 +193,13 @@ person, never an app token. The CLI 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.
+ operator can remove it afterwards: show and remove resolve tombstoned
+ accounts (`AccountAnyBySqid`); set does not.
+- Every effective set and remove bumps the deployment serial
+ (`bumpSerial`), as other claim writes do, so boxes reconcile at once.
+- With host claims on (`CARLOS_HOST_CLAIM`, shelved since 2026-10-25),
+ the door refuses: the claim mutation boundary has no account-level
+ writes.
There is no environment switch. The door is operator-only on every
deployment, and nothing changes until an operator sets a subdomain.
@@ -188,17 +216,17 @@ replica row, has account column `A`, and whose host is
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:
+The precedence rules are the instance catch-all's:
-- 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.
+- An exact claim on the derived name wins. That lets the account attach
+ `blog.harbour...` to a different app if it wants.
- 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.
+- A listing failure, or an unread namespace claim body, keeps the
+ existing derived rows and held-name table for that pass instead of
+ dropping them.
+
+A box on a customer fleet reads its own account's claims through the
+store door, so it sees its own namespace claim and needs nothing else.
The mapping swaps one label, so it is one-to-one: two routes can never
derive the same name. Rows are ordinary `route_aliases` rows, so the
@@ -218,11 +246,14 @@ The console's checks that know `<sqid>.<apps-domain>` means "this
account's namespace" learn the name too. `appsNamespace(host)` resolves
the label under the apps domain to an account sqid when it is a sqid
**or** a held subdomain (one claim read, through the existing claim
-cache). With that one change:
+cache, with unread keys treated as held, §4.2). With that one change:
- `otherAccountsNamespace` refuses other accounts anything under
`harbour.<apps-domain>`, operators' platform door included, as it does
for sqids today. A removed subdomain stops protecting at once.
+- Every door that mints a host under the apps domain goes through it,
+ instance create included; the builder lists them from the callers of
+ `appsNamespace` and `otherAccountsNamespace`.
- `domainProofExempt` treats the account's own subdomain as proof-exempt,
like its sqid namespace.
- `firstRouteOutsideNamespace` treats a held name as a namespace.
@@ -286,8 +317,9 @@ 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).
+- The account settings page shows the subdomain, read-only for everyone
+ in this slice. Operators set and remove it with the CLI; console
+ controls can follow.
- Refusals name the rule that refused (taken, reserved, sqid-shaped and
too short, held by another account).
@@ -306,8 +338,11 @@ 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, and if
- it races the assignment, inert on every box (§4.4).
+- **Another account attaches `x.harbour...`:** refused by §4.5. If it
+ races the assignment, the assignment rolls back, or (a write landing
+ after the re-read) it is listed by `show` for the operator (§4.2).
+- **A claim body fails to read:** its label counts as held; attaches
+ under it are refused until the read succeeds (§4.2).
- **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.
@@ -348,8 +383,10 @@ it ships in; there is no switch (§4.3).
shared platforms included, is Paul's decision (§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).
+- The namespace is enforced in the console doors, with a re-read after
+ assignment; the residual race is stated and visible (§4.2, rev 2).
+- Console controls for set/remove wait; the CLI does it in this slice
+ (§4.8).
- Names get the sqid's DNS and certificate behaviour exactly, including
the existing `_acme-challenge` wildcard window (§4.7).
- Both URLs serve; no redirect. The name URL is canonical on every