Skip to content

Hosted billing: email support when the billing cron fails, and write the support runbooks - #1562

Merged
nedtwigg merged 9 commits into
mainfrom
billing-ops
Nov 5, 2026
Merged

nedtwigg merged 9 commits into
mainfrom
billing-ops

Conversation

@nedtwigg

@nedtwigg nedtwigg commented Nov 3, 2026

Copy link
Copy Markdown
Member

Part of the billing release gate, #1074. Billing still ships closed. Based on #1561, so that the alert's email joins Hosted/Emails; merge #1561 first and this retargets to main.

  • Billing alert. The 14-day withdrawal refund and "Refund by hand" relied on someone watching Cron Events, with Worker observability off. When the account cron's billing pass fails, it now emails [email protected], once a day per distinct error, with overdue withdrawals, closures, and acknowledgements first. Messages only, with keys, connection URLs, and card-shaped numbers masked. A failed alert is logged and retried, and the invocation still fails. Migration 028 keeps only fingerprints. The alert's text lives in billing-alert-message.ts, so Storybook can show it. See docs/specs/hosted.md -> "Billing alert".
  • Support runbooks in hosted/README.md: verifying a customer, cancelling for someone who cannot sign in, closing by email, the 30-day refund, withdrawal by email or post, unused-period refunds, restoring a founding lock, and the first 30-day notice. The withdrawal path records by SQL and lets the cron end, refund, and acknowledge it, which also brings it under the alert. Tests run the README's own SQL. The owner line is still to be named before launch.
  • Stale docs. The README no longer calls Relay and voice admin-only, or says there is no paid-service activation.

pnpm test:hosted (367) passes, and the alert was seen arriving in the local inbox at the 10-minute cron. Mutation checks are recorded on the alert and overdue lines.

Known limits, in the README: the alert cannot report a cron that has stopped or a Postmark refusal, so the runbook asks for a weekly look at Cron Events; nothing shows notices at sign-in for an account without an email, so a notice to one starts no period; the founding-restore stripe subscriptions create command has not been run; and Postmark delivery from support to itself is unproven until the README's alert exercise runs on production.

🤖 Generated with Claude Code

nedtwigg and others added 5 commits November 3, 2026 13:08
The 14-day withdrawal refund and the hand refund path rested on someone
watching Cron Events, with Worker observability off. A failing pass now
mails the error messages to the support address, leading with what is
overdue, at most once a day per distinct line. The invocation still fails
whatever the alert does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cancelling, closing, the 30-day and unused-period refunds, withdrawal by
email or post, restoring a founding lock, and first-time notices each get
exact steps and the deadline the Terms promise. The runbooks' SQL is what the
tests run. The README and rationale no longer say the entitlement is admin-only.
The built promises move above the fold in the pricing spec; what remains stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	docs/specs/pricing.md
#	hosted/README.md
#	hosted/server/notices.ts
#	hosted/server/tests/billing-routes.test.ts
#	hosted/server/tests/migrations.test.ts
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 54c3a3f
Status: ✅  Deploy successful!
Preview URL: https://fcf10982.mouseterm.pages.dev
Branch Preview URL: https://billing-ops.mouseterm.pages.dev

View logs

export const BillingAlert: Story = {
args: alertMessage(
[
{ text: "Withdrawal e7a40e59-bc8d-404c-b29c-5a32b0c40bef: submitted 2027-03-05, its refund is due by 2027-03-19", overdue: true },

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overdue line doesn't match what settleWithdrawals emits (Withdrawal ${id}, noticed …, is unsettled: its refund is due by …), so the story shows support a wording that never arrives:

Suggested change
{ text: "Withdrawal e7a40e59-bc8d-404c-b29c-5a32b0c40bef: submitted 2027-03-05, its refund is due by 2027-03-19", overdue: true },
{ text: "Withdrawal e7a40e59-bc8d-404c-b29c-5a32b0c40bef, noticed 2027-03-05, is unsettled: its refund is due by 2027-03-19", overdue: true },

nedtwigg and others added 3 commits November 3, 2026 21:31
A billing correction is now a marked refund, so the runbook says that instead of staying below the full amount.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Base automatically changed from billing-confirmation to main November 5, 2026 21:10
@nedtwigg
nedtwigg merged commit 5e6b176 into main Nov 5, 2026
18 checks passed
@nedtwigg
nedtwigg deleted the billing-ops branch November 5, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants