carlos / platform Public

plan: account subdomains, final review findings (Astra NOT READY, Fable RAF)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev b60b27a39c488289d0a4a530773d5a4f7173d65e parent 862837c
2 files changed, +119 −0
  • docs/superpowers/plans/CODEX-FINDINGS-account-subdomains-final.md +69 −0
  • docs/superpowers/plans/FABLE-FINDINGS-account-subdomains-final.md +50 −0

Intent

Human

<task-notification> <task-id>a174b8f97b1bf16aa</task-id> <tool-use-id>toolu_018Q8xFNKSBw1b3q5DWN3d7F</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/709ac745-ee81-4971-97b8-321e18b19cf6/tasks/a174b8f97b1bf16aa.output</output-file> <status>completed</status> <summary>Agent "Merge main into branch, resolve census" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>**Status:** Done. Main is merged into `design-account-name-hosts` with all three conflicts resolved as briefed. Not pushed. Full report: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/.superpowers/sdd/2026-11-11-account-subdomains/merge-main-report.md **Merge commit:** `862837caa994ae848040992398a0aee0f1ac599b` (parents 1c2208db and e8a36b14). Subject: "Merge main into design-account-name-hosts". **Tests:** all pass. - `go build ./...` - provision: TestPlan9B8RecordWriteCensus, TestPlan14RootReadCensus and its RejectsDrift test. - host: TestGroupNameClassCensus and TestGroupNameProducerCensusScope. - Root package: golden, projection, account subdomains copy, AccountsSubdomain, plus main's member backups copy and InstancesBackups (21 tests). - parity: TestParityCLIPaths. - console: Subdomain, CanonicalHost, LinksToName, InstanceList, Backup, AppInstance, Census and route checks. - `GOOS=darwin` and `GOOS=windows go vet .` are clean, and so is gofmt. - The golden file and parity tables needed no regeneration: `make parity-doc` changed nothing and TestCLIGolden passes without `-record`. **Census units re-pinned:** - **Write census:** `accountSubdomainsWriteCensusInventory` now builds on main's `memberBackups1WriteCensusInventory`. Two re-pins moved to the merged digests, and no class or kind changed. Each merged unit is exactly both sides' reviewed changes combined. - `Server.handleAppInstance` → `b9339349…`: the branch's alias filter, then main's Backups read. - `var routeDecls` → `70d4e4ad…`: main's backups route next to the branch's four subdomain routes. - **Root-read census:** re-proposed with `make census-propose NAME=account-subdomains` on top of main's chain. The seal is now `44b11f63…` → `8a98d030…`. No unit digest changed. Only two package fingerprints moved, both from main's own changes, which main's overlays already cover: - `.` (repository root) → `d6ae7a91…`: member backups files (apimode.go, cli.go, db.go, instances_backups.go). - `internal/edge` → `2f9527a8…`: the demo Referrer-Policy change. **Concerns:** - **Approval still needed:** the re-proposed root-read overlay needs the independent reviewer's approval before landing. The Task 7 runDeploy extension from fix round 1 is also still not ruled on. I approved nothing. - **Sandbox off for Go:** the sandbox mounts the default Go build cache read-only, so Go commands ran with the sandbox off. GOCACHE stayed at its default. - **Lock warning on commit:** `git commit` printed a `packed-refs.lock` error, probably from another session's git process. The branch ref points at the merge commit and the tree is clean. - **Backups section keeps the stored host:** main's section shows the stored host, not the canonical name, in its `db pull` commands. This matches the page's other actions, so I left it.</result> <usage><subagent_tokens>106112</subagent_tokens><tool_uses>46</tool_uses><duration_ms>460390</duration_ms></usage> </task-notification>

Human

<cross-session-message from="uds:/run/user/1001/cc-socks/3050168.sock" from-name="amadan-1e" from-mode="bypass"> Heads-up from amadan-1e: at Paul's request I'm resizing carlos-flagship-ie (i-092c0c1eea75723cb) from t4g.large to m7g.xlarge at 07:23 UTC — stop, modify, start. Console and all flagship apps down ~5 min; Elastic IP stays. Please hold any ship/promote against carloku until I post it's back; reply before 07:23 if you need me to wait. </cross-session-message>

Human

<task-notification> <task-id>bp5sf94cl</task-id> <tool-use-id>toolu_01QS871xwTk1HjLskqMVAuiY</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/709ac745-ee81-4971-97b8-321e18b19cf6/tasks/bp5sf94cl.output</output-file> <status>completed</status> <summary>Background command "Build final review prompt and run Astra + Fable whole-branch review" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 27.9 g CO₂e (3,601,728 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/plans/CODEX-FINDINGS-account-subdomains-final.md b/docs/superpowers/plans/CODEX-FINDINGS-account-subdomains-final.md
new file mode 100644
index 000000000..53569e5fe
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-FINDINGS-account-subdomains-final.md
@@ -0,0 +1,69 @@
+Found **one P1 and four P2s** in `e8a36b14..862837ca`. The ownership race blocks merge.
+
+1. **P1 — Namespace permission can outlive removal and reassignment.**
+ **Family:** namespace ownership throughout a write; spec §4.2, Tasks 5–6.
+
+ A placements request loads its namespace view [before reading its body](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/apiplacements.go:484), then uses that same view for the [write decision](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/apiplacements.go:545).
+
+ Reproducible ordering:
+
+ - Account A holds `harbour`. Start a placements request for `x.api.harbour.apps.test`, pausing its body after the namespace read.
+ - Remove A’s name, then assign `harbour` to B. Both assignment scans finish before the pending request writes anything.
+ - Complete A’s request with valid placements targeting A’s instances. Its saved view still authorizes A, so it writes a foreign claim beneath B’s name.
+
+ The regional overlap check only examines the immediate parent, `api.harbour.apps.test`, so the namespace claim at `*.harbour.apps.test` does not prevent this deeper-host case. Ordinary attaches have the same underlying gap: [an owned namespace returns no pin](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/subdomains.go:310). The pin protects an existing *host claim*, not the namespace ownership that authorized a new claim.
+
+ **Required:** fence namespace removal/reassignment against every authorized host write, across supported console writers. Another scan or an unlocked final ownership read does not close the race. Add an interleaving test covering admission → removal → reassignment → delayed write.
+
+2. **P2 — A namespace claim blocks its owner’s regional placements.**
+ **Family:** distinguishing namespace ownership from catch-all coverage; spec §§4.2–4.4, Task 5.
+
+ [regionalOverlapRefusal](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/apiplacements.go:902) rejects any object at `*.parent`. After assigning `harbour`, creating regional `shop.harbour.apps.test` therefore returns 409 even for the owner. Assigning the name over an existing same-account regional claim also prevents subsequent placement updates.
+
+ **Required:** recognize a valid, same-account namespace claim separately from an overlapping catch-all. Preserve refusal for foreign, malformed and unread claims. Test both creation and updating a regional claim that predates assignment.
+
+3. **P2 — Rollback can delete a later successful assignment.**
+ **Family:** rollback owns only its original write; Task 6 deferred item.
+
+ [subdomainRollBack](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/apisubdomain.go:438) obtains a fresh ETag and deletes whichever namespace claim now belongs to that account. If an earlier set encounters a read failure, another console can remove and successfully recreate the same assignment before the first request rolls back. The first request then deletes the successor.
+
+ **Required:** retain the ETag returned by the original namespace `Put` and condition rollback on that revision. Test replacement between the failed reread and rollback.
+
+4. **P2 — TLS readiness is skipped for accounts with only platform routes.**
+ **Family:** readiness covers every supported serving route; spec §4.8, Task 7 deferred item.
+
+ [subdomainCheckHost](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/apisubdomain.go:216) searches only instance records. Eligible console-registry `Platform` routes derive name aliases too, but an account containing only those routes gets no `check_host`; `set` skips the required TLS check.
+
+ **Required:** include eligible platform routes when selecting a real check host. Test an account with a platform route and no instance records.
+
+5. **P2 — API search cannot find the host it displays.**
+ **Family:** canonical display and human search agree; Task 6 deferred item.
+
+ The instance API [filters only `rec.Host`](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-account-name-hosts/internal/console/apiinstances.go:1325), although its response and CLI table display `public_host`. Searching for `shop.harbour.apps.test` returns no result for the displayed instance; the browser filter already handles both forms.
+
+ **Required:** match the identity host and eligible public host, using the request’s existing canonical view.
+
+The deferred ledger items are triaged as follows:
+
+| Disposition | Items |
+|---|---|
+| **Fix before merge** | Rollback ETag, record-only TLS selection, API query matching: findings 3–5. |
+| **P3 follow-up** | Primitive CAS-interleaving coverage and invalid-account test; attach documentation mismatch; `ValidAccount` tightening; non-HA zeroing; shape-only not-found classification; duplicate lookups/policy calls; multiple-name wildcard fallback; settings unknown state; namespace-view caching; host-claims wording; removal audit row; per-host deployment’s wildcard timeout wording. The specific interleaving tests required by findings 1 and 3 are mandatory. |
+| **No fix required here** | Worker allow-list deferral: the edge reads its local registry directly. |
+| **Verification outstanding** | Reported Darwin vet and lifecycle-test failures. Their cited source files are unchanged by this branch, but that does not establish a green gate on this tip. |
+
+**Census ruling — APPROVE**, for the root-read overlay at `862837caa994ae848040992398a0aee0f1ac599b`.
+
+The approval covers every proposed unit: `runDeploy`; `newWildcardFromEnv`; `aliasPassReportingComplete`; `ReconcileAliasesReport`; `deriveInstanceAliases`; `StampHealth`; all four namespace-alias census units; registry `ListAccountNamespaces`, `SetAccountNamespaces`, `Fingerprint`, `migrate` and `dispatchRemote`; the registry-field inventory; and all six envelopes (`.`, `internal/domains`, `internal/edge`, `internal/host`, `internal/provision`, `internal/registry`). The changes retain the stated dispositions: display-only CLI changes, agent/edge routing work, and queries against the existing registry, with no new root-controlled path or execution input.
+
+The merge changes only the repository-root and edge envelope fingerprints. Every unit row is unchanged from the first parent. Independently recomputing the accumulated legacy seal gives **`8a98d030b98e58bba5940e5549ed477ae5be581953c68e89c86f2831513ff091`**, matching the chain tip.
+
+**Write-census ruling — APPROVE** for `accountSubdomainsWriteCensusInventory` on `memberBackups1WriteCensusInventory`. The classifications and narrowed `RecordHostDeclared` kinds match the changes. The merged instance-page and route-declaration pins preserve both branches’ additions. These census approvals do not approve the namespace lifecycle behavior identified above.
+
+Identity separation is preserved in the reviewed changes: watch origins, record hosts, detail paths and form actions retain the sqid host. All 37 approved-copy entries are present in their recorded files.
+
+The targeted Go tests could not start because the read-only sandbox prevented creation of Go’s build directory. No files were edited, no subagents were spawned, and no full suites ran. `git diff --check` reports documentation whitespace.
+
+The P1 belongs to the previously reviewed **namespace-ownership** family; its review history must not reset. Under the stopping rule, resolve the mechanism before another patch cycle: gate reuse, cut removal/reassignment, or enforce ownership through one shared fencing mechanism. I recommend the shared mechanism with bounded interleaving tests.
+
+**NOT READY**
\ No newline at end of file
diff --git a/docs/superpowers/plans/FABLE-FINDINGS-account-subdomains-final.md b/docs/superpowers/plans/FABLE-FINDINGS-account-subdomains-final.md
new file mode 100644
index 000000000..35fc5062a
--- /dev/null
+++ b/docs/superpowers/plans/FABLE-FINDINGS-account-subdomains-final.md
@@ -0,0 +1,50 @@
+**Verdict: READY AFTER FIXES.** I found no way for a held name to serve another account through any console door, the box derivation, the edge or the CLI. One mechanical blocker: main has moved since the merge.
+
+## Must fix before merge (P2, no new review round)
+
+**The branch is one commit behind main.** `178dcfe5` (member backups 2a, #898) landed after `862837ca` and touches four files this branch also changes:
+- `internal/provision/plan9_b8_census_test.go`: main's write tip is now `memberBackups2aWriteCensusInventory`.
+- `internal/provision/testdata/plan14-root-reads-chain.tsv`: main appended `plan14-root-reads-member-backups-2a.tsv`.
+- `internal/host/agent.go` and `testdata/clireg-golden.jsonl`.
+
+Merge main again, layer `accountSubdomainsWriteCensusInventory` on `memberBackups2a…`, re-propose the root-read overlay on the new chain, and re-record the golden file. The new seal needs a digest-only ruling from the other family.
+
+## Fix before a flagship release (P2, not a merge blocker)
+
+**`loadNamespaces` runs one bucket LIST per display request** (`internal/console/canonical.go:78`). That covers every app page, instance list and deploy-watch poll, even when no account has a name. This is the deferred Task 6 item; given the S3 request-cost rule, add the memo (reset in `subdomainWritten`) for display reads only. Doors must keep reading fresh.
+
+## Follow-ups (P3)
+
+- **Canonical URL can point at a different app.** `hostCanon.host` rewrites by label only. If the account hand-attaches `blog.harbour.<apps>` to another app (spec §4.4 allows it), the console, API and CLI still show that URL for `blog.<sqid>`. The same happens past the alias cap. Same account only, so not a boundary break.
+- **Remove-then-reassign race.** A former holder's create that loaded its view before `remove` can land after `set` gives the name to another account, and the exact claim then wins on the box. Spec §4.2 says only the owner's own create can race; that is not quite true. The window is one request wide and `show` reports the result.
+- **Hand-minted box routes are invisible** to the assignment walk, `show` and the inventory (the deliberate "no route fold"). On a self-hosted deployment, a pre-existing hand route `x.team.<apps>` for another account keeps serving after `team` is assigned, because real routes win. Add a `carlos routes` check to the Task 8 inventory step.
+- **A reassigned name can briefly serve the old holder.** Its derived rows survive a startup pass, or a failed read of the new claim body, until the next good pass. The spec accepts this.
+- **Set and remove leave only a log line**, no audit row.
+- **A new canonical test dials a real host** (`c1.shop.bab.oncarlos.com:80`); the sandbox blocked it and the run still passed.
+- **`ListAccountNamespaces` is not on the read-only worker allow-list.** This is harmless today because the edge reads its own registry handle.
+
+## Trust boundary and identity
+
+- **Console doors:** every claim and record writer is behind `createRefusal` or `namespaceCreateRefusal`: attach (both doors, pinned to the claim revision), first route, placements, catch-alls, capability changes and instance create (seed, import and restore included). Demo and sidecar creates only make hosts under the creator's own sqid, the demo domain or `.sidecar.internal`. Detach, paths and plan caps use the zero view and create nothing.
+- **Boxes:** derivation needs both the route's account column and the host label to match the claim's sqid. Exact claims, local routes and deployment routes win. Names the rules refuse are ignored even if written straight to the bucket.
+- **Edge:** a name parent is added only alongside a sqid parent from a real route host.
+- **Identity:** probes, `watchOrigin`, matching, detail paths and forward rows stay on the sqid host; only printed and linked hosts change.
+
+## Deferred minors
+
+None of the deferred minors needs fixing before merge. The `loadNamespaces` memo is the only one to do before a flagship roll; the rest are follow-ups.
+
+- **Darwin vet, `internal/edge`:** confirmed pre-existing. It fails on five untouched test files (`readerConn` undefined). I did not re-check `internal/host` vet.
+- **Four `internal/host` lifecycle tests:** not re-checked; CI must confirm they fail the same way on main.
+
+## Census ruling
+
+**APPROVE** for the overlay as merged at `862837ca`, on content. The 15 units are registry reads, the `account_namespaces` table and one `PLATFORM_APPS_DOMAIN` read. None of them reads a tenant-writable path, and each matches the source I read.
+
+- **Write census:** `TestPlan9B8RecordWriteCensus` passes with `accountSubdomainsWriteCensusInventory` on `memberBackups1WriteCensusInventory`. APPROVE, subject to the rewire above.
+- **Root-read seal `8a98d030…`:** not verified here. `TestPlan14RootReadCensus` could not run in my sandbox (read-only Go cache), and the seal is replaced by the re-merge anyway.
+
+## What I ran
+
+- **Passed:** targeted tests in `internal/domains`, `internal/edge`, `internal/host`, `internal/registry` and `internal/console` (door, enforcement, canonical and claim-invariant selectors).
+- **Not run:** the root-package CLI tests (`AccountsSubdomain`, approved copy, golden), for the same sandbox reason. CI must show them green.