plans 6a: billing copy through the Luna pass (approved by delegation), operator docs for billing
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 files changed,
+156
−10
billing_cli_copy.go+6 −5cmd/console/billing.go+1 −1cmd/console/billing_test.go+1 −1docs/site/plans.md+53 −0docs/superpowers/specs/LUNA-COPY-BRIEF-PLANS-6A.md+63 −0docs/superpowers/specs/LUNA-COPY-RESULT-PLANS-6A.md+28 −0internal/console/apibilling_copy.go+3 −2main.go+1 −1
diff --git a/billing_cli_copy.go b/billing_cli_copy.go| index 074f43bbb..da7294356 100644 |
| --- a/billing_cli_copy.go |
| +++ b/billing_cli_copy.go |
| @@ -1,15 +1,16 @@ |
| package main |
| -// `carlos billing` strings (billing_cli.go). Draft copy: the Luna pass |
| -// (plans 6a Task 9) replaces these. |
| +// `carlos billing` strings (billing_cli.go). Approved by delegation (Luna), |
| +// 2026-10-25: docs/superpowers/specs/LUNA-COPY-RESULT-PLANS-6A.md. Apply |
| +// later edits through a copy pass, not by hand. |
| const ( |
| cliBillingCopyUsage = "usage: carlos billing problems [-all] | close -id N -note \"...\"" |
| cliBillingCopyFlagAll = "include closed problems" |
| - cliBillingCopyFlagID = "the problem to close, from carlos billing problems" |
| - cliBillingCopyFlagNote = "what you did in stripe. it is kept with the problem" |
| + cliBillingCopyFlagID = "problem number from carlos billing problems" |
| + cliBillingCopyFlagNote = "what you did in stripe. this note is kept with the problem" |
| cliBillingCopyNoteRequired = "say what you did in stripe with -note" |
| cliBillingCopyIDRequired = "say which problem to close with -id" |
| cliBillingCopyNoProblems = "no open billing problems" |
| cliBillingCopyClosed = "problem %d closed" |
| - cliBillingCopyNeedsConsole = "carlos billing works through a console, and this shell is in direct bucket mode\n(CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR is set). billing is kept by the console.\nunset the store env and run: carlos auth login --console <url>" |
| + cliBillingCopyNeedsConsole = "billing works through a console, but this shell is in direct bucket mode\n(CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR is set). billing is kept by the console.\nunset the store env and run: carlos auth login --console <url>" |
| ) |
diff --git a/cmd/console/billing.go b/cmd/console/billing.go| index 21f46c529..8f7282d92 100644 |
| --- a/cmd/console/billing.go |
| +++ b/cmd/console/billing.go |
| @@ -13,7 +13,7 @@ import ( |
| // billingConfigError names the variable at fault and never its value: the |
| // values are secrets, or carry them. |
| func billingConfigError(variable string) error { |
| - return fmt.Errorf("console: billing configuration invalid: %s", variable) |
| + return fmt.Errorf("console: invalid billing configuration: %s", variable) // copy: Luna, 2026-10-25 |
| } |
| // billingConfig reads the billing configuration from the console's |
diff --git a/cmd/console/billing_test.go b/cmd/console/billing_test.go| index 5aedc187a..224de0c43 100644 |
| --- a/cmd/console/billing_test.go |
| +++ b/cmd/console/billing_test.go |
| @@ -148,7 +148,7 @@ func TestBillingConfigRefuses(t *testing.T) { |
| if err == nil || cfg != nil { |
| t.Fatalf("accepted: %v", cfg) |
| } |
| - if want := "console: billing configuration invalid: " + tc.variable; err.Error() != want { |
| + if want := "console: invalid billing configuration: " + tc.variable; err.Error() != want { |
| t.Errorf("error %q, want %q", err, want) |
| } |
| for _, v := range env { |
diff --git a/docs/site/plans.md b/docs/site/plans.md| index 1f2e53de2..a6403de15 100644 |
| --- a/docs/site/plans.md |
| +++ b/docs/site/plans.md |
| @@ -92,3 +92,56 @@ The slowdown is a plan stage, not abuse protection, so it applies whatever `CARL |
| The account banner and the CLI warning line say which stage is in force. |
| The console also records when an owner actually received notice: an email that was accepted for delivery, an owner viewing an account page with the banner, or an owner's CLI printing the warning. Apart from the ceilings above (email, storage and bandwidth at twice their limits), whatever acts after grace starts only once grace has ended and an owner received notice at least 3 days earlier. So an account nobody has heard from is never cut off for anything short of a ceiling. |
| + |
| +## Billing (operators) |
| + |
| +Billing keeps each paying account's plan in step with its subscription at Stripe. When a subscription is paid, the account is on the plan and packs it bought. When the subscription ends, the account goes back to the default plan. Nobody can buy anything through the console yet: checkout, pack changes and the billing page come later. Until then, this section is for operators setting billing up in test mode. |
| + |
| +Billing is off unless you turn it on, and it needs plans: `CARLOS_BILLING` without `CARLOS_PLAN_CATALOG` stops the console at start. Nothing switches billing on by itself. |
| + |
| +### Turning it on |
| + |
| +Every billing setting lives in the console's EnvironmentFile. None of them is a flag, a file in the bucket or a `carlos secrets` value, and the console never logs the key. |
| + |
| +| Variable | What it holds | |
| +| --- | --- | |
| +| `CARLOS_BILLING` | `off`, `test` or `live`. Unset is `off`. | |
| +| `CARLOS_PRICE_BOOK` | The path to the price book file. | |
| +| `CARLOS_BILLING_PRICES` | A JSON object from each price key to its Stripe price id. | |
| +| `CARLOS_STRIPE_SECRET_KEY` | A restricted key: `rk_test_` in test mode, `rk_live_` in live mode. | |
| +| `CARLOS_STRIPE_ACCOUNT` | The Stripe account the key belongs to (`acct_`). | |
| +| `CARLOS_STRIPE_WEBHOOK_SECRET` | The webhook signing secret (`whsec_`). | |
| +| `CARLOS_STRIPE_PREVIOUS_WEBHOOK_SECRETS` | Optional. Up to two older signing secrets, comma separated, while you rotate. | |
| + |
| +If any of them is wrong, the console refuses to start and names the variable, never its value. |
| + |
| +Point Stripe's webhook at `https://<console>/billing/webhook`. When the console starts, it checks the account and every price in the book against Stripe before it accepts a webhook. Until that check passes, the webhook answers 503 and Stripe tries again later, so a console that starts while Stripe is unreachable catches up by itself. |
| + |
| +### The price book |
| + |
| +The price book is a file beside the catalog. It gives one yearly price for each paid plan and each pack, in each currency you sell (`usd`, `eur` and `gbp`), and names the catalog version it prices. Its status is `draft` or `approved`. Test mode accepts a draft. Live mode refuses one. |
| + |
| +The price keys in `CARLOS_BILLING_PRICES` are `<book>/<plan>/<currency>` for a plan and `<book>/pack/<pack>/<currency>` for a pack, for example `2026-11-01-v1/personal/usd`. Give each Stripe price the same key in its `price_key` metadata. The start-up check compares them, so two prices can't be swapped by mistake. Stripe price ids never go in the book. |
| + |
| +A book is never edited. To change a price, or to approve a draft, write a new book with a new version. The console remembers each version it has started with, and refuses to start if a version's content has changed. |
| + |
| +### Billing problems |
| + |
| +When the console sees something about a subscription it can't settle on its own, it leaves the plan alone and opens a billing problem. List them, and close one once you've dealt with it in the Stripe Dashboard: |
| + |
| +```sh |
| +carlos billing problems # open problems |
| +carlos billing problems -all # closed ones too |
| +carlos billing close -id 12 -note "refunded and cancelled in the dashboard" |
| +``` |
| + |
| +The console can't close a problem while Stripe still shows the subscription as live, and it can't see refunds, so your note is the record of what you did. |
| + |
| +| Reason | What it means | What to do in Stripe | |
| +| --- | --- | --- | |
| +| `unrecognised` | A paid subscription whose prices aren't a purchase the console sells: an unknown price, mixed currencies, a second plan. | Refund the payment and cancel the subscription. | |
| +| `second_subscription` | The account already has a live subscription and another one appeared. | Refund and cancel the newer one. | |
| +| `not_billing_owned` | A paid subscription on an account whose plan an operator set or sponsored. Billing never overwrites those. | Refund and cancel, or move the account back to the default plan first if it should be billed. | |
| +| `unknown_customer` | A subscription on a Stripe customer the console never created. | Find out where it came from, then refund and cancel. | |
| +| `account_mismatch` | The subscription's metadata names a different account from its customer's. | Check both accounts, then refund and cancel. | |
| +| `mode_mismatch` | A test-mode subscription reached a live console, or the other way round. | Check the webhook endpoints in each mode. | |
diff --git a/docs/superpowers/specs/LUNA-COPY-BRIEF-PLANS-6A.md b/docs/superpowers/specs/LUNA-COPY-BRIEF-PLANS-6A.md| new file mode 100644 |
| index 000000000..6c14beeee |
| --- /dev/null |
| +++ b/docs/superpowers/specs/LUNA-COPY-BRIEF-PLANS-6A.md |
| @@ -0,0 +1,63 @@ |
| +# Copy pass brief: billing problems and billing configuration (plans 6a) |
| + |
| +You are reviewing user-facing strings for a hosting console (the carlos platform). Paul, the owner, delegated this review to you. Apply his house rules and return improved strings. |
| + |
| +Every string here is read by a deployment operator, not by a customer. The operator runs the console, keeps its billing configuration, and settles billing problems by hand in the Stripe Dashboard. |
| + |
| +## House rules |
| + |
| +- No em dashes or en dashes used as dashes. Where you would use one, end the sentence with a full stop and start a new one. |
| +- Plain words, short sentences, no jargon, no marketing tone, no exclamation marks. |
| +- Strings whose key starts `cli.` or `door.` are entirely lower case (variable names, flag names and command names keep their own spelling), with no full stop at the very end. A string with a line break keeps its line breaks. |
| +- Keep every placeholder (`%s`, `%d`, `%q`) and its order. |
| +- Do not name the product. Naming Stripe, the billing provider, is fine. |
| +- Leave flag names (`-id`, `-note`, `-all`), command names (`carlos billing problems`, `carlos billing close`, `carlos auth login --console <url>`), variable names (`CARLOS_BILLING`, `CARLOS_DEPLOYMENT_BUCKET`, `CARLOS_DEPLOYMENT_DIR`) and the words `problems | close` in the usage text exactly as they are. |
| +- Facts that must stay true: |
| + - billing is off unless the console's `CARLOS_BILLING` is set; |
| + - a problem can be closed only once the subscription is no longer live at Stripe: the operator cancels it there first; |
| + - closing a problem needs a note saying what the operator did in Stripe, given with `-note`; the console cannot see refunds, so the note is the record; |
| + - `carlos billing` works only through a console, never in direct bucket mode; |
| + - a price book is never edited in place: changing one means a new version; |
| + - a configuration error names the variable that is wrong, never its value. |
| + |
| +## How the strings appear |
| + |
| +Door strings come back from the console and the CLI prints them after `billing: `. Examples: |
| + |
| +- `door.off`: `billing: billing is off on this deployment. set CARLOS_BILLING on the console to turn it on` |
| +- `door.still_live`: `billing: the subscription is still live at the provider. cancel it there, then close the problem` |
| +- `cli.problems_line` is not a string under review. A problem prints as `12 bab unrecognised sub_1Abc 2026-10-25 12:00 price price_9 is not in the price map`. |
| +- `cli.closed`: `problem 12 closed` |
| +- `start.config_invalid` is a fatal log line when the console starts: `console: billing configuration invalid: CARLOS_STRIPE_SECRET_KEY`. Keep the `console: ` prefix. |
| +- `start.book_edited`: `console: price book 2026-11-01-v1 changed without a new version`. Keep the `console: ` prefix. |
| +- `usage.billing` is one line in `carlos help`, after a 16-character command column: ` billing billing problems the console could not settle: problems | close`. Keep it under 60 characters. |
| +- Flag help (`cli.flag_*`) prints under the flag in `carlos billing close -h`. |
| + |
| +## Strings |
| + |
| +| key | current | |
| +|---|---| |
| +| `door.off` | billing is off on this deployment. set CARLOS_BILLING on the console to turn it on | |
| +| `door.still_live` | the subscription is still live at the provider. cancel it there, then close the problem | |
| +| `door.note_required` | say what you did in stripe with -note | |
| +| `door.closed` | this problem is already closed | |
| +| `door.provider_down` | the billing provider did not answer. try again in a minute | |
| +| `door.failed` | could not read or save billing problems. try again | |
| +| `cli.usage` | usage: carlos billing problems [-all] \| close -id N -note "..." | |
| +| `cli.flag_all` | include closed problems | |
| +| `cli.flag_id` | the problem to close, from carlos billing problems | |
| +| `cli.flag_note` | what you did in stripe. it is kept with the problem | |
| +| `cli.note_required` | say what you did in stripe with -note | |
| +| `cli.id_required` | say which problem to close with -id | |
| +| `cli.no_problems` | no open billing problems | |
| +| `cli.closed` | problem %d closed | |
| +| `cli.needs_console` | carlos billing works through a console, and this shell is in direct bucket mode<br>(CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR is set). billing is kept by the console.<br>unset the store env and run: carlos auth login --console \<url\> | |
| +| `start.config_invalid` | console: billing configuration invalid: %s | |
| +| `start.book_edited` | console: price book %s changed without a new version | |
| +| `usage.billing` | billing problems the console could not settle: problems \| close | |
| + |
| +(`<br>` in `cli.needs_console` is a line break. Keep the breaks where they are.) |
| + |
| +## Answer |
| + |
| +Return a Markdown table with columns `key`, `new`, `why` for every key, `new` equal to `current` where no change is needed. Write `<br>` for a line break. Then a section `Flags` for anything Paul must decide. Do not edit any files. |
diff --git a/docs/superpowers/specs/LUNA-COPY-RESULT-PLANS-6A.md b/docs/superpowers/specs/LUNA-COPY-RESULT-PLANS-6A.md| new file mode 100644 |
| index 000000000..ac5e720ab |
| --- /dev/null |
| +++ b/docs/superpowers/specs/LUNA-COPY-RESULT-PLANS-6A.md |
| @@ -0,0 +1,28 @@ |
| +# Luna copy result: billing problems and billing configuration (plans 6a) |
| + |
| +Approved by delegation (Luna). Model gpt-5.6-luna via codex, reasoning medium, run 2026-10-25 against docs/superpowers/specs/LUNA-COPY-BRIEF-PLANS-6A.md. Applied verbatim. Luna flagged nothing for Paul. |
| + |
| +| key | new | why | |
| +|---|---|---| |
| +| `door.off` | billing is off on this deployment. set CARLOS_BILLING on the console to turn it on | No change needed | |
| +| `door.still_live` | the subscription is still live at the provider. cancel it there, then close the problem | No change needed | |
| +| `door.note_required` | say what you did in stripe with -note | No change needed | |
| +| `door.closed` | this problem is already closed | No change needed | |
| +| `door.provider_down` | the billing provider did not answer. try again in a minute | No change needed | |
| +| `door.failed` | could not read or save billing problems. try again | No change needed | |
| +| `cli.usage` | usage: carlos billing problems [-all] \| close -id N -note "..." | No change needed | |
| +| `cli.flag_all` | include closed problems | No change needed | |
| +| `cli.flag_id` | problem number from carlos billing problems | Shorter and clearer | |
| +| `cli.flag_note` | what you did in stripe. this note is kept with the problem | Makes the record’s purpose explicit | |
| +| `cli.note_required` | say what you did in stripe with -note | No change needed | |
| +| `cli.id_required` | say which problem to close with -id | No change needed | |
| +| `cli.no_problems` | no open billing problems | No change needed | |
| +| `cli.closed` | problem %d closed | No change needed | |
| +| `cli.needs_console` | billing works through a console, but this shell is in direct bucket mode<br>(CARLOS_DEPLOYMENT_BUCKET/CARLOS_DEPLOYMENT_DIR is set). billing is kept by the console.<br>unset the store env and run: carlos auth login --console \<url\> | Removes the unnecessary product name and makes the contrast clearer | |
| +| `start.config_invalid` | console: invalid billing configuration: %s | More natural word order | |
| +| `start.book_edited` | console: price book %s changed without a new version | No change needed | |
| +| `usage.billing` | billing problems the console left open: problems \| close | Keeps the meaning while staying under 60 characters | |
| + |
| +## Flags |
| + |
| +None. |
| \ No newline at end of file |
diff --git a/internal/console/apibilling_copy.go b/internal/console/apibilling_copy.go| index 1355963de..36e3b4802 100644 |
| --- a/internal/console/apibilling_copy.go |
| +++ b/internal/console/apibilling_copy.go |
| @@ -1,7 +1,8 @@ |
| package console |
| -// Door errors for the billing problem doors (apibilling.go). Draft copy: |
| -// the Luna pass (plans 6a Task 9) replaces these. |
| +// Door errors for the billing problem doors (apibilling.go). Approved by |
| +// delegation (Luna), 2026-10-25: docs/superpowers/specs/LUNA-COPY-RESULT-PLANS-6A.md. |
| +// Apply later edits through a copy pass, not by hand. |
| const ( |
| billingCopyOff = "billing is off on this deployment. set CARLOS_BILLING on the console to turn it on" |
| billingCopyStillLive = "the subscription is still live at the provider. cancel it there, then close the problem" |
diff --git a/main.go b/main.go| index 9fed3be08..794f09d3a 100644 |
| --- a/main.go |
| +++ b/main.go |
| @@ -306,7 +306,7 @@ Your apps — ship and run software on a CARLOS deployment |
| Your deployment — stand up and administer boxes, routes and accounts |
| bootstrap prepare a host: units, dirs, user |
| accounts the tenancy primitive: create | list | migrate |
| - billing billing problems the console could not settle: problems | close |
| + billing billing problems the console left open: problems | close |
| fleets account-owned groups of remote boxes that dial this |
| console: create | add-box | rotate-token | tag-box | |
| detach-box | ls — box tokens print exactly once, at mint |