carlos / platform Public

platform accounts: approved copy, census overlay, ratchet record

Copy: Luna pass + Paul 2026-11-19. Paul's four rows: the delete refusal
drops its count; audit.revoke reworded; the mint line splits into
MintedPublish and MintedDeploy, with audit.credential split the same
way; a platform owner's lapse_grace email line (email.platform.
lapse_grace) drops the keep-page promise, the ordinary owner's line
is unchanged. approved_platform_accounts_copy_test.go pins every row.

The read doors answer a store error with their own rows, list.failed
and show.failed, instead of the status text. ReservePlatformMint tells
its constraint failures apart by SQLite's extended result code, not
the message.

Census overlay re-proposed under design-platform-accounts (root
envelope re-pinned). code-health record lowered: (*Store).migrate and
(*Store).EnsureAccount.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev dd910233ab16456e89e481f039fac06ce715359d parent d23dab9
19 files changed, +699 −226
  • .amadan/code-health.tsv +1 −3
  • approved_platform_accounts_copy_test.go +180 −0
  • docs/superpowers/plans/2026-11-19-platform-accounts-1-platform-layer.md +162 −149
  • docs/superpowers/plans/LUNA-COPY-RESULT-PLATFORM-ACCOUNTS-1.md +149 −0
  • internal/console/apiplatformcredentials.go +5 −5
  • internal/console/apiplatformcustomers.go +39 −38
  • internal/console/apiplatformcustomers_test.go +16 −0
  • internal/console/ownership.go +1 −1
  • internal/console/plancaps_copy.go +6 −3
  • internal/console/platform_copy.go +15 −6
  • internal/console/platform_credentials_test.go +2 −2
  • internal/console/platform_store.go +23 −9
  • internal/console/platform_store_test.go +30 −0
  • internal/console/platformlinked.go +11 −1
  • internal/console/platformlinked_test.go +26 −3
  • internal/provision/testdata/plan14-root-reads-design-platform-accounts.tsv +1 −1
  • platform_cli.go +5 −1
  • platform_cli_test.go +20 −0
  • platform_copy.go +7 −4

CI failed — run details

diff --git a/.amadan/code-health.tsv b/.amadan/code-health.tsv
index 167bda300..4de3db1c0 100644
--- a/.amadan/code-health.tsv
+++ b/.amadan/code-health.tsv
@@ -1449,8 +1449,6 @@ db-no-context internal/console (*Store).EndBillingDiscovery (*sql.Tx).Exec 2
db-no-context internal/console (*Store).EndBillingDiscovery console.sqlHandle.Begin 1
db-no-context internal/console (*Store).EndBillingDiscovery console.sqlHandle.QueryRow 1
db-no-context internal/console (*Store).EndBillingRetirement console.sqlHandle.Exec 1
-db-no-context internal/console (*Store).EnsureAccount (*sql.Tx).Exec 1
-db-no-context internal/console (*Store).EnsureAccount console.sqlHandle.Begin 1
db-no-context internal/console (*Store).EnsureDefaultPlans console.sqlHandle.Exec 1
db-no-context internal/console (*Store).EnsureUser console.sqlHandle.Exec 1
db-no-context internal/console (*Store).FinishOutbox (*sql.Tx).Exec 1
@@ -2190,7 +2188,7 @@ func-lines internal/analytics Prune - 343
func-lines internal/appconfig SyncExecWithCallbacks - 320
func-lines internal/console (*Server).handleAPIInstanceCreate - 769
func-lines internal/console (*Server).handleAPIShip - 378
-func-lines internal/console (*Store).migrate - 389
+func-lines internal/console (*Store).migrate - 335
func-lines internal/console TestDemoProtectionsSourceToLimitAndTakedown - 412
func-lines internal/console TestDemoSourceToLiveAndUpdate - 383
func-lines internal/console TestHAP2ProductionDoors - 321
diff --git a/approved_platform_accounts_copy_test.go b/approved_platform_accounts_copy_test.go
new file mode 100644
index 000000000..8bca5b047
--- /dev/null
+++ b/approved_platform_accounts_copy_test.go
@@ -0,0 +1,180 @@
+package main
+
+import (
+ "os"
+ "strings"
+ "testing"
+)
+
+// Platform accounts slice 1 (docs/superpowers/plans/2026-11-19-platform-
+// accounts-1-platform-layer.md, "Copy table"). Approved: Luna pass + Paul
+// 2026-11-19 (docs/superpowers/plans/LUNA-COPY-RESULT-PLATFORM-ACCOUNTS-1.md,
+// as written except Paul's four rows: delete.platform_has_customers,
+// audit.revoke, the Minted split with audit.credential to match, and
+// email.platform.lapse_grace), plus list.failed and show.failed in Paul's
+// wording. Like approved_copy_test.go, Go rows compare decoded literals byte
+// for byte; the docs rows are sentences of docs/site/cli.md.
+func TestApprovedPlatformAccountsCopy(t *testing.T) {
+ rows := []struct{ key, path, want string }{
+ {"grant.ops", "internal/console/platform_copy.go", "the ops account can’t be a platform account"},
+ {"grant.linked", "internal/console/platform_copy.go", "a customer account can’t be a platform account"},
+ {"grant.reason", "internal/console/platform_copy.go", "--reason is required"},
+ {"grant.max", "internal/console/platform_copy.go", "--max-customers must be a whole number from 1 to 10000"},
+ {"grant.plans", "internal/console/platform_copy.go", "--plans must name plans in this console’s catalog, and --default-plan must be one of them"},
+ {"grant.no_catalog", "internal/console/platform_copy.go", "this console has no plan catalog, so a grant can’t name plans"},
+ {"grant.not_platform", "internal/console/platform_copy.go", "this account isn’t a platform account"},
+ {"grant.failed", "internal/console/platform_copy.go", "could not save the grant. try again"},
+ {"door.not_platform", "internal/console/platform_copy.go", "this account isn’t a platform account. an operator can make it one with carlos accounts platform"},
+ {"door.revoked", "internal/console/platform_copy.go", "this account’s platform access is turned off. ask the operator who granted it"},
+ {"door.not_owner", "internal/console/platform_copy.go", "only an owner of this account can manage its customer accounts"},
+ {"door.rate", "internal/console/platform_copy.go", "too many requests. wait a minute and try again"},
+ {"list.failed", "internal/console/platform_copy.go", "Couldn’t read the customer accounts. Try again in a moment."},
+ {"show.failed", "internal/console/platform_copy.go", "Couldn’t read that customer account. Try again in a moment."},
+ {"create.name", "internal/console/platform_copy.go", "an account name appears in URLs and --account: 1-63 characters of a-z, 0-9 and hyphen, no leading or trailing hyphen"},
+ {"create.ref", "internal/console/platform_copy.go", "a customer reference is 1 to 64 letters, digits, dots, colons, hyphens or underscores"},
+ {"create.plan", "internal/console/platform_copy.go", "this platform can put customer accounts on these plans: %s"},
+ {"create.no_catalog_plan", "internal/console/platform_copy.go", "this console has no plan catalog, so leave out the plan"},
+ {"create.cap", "internal/console/platform_copy.go", "this platform has %d customer accounts, the most its grant allows. ask the operator for more"},
+ {"create.rate", "internal/console/platform_copy.go", "too many customer accounts were created today. try again tomorrow, or ask the operator"},
+ {"create.failed", "internal/console/platform_copy.go", "could not create the customer account. try again"},
+ {"update.empty", "internal/console/platform_copy.go", "nothing to change. pass a new name, a new plan, or both"},
+ {"update.operator_plan", "internal/console/platform_copy.go", "an operator set this account’s plan. ask them to change it"},
+ {"update.failed", "internal/console/platform_copy.go", "could not change the customer account. try again"},
+ {"cred.role", "internal/console/platform_copy.go", "a customer credential is publish for the whole account, or deploy for one app with its rungs"},
+ {"cred.ttl", "internal/console/platform_copy.go", "a customer credential lasts from 1 minute to 24 hours"},
+ {"cred.failed", "internal/console/platform_copy.go", "could not mint the credential. try again"},
+ {"host.not_static", "internal/console/platform_copy.go", "channel %s serves %s, which isn’t a static site, so it can’t be given a static host"},
+ {"svc.platform_app", "internal/console/platform_copy.go", "a platform credential works for the whole platform account, so it takes no --app"},
+ {"svc.not_platform", "internal/console/platform_copy.go", "only a platform account can hold a platform credential. an operator grants that with carlos accounts platform"},
+ {"billing notice.platform", "internal/console/billingpage_copy.go", "Your plan is managed by %s."},
+ {"billing notice.platform_generic", "internal/console/billingpage_copy.go", "This account’s plan is managed by the platform account that runs it."},
+ {"domainbuy platform", "internal/console/domainbuy_copy.go", "buying a domain isn’t available on an account run by %s. attach a domain registered elsewhere instead"},
+ {"delete.platform_has_customers", "internal/console/platform_copy.go", "This account still has customer accounts linked to it, so it can’t be deleted."},
+ {"delete.linked", "internal/console/platform_copy.go", "This account is run by %s. Ask them to delete it."},
+ {"email.platform.subject", "internal/console/plancaps_copy.go", "[carlos] Customer account %s (%s): plan usage"},
+ {"email.platform.intro", "internal/console/plancaps_copy.go", "Customer account %s (%s), run by %s, is near or over its plan limits:"},
+ {"email.platform.lapse_grace", "internal/console/plancaps_copy.go", "- %s. On %s, anything not covered is turned off. Apps, instances and workers go newest first. Custom domains are all turned off when the plan does not include them. Settings and data are kept."},
+ {"email.platform.lapse_off_list", "internal/console/plancaps_copy.go", "Turned off: %s."},
+ {"email.platform.ways_out", "internal/console/plancaps_copy.go", "To stay within the plan, move the account to a bigger plan or clean it up.\n\nSee its usage:\n carlos platform customers show --platform %s --customer %s\n\nChange its plan:\n carlos platform customers update --platform %s --customer %s --plan <plan>"},
+ {"audit.grant", "internal/console/platform_copy.go", "made this a platform account: up to %d customer accounts, plans %s, new ones on %s. reason: %s"},
+ {"audit.grant_no_plans", "internal/console/platform_copy.go", "made this a platform account: up to %d customer accounts. reason: %s"},
+ {"audit.revoke", "internal/console/platform_copy.go", "turned off platform access. Credentials stopped: %d. Reason: %s"},
+ {"audit.customer_create", "internal/console/platform_copy.go", "created customer account %s (%s)"},
+ {"audit.customer_created_by", "internal/console/platform_copy.go", "created by platform account %s"},
+ {"audit.customer_rename", "internal/console/platform_copy.go", "renamed customer account %s to %s"},
+ {"audit.customer_plan", "internal/console/platform_copy.go", "moved customer account %s to the %s plan"},
+ {"audit.credential_publish", "internal/console/platform_copy.go", "minted a publish credential for %s (%s), valid until %s"},
+ {"audit.credential_deploy", "internal/console/platform_copy.go", "minted a deploy credential for app %s in %s (%s), valid until %s"},
+ {"NeedsConsole", "platform_copy.go", "carlos %s works through a console, and this shell is in direct bucket mode\n(CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR is set).\nunset the store env, then run carlos auth login --console <url> or set CARLOS_SERVICE_TOKEN"},
+ {"FlagAccount", "platform_copy.go", "platform account sqid to show or change"},
+ {"FlagGrant", "platform_copy.go", "make the account a platform account, or change its grant"},
+ {"FlagRevoke", "platform_copy.go", "turn the account’s platform access off"},
+ {"FlagMaxCustomers", "platform_copy.go", "how many customer accounts it may have"},
+ {"FlagPlans", "platform_copy.go", "plans its customer accounts may be on, comma-separated"},
+ {"FlagDefaultPlan", "platform_copy.go", "the plan new customer accounts start on"},
+ {"FlagReason", "platform_copy.go", "why. it is kept with the change"},
+ {"FlagPlatform", "platform_copy.go", "your platform account’s sqid"},
+ {"FlagCustomer", "platform_copy.go", "the customer account’s sqid"},
+ {"FlagRef", "platform_copy.go", "your own id for the customer, instead of --customer"},
+ {"FlagName", "platform_copy.go", "the customer account’s name"},
+ {"FlagPlan", "platform_copy.go", "plan to put the account on"},
+ {"FlagRole", "platform_copy.go", "publish (the whole account) or deploy (one app)"},
+ {"FlagApp", "platform_copy.go", "the app a deploy credential is for"},
+ {"FlagRungs", "platform_copy.go", "the rungs a deploy credential may move, comma-separated"},
+ {"FlagTTL", "platform_copy.go", "how long the credential works, 1m to 24h"},
+ {"FlagJSON", "platform_copy.go", "print JSON for scripts"},
+ {"GrantAndRevoke", "platform_copy.go", "--grant and --revoke can’t be used together"},
+ {"GrantFlagsAlone", "platform_copy.go", "--max-customers, --plans and --default-plan go with --grant"},
+ {"ReasonRequired", "platform_copy.go", "--reason is required"},
+ {"ReasonAlone", "platform_copy.go", "--reason goes with --grant or --revoke"},
+ {"Usage", "platform_copy.go", "show or change an account’s platform grant (deployment operators)"},
+ {"OneHandle", "platform_copy.go", "pass --customer or --ref, not both"},
+ {"NoHandle", "platform_copy.go", "pass --customer or --ref"},
+ {"NoRef", "platform_copy.go", "no customer account has the reference %s"},
+ {"IsPlatform", "platform_copy.go", "%s is a platform account"},
+ {"NotPlatform", "platform_copy.go", "%s isn’t a platform account"},
+ {"LabelStatus", "platform_copy.go", "status"},
+ {"ValueOn", "platform_copy.go", "on"},
+ {"ValueOff", "platform_copy.go", "off"},
+ {"LabelCustomers", "platform_copy.go", "customers"},
+ {"ValueCustomers", "platform_copy.go", "%d of %d"},
+ {"LabelPlans", "platform_copy.go", "customer plans"},
+ {"LabelDefault", "platform_copy.go", "default plan"},
+ {"LabelGrantedBy", "platform_copy.go", "granted by"},
+ {"LabelTurnedOffBy", "platform_copy.go", "turned off by"},
+ {"ValueByOn", "platform_copy.go", "%s on %s"},
+ {"LabelReason", "platform_copy.go", "reason"},
+ {"Granted", "platform_copy.go", "%s is now a platform account"},
+ {"Revoked", "platform_copy.go", "turned off platform access for %s. credentials that stopped working: %d"},
+ {"ListHeading", "platform_copy.go", "%d of %d customer accounts"},
+ {"ListOver", "platform_copy.go", ", %d over a limit"},
+ {"ListNear", "platform_copy.go", ", %d near a limit"},
+ {"ListEmpty", "platform_copy.go", "no customer accounts yet. create one with carlos platform customers create"},
+ {"ColAccount", "platform_copy.go", "ACCOUNT"},
+ {"ColName", "platform_copy.go", "NAME"},
+ {"ColRef", "platform_copy.go", "REF"},
+ {"ColPlan", "platform_copy.go", "PLAN"},
+ {"ColOwned", "platform_copy.go", "CLAIMED"},
+ {"ColUsage", "platform_copy.go", "USAGE"},
+ {"Yes", "platform_copy.go", "yes"},
+ {"No", "platform_copy.go", "no"},
+ {"UsageOK", "platform_copy.go", "ok"},
+ {"UsageNear", "platform_copy.go", "near: %s"},
+ {"UsageOver", "platform_copy.go", "over: %s"},
+ {"ShowHeading", "platform_copy.go", "%s (%s)"},
+ {"ShowOK", "platform_copy.go", "%s (%s) is within its limits"},
+ {"ShowNear", "platform_copy.go", "%s (%s) is near a limit"},
+ {"ShowOver", "platform_copy.go", "%s (%s) is over a limit"},
+ {"LabelRef", "platform_copy.go", "ref"},
+ {"LabelPlan", "platform_copy.go", "plan"},
+ {"LabelOwned", "platform_copy.go", "claimed"},
+ {"LabelCreated", "platform_copy.go", "created"},
+ {"UsageHeading", "platform_copy.go", "usage"},
+ {"UsageRow", "platform_copy.go", "%s of %s"},
+ {"UsageNearLimit", "platform_copy.go", "near the limit"},
+ {"UsageOverLimit", "platform_copy.go", "over, grace until %s"},
+ {"CapPDF", "platform_copy.go", "PDFs a month"},
+ {"Created", "platform_copy.go", "created %s (%s) on the %s plan"},
+ {"CreatedNoPlan", "platform_copy.go", "created %s (%s)"},
+ {"Exists", "platform_copy.go", "%s (%s) already exists for reference %s"},
+ {"Renamed", "platform_copy.go", "%s (%s) is now called %s"},
+ {"Replanned", "platform_copy.go", "%s (%s) is now on the %s plan"},
+ {"MintedPublish", "platform_copy.go", "minted a publish credential for %s (%s)"},
+ {"MintedDeploy", "platform_copy.go", "minted a deploy credential for app %s in %s (%s)"},
+ {"LabelValidUntil", "platform_copy.go", "valid until"},
+ {"MintedToken", "platform_copy.go", "token"},
+ {"MintedUse", "platform_copy.go", "use it as CARLOS_SERVICE_TOKEN with --account %s"},
+ {"FlagCreateRef", "platform_copy.go", "your own id for the customer. pass it so a retried create returns the same account"},
+ {"CreateRetry", "platform_copy.go", "a create retried without --ref can make a second account.\npass --ref so a retried create returns the same account"},
+ {"SqidRequired", "platform_copy.go", "%s requires an account sqid"},
+ {"SqidInvalid", "platform_copy.go", "%s %q is not an account sqid"},
+ {"HelpLine", "platform_copy.go", "customer accounts a platform runs: customers | credentials"},
+ {"PlatformHostUnreadable", "platform_copy.go", "platform host: unreadable response: %w"},
+ {"cliPlanCopySourcePlatform", "accounts_plan_copy.go", "set by its platform account: %s"},
+ {"docs.accounts_platform", "docs/site/cli.md", "Shows an account’s platform grant, or changes it. A platform account can create customer accounts and deploy into them for its own customers. It is a deployment-operator command."},
+ {"docs.accounts_platform.revoke", "docs/site/cli.md", "Turning platform access off stops the platform’s credentials at once. Its customers’ sites keep serving."},
+ {"docs.platform", "docs/site/cli.md", "Runs customer accounts from a platform account: `customers` creates and manages them, and `credentials` mints a credential for deploying into one."},
+ {"docs.platform_customers", "docs/site/cli.md", "Creates and manages the customer accounts a platform account runs. Each customer account is a full account of its own, with nobody signed in to it."},
+ {"docs.platform_customers.ref", "docs/site/cli.md", "`--ref` is your own id for the customer. Creating again with the same ref returns the same account."},
+ {"docs.platform_customers_retry", "docs/site/cli.md", "Without `--ref`, a create retried after a timeout can make a second account, so pass `--ref` when your server retries."},
+ {"docs.platform_credentials", "docs/site/cli.md", "Mints a short-lived credential for one customer account, for deploying into it."},
+ {"docs.platform_credentials.ttl", "docs/site/cli.md", "It lasts an hour unless you pass `--ttl`, up to 24 hours. It works only in that one account, and stops working when the platform’s access is turned off. Use it as `CARLOS_SERVICE_TOKEN`."},
+ }
+ for _, row := range rows {
+ t.Run(row.key, func(t *testing.T) {
+ body, err := os.ReadFile(row.path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if strings.HasSuffix(row.path, ".md") {
+ if !strings.Contains(string(body), row.want) {
+ t.Errorf("%s: missing approved sentence %q", row.path, row.want)
+ }
+ return
+ }
+ if !goLiteralMatches(body, func(s string) bool { return s == row.want }) {
+ t.Errorf("%s: missing approved string %q", row.path, row.want)
+ }
+ })
+ }
+}
diff --git a/docs/superpowers/plans/2026-11-19-platform-accounts-1-platform-layer.md b/docs/superpowers/plans/2026-11-19-platform-accounts-1-platform-layer.md
index 79c1bfbeb..fcb07023f 100644
--- a/docs/superpowers/plans/2026-11-19-platform-accounts-1-platform-layer.md
+++ b/docs/superpowers/plans/2026-11-19-platform-accounts-1-platform-layer.md
@@ -208,6 +208,12 @@ minted a publish credential for shop (bdf)
valid until 19 November 2026 15:04 UTC
token <the secret>
use it as CARLOS_SERVICE_TOKEN with --account bdf
+
+$ carlos platform credentials mint --platform bcd --customer bdf --role deploy --app site --rungs edge
+minted a deploy credential for app site in shop (bdf)
+ valid until 19 November 2026 15:04 UTC
+ token <the secret>
+use it as CARLOS_SERVICE_TOKEN with --account bdf
```
Rules the mocks carry: in each block or table, every column but the last is padded to its longest value plus two spaces (a `tabwriter` with padding 2), so a usage section aligns on its own. The status block shows "granted by" and its reason while the grant is on, and "turned off by" and the revoke's reason (not the grant's) once it is off. A customer with no ref has no `ref` line in `show` and `-` in the list. The list heading appends `ListOver` then `ListNear`, each only when its count is non-zero. `show`'s heading is `ShowOver` if any usage row is over, else `ShowNear` if any is near, else `ShowOK`; a customer with no plan gets the bare `ShowHeading`. The list's USAGE word uses the same worst-cap rule.
@@ -1006,7 +1012,7 @@ func TestPlatformCustomersListEmpty(t *testing.T)
func TestPlatformCustomersRefLookup(t *testing.T) // show --ref 4812 -> GET ?ref=4812 then GET .../customers/bdf; unknown ref -> cliPlatformCopyNoRef
func TestPlatformCustomerFlagsNeedExactlyOneHandle(t *testing.T)
func TestPlatformCredentialsMintJSON(t *testing.T) // --json output parses; token and name fields equal the fake's (pre-flight C5)
-func TestPlatformCredentialsMintPrints(t *testing.T) // human output: cliPlatformCopyMinted with the reply's name and account, as the Task 1 mock
+func TestPlatformCredentialsMintPrints(t *testing.T) // human output: cliPlatformCopyMintedPublish (MintedDeploy for a deploy credential) with the reply's name and account, as the Task 1 mocks
func TestPlatformCredentialsMintSendsTTL(t *testing.T) // --ttl 2h -> ttl_seconds 7200
func TestPlatformCommandsNeedAConsole(t *testing.T) // CARLOS_DEPLOYMENT_DIR set -> cliPlatformCopyNeedsConsole
```
@@ -1183,11 +1189,11 @@ git commit -m "witness: a platform deploys a customer's static site end to end"
- Modify: `internal/console/platform_copy.go`, `platform_copy.go`, `accounts_plan_copy.go`, `internal/console/billingpage_copy.go`, `internal/console/plancaps_copy.go`, `internal/console/domainbuy_copy.go`, `docs/site/cli.md`
- Create: `approved_platform_accounts_copy_test.go`, the census overlay and card `make census-propose` writes
-- [ ] **Step 1: Copy review.** Run the `copy-review` skill over the copy table below, rendered in the layouts it ships in (the Task 1 mocks, the email body, the browser flashes). Apply the edits verbatim to the copy files and to this table. Expected: every row approved; no string in the diff that is not in the table (`git diff main -- '*.go' | grep '^+.*"' ` read by hand against the table).
-- [ ] **Step 2: Pin the approved copy.** `approved_platform_accounts_copy_test.go` in the shape of `approved_domains_buy_copy_test.go`: one row per table id, its file, and the approved text. Run `go test . -run TestApprovedPlatformAccountsCopy -count=1`. Expected: PASS.
-- [ ] **Step 3: Census.** `make census-card`, write CLAIMS for each changed unit in scope (`internal/domains/mint.go`, `internal/svcrole/svcrole.go`, root package files: new commands, the deploy fallback; no unit gains a root read), then `make census-propose NAME=platform-accounts-1 CLAIMS=<file>`. Expected: the proposal writes its overlay and card and reports the census clean. The reviewer's verdict is part of branch review.
-- [ ] **Step 4: Ratchet and generated files.** `make code-health` (expect PASS; then `make code-health-record` to lower the record for `(*Store).migrate`), `make parity-doc` (expect no diff after), `gofmt -l .` (expect empty).
-- [ ] **Step 5: Targeted run over everything this branch touched:** `go test ./internal/domains/ ./internal/svcrole/ -count=1`; `go test ./internal/console/ -run 'Platform|Customer|Linked|Materialize|ClosedDoor|EveryCLIDoor|NoRoleReaches|ServiceCreate|CLIPrincipal|DeleteAccount|BillingHold|PlanNotice|DomainBuy|FreeAccount|PublishCredential' -count=1`; `go test . -run '^Test(Platform|AccountsPlatform|AccountsPlan|MintPlatformHost|ApprovedPlatform|CLIProjection)' -count=1` (anchored, so no `TestE2E...` test runs locally; pre-flight C8); `go test ./internal/parity/ ./internal/docsite/ -count=1`. Expected: PASS.
+- [x] **Step 1: Copy review.** (Done as a delegated Luna pass + Paul 2026-11-19, not the skill; see the copy table.) Run the `copy-review` skill over the copy table below, rendered in the layouts it ships in (the Task 1 mocks, the email body, the browser flashes). Apply the edits verbatim to the copy files and to this table. Expected: every row approved; no string in the diff that is not in the table (`git diff main -- '*.go' | grep '^+.*"' ` read by hand against the table).
+- [x] **Step 2: Pin the approved copy.** `approved_platform_accounts_copy_test.go` in the shape of `approved_domains_buy_copy_test.go`: one row per table id, its file, and the approved text. Run `go test . -run TestApprovedPlatformAccountsCopy -count=1`. Expected: PASS.
+- [x] **Step 3: Census.** (Run under NAME=design-platform-accounts with empty CLAIMS, as the CI fix first did: no unit changed, three envelopes re-pinned.) `make census-card`, write CLAIMS for each changed unit in scope (`internal/domains/mint.go`, `internal/svcrole/svcrole.go`, root package files: new commands, the deploy fallback; no unit gains a root read), then `make census-propose NAME=platform-accounts-1 CLAIMS=<file>`. Expected: the proposal writes its overlay and card and reports the census clean. The reviewer's verdict is part of branch review.
+- [x] **Step 4: Ratchet and generated files.** `make code-health` (expect PASS; then `make code-health-record` to lower the record for `(*Store).migrate`), `make parity-doc` (expect no diff after), `gofmt -l .` (expect empty).
+- [x] **Step 5: Targeted run over everything this branch touched:** `go test ./internal/domains/ ./internal/svcrole/ -count=1`; `go test ./internal/console/ -run 'Platform|Customer|Linked|Materialize|ClosedDoor|EveryCLIDoor|NoRoleReaches|ServiceCreate|CLIPrincipal|DeleteAccount|BillingHold|PlanNotice|DomainBuy|FreeAccount|PublishCredential' -count=1`; `go test . -run '^Test(Platform|AccountsPlatform|AccountsPlan|MintPlatformHost|ApprovedPlatform|CLIProjection)' -count=1` (anchored, so no `TestE2E...` test runs locally; pre-flight C8); `go test ./internal/parity/ ./internal/docsite/ -count=1`. Expected: PASS.
- [ ] **Step 6: Commit**
```bash
@@ -1208,179 +1214,186 @@ Not part of the branch. Dev first, per the roll recipe; nothing on the flagship
---
-## Copy table (pending copy review)
+## Copy table (approved: Luna pass + Paul 2026-11-19)
-Every row is pending copy review (Task 15). `%s`/`%d` are filled as named. CLI errors are lowercase with no closing full stop, as the existing `cli.*` copy is; browser and email copy is sentence case. Apostrophes are curly. Examples use neutral names only.
+Every row is approved: Luna pass + Paul 2026-11-19 (Task 15; the pass is `docs/superpowers/plans/LUNA-COPY-RESULT-PLATFORM-ACCOUNTS-1.md`, approved as written except for the four rows Paul changed, named below). `approved_platform_accounts_copy_test.go` pins every row. `%s`/`%d` are filled as named. CLI errors are lowercase with no closing full stop, as the existing `cli.*` copy is; browser and email copy is sentence case. Apostrophes are curly. Examples use neutral names only.
**Console, JSON errors the CLI prints** (`internal/console/platform_copy.go`, map `platformCopy`)
-| id | text |
-|---|---|
-| grant.ops | the ops account can’t be a platform account |
-| grant.linked | a customer account can’t be a platform account |
-| grant.reason | --reason is required |
-| grant.max | --max-customers must be a whole number from 1 to 10000 |
-| grant.plans | --plans must name plans in this console’s catalog, and --default-plan must be one of them |
-| grant.no_catalog | this console has no plan catalog, so a grant can’t name plans |
-| grant.not_platform | this account isn’t a platform account |
-| grant.failed | could not save the grant. try again |
-| door.not_platform | this account isn’t a platform account. an operator can make it one with carlos accounts platform |
-| door.revoked | this account’s platform access is turned off. ask the operator who granted it |
-| door.not_owner | only an owner of this account can manage its customer accounts |
-| door.rate | too many requests. wait a minute and try again |
-| create.name | an account name appears in URLs and --account: 1-63 characters of a-z, 0-9 and hyphen, no leading or trailing hyphen |
-| create.ref | a customer reference is 1 to 64 letters, digits, dots, colons, hyphens or underscores |
-| create.plan | this platform can put customer accounts on these plans: %s |
-| create.no_catalog_plan | this console has no plan catalog, so leave out the plan |
-| create.cap | this platform has %d customer accounts, the most its grant allows. ask the operator for more |
-| create.rate | too many customer accounts were created today. try again tomorrow, or ask the operator |
-| create.failed | could not create the customer account. try again |
-| update.empty | nothing to change. pass a new name, a new plan, or both |
-| update.operator_plan | an operator set this account’s plan. ask them to change it |
-| update.failed | could not change the customer account. try again |
-| cred.role | a customer credential is publish for the whole account, or deploy for one app with its rungs |
-| cred.ttl | a customer credential lasts from 1 minute to 24 hours |
-| cred.failed | could not mint the credential. try again |
-| host.not_static | channel %s serves %s, which isn’t a static site, so it can’t be given a static host |
-| svc.platform_app | a platform credential works for the whole platform account, so it takes no --app |
-| svc.not_platform | only a platform account can hold a platform credential. an operator grants that with carlos accounts platform |
+| id | text | status |
+|---|---|---|
+| grant.ops | the ops account can’t be a platform account | approved |
+| grant.linked | a customer account can’t be a platform account | approved |
+| grant.reason | --reason is required | approved |
+| grant.max | --max-customers must be a whole number from 1 to 10000 | approved |
+| grant.plans | --plans must name plans in this console’s catalog, and --default-plan must be one of them | approved |
+| grant.no_catalog | this console has no plan catalog, so a grant can’t name plans | approved |
+| grant.not_platform | this account isn’t a platform account | approved |
+| grant.failed | could not save the grant. try again | approved |
+| door.not_platform | this account isn’t a platform account. an operator can make it one with carlos accounts platform | approved |
+| door.revoked | this account’s platform access is turned off. ask the operator who granted it | approved |
+| door.not_owner | only an owner of this account can manage its customer accounts | approved |
+| door.rate | too many requests. wait a minute and try again | approved |
+| list.failed | Couldn’t read the customer accounts. Try again in a moment. | approved |
+| show.failed | Couldn’t read that customer account. Try again in a moment. | approved |
+| create.name | an account name appears in URLs and --account: 1-63 characters of a-z, 0-9 and hyphen, no leading or trailing hyphen | approved |
+| create.ref | a customer reference is 1 to 64 letters, digits, dots, colons, hyphens or underscores | approved |
+| create.plan | this platform can put customer accounts on these plans: %s | approved |
+| create.no_catalog_plan | this console has no plan catalog, so leave out the plan | approved |
+| create.cap | this platform has %d customer accounts, the most its grant allows. ask the operator for more | approved |
+| create.rate | too many customer accounts were created today. try again tomorrow, or ask the operator | approved |
+| create.failed | could not create the customer account. try again | approved |
+| update.empty | nothing to change. pass a new name, a new plan, or both | approved |
+| update.operator_plan | an operator set this account’s plan. ask them to change it | approved |
+| update.failed | could not change the customer account. try again | approved |
+| cred.role | a customer credential is publish for the whole account, or deploy for one app with its rungs | approved |
+| cred.ttl | a customer credential lasts from 1 minute to 24 hours | approved |
+| cred.failed | could not mint the credential. try again | approved |
+| host.not_static | channel %s serves %s, which isn’t a static site, so it can’t be given a static host | approved |
+| svc.platform_app | a platform credential works for the whole platform account, so it takes no --app | approved |
+| svc.not_platform | only a platform account can hold a platform credential. an operator grants that with carlos accounts platform | approved |
**Console, browser and shared** (file named per row)
-| id | file | text |
-|---|---|---|
-| billing notice.platform | billingpage_copy.go | Your plan is managed by %s. |
-| billing notice.platform_generic | billingpage_copy.go | This account’s plan is managed by the platform account that runs it. |
-| domainbuy platform | domainbuy_copy.go | buying a domain isn’t available on an account run by %s. attach a domain registered elsewhere instead |
-| delete.platform_has_customers | platform_copy.go | This account runs %d customer accounts, so it can’t be deleted. |
-| delete.linked | platform_copy.go | This account is run by %s. Ask them to delete it. |
+| id | file | text | status |
+|---|---|---|---|
+| billing notice.platform | billingpage_copy.go | Your plan is managed by %s. | approved |
+| billing notice.platform_generic | billingpage_copy.go | This account’s plan is managed by the platform account that runs it. | approved |
+| domainbuy platform | domainbuy_copy.go | buying a domain isn’t available on an account run by %s. attach a domain registered elsewhere instead | approved |
+| delete.platform_has_customers | platform_copy.go | This account still has customer accounts linked to it, so it can’t be deleted. | approved |
+| delete.linked | platform_copy.go | This account is run by %s. Ask them to delete it. | approved |
**Email to a platform's owners** (`plancaps_copy.go`, `planNoticeCopy`; the per-cap lines reuse the approved `email.warn`, `email.over`, `email.lapse_grace`, `email.lapse_off`)
-| id | text |
-|---|---|
-| email.platform.subject | [carlos] Customer account %s (%s): plan usage |
-| email.platform.intro | Customer account %s (%s), run by %s, is near or over its plan limits: |
-| email.platform.lapse_off_list | Turned off: %s. |
-| email.platform.ways_out | To stay within the plan, move the account to a bigger plan or clean it up.\n\nSee its usage:\n carlos platform customers show --platform %s --customer %s\n\nChange its plan:\n carlos platform customers update --platform %s --customer %s --plan <plan> |
+| id | text | status |
+|---|---|---|
+| email.platform.subject | [carlos] Customer account %s (%s): plan usage | approved |
+| email.platform.intro | Customer account %s (%s), run by %s, is near or over its plan limits: | approved |
+| email.platform.lapse_grace | - %s. On %s, anything not covered is turned off. Apps, instances and workers go newest first. Custom domains are all turned off when the plan does not include them. Settings and data are kept. | approved |
+| email.platform.lapse_off_list | Turned off: %s. | approved |
+| email.platform.ways_out | To stay within the plan, move the account to a bigger plan or clean it up.\n\nSee its usage:\n carlos platform customers show --platform %s --customer %s\n\nChange its plan:\n carlos platform customers update --platform %s --customer %s --plan <plan> | approved |
**Audit details** (shown in account history; `platform_copy.go`)
-| id | text |
-|---|---|
-| audit.grant | made this a platform account: up to %d customer accounts, plans %s, new ones on %s. reason: %s |
-| audit.grant_no_plans | made this a platform account: up to %d customer accounts. reason: %s |
-| audit.revoke | turned off platform access, %d credentials stopped working. reason: %s |
-| audit.customer_create | created customer account %s (%s) |
-| audit.customer_created_by | created by platform account %s |
-| audit.customer_rename | renamed customer account %s to %s |
-| audit.customer_plan | moved customer account %s to the %s plan |
-| audit.credential | minted a %s credential for %s, valid until %s |
+| id | text | status |
+|---|---|---|
+| audit.grant | made this a platform account: up to %d customer accounts, plans %s, new ones on %s. reason: %s | approved |
+| audit.grant_no_plans | made this a platform account: up to %d customer accounts. reason: %s | approved |
+| audit.revoke | turned off platform access. Credentials stopped: %d. Reason: %s | approved |
+| audit.customer_create | created customer account %s (%s) | approved |
+| audit.customer_created_by | created by platform account %s | approved |
+| audit.customer_rename | renamed customer account %s to %s | approved |
+| audit.customer_plan | moved customer account %s to the %s plan | approved |
+| audit.credential_publish | minted a publish credential for %s (%s), valid until %s | approved |
+| audit.credential_deploy | minted a deploy credential for app %s in %s (%s), valid until %s | approved |
`audit.grant_no_plans` is the grant's audit line on a console with no plan catalog, where a grant has no plans (pre-flight C17).
**CLI** (`platform_copy.go`, constants `cliPlatformCopy*`)
-| id | text |
-|---|---|
-| NeedsConsole | carlos %s works through a console, and this shell is in direct bucket mode\n(CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR is set).\nunset the store env, then run carlos auth login --console <url> or set CARLOS_SERVICE_TOKEN |
-| FlagAccount | platform account sqid to show or change |
-| FlagGrant | make the account a platform account, or change its grant |
-| FlagRevoke | turn the account’s platform access off |
-| FlagMaxCustomers | how many customer accounts it may have |
-| FlagPlans | plans its customer accounts may be on, comma-separated |
-| FlagDefaultPlan | the plan new customer accounts start on |
-| FlagReason | why. it is kept with the change |
-| FlagPlatform | your platform account’s sqid |
-| FlagCustomer | the customer account’s sqid |
-| FlagRef | your own id for the customer, instead of --customer |
-| FlagName | the customer account’s name |
-| FlagPlan | plan to put the account on |
-| FlagRole | publish (the whole account) or deploy (one app) |
-| FlagApp | the app a deploy credential is for |
-| FlagRungs | the rungs a deploy credential may move, comma-separated |
-| FlagTTL | how long the credential works, 1m to 24h |
-| FlagJSON | print JSON for scripts |
-| GrantAndRevoke | --grant and --revoke can’t be used together |
-| GrantFlagsAlone | --max-customers, --plans and --default-plan go with --grant |
-| ReasonRequired | --reason is required |
-| ReasonAlone | --reason goes with --grant or --revoke |
-| Usage | show or change an account’s platform grant (deployment operators) |
-| OneHandle | pass --customer or --ref, not both |
-| NoHandle | pass --customer or --ref |
-| NoRef | no customer account has the reference %s |
-| IsPlatform | %s is a platform account |
-| NotPlatform | %s isn’t a platform account |
-| LabelStatus | status |
-| ValueOn | on |
-| ValueOff | off |
-| LabelCustomers | customers |
-| ValueCustomers | %d of %d |
-| LabelPlans | customer plans |
-| LabelDefault | default plan |
-| LabelGrantedBy | granted by |
-| LabelTurnedOffBy | turned off by |
-| ValueByOn | %s on %s |
-| LabelReason | reason |
-| Granted | %s is now a platform account |
-| Revoked | turned off platform access for %s. credentials that stopped working: %d |
-| ListHeading | %d of %d customer accounts |
-| ListOver | , %d over a limit |
-| ListNear | , %d near a limit |
-| ListEmpty | no customer accounts yet. create one with carlos platform customers create |
-| ColAccount / ColName / ColRef / ColPlan / ColOwned / ColUsage | ACCOUNT / NAME / REF / PLAN / CLAIMED / USAGE |
-| Yes / No | yes / no |
-| UsageOK | ok |
-| UsageNear | near: %s |
-| UsageOver | over: %s |
-| ShowHeading | %s (%s) |
-| ShowOK | %s (%s) is within its limits |
-| ShowNear | %s (%s) is near a limit |
-| ShowOver | %s (%s) is over a limit |
-| LabelRef / LabelPlan / LabelOwned / LabelCreated | ref / plan / claimed / created |
-| UsageHeading | usage |
-| UsageRow | %s of %s |
-| UsageNearLimit | near the limit |
-| UsageOverLimit | over, grace until %s |
-| CapPDF | PDFs a month |
-| Created | created %s (%s) on the %s plan |
-| CreatedNoPlan | created %s (%s) |
-| Exists | %s (%s) already exists for reference %s |
-| Renamed | %s (%s) is now called %s |
-| Replanned | %s (%s) is now on the %s plan |
-| Minted | minted a %s credential for %s (%s) |
-| LabelValidUntil | valid until |
-| MintedToken | token |
-| MintedUse | use it as CARLOS_SERVICE_TOKEN with --account %s |
-| FlagCreateRef | your own id for the customer. pass it so a retried create returns the same account |
-| CreateRetry | a create retried without --ref can make a second account.\npass --ref so a retried create returns the same account |
-| SqidRequired | %s requires an account sqid |
-| SqidInvalid | %s %q is not an account sqid |
-| HelpLine | customer accounts a platform runs: customers \| credentials |
-| PlatformHostUnreadable | platform host: unreadable response: %w |
-| accounts plan: cliPlanCopySourcePlatform | set by its platform account: %s (lives in `accounts_plan_copy.go` with the other `cliPlanCopy*` constants; pre-flight C6) |
+| id | text | status |
+|---|---|---|
+| NeedsConsole | carlos %s works through a console, and this shell is in direct bucket mode\n(CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR is set).\nunset the store env, then run carlos auth login --console <url> or set CARLOS_SERVICE_TOKEN | approved |
+| FlagAccount | platform account sqid to show or change | approved |
+| FlagGrant | make the account a platform account, or change its grant | approved |
+| FlagRevoke | turn the account’s platform access off | approved |
+| FlagMaxCustomers | how many customer accounts it may have | approved |
+| FlagPlans | plans its customer accounts may be on, comma-separated | approved |
+| FlagDefaultPlan | the plan new customer accounts start on | approved |
+| FlagReason | why. it is kept with the change | approved |
+| FlagPlatform | your platform account’s sqid | approved |
+| FlagCustomer | the customer account’s sqid | approved |
+| FlagRef | your own id for the customer, instead of --customer | approved |
+| FlagName | the customer account’s name | approved |
+| FlagPlan | plan to put the account on | approved |
+| FlagRole | publish (the whole account) or deploy (one app) | approved |
+| FlagApp | the app a deploy credential is for | approved |
+| FlagRungs | the rungs a deploy credential may move, comma-separated | approved |
+| FlagTTL | how long the credential works, 1m to 24h | approved |
+| FlagJSON | print JSON for scripts | approved |
+| GrantAndRevoke | --grant and --revoke can’t be used together | approved |
+| GrantFlagsAlone | --max-customers, --plans and --default-plan go with --grant | approved |
+| ReasonRequired | --reason is required | approved |
+| ReasonAlone | --reason goes with --grant or --revoke | approved |
+| Usage | show or change an account’s platform grant (deployment operators) | approved |
+| OneHandle | pass --customer or --ref, not both | approved |
+| NoHandle | pass --customer or --ref | approved |
+| NoRef | no customer account has the reference %s | approved |
+| IsPlatform | %s is a platform account | approved |
+| NotPlatform | %s isn’t a platform account | approved |
+| LabelStatus | status | approved |
+| ValueOn | on | approved |
+| ValueOff | off | approved |
+| LabelCustomers | customers | approved |
+| ValueCustomers | %d of %d | approved |
+| LabelPlans | customer plans | approved |
+| LabelDefault | default plan | approved |
+| LabelGrantedBy | granted by | approved |
+| LabelTurnedOffBy | turned off by | approved |
+| ValueByOn | %s on %s | approved |
+| LabelReason | reason | approved |
+| Granted | %s is now a platform account | approved |
+| Revoked | turned off platform access for %s. credentials that stopped working: %d | approved |
+| ListHeading | %d of %d customer accounts | approved |
+| ListOver | , %d over a limit | approved |
+| ListNear | , %d near a limit | approved |
+| ListEmpty | no customer accounts yet. create one with carlos platform customers create | approved |
+| ColAccount / ColName / ColRef / ColPlan / ColOwned / ColUsage | ACCOUNT / NAME / REF / PLAN / CLAIMED / USAGE | approved |
+| Yes / No | yes / no | approved |
+| UsageOK | ok | approved |
+| UsageNear | near: %s | approved |
+| UsageOver | over: %s | approved |
+| ShowHeading | %s (%s) | approved |
+| ShowOK | %s (%s) is within its limits | approved |
+| ShowNear | %s (%s) is near a limit | approved |
+| ShowOver | %s (%s) is over a limit | approved |
+| LabelRef / LabelPlan / LabelOwned / LabelCreated | ref / plan / claimed / created | approved |
+| UsageHeading | usage | approved |
+| UsageRow | %s of %s | approved |
+| UsageNearLimit | near the limit | approved |
+| UsageOverLimit | over, grace until %s | approved |
+| CapPDF | PDFs a month | approved |
+| Created | created %s (%s) on the %s plan | approved |
+| CreatedNoPlan | created %s (%s) | approved |
+| Exists | %s (%s) already exists for reference %s | approved |
+| Renamed | %s (%s) is now called %s | approved |
+| Replanned | %s (%s) is now on the %s plan | approved |
+| MintedPublish | minted a publish credential for %s (%s) | approved |
+| MintedDeploy | minted a deploy credential for app %s in %s (%s) | approved |
+| LabelValidUntil | valid until | approved |
+| MintedToken | token | approved |
+| MintedUse | use it as CARLOS_SERVICE_TOKEN with --account %s | approved |
+| FlagCreateRef | your own id for the customer. pass it so a retried create returns the same account | approved |
+| CreateRetry | a create retried without --ref can make a second account.\npass --ref so a retried create returns the same account | approved |
+| SqidRequired | %s requires an account sqid | approved |
+| SqidInvalid | %s %q is not an account sqid | approved |
+| HelpLine | customer accounts a platform runs: customers \| credentials | approved |
+| PlatformHostUnreadable | platform host: unreadable response: %w | approved |
+| accounts plan: cliPlanCopySourcePlatform | set by its platform account: %s (lives in `accounts_plan_copy.go` with the other `cliPlanCopy*` constants; pre-flight C6) | approved |
A grant with no plans (no plan catalog) prints no `LabelPlans` or `LabelDefault` line in `carlos accounts platform`; a customer with no plan gets `CreatedNoPlan`, no PLAN or USAGE column, and the bare `ShowHeading` with no `plan` line or usage section. See the Task 1 no-catalog mocks (pre-flight C17).
Task 1's UX pass (2026-11-19) changed the text of `ValueByOn`, `LabelPlans`, `LabelDefault`, `Revoked`, `ListHeading`, `ColOwned`, `LabelOwned`, `UsageNear`, `UsageOver`, `UsageOverLimit`, `Minted`, `CreatedNoPlan` and `audit.grant_no_plans`, and added these rows: `LabelReason`, `ListOver`, `ListNear`, `ShowOK`, `ShowNear`, `ShowOver`, `LabelValidUntil`. The ids `ColOwned` and `LabelOwned` are kept although the words are now “claimed”. `ShowHeading` is used only for a customer with no plan. `ListOver` and `ListNear` are appended to `ListHeading` in that order, each only when its count is non-zero.
-Task 11 added, all pending copy review: `FlagCreateRef` (`--ref` on `customers create`, where it is also what makes a retry safe: create is idempotent only on the ref, Task 8), `CreateRetry` (the last lines of `carlos platform`'s usage, which is otherwise command syntax), `HelpLine` (`platform`'s line in `carlos help`, under "Your deployment" after `services`; Task 11 follow-up), and `SqidRequired`/`SqidInvalid` (the CLI's refusal of a missing or malformed `--platform` or `--customer` before anything is sent, `%s` the flag; worded as the existing `--account` refusals in `store.go`).
+Task 11 added: `FlagCreateRef` (`--ref` on `customers create`, where it is also what makes a retry safe: create is idempotent only on the ref, Task 8), `CreateRetry` (the last lines of `carlos platform`'s usage, which is otherwise command syntax), `HelpLine` (`platform`'s line in `carlos help`, under "Your deployment" after `services`; Task 11 follow-up), and `SqidRequired`/`SqidInvalid` (the CLI's refusal of a missing or malformed `--platform` or `--customer` before anything is sent, `%s` the flag; worded as the existing `--account` refusals in `store.go`).
-Task 12 also added `PlatformHostUnreadable` (pending copy review; fix round 1, Astra minor): the deploy's error when the platform-host door's answer cannot be decoded. Task 12 added `host.not_static` (pending copy review): the platform-host door's 422 for a channel whose head is a release that is not a static site, filled with the channel and that release's version. The brief listed this refusal among the door's witnesses, but the create handler has no such check for a static record (`staticHeadRefusal` refuses only an instance on a static head), so the door makes it, read-only, before delegating.
+Task 12 also added `PlatformHostUnreadable` (fix round 1, Astra minor): the deploy's error when the platform-host door's answer cannot be decoded. Task 12 added `host.not_static`: the platform-host door's 422 for a channel whose head is a release that is not a static site, filled with the channel and that release's version. The brief listed this refusal among the door's witnesses, but the create handler has no such check for a static record (`staticHeadRefusal` refuses only an instance on a static head), so the door makes it, read-only, before delegating.
-Task 6 added `ReasonRequired` (the CLI's refusal of `--grant` or `--revoke` without `--reason`, before anything is sent; the text of the console's `grant.reason`), `ReasonAlone` (its refusal of `--reason` with neither, pending copy review; Task 6 fix round 1) and `Usage` (the `platform` line in `carlos accounts`' usage).
+Task 6 added `ReasonRequired` (the CLI's refusal of `--grant` or `--revoke` without `--reason`, before anything is sent; the text of the console's `grant.reason`), `ReasonAlone` (its refusal of `--reason` with neither; Task 6 fix round 1) and `Usage` (the `platform` line in `carlos accounts`' usage).
Cap names in usage reuse the approved `cliPlanCopyLimit*` labels (apps and instances, object storage, emails a day, bandwidth a month, awake hours a month); `CapPDF` is the one new label.
**Docs** (`docs/site/cli.md`)
-| id | text |
-|---|---|
-| docs.accounts_platform | `### carlos accounts platform`, then: Shows an account’s platform grant, or changes it. A platform account can create customer accounts and deploy into them for its own customers. It is a deployment-operator command. Then the three examples: show, `--grant --max-customers 50 --plans free,personal --default-plan free --reason "agreed by email"`, `--revoke --reason "..."`. Then: "Turning platform access off stops the platform’s credentials at once. Its customers’ sites keep serving." |
-| docs.platform_customers | `### carlos platform customers`, then: Creates and manages the customer accounts a platform account runs. Each customer account is a full account of its own, with nobody signed in to it. Examples with `--platform bcd`: create `--name shop --ref 4812`, list, show `--ref 4812`, update `--customer bdf --plan personal`. Then: "`--ref` is your own id for the customer. Creating again with the same ref returns the same account." |
-| docs.platform_credentials | `### carlos platform credentials`, then: Mints a short-lived credential for one customer account, for deploying into it. Example: `carlos platform credentials mint --platform bcd --customer bdf --json`. Then: "It lasts an hour unless you pass `--ttl`, up to 24 hours. It works only in that one account, and stops working when the platform’s access is turned off. Use it as `CARLOS_SERVICE_TOKEN`." |
-| docs.platform | `### carlos platform` (required by `internal/docsite`'s one-heading-per-top-level-command gate; Task 11 added it and moved the customers and credentials headings under it to `####`), then: "Runs customer accounts from a platform account: `customers` creates and manages them, and `credentials` mints a credential for deploying into one." |
-| docs.platform_customers_retry | Appended to docs.platform_customers by Task 11: "Without `--ref`, a create retried after a timeout can make a second account, so pass `--ref` when your server retries." |
+| id | text | status |
+|---|---|---|
+| docs.accounts_platform | `### carlos accounts platform`, then: Shows an account’s platform grant, or changes it. A platform account can create customer accounts and deploy into them for its own customers. It is a deployment-operator command. Then the three examples: show, `--grant --max-customers 50 --plans free,personal --default-plan free --reason "agreed by email"`, `--revoke --reason "..."`. Then: "Turning platform access off stops the platform’s credentials at once. Its customers’ sites keep serving." | approved |
+| docs.platform_customers | `### carlos platform customers`, then: Creates and manages the customer accounts a platform account runs. Each customer account is a full account of its own, with nobody signed in to it. Examples with `--platform bcd`: create `--name shop --ref 4812`, list, show `--ref 4812`, update `--customer bdf --plan personal`. Then: "`--ref` is your own id for the customer. Creating again with the same ref returns the same account." | approved |
+| docs.platform_credentials | `### carlos platform credentials`, then: Mints a short-lived credential for one customer account, for deploying into it. Example: `carlos platform credentials mint --platform bcd --customer bdf --json`. Then: "It lasts an hour unless you pass `--ttl`, up to 24 hours. It works only in that one account, and stops working when the platform’s access is turned off. Use it as `CARLOS_SERVICE_TOKEN`." | approved |
+| docs.platform | `### carlos platform` (required by `internal/docsite`'s one-heading-per-top-level-command gate; Task 11 added it and moved the customers and credentials headings under it to `####`), then: "Runs customer accounts from a platform account: `customers` creates and manages them, and `credentials` mints a credential for deploying into one." | approved |
+| docs.platform_customers_retry | Appended to docs.platform_customers by Task 11: "Without `--ref`, a create retried after a timeout can make a second account, so pass `--ref` when your server retries." | approved |
+
+**Task 15 (copy review, Luna pass + Paul 2026-11-19).** Paul approved Luna's rows as written except four, which carry his text: `delete.platform_has_customers` (no count), `audit.revoke`, `Minted` (split into `MintedPublish` and `MintedDeploy`, with `audit.credential` split the same way into `audit.credential_publish` and `audit.credential_deploy`: publish names the customer, deploy names the app in the customer), and `email.lapse_grace` for a platform's owners (new `email.platform.lapse_grace`: the approved `email.lapse_grace` without "unless you choose what stays", which only the customer's own owners can act on; the ordinary owner email keeps `email.lapse_grace`). Task 15 also added `list.failed` and `show.failed`, the read doors' own failure rows for a store error (500), in Paul's wording.
(The docs rows describe the prose; the heading lines are fixed by `internal/docsite`. Write the paragraphs from these sentences without adding claims, and put them through the same copy review.)
diff --git a/docs/superpowers/plans/LUNA-COPY-RESULT-PLATFORM-ACCOUNTS-1.md b/docs/superpowers/plans/LUNA-COPY-RESULT-PLATFORM-ACCOUNTS-1.md
new file mode 100644
index 000000000..e251c43d1
--- /dev/null
+++ b/docs/superpowers/plans/LUNA-COPY-RESULT-PLATFORM-ACCOUNTS-1.md
@@ -0,0 +1,149 @@
+| ID | file/surface | approved text | changed? (yes/no) | note |
+|---|---|---|---|---|
+| grant.ops | internal/console/platform_copy.go | `the ops account can’t be a platform account` | no | |
+| grant.linked | internal/console/platform_copy.go | `a customer account can’t be a platform account` | no | |
+| grant.reason | internal/console/platform_copy.go | `--reason is required` | no | Direct and consistent with CLI tone. |
+| grant.max | internal/console/platform_copy.go | `--max-customers must be a whole number from 1 to 10000` | no | |
+| grant.plans | internal/console/platform_copy.go | `--plans must name plans in this console’s catalog, and --default-plan must be one of them` | no | |
+| grant.no_catalog | internal/console/platform_copy.go | `this console has no plan catalog, so a grant can’t name plans` | no | |
+| grant.not_platform | internal/console/platform_copy.go | `this account isn’t a platform account` | no | |
+| grant.failed | internal/console/platform_copy.go | `could not save the grant. try again` | no | |
+| door.not_platform | internal/console/platform_copy.go | `this account isn’t a platform account. an operator can make it one with carlos accounts platform` | no | |
+| door.revoked | internal/console/platform_copy.go | `this account’s platform access is turned off. ask the operator who granted it` | no | |
+| door.not_owner | internal/console/platform_copy.go | `only an owner of this account can manage its customer accounts` | no | |
+| door.rate | internal/console/platform_copy.go | `too many requests. wait a minute and try again` | no | |
+| create.name | internal/console/platform_copy.go | `an account name appears in URLs and --account: 1-63 characters of a-z, 0-9 and hyphen, no leading or trailing hyphen` | no | |
+| create.ref | internal/console/platform_copy.go | `a customer reference is 1 to 64 letters, digits, dots, colons, hyphens or underscores` | no | |
+| create.plan | internal/console/platform_copy.go | `this platform can put customer accounts on these plans: %s` | no | |
+| create.no_catalog_plan | internal/console/platform_copy.go | `this console has no plan catalog, so leave out the plan` | no | |
+| create.cap | internal/console/platform_copy.go | `this platform has %d customer accounts, the most its grant allows. ask the operator for more` | no | |
+| create.rate | internal/console/platform_copy.go | `too many customer accounts were created today. try again tomorrow, or ask the operator` | no | |
+| create.failed | internal/console/platform_copy.go | `could not create the customer account. try again` | no | |
+| update.empty | internal/console/platform_copy.go | `nothing to change. pass a new name, a new plan, or both` | no | |
+| update.operator_plan | internal/console/platform_copy.go | `an operator set this account’s plan. ask them to change it` | no | |
+| update.failed | internal/console/platform_copy.go | `could not change the customer account. try again` | no | |
+| cred.role | internal/console/platform_copy.go | `a customer credential is publish for the whole account, or deploy for one app with its rungs` | no | |
+| cred.ttl | internal/console/platform_copy.go | `a customer credential lasts from 1 minute to 24 hours` | no | |
+| cred.failed | internal/console/platform_copy.go | `could not mint the credential. try again` | no | |
+| host.not_static | internal/console/platform_copy.go | `channel %s serves %s, which isn’t a static site, so it can’t be given a static host` | no | |
+| svc.platform_app | internal/console/platform_copy.go | `a platform credential works for the whole platform account, so it takes no --app` | no | |
+| svc.not_platform | internal/console/platform_copy.go | `only a platform account can hold a platform credential. an operator grants that with carlos accounts platform` | no | |
+| billing notice.platform | internal/console/billingpage_copy.go | `Your plan is managed by %s.` | no | |
+| billing notice.platform_generic | internal/console/billingpage_copy.go | `This account’s plan is managed by the platform account that runs it.` | no | |
+| domainbuy platform | internal/console/domainbuy_copy.go | `buying a domain isn’t available on an account run by %s. attach a domain registered elsewhere instead` | no | |
+| delete.platform_has_customers | platform_copy.go | `This account has linked customer accounts (%d), so it can’t be deleted.` | yes | Count remains grammatical for one or many. |
+| delete.linked | platform_copy.go | `This account is run by %s. Ask them to delete it.` | no | |
+| email.platform.subject | internal/console/plancaps_copy.go | `[carlos] Customer account %s (%s): plan usage` | no | |
+| email.platform.intro | internal/console/plancaps_copy.go | `Customer account %s (%s), run by %s, is near or over its plan limits:` | no | |
+| email.platform.lapse_off_list | internal/console/plancaps_copy.go | `Turned off: %s.` | no | |
+| email.platform.ways_out | internal/console/plancaps_copy.go | `To stay within the plan, move the account to a bigger plan or clean it up.\n\nSee its usage:\n carlos platform customers show --platform %s --customer %s\n\nChange its plan:\n carlos platform customers update --platform %s --customer %s --plan <plan>` | no | |
+| audit.grant | internal/console/platform_copy.go | `made this a platform account: up to %d customer accounts, plans %s, new ones on %s. reason: %s` | no | |
+| audit.grant_no_plans | internal/console/platform_copy.go | `made this a platform account: up to %d customer accounts. reason: %s` | no | |
+| audit.revoke | internal/console/platform_copy.go | `turned off platform access. credentials stopped working: %d. reason: %s` | yes | Avoids singular/plural mismatch. |
+| audit.customer_create | internal/console/platform_copy.go | `created customer account %s (%s)` | no | |
+| audit.customer_created_by | internal/console/platform_copy.go | `created by platform account %s` | no | |
+| audit.customer_rename | internal/console/platform_copy.go | `renamed customer account %s to %s` | no | |
+| audit.customer_plan | internal/console/platform_copy.go | `moved customer account %s to the %s plan` | no | |
+| audit.credential | internal/console/platform_copy.go | `minted a %s credential for %s, valid until %s` | no | Caller must consistently name the target. |
+| NeedsConsole | platform_copy.go | `carlos %s works through a console, and this shell is in direct bucket mode\n(CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR is set).\nunset the store env, then run carlos auth login --console <url> or set CARLOS_SERVICE_TOKEN` | no | |
+| FlagAccount | platform_copy.go | `platform account sqid to show or change` | no | |
+| FlagGrant | platform_copy.go | `make the account a platform account, or change its grant` | no | |
+| FlagRevoke | platform_copy.go | `turn the account’s platform access off` | no | |
+| FlagMaxCustomers | platform_copy.go | `how many customer accounts it may have` | no | |
+| FlagPlans | platform_copy.go | `plans its customer accounts may be on, comma-separated` | no | |
+| FlagDefaultPlan | platform_copy.go | `the plan new customer accounts start on` | no | |
+| FlagReason | platform_copy.go | `why. it is kept with the change` | no | |
+| FlagPlatform | platform_copy.go | `your platform account’s sqid` | no | |
+| FlagCustomer | platform_copy.go | `the customer account’s sqid` | no | |
+| FlagRef | platform_copy.go | `your own id for the customer, instead of --customer` | no | |
+| FlagName | platform_copy.go | `the customer account’s name` | no | |
+| FlagPlan | platform_copy.go | `plan to put the account on` | no | |
+| FlagRole | platform_copy.go | `publish (the whole account) or deploy (one app)` | no | |
+| FlagApp | platform_copy.go | `the app a deploy credential is for` | no | |
+| FlagRungs | platform_copy.go | `the rungs a deploy credential may move, comma-separated` | no | |
+| FlagTTL | platform_copy.go | `how long the credential works, 1m to 24h` | no | |
+| FlagJSON | platform_copy.go | `print JSON for scripts` | no | |
+| GrantAndRevoke | platform_copy.go | `--grant and --revoke can’t be used together` | no | |
+| GrantFlagsAlone | platform_copy.go | `--max-customers, --plans and --default-plan go with --grant` | no | |
+| ReasonRequired | platform_copy.go | `--reason is required` | no | Direct and consistent with existing CLI errors. |
+| ReasonAlone | platform_copy.go | `--reason goes with --grant or --revoke` | no | Direct and actionable enough. |
+| Usage | platform_copy.go | `show or change an account’s platform grant (deployment operators)` | no | |
+| OneHandle | platform_copy.go | `pass --customer or --ref, not both` | no | |
+| NoHandle | platform_copy.go | `pass --customer or --ref` | no | |
+| NoRef | platform_copy.go | `no customer account has the reference %s` | no | |
+| IsPlatform | platform_copy.go | `%s is a platform account` | no | |
+| NotPlatform | platform_copy.go | `%s isn’t a platform account` | no | |
+| LabelStatus | platform_copy.go | `status` | no | |
+| ValueOn | platform_copy.go | `on` | no | |
+| ValueOff | platform_copy.go | `off` | no | |
+| LabelCustomers | platform_copy.go | `customers` | no | |
+| ValueCustomers | platform_copy.go | `%d of %d` | no | |
+| LabelPlans | platform_copy.go | `customer plans` | no | |
+| LabelDefault | platform_copy.go | `default plan` | no | |
+| LabelGrantedBy | platform_copy.go | `granted by` | no | |
+| LabelTurnedOffBy | platform_copy.go | `turned off by` | no | |
+| ValueByOn | platform_copy.go | `%s on %s` | no | |
+| LabelReason | platform_copy.go | `reason` | no | |
+| Granted | platform_copy.go | `%s is now a platform account` | no | |
+| Revoked | platform_copy.go | `turned off platform access for %s. credentials that stopped working: %d` | no | |
+| ListHeading | platform_copy.go | `%d of %d customer accounts` | no | |
+| ListOver | platform_copy.go | `, %d over a limit` | no | |
+| ListNear | platform_copy.go | `, %d near a limit` | no | |
+| ListEmpty | platform_copy.go | `no customer accounts yet. create one with carlos platform customers create` | no | |
+| ColAccount | platform_copy.go | `ACCOUNT` | no | |
+| ColName | platform_copy.go | `NAME` | no | |
+| ColRef | platform_copy.go | `REF` | no | |
+| ColPlan | platform_copy.go | `PLAN` | no | |
+| ColOwned | platform_copy.go | `CLAIMED` | no | |
+| ColUsage | platform_copy.go | `USAGE` | no | |
+| Yes | platform_copy.go | `yes` | no | |
+| No | platform_copy.go | `no` | no | |
+| UsageOK | platform_copy.go | `ok` | no | |
+| UsageNear | platform_copy.go | `near: %s` | no | |
+| UsageOver | platform_copy.go | `over: %s` | no | |
+| ShowHeading | platform_copy.go | `%s (%s)` | no | Used only without a plan. |
+| ShowOK | platform_copy.go | `%s (%s) is within its limits` | no | |
+| ShowNear | platform_copy.go | `%s (%s) is near a limit` | no | |
+| ShowOver | platform_copy.go | `%s (%s) is over a limit` | no | |
+| LabelRef | platform_copy.go | `ref` | no | |
+| LabelPlan | platform_copy.go | `plan` | no | |
+| LabelOwned | platform_copy.go | `claimed` | no | |
+| LabelCreated | platform_copy.go | `created` | no | |
+| UsageHeading | platform_copy.go | `usage` | no | |
+| UsageRow | platform_copy.go | `%s of %s` | no | |
+| UsageNearLimit | platform_copy.go | `near the limit` | no | |
+| UsageOverLimit | platform_copy.go | `over, grace until %s` | no | |
+| CapPDF | platform_copy.go | `PDFs a month` | no | |
+| Created | platform_copy.go | `created %s (%s) on the %s plan` | no | |
+| CreatedNoPlan | platform_copy.go | `created %s (%s)` | no | |
+| Exists | platform_copy.go | `%s (%s) already exists for reference %s` | no | |
+| Renamed | platform_copy.go | `%s (%s) is now called %s` | no | |
+| Replanned | platform_copy.go | `%s (%s) is now on the %s plan` | no | |
+| Minted | platform_copy.go | `minted a %s credential for %s in customer account %s` | yes | The caller should pass `customer <name>` for publish and `app <name>` for deploy. |
+| LabelValidUntil | platform_copy.go | `valid until` | no | |
+| MintedToken | platform_copy.go | `token` | no | |
+| MintedUse | platform_copy.go | `use it as CARLOS_SERVICE_TOKEN with --account %s` | no | |
+| FlagCreateRef | platform_copy.go | `your own id for the customer. pass it so a retried create returns the same account` | no | |
+| CreateRetry | platform_copy.go | `a create retried without --ref can make a second account.\npass --ref so a retried create returns the same account` | no | |
+| SqidRequired | platform_copy.go | `%s requires an account sqid` | no | |
+| SqidInvalid | platform_copy.go | `%s %q is not an account sqid` | no | |
+| HelpLine | platform_copy.go | `customer accounts a platform runs: customers \| credentials` | no | |
+| PlatformHostUnreadable | platform_copy.go | `platform host: unreadable response: %w` | no | |
+| accounts plan: cliPlanCopySourcePlatform | accounts_plan_copy.go | `set by its platform account: %s` | no | |
+| docs.accounts_platform | docs/site/cli.md | `Shows an account’s platform grant, or changes it. A platform account can create customer accounts and deploy into them for its own customers. It is a deployment-operator command.` | no | |
+| docs.platform_customers | docs/site/cli.md | `Creates and manages the customer accounts a platform account runs. Each customer account is a full account of its own, with nobody signed in to it.` | no | |
+| docs.platform_credentials | docs/site/cli.md | `Mints a short-lived credential for one customer account, for deploying into it.` | no | |
+| docs.platform | docs/site/cli.md | `Runs customer accounts from a platform account: customers creates and manages them, and credentials mints a credential for deploying into one.` | no | |
+| docs.platform_customers_retry | docs/site/cli.md | `Without --ref, a create retried after a timeout can make a second account, so pass --ref when your server retries.` | no | |
+
+## Flags for Paul
+
+- `email.lapse_grace` in `internal/console/plancaps_copy.go`: recommend removing the keep-page promise for platform recipients: `- %s. On %s, anything not covered is turned off. Apps, instances and workers go newest first. Custom domains are all turned off when the plan does not include them. Settings and data are kept.`
+- `Minted` requires the caller to label the interpolation consistently: `customer shop` for publish and `app site` for deploy.
+- `audit.credential` should pass `customer shop (bdf)` for publish and `app site in customer shop (bdf)` for deploy.
+
+## Mismatches
+
+- `delete.platform_has_customers`: shipped `This account runs %d customer accounts, so it can’t be deleted.` → approved `This account has linked customer accounts (%d), so it can’t be deleted.`
+- `audit.revoke`: shipped `turned off platform access, %d credentials stopped working. reason: %s` → approved `turned off platform access. credentials stopped working: %d. reason: %s`
+- `Minted`: shipped `minted a %s credential for %s (%s)` → approved `minted a %s credential for %s in customer account %s`
\ No newline at end of file
diff --git a/internal/console/apiplatformcredentials.go b/internal/console/apiplatformcredentials.go
index 6991bdd75..e5e26b38b 100644
--- a/internal/console/apiplatformcredentials.go
+++ b/internal/console/apiplatformcredentials.go
@@ -117,12 +117,12 @@ func (s *Server) handlePlatformCredentialMint(w http.ResponseWriter, r *http.Req
return
}
- target := fmt.Sprintf("%s (%s)", lc.Name, cust.Sqid)
- if app != "" {
- target = app
+ until := expires.Format("2 January 2006 15:04 UTC")
+ detail := fmt.Sprintf(platformCopy["audit.credential_publish"], lc.Name, cust.Sqid, until)
+ if role == svcrole.Deploy {
+ detail = fmt.Sprintf(platformCopy["audit.credential_deploy"], app, lc.Name, cust.Sqid, until)
}
- s.audit(cust, accountAuditSubject, c.Actor, auditPlatformCustomerCredential,
- fmt.Sprintf(platformCopy["audit.credential"], role, target, expires.Format("2 January 2006 15:04 UTC")))
+ s.audit(cust, accountAuditSubject, c.Actor, auditPlatformCustomerCredential, detail)
reply := platformCredentialReply{Token: raw, Account: cust.Sqid, Name: lc.Name, Role: string(role), App: app,
Rungs: []string{}, ExpiresAt: expires}
if rungs != "" {
diff --git a/internal/console/apiplatformcustomers.go b/internal/console/apiplatformcustomers.go
index 5cae46504..8bd76130c 100644
--- a/internal/console/apiplatformcustomers.go
+++ b/internal/console/apiplatformcustomers.go
@@ -53,8 +53,11 @@ type platformCaller struct {
Grant *PlatformGrant
Actor string // auditActor(P, Platform)
// failRow is the copy id of the door's own failure row (pre-flight
- // C10), "" on a read door.
+ // C10; list.failed and show.failed on the read doors).
failRow string
+ // read marks a read door: a pending mint it cannot finish is logged
+ // and the request goes on, and a store failure is 500, not 502.
+ read bool
}
// platformCustomerView is one customer account as the platform doors show
@@ -113,11 +116,24 @@ func validPlatformRef(ref string) bool {
return true
}
-// platformGate is a read door's gate: platformGateFor with no failure row,
-// so a pending mint that cannot be finished is logged and the request goes
-// on.
-func (s *Server) platformGate(w http.ResponseWriter, r *http.Request) (platformCaller, bool) {
- return s.platformGateFor(w, r, "")
+// platformGate is a read door's gate: platformAuthorize, then, when the
+// platform has pending mints, they are finished under the platform
+// lifecycle lock, released before the handler runs (the lock is not
+// re-entrant). A held promise is passed over and the door goes on (fix
+// round 2), and a finish that fails for any other reason is logged and the
+// door goes on too. failRow is the door's own failure row for a store
+// error (list.failed, show.failed). One indexed query when there are none.
+//
+// Create runs platformAuthorize alone and finishes under its own hold of
+// the lock, after it has validated its body, so a refused create writes
+// nothing (Astra P2-4). Update runs platformAuthorize, its refusals, then
+// platformFinishPending (ruling B, Task 9 fix round 1).
+func (s *Server) platformGate(w http.ResponseWriter, r *http.Request, failRow string) (platformCaller, bool) {
+ c, ok := s.platformAuthorizeDoor(w, r, failRow, true)
+ if !ok || !s.platformFinishPending(w, r, c) {
+ return platformCaller{}, false
+ }
+ return c, true
}
// platformAuthorize is who may use a platform door, in order, writing
@@ -135,6 +151,12 @@ func (s *Server) platformGate(w http.ResponseWriter, r *http.Request) (platformC
//
// failRow is the door's own failure row, for a store error.
func (s *Server) platformAuthorize(w http.ResponseWriter, r *http.Request, failRow string) (platformCaller, bool) {
+ return s.platformAuthorizeDoor(w, r, failRow, false)
+}
+
+// platformAuthorizeDoor is platformAuthorize for a read door (read) or a
+// write door.
+func (s *Server) platformAuthorizeDoor(w http.ResponseWriter, r *http.Request, failRow string, read bool) (platformCaller, bool) {
p, acct, ok := s.apiPrincipalAccount(w, r)
if !ok {
return platformCaller{}, false
@@ -159,7 +181,7 @@ func (s *Server) platformAuthorize(w http.ResponseWriter, r *http.Request, failR
http.NotFound(w, r)
return platformCaller{}, false
}
- c := platformCaller{P: p, Platform: acct, Actor: auditActor(p, acct), failRow: failRow}
+ c := platformCaller{P: p, Platform: acct, Actor: auditActor(p, acct), failRow: failRow, read: read}
g, err := s.store.PlatformGrant(ctx, acct.ID)
if err != nil {
log.Printf("console: platform %s: read grant: %v", acct.Sqid, err)
@@ -181,31 +203,11 @@ func (s *Server) platformAuthorize(w http.ResponseWriter, r *http.Request, failR
return c, true
}
-// platformGateFor is the gate of every platform door that has nothing to
-// refuse before it may write (the read doors): platformAuthorize, then, when the platform has pending mints, they are
-// finished under the platform lifecycle lock, released before the handler
-// runs (the lock is not re-entrant). A held promise is passed over and the
-// door goes on (fix round 2). failRow is the caller's door's own failure
-// row (pre-flight C10): on a write door a finish that fails for any other
-// reason is 502 with it; with failRow "" (a read door) it is logged and the
-// request goes on. One indexed query when there are none.
-//
-// Create runs platformAuthorize alone and finishes under its own hold of
-// the lock, after it has validated its body, so a refused create writes
-// nothing (Astra P2-4). Update runs platformAuthorize, its refusals, then
-// platformFinishPending (ruling B, Task 9 fix round 1).
-func (s *Server) platformGateFor(w http.ResponseWriter, r *http.Request, failRow string) (platformCaller, bool) {
- c, ok := s.platformAuthorize(w, r, failRow)
- if !ok || !s.platformFinishPending(w, r, c) {
- return platformCaller{}, false
- }
- return c, true
-}
-
// platformFinishPending is the gate's second half: when the platform has
// pending mints, they are finished under the platform lifecycle lock,
-// released before it returns. It answers whether the door goes on (on a
-// write door, a failed finish has been answered with the door's row). A
+// released before it returns. It answers whether the door goes on: on a
+// write door a failed finish is answered with the door's row (pre-flight
+// C10); on a read door it is logged and the door goes on. A
// write door that validates its request first (create, update; ruling B)
// runs platformAuthorize, its refusals, then this.
func (s *Server) platformFinishPending(w http.ResponseWriter, r *http.Request, c platformCaller) bool {
@@ -219,7 +221,7 @@ func (s *Server) platformFinishPending(w http.ResponseWriter, r *http.Request, c
}
if err != nil {
log.Printf("console: platform %s: finish pending customer creates: %v", acct.Sqid, err)
- if c.failRow != "" {
+ if !c.read {
s.platformDoorFailed(w, c)
return false
}
@@ -227,12 +229,11 @@ func (s *Server) platformFinishPending(w http.ResponseWriter, r *http.Request, c
return true
}
-// platformDoorFailed answers a store or bucket failure: 502 with the
-// door's own failure row on a write door (pre-flight C10), and on a read
-// door, which has no row of its own, a 500 with the status text.
+// platformDoorFailed answers a store or bucket failure with the door's own
+// failure row: 502 on a write door (pre-flight C10), 500 on a read door.
func (s *Server) platformDoorFailed(w http.ResponseWriter, c platformCaller) {
- if c.failRow == "" {
- jsonError(w, http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
+ if c.read {
+ jsonError(w, http.StatusInternalServerError, platformCopy[c.failRow])
return
}
jsonError(w, http.StatusBadGateway, platformCopy[c.failRow])
@@ -259,7 +260,7 @@ func (s *Server) platformCustomer(w http.ResponseWriter, r *http.Request, c plat
// handlePlatformCustomerList answers GET .../customers: every live customer
// with its plan and usage, or with ?ref= the one holding that reference.
func (s *Server) handlePlatformCustomerList(w http.ResponseWriter, r *http.Request) {
- c, ok := s.platformGate(w, r)
+ c, ok := s.platformGate(w, r, "list.failed")
if !ok {
return
}
@@ -315,7 +316,7 @@ func (s *Server) handlePlatformCustomerList(w http.ResponseWriter, r *http.Reque
// handlePlatformCustomerShow answers GET .../customers/{customer}.
func (s *Server) handlePlatformCustomerShow(w http.ResponseWriter, r *http.Request) {
- c, ok := s.platformGate(w, r)
+ c, ok := s.platformGate(w, r, "show.failed")
if !ok {
return
}
diff --git a/internal/console/apiplatformcustomers_test.go b/internal/console/apiplatformcustomers_test.go
index 82c1d1468..fd1ff7e92 100644
--- a/internal/console/apiplatformcustomers_test.go
+++ b/internal/console/apiplatformcustomers_test.go
@@ -859,6 +859,22 @@ func TestCustomerListAndShowCarryUsage(t *testing.T) {
}
}
+// TestCustomerReadDoorsAnswerTheirOwnFailureRows: a store error on list or
+// show is 500 with the door's own row, not the status text.
+func TestCustomerReadDoorsAnswerTheirOwnFailureRows(t *testing.T) {
+ fx, p, tok, cust := customerWorld(t, "free")
+ // Both doors read the customers' cap rows after the gate.
+ if _, err := fx.st.db.ExecContext(context.Background(), `DROP TABLE plan_cap_state`); err != nil {
+ t.Fatal(err)
+ }
+ status, out, _ := getPlatform(t, platformCustomersURL(fx.ts.URL, p.Sqid), tok)
+ wantPlatformError(t, "list with a failing store", status, out, http.StatusInternalServerError, "list.failed")
+ status, out, _ = getPlatform(t, platformCustomersURL(fx.ts.URL, p.Sqid)+"?ref=4812", tok)
+ wantPlatformError(t, "list ?ref= with a failing store", status, out, http.StatusInternalServerError, "list.failed")
+ status, out, _ = getPlatform(t, platformCustomersURL(fx.ts.URL, p.Sqid)+"/"+cust.Sqid, tok)
+ wantPlatformError(t, "show with a failing store", status, out, http.StatusInternalServerError, "show.failed")
+}
+
func TestCustomerDoorsHideOtherPlatformsCustomers(t *testing.T) {
fx := newConsoleFixture(t)
a := planAccount(t, fx, 501)
diff --git a/internal/console/ownership.go b/internal/console/ownership.go
index c09f0ed23..5d8260f29 100644
--- a/internal/console/ownership.go
+++ b/internal/console/ownership.go
@@ -206,7 +206,7 @@ func (s *Server) deletionRefused(w http.ResponseWriter, r *http.Request, acct *A
log.Printf("console: delete %s: count customer accounts: %v", acct.Sqid, err)
return refuse(deletionAdvice(err))
} else if n > 0 {
- return refuse(fmt.Sprintf(platformCopy["delete.platform_has_customers"], n))
+ return refuse(platformCopy["delete.platform_has_customers"])
}
if n, err := s.store.AppCount(acct.ID); err != nil || n > 0 {
if err != nil {
diff --git a/internal/console/plancaps_copy.go b/internal/console/plancaps_copy.go
index 046463a59..8f8b88200 100644
--- a/internal/console/plancaps_copy.go
+++ b/internal/console/plancaps_copy.go
@@ -86,11 +86,14 @@ var planNoticeCopy = map[string]string{
"cli.lapse_off": "turned off because this account's plan no longer covers them: %s. settings and data are kept. covered things come back within a few minutes. only owners can choose what stays",
"email.lapse_off": "- Turned off: %s. Settings and data are kept. Covered things come back within a few minutes.",
"email.lapse_off_list": "Turned off: %s.\n\nChoose what stays for apps, instances and workers:\n%s",
- // Platform accounts slice 1 (plan "Copy table", pending copy review):
- // a customer account's notices go to its platform's owners, who manage
- // it with carlos platform, not in the customer's settings.
+ // Platform accounts slice 1 (plan "Copy table"; approved, Luna pass +
+ // Paul 2026-11-19): a customer account's notices go to its platform's
+ // owners, who manage it with carlos platform, not in the customer's
+ // settings. Its lapse_grace line is email.lapse_grace without the keep
+ // page's promise ("unless you choose what stays"): they cannot open it.
"email.platform.subject": "[carlos] Customer account %s (%s): plan usage",
"email.platform.intro": "Customer account %s (%s), run by %s, is near or over its plan limits:",
+ "email.platform.lapse_grace": "- %s. On %s, anything not covered is turned off. Apps, instances and workers go newest first. Custom domains are all turned off when the plan does not include them. Settings and data are kept.",
"email.platform.lapse_off_list": "Turned off: %s.",
"email.platform.ways_out": "To stay within the plan, move the account to a bigger plan or clean it up.\n\nSee its usage:\n carlos platform customers show --platform %s --customer %s\n\nChange its plan:\n carlos platform customers update --platform %s --customer %s --plan <plan>",
}
diff --git a/internal/console/platform_copy.go b/internal/console/platform_copy.go
index 43fb3aed2..3681cf621 100644
--- a/internal/console/platform_copy.go
+++ b/internal/console/platform_copy.go
@@ -1,9 +1,10 @@
package console
// Copy for platform accounts (docs/superpowers/plans/2026-11-19-platform-
-// accounts-1-platform-layer.md, "Copy table", pending copy review). Each key
-// is the table's id; each text is the table's, byte for byte. Each task of
-// that plan adds the rows it uses.
+// accounts-1-platform-layer.md, "Copy table"). Approved: Luna pass + Paul
+// 2026-11-19 (docs/superpowers/plans/LUNA-COPY-RESULT-PLATFORM-ACCOUNTS-1.md,
+// with Paul's four changes), pinned by approved_platform_accounts_copy_test.go.
+// Each key is the table's id; each text is the table's, byte for byte.
//
// The CLI prints the JSON errors as they come, so they are lowercase with no
// closing full stop, as the existing cli copy is. The audit.* rows are the
@@ -24,6 +25,11 @@ var platformCopy = map[string]string{
"door.not_owner": "only an owner of this account can manage its customer accounts",
"door.rate": "too many requests. wait a minute and try again",
+ // The read doors' own failure rows, for a store error. Sentence case,
+ // as Paul approved them (2026-11-19).
+ "list.failed": "Couldn’t read the customer accounts. Try again in a moment.",
+ "show.failed": "Couldn’t read that customer account. Try again in a moment.",
+
"create.name": "an account name appears in URLs and --account: 1-63 characters of a-z, 0-9 and hyphen, no leading or trailing hyphen",
"create.ref": "a customer reference is 1 to 64 letters, digits, dots, colons, hyphens or underscores",
"create.plan": "this platform can put customer accounts on these plans: %s",
@@ -47,16 +53,19 @@ var platformCopy = map[string]string{
"audit.grant": "made this a platform account: up to %d customer accounts, plans %s, new ones on %s. reason: %s",
"audit.grant_no_plans": "made this a platform account: up to %d customer accounts. reason: %s",
- "audit.revoke": "turned off platform access, %d credentials stopped working. reason: %s",
+ "audit.revoke": "turned off platform access. Credentials stopped: %d. Reason: %s",
"audit.customer_create": "created customer account %s (%s)",
"audit.customer_created_by": "created by platform account %s",
"audit.customer_rename": "renamed customer account %s to %s",
"audit.customer_plan": "moved customer account %s to the %s plan",
- "audit.credential": "minted a %s credential for %s, valid until %s",
+ // A publish credential names the customer; a deploy credential names
+ // the app in the customer, as the CLI's Minted lines do.
+ "audit.credential_publish": "minted a publish credential for %s (%s), valid until %s",
+ "audit.credential_deploy": "minted a deploy credential for app %s in %s (%s), valid until %s",
// Browser flashes on the account's Delete account (ownership.go),
// sentence case as the rest of the browser copy is.
- "delete.platform_has_customers": "This account runs %d customer accounts, so it can’t be deleted.",
+ "delete.platform_has_customers": "This account still has customer accounts linked to it, so it can’t be deleted.",
"delete.linked": "This account is run by %s. Ask them to delete it.",
}
diff --git a/internal/console/platform_credentials_test.go b/internal/console/platform_credentials_test.go
index aecbe8c05..d2203a820 100644
--- a/internal/console/platform_credentials_test.go
+++ b/internal/console/platform_credentials_test.go
@@ -428,7 +428,7 @@ func TestCustomerCredentialResolvesToTheCustomerOnly(t *testing.T) {
t.Fatalf("app create on the platform account = %d %q, want the stdlib 404", status, body)
}
- want := fmt.Sprintf(platformCopy["audit.credential"], "publish", "shop ("+cust.Sqid+")", expires.UTC().Format("2 January 2006 15:04 UTC"))
+ want := fmt.Sprintf(platformCopy["audit.credential_publish"], "shop", cust.Sqid, expires.UTC().Format("2 January 2006 15:04 UTC"))
if rows := platformAudit(t, fx, cust.ID, auditPlatformCustomerCredential); len(rows) != 1 || rows[0].Detail != want || rows[0].Address != actor {
t.Fatalf("customer audit %+v, want one %q by %s", rows, want, actor)
}
@@ -795,7 +795,7 @@ func TestCustomerCredentialDeployNarrowedToOneApp(t *testing.T) {
if status, _, body := rawReq(t, http.MethodGet, fx.ts.URL+"/api/cli/apps/"+cust.Sqid+"/site/channels", raw, ""); status != http.StatusOK {
t.Fatalf("site channels = %d %s, want 200", status, body)
}
- want := fmt.Sprintf(platformCopy["audit.credential"], "deploy", "site", "")
+ want := fmt.Sprintf(platformCopy["audit.credential_deploy"], "site", "shop", cust.Sqid, "")
if rows := platformAudit(t, fx, cust.ID, auditPlatformCustomerCredential); len(rows) != 1 || !strings.HasPrefix(rows[0].Detail, want) {
t.Fatalf("customer audit %+v, want one starting %q", rows, want)
}
diff --git a/internal/console/platform_store.go b/internal/console/platform_store.go
index 61f327e0c..07d1cb01b 100644
--- a/internal/console/platform_store.go
+++ b/internal/console/platform_store.go
@@ -29,6 +29,9 @@ import (
"strings"
"time"
+ "modernc.org/sqlite"
+ sqlite3 "modernc.org/sqlite/lib"
+
"github.com/carlosframework/platform/internal/svcrole"
)
@@ -441,19 +444,30 @@ func (s *Store) ReservePlatformMint(ctx context.Context, m PendingMint) error {
if _, err := tx.ExecContext(ctx, `INSERT INTO platform_pending_mints
(mint_id, platform, ref, name, plan, plan_reason, by, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
m.MintID, m.Platform, m.Ref, m.Name, m.Plan, m.PlanReason, m.By, m.CreatedAt.Unix()); err != nil {
- // SQLite names the index's columns in its message; there is no
- // other way through database/sql to tell which constraint failed.
- switch msg := err.Error(); {
- case strings.Contains(msg, "UNIQUE constraint failed: platform_pending_mints.platform, platform_pending_mints.ref"):
- return ErrPlatformRefTaken
- case strings.Contains(msg, "UNIQUE constraint failed: platform_pending_mints.mint_id"):
- return errPlatformMintUsed
- }
- return err
+ return pendingMintConstraint(err)
}
return tx.Commit()
}
+// pendingMintConstraint maps a platform_pending_mints insert's constraint
+// failure to its sentinel by SQLite's extended result code: the mint_id
+// primary key is SQLITE_CONSTRAINT_PRIMARYKEY (errPlatformMintUsed), and
+// the table's only unique index, platform_pending_mints_ref, is
+// SQLITE_CONSTRAINT_UNIQUE (ErrPlatformRefTaken). Anything else is err.
+func pendingMintConstraint(err error) error {
+ var se *sqlite.Error
+ if !errors.As(err, &se) {
+ return err
+ }
+ switch se.Code() {
+ case sqlite3.SQLITE_CONSTRAINT_UNIQUE:
+ return ErrPlatformRefTaken
+ case sqlite3.SQLITE_CONSTRAINT_PRIMARYKEY:
+ return errPlatformMintUsed
+ }
+ return err
+}
+
// PendingPlatformMints lists the platform's unfinished customer creates,
// oldest first.
func (s *Store) PendingPlatformMints(ctx context.Context, platformSqid string) ([]PendingMint, error) {
diff --git a/internal/console/platform_store_test.go b/internal/console/platform_store_test.go
index 952aab4ab..12d0d3684 100644
--- a/internal/console/platform_store_test.go
+++ b/internal/console/platform_store_test.go
@@ -817,6 +817,36 @@ func TestReservePlatformMintRefusesADuplicate(t *testing.T) {
}
}
+// TestPendingMintConstraintReadsTheResultCode: the insert's constraint
+// failures are told apart by SQLite's extended result code, not the
+// message. The mint id path is reachable only in a race past the
+// transaction's own check, so it is driven here with the raw insert.
+func TestPendingMintConstraintReadsTheResultCode(t *testing.T) {
+ s := openTestStore(t)
+ ctx := context.Background()
+ reserveMint(t, s, "bcd", "aa11", "4812")
+ insert := func(mintID, ref string) error {
+ _, err := s.db.ExecContext(ctx, `INSERT INTO platform_pending_mints (mint_id, platform, ref, name, by, created_at)
+ VALUES (?, 'bcd', ?, 'x', 'service:bcd/cms', 1)`, mintID, ref)
+ return err
+ }
+ if err := pendingMintConstraint(insert("aa11", "4999")); !errors.Is(err, errPlatformMintUsed) {
+ t.Errorf("a mint id twice = %v, want errPlatformMintUsed", err)
+ }
+ if err := pendingMintConstraint(insert("bb22", "4812")); !errors.Is(err, ErrPlatformRefTaken) {
+ t.Errorf("a pending ref twice = %v, want ErrPlatformRefTaken", err)
+ }
+ other := errors.New("disk full")
+ if err := pendingMintConstraint(other); err != other {
+ t.Errorf("a non-SQLite error = %v, want it as it was", err)
+ }
+ // A constraint that is neither (name is NOT NULL) passes through.
+ if _, err := s.db.ExecContext(ctx, `INSERT INTO platform_pending_mints (mint_id, platform, ref, by, created_at)
+ VALUES ('dd44', 'bcd', '4814', 'service:bcd/cms', 1)`); err == nil || pendingMintConstraint(err) != err {
+ t.Errorf("a NOT NULL failure = %v, want it as it was", err)
+ }
+}
+
func TestPutPlatformGrantRefusesADeadAccount(t *testing.T) {
s := openTestStore(t)
ctx := context.Background()
diff --git a/internal/console/platformlinked.go b/internal/console/platformlinked.go
index 7bcfbf643..70d95baa1 100644
--- a/internal/console/platformlinked.go
+++ b/internal/console/platformlinked.go
@@ -79,6 +79,16 @@ func (s *Server) ownerNoticeCounts(ctx context.Context, acct *Account) bool {
return platform == ""
}
+// platformPlanNoticeLine is planNoticeText's email line for a platform's
+// owners: the same, except that a lapse in grace makes no promise about
+// the keep page, which the platform's staff cannot open.
+func platformPlanNoticeLine(n planNotice) string {
+ if n.Stage == "lapse_grace" {
+ return fmt.Sprintf(planNoticeCopy["email.platform.lapse_grace"], usagePhrase(n), n.GraceEnds.UTC().Format("2 January 2006"))
+ }
+ return planNoticeText(n, "email")
+}
+
// platformPlanNoticeEmail is planNoticeEmail for a customer account's
// notice to its platform's owners: the same per-cap lines, and ways out
// through carlos platform instead of links into the customer account,
@@ -87,7 +97,7 @@ func (s *Server) platformPlanNoticeEmail(cust, platform *Account, due []capState
lines := []string{fmt.Sprintf(planNoticeCopy["email.platform.intro"], cust.Name, cust.Sqid, platform.Name), ""}
lapsed := false
for _, n := range planNoticesOf(due, time.Now(), stage) {
- lines = append(lines, planNoticeText(n, "email"))
+ lines = append(lines, platformPlanNoticeLine(n))
lapsed = lapsed || n.Stage == "lapse_off"
}
if names := s.lapseOffNames(cust); lapsed && len(names) > 0 {
diff --git a/internal/console/platformlinked_test.go b/internal/console/platformlinked_test.go
index c8d90d83e..2f0f6944d 100644
--- a/internal/console/platformlinked_test.go
+++ b/internal/console/platformlinked_test.go
@@ -240,7 +240,7 @@ func TestPlatformAccountDeletionRefusedWithCustomers(t *testing.T) {
}
c, csrf := freshOwner(t, fx, "owner"+p.Sqid+"@example.com", "code-delete-platform")
r := browserDelete(fx.srv, fx.ts.URL, c, csrf, p.Sqid, p.Name)
- wantRefusedDelete(t, r, p.Sqid, fmt.Sprintf(platformCopy["delete.platform_has_customers"], 1))
+ wantRefusedDelete(t, r, p.Sqid, platformCopy["delete.platform_has_customers"])
wantLive(t, fx, p.Sqid)
// A pending mint alone holds a platform too.
@@ -251,7 +251,7 @@ func TestPlatformAccountDeletionRefusedWithCustomers(t *testing.T) {
}
c, csrf = freshOwner(t, fx, "owner"+q.Sqid+"@example.com", "code-delete-pending")
r = browserDelete(fx.srv, fx.ts.URL, c, csrf, q.Sqid, q.Name)
- wantRefusedDelete(t, r, q.Sqid, fmt.Sprintf(platformCopy["delete.platform_has_customers"], 1))
+ wantRefusedDelete(t, r, q.Sqid, platformCopy["delete.platform_has_customers"])
wantLive(t, fx, q.Sqid)
}
@@ -327,7 +327,7 @@ func TestPlatformDeletionWaitsForAnInFlightCreate(t *testing.T) {
t.Fatalf("create = %d %s %v, want 201", r.status, r.raw, r.err)
}
r := waitOrGuard(t, deleted, guard.C, "the delete never answered")
- wantRefusedDelete(t, r, p.Sqid, fmt.Sprintf(platformCopy["delete.platform_has_customers"], 1))
+ wantRefusedDelete(t, r, p.Sqid, platformCopy["delete.platform_has_customers"])
wantLive(t, fx, p.Sqid)
// A fresh start reaps nothing: the platform and its customer stay.
@@ -897,6 +897,29 @@ func TestPlanNoticesForLinkedAccountsGoToPlatformOwners(t *testing.T) {
}
}
+// TestPlatformLapseGraceNoticeMakesNoKeepPromise (Paul, 2026-11-19): a
+// customer's lapse in grace tells the platform's owners what goes when,
+// without "unless you choose what stays", as they cannot open the keep
+// page. An ordinary owner's email keeps the approved line.
+func TestPlatformLapseGraceNoticeMakesNoKeepPromise(t *testing.T) {
+ fx, studio, shop, _ := noticeWorld(t)
+ now := time.Now()
+ st := evaluateCap(nil, capRunningThings, 3, 2, now)
+ st.AccountID = shop.ID
+ st.GraceEnds = time.Date(2026, time.November, 30, 0, 0, 0, 0, time.UTC)
+ lapse := func(capState) string { return "lapse_grace" }
+ _, body := fx.srv.platformPlanNoticeEmail(shop, studio, []capState{st}, lapse)
+ n := planNoticesOf([]capState{st}, now, lapse)[0]
+ want := fmt.Sprintf(planNoticeCopy["email.platform.lapse_grace"], usagePhrase(n), "30 November 2026")
+ if !strings.Contains(body, want) || strings.Contains(body, "choose what stays") {
+ t.Fatalf("platform owners' body:\n%s\nwant the line %q and no keep promise", body, want)
+ }
+ if own := planNoticeText(n, "email"); own != fmt.Sprintf(planNoticeCopy["email.lapse_grace"], usagePhrase(n), "30 November 2026") ||
+ !strings.Contains(own, "unless you choose what stays") {
+ t.Fatalf("an ordinary owner's line %q, want email.lapse_grace as approved", own)
+ }
+}
+
func TestPlatformOwnerNoticeCountsForAfterGraceDue(t *testing.T) {
fx, _, shop, mail := noticeWorld(t)
ctx := context.Background()
diff --git a/internal/provision/testdata/plan14-root-reads-design-platform-accounts.tsv b/internal/provision/testdata/plan14-root-reads-design-platform-accounts.tsv
index d2f919f9a..e57fb57ba 100644
--- a/internal/provision/testdata/plan14-root-reads-design-platform-accounts.tsv
+++ b/internal/provision/testdata/plan14-root-reads-design-platform-accounts.tsv
@@ -1,5 +1,5 @@
# Census overlay design-platform-accounts, written by census-propose (#369). census-ruling-design-platform-accounts, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-design-platform-accounts.md.
# 0 body, 0 sites, 3 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
-@coverage . 3d455e1942ff419bd6f7d6128b5f7583de7de7963ba993bbf4ffc092efe28239
+@coverage . d027c205fa162ee5afe0b7a20b62fef54f2f3e155c08f651e5ef1feb096ecb03
@coverage internal/domains 7a54788493b1f0c89412d24604eaec2b5dee6d9ce078717cb9301e4468efab90
@coverage internal/svcrole 5d5177f2446a75afb22c4fe4f8c75464b5c433af928ad1c96fa7a160e2a01bb9
diff --git a/platform_cli.go b/platform_cli.go
index 558331ee5..733836e07 100644
--- a/platform_cli.go
+++ b/platform_cli.go
@@ -455,7 +455,11 @@ func runPlatformCredentialsMintWithSession(ctx context.Context, sess *apiSession
if pf.wantJSON() {
return printPlatformJSON(out, body)
}
- fmt.Fprintf(out, cliPlatformCopyMinted+"\n", res.Role, res.Name, res.Account)
+ if res.Role == "deploy" {
+ fmt.Fprintf(out, cliPlatformCopyMintedDeploy+"\n", res.App, res.Name, res.Account)
+ } else {
+ fmt.Fprintf(out, cliPlatformCopyMintedPublish+"\n", res.Name, res.Account)
+ }
printPlatformRows(out, " ", [][]string{
{cliPlatformCopyLabelValidUntil, res.ExpiresAt.UTC().Format("2 January 2006 15:04") + " UTC"},
{cliPlatformCopyMintedToken, res.Token},
diff --git a/platform_cli_test.go b/platform_cli_test.go
index 53bb88d76..7fac7998a 100644
--- a/platform_cli_test.go
+++ b/platform_cli_test.go
@@ -471,6 +471,26 @@ use it as CARLOS_SERVICE_TOKEN with --account bdf
}
}
+// TestPlatformCredentialsMintPrintsDeploy: a deploy credential's line names
+// the app in the customer (Paul, 2026-11-19).
+func TestPlatformCredentialsMintPrintsDeploy(t *testing.T) {
+ reply := mintReply()
+ reply.Role, reply.App, reply.Rungs = "deploy", "site", []string{"edge"}
+ pc := newPlatformConsole(t, map[string]platformDoorReply{
+ "POST /api/cli/platform/bcd/customers/bdf/credentials": {http.StatusCreated, reply},
+ })
+ got := pc.mustRun(t, runPlatformCredentialsMintWithSession, "--platform", "bcd", "--customer", "bdf",
+ "--role", "deploy", "--app", "site", "--rungs", "edge")
+ want := `minted a deploy credential for app site in shop (bdf)
+ valid until 19 November 2026 15:04 UTC
+ token carlos_svc_0123456789
+use it as CARLOS_SERVICE_TOKEN with --account bdf
+`
+ if got != want {
+ t.Errorf("deploy mint:\n%s\nwant:\n%s", got, want)
+ }
+}
+
func TestPlatformCredentialsMintSendsTTL(t *testing.T) {
pc := newPlatformConsole(t, map[string]platformDoorReply{
"GET /api/cli/platform/bcd/customers?ref=4812": {http.StatusOK, platformCustomerList{Platform: "bcd", MaxCustomers: 50, Count: 1,
diff --git a/platform_copy.go b/platform_copy.go
index c803a9441..173b02740 100644
--- a/platform_copy.go
+++ b/platform_copy.go
@@ -2,9 +2,9 @@ package main
// Copy for platform accounts on the command line (docs/superpowers/plans/
// 2026-11-19-platform-accounts-1-platform-layer.md, "Copy table", the CLI
-// rows, pending copy review). Each constant is cliPlatformCopy plus the
-// table's id, and its text is the table's, byte for byte. Each task of that
-// plan adds the rows it uses.
+// rows). Approved: Luna pass + Paul 2026-11-19, pinned by
+// approved_platform_accounts_copy_test.go. Each constant is cliPlatformCopy
+// plus the table's id, and its text is the table's, byte for byte.
//
// The console's refusals are not here: its JSON errors already carry their
// sentences (internal/console/platform_copy.go), and the CLI prints them as
@@ -122,7 +122,10 @@ const (
cliPlatformCopyRenamed = "%s (%s) is now called %s"
cliPlatformCopyReplanned = "%s (%s) is now on the %s plan"
- cliPlatformCopyMinted = "minted a %s credential for %s (%s)"
+ // MintedPublish names the customer; MintedDeploy names the app in the
+ // customer (Paul, 2026-11-19).
+ cliPlatformCopyMintedPublish = "minted a publish credential for %s (%s)"
+ cliPlatformCopyMintedDeploy = "minted a deploy credential for app %s in %s (%s)"
cliPlatformCopyLabelValidUntil = "valid until"
cliPlatformCopyMintedToken = "token"
cliPlatformCopyMintedUse = "use it as CARLOS_SERVICE_TOKEN with --account %s"