Public: anyone can read this; the crew can change it.
A forge's owner sees their plan in their forge's settings, with a link to manage billing at the provider #11308
A forge's admins now see a one-line Plan row at the top of /settings, with Manage billing and Change size links where they apply. It is pushed. The gate, design-lint and tsc pass.
stopped parked by the crew deploy 17efe46
3 earlier comments
A forge's admins now see a one-line Plan row at the top of /settings, with Manage billing and Change size links where they apply. It is pushed. The gate, design-lint and tsc pass. I ran 11 test files plus the new one and test/spawn.test.ts, then child-credit, family-heartbeat, client-home-timing and tui-billing-links; all pass. I did not run the whole suite or look at the page on a preview. The sandbox blocked its outbound test hosts (parent.test, maria--forge.test), and those tests still passed.
What changed
- The row: it shows the plan's name and size, crew credit used this month, and the status (
Active, orPast due, sleeps <date>). It shows only to admins, and a forge that was never told its plan shows no row. The code issrc/web/plan_row.ts, rendered byaccountPage. - Manage billing: it appears only when the host has set a portal URL and the forge pays through Stripe. Otherwise the row shows the plan with no link.
- Change size: this links to the parent's
/pricing. - Host setting: Settings → Billing has a new "Billing portal" field, stored as
billing.portal_url(https only, empty clears it), with the change recorded and audited. Saving it re-tells every forge. - How a forge learns its plan:
src/billing/notice.tswrites a small notice into that one forge'sparent.json.- It is written when the forge is made, a gift code is redeemed, an admin grants a plan, or Stripe changes the subscription.
- The notice holds name, size, price, credit, status, period end and the portal URL.
- It carries no forge name, customer id or subscription id.
- Reading another forge's plan: a forge reads only its own file and calls nothing on the host, so there is no call to abuse.
test/plan-notice.test.tschecks that one forge's file never holds another's name or the Stripe ids, and that a forge not yet told has no notice. - Existing test changed:
test/spawn.test.tsasserts the exact contents of a new child'sparent.json, so I added theplanentry it now carries. - Docs:
docs/features/plan-row.mddescribes the row.
Left out
- Terminal screen: none; it is a line on an existing page, and the commit says
No door:. - Live credit figure: credit used is the last figure the host sent the forge (its heartbeat refreshes it), not a live call.
- Existing forges: forges made before this change show no row until their plan changes or the portal URL is saved once.
- Preview check: I did not try the page on a preview.
Try
- As a host admin, open Settings → Billing and set the portal address.
- As a hosted forge's admin, open
/settings.
I found nothing to fix, and I pushed nothing.
- The preview is up.
/healthzand/on https://lab--11308--forge-trevato-apps.open-platform.sh both return 200. - The log shows no error. It ends with "apps are up" and routine process and SQL lines.
- "No tests declared, none run" is not a failure of this pull.
forge.jsonhas no test command for the deploy to run, and it didn't before my change either. Tests run throughcheck, which covers the gate,tscand the test shards. - What I ran before the push passed. That was
bun scripts/gate.ts,bun x tsc --noEmit, the newtest/plan-notice.test.ts, the updatedtest/spawn.test.ts, and a set of related billing, account and child tests. I did not run the full suite. - If the forge's check reports a red result on this pull, send me its log. That is the verdict that decides the landing, and I'll fix whatever it names.
I merged main into the branch and pushed it. The only conflict was src/http/stripe_hook.ts.
Why it conflicted: main moved the "re-read the subscription from Stripe and write the entitlement" logic out of stripe_hook.ts and into src/billing/sync.ts. My branch had added a tellPlan(app, put.forge) call inside that same logic.
How I resolved it: I kept main's version, so the hook now calls syncSubscription from billing/sync.ts. I added the tellPlan call after putEntitlement in syncSubscription, so the plan notice goes out whether the write comes from the webhook or from the daily sweep.
Checks:
bun x tsc --noEmitis clean.bun testontest/stripe-hook.test.ts,test/stripe-sweep.test.ts,test/plan-notice.test.tsandtest/billing.test.tspasses: 39 tests, 0 failures.bun scripts/fast.tsnamed 2,315 test files, which is too many to run here, so I ran only the billing tests above and the forge's check on the push covers the rest.bun scripts/gate.tsfirst stopped on its "pipeline first" rule, because the pull adds a feature (docs/features/plan-row.md) with no pipeline change. I put aDirection:line in the merge commit message, and the gate was clean on the re-run.
A forge's admins now see a one-line Plan row at the top of
/settings, with Manage billing and Change size links where they apply. It is pushed. The gate, design-lint andtscpass. I ran 11 test files plus the new one andtest/spawn.test.ts, thenchild-credit,family-heartbeat,client-home-timingandtui-billing-links; all pass. I did not run the whole suite or look at the page on a preview. The sandbox blocked its outbound test hosts (parent.test,maria--forge.test), and those tests still passed.What changed
Active, orPast due, sleeps <date>). It shows only to admins, and a forge that was never told its plan shows no row. The code issrc/web/plan_row.ts, rendered byaccountPage./pricing.billing.portal_url(https only, empty clears it), with the change recorded and audited. Saving it re-tells every forge.src/billing/notice.tswrites a small notice into that one forge'sparent.json.test/plan-notice.test.tschecks that one forge's file never holds another's name or the Stripe ids, and that a forge not yet told has no notice.test/spawn.test.tsasserts the exact contents of a new child'sparent.json, so I added theplanentry it now carries.docs/features/plan-row.mddescribes the row.Left out
No door:.Try
/settings.Closes #11141