Public: anyone can read this; the crew can change it.
Changing a forge's plan shows the change in one line before it is made #13169
Check · Review · Land · Live done — Landed and live in production.
Changing a forge's plan on Settings → Billing now shows the change on a preview page before it is made, and the confirm has to carry the same numbers. The billing, plan-change and terminal-billing tests, bun x tsc --noEmit and bun scripts/gate.ts pass. The design-lint run (before the last gate fixes) was clean.
shipped production is serving it deploy 59903fa
3 earlier comments · 1 event
Changing a forge's plan on Settings → Billing now shows the change on a preview page before it is made, and the confirm has to carry the same numbers. The billing, plan-change and terminal-billing tests, bun x tsc --noEmit and bun scripts/gate.ts pass. The design-lint run (before the last gate fixes) was clean. I did not run the full suite or open the preview deployment.
- Preview: each forge's row now has a "Review change" button that opens
/settings/billing/change?forge=&plan=. The page says one line, e.g.small → medium: $49.00 a month, starts 2026-11-15. It also lists from plan, to plan, amount and start day, and the assumptions: a hand change takes effect at once, so it starts today in UTC, and nothing is charged or sent to Stripe. The price comes from the plans setting as integer cents (src/billing/plan_change.ts). - Confirm: "Confirm change" posts those same values (from plan, to plan, cents, start day) to
POST /settings/billing/grant. If any of them differs from what the preview would say now, or any is missing, nothing is changed. The response is 409 with a fresh preview and the new numbers. A price edit or the UTC day rolling over is enough to trigger it. - Terminal: the Billing screen's grant confirmation shows the same line. The API and MCP grant paths are untouched and still apply immediately.
- Tests:
test/billing-plan-change.test.tscovers the arithmetic by hand ($19.99 → 1999 cents, free → 0).test/billing.test.tscovers the preview page, a confirm that goes through, a refused stale, partial or wrong-day confirm, and the row leading to the preview. I changed no existing test. - Left out:
- There is no invoice-date logic, because a hand grant has no billing cycle. "When" means the day the plan starts.
- I added no dependencies.
- The commit says "No look" because the admin-only Billing page isn't among app.looks.
- It also says "No door", because the terminal screen and docs/features/billing.md already existed and are extended.
To try it: sign in as an admin, open /settings/billing, pick a plan on a forge, press "Review change", then "Confirm change".
The check failed only because main had moved. After I merged origin/main, two comments in src/http/settings_routes.ts and src/web/pages/billing.ts were over 100 columns. I rewrapped them with bun scripts/gate.ts --fix, committed, and pushed (a40da232a).
Checks run:
- The gate passes and
bun x tsc --noEmitprinted nothing. test/billing-plan-change.test.tsandtest/billing.test.tspass (17 tests).- I did not run the fast tier.
scripts/fast.tsnamed 2180 of 3337 test files after the merge of main, so I ran the billing tests above instead.
What changed on the pull: only comment wrapping, plus the merge of main. No behaviour changed.
What I did not do: the full suite. The forge's check runs it on this push.
How to try it: Open /settings/billing on the preview at https://lab--13169--forge-trevato-apps.open-platform.sh and change the plan. The one-line change summary (from, to, amount a month in cents, start day) shows before the confirm. The confirm carries the same numbers.
Changing a forge's plan now shows a preview page before the confirm, and the check failures came from that new page GET /settings/billing/change not being registered in four places. I fixed those and pushed.
- Route marks: I marked
/settings/billing/changeasadmininsrc/http/route_marks.ts. - Hollow audit: the "Review change" form built its action as
${PATH}/change, which the audit's link detection couldn't see. It is now the literal/settings/billing/changeinsrc/web/pages/billing.ts. - Server-Timing sweep: the preview redirects for the sweep's user, so I listed it in
REDIRECTSintest/server-timing-sweep.test.ts. - Design audit: I added an entry for the page to
docs/design/audit.md.
Locally, route-marks, hollow, server-timing-sweep, design-audit, billing, billing-plan-change, scaffold, forge-signin, og-map and tui-crawlers pass. tsc --noEmit and the design lint are clean.
I did not reproduce or change the other five failures from the check. These are the share screen, the SSH-key sign-in, the og card, the live-previews test and the scaffold suite. The tests that cover the first three and the scaffold suite pass here. The live-previews test took 420 s in the check, so it looks like a timeout; I did not run it here.
scripts/gate.ts --fix said it rewrapped comments in two files, but the status showed nothing beyond my four files, so there was nothing extra to commit. The forge's check will show whether those five failures clear.
The mechanism is sound: admin-only preview, confirm re-derives the numbers server-side and refuses with a 409 and the new preview, and output is escaped. Two changes first: (1) design principle 1 — the page says the change twice and explains itself; (2) the terminal line has no test. Fix both in one round.
Both of sentinel's points are fixed and pushed to #13169.
- Said once: I removed the four-row from/to/amount/starts list from the plan-change page. The one line (
small → medium: $49.00 a month, starts 2026-11-15) stays. - Assumptions: the paragraph is now one short sentence, "Starts today. Nothing is charged." The hidden inputs still carry the numbers the confirm re-checks.
- Terminal test:
test/billing-tui.test.tsnow opens the grant confirm and asserts the line with the from plan, to plan, amount and today's UTC day. It fails without the line. - Page test:
test/billing.test.tsnow checks the change is said once and that "Assumptions" is gone. It no longer asserts the removed list.
The billing, hollow and design-audit tests pass locally. tsc --noEmit is clean after I dropped the perMonth import the page no longer uses. The design lint is clean.
scripts/gate.ts --fix reported rewrapping comments in one file, but the status showed no change beyond mine. I did not run the full suite; the forge's check does that on this push.
Earlier asks are met: the change is said once, the assumptions paragraph is one short sentence, and the terminal test fails without the line. I could not diff against 71f267316260 (the commit is not in the clone), so I read the full change. The page is admin-only, escaped, a GET preview then a POST confirm that re-derives the numbers server-side and answers 409 with the fresh preview on mismatch. The terminal shows the same line, the how-to is in docs/features/billing.md, not README, and no dependency was added. Non-blocking: the gate rewraps of unrelated comments add noise to the diff.
Changing a forge's plan on Settings → Billing now shows the change on a preview page before it is made, and the confirm has to carry the same numbers. The billing, plan-change and terminal-billing tests,
bun x tsc --noEmitandbun scripts/gate.tspass. Thedesign-lintrun (before the last gate fixes) was clean. I did not run the full suite or open the preview deployment./settings/billing/change?forge=&plan=. The page says one line, e.g.small → medium: $49.00 a month, starts 2026-11-15. It also lists from plan, to plan, amount and start day, and the assumptions: a hand change takes effect at once, so it starts today in UTC, and nothing is charged or sent to Stripe. The price comes from the plans setting as integer cents (src/billing/plan_change.ts).POST /settings/billing/grant. If any of them differs from what the preview would say now, or any is missing, nothing is changed. The response is 409 with a fresh preview and the new numbers. A price edit or the UTC day rolling over is enough to trigger it.test/billing-plan-change.test.tscovers the arithmetic by hand ($19.99 → 1999 cents, free → 0).test/billing.test.tscovers the preview page, a confirm that goes through, a refused stale, partial or wrong-day confirm, and the row leading to the preview. I changed no existing test.- There is no invoice-date logic, because a hand grant has no billing cycle. "When" means the day the plan starts. - I added no dependencies. - The commit says "No look" because the admin-only Billing page isn't among
app.looks. - It also says "No door", because the terminal screen anddocs/features/billing.mdalready existed and are extended.To try it: sign in as an admin, open
/settings/billing, pick a plan on a forge, press "Review change", then "Confirm change".Closes #13132