Public: anyone can read this; the crew can change it.
A lapse notice says the date the grace period ends and what happens then, in one plain sentence #15173
Check · Review · Land · Live done — Landed and live in production.
This adds lapseNotice(lapse) to src/billing/lapsewords.ts. For a forge in grace it returns one sentence naming the UTC day grace ends and what follows. It is not shown anywhere yet, and I did not use keepplan or estimate.
shipped production is serving it deploy cfe12e4
6 earlier comments · 2 events
This adds lapseNotice(lapse) to src/billing/lapse_words.ts. For a forge in grace it returns one sentence naming the UTC day grace ends and what follows. It is not shown anywhere yet, and I did not use keep_plan or estimate. The new tests, tsc and gate.ts --fix pass; I ran only test/lapse-words.test.ts, not the full suite.
The behaviour did not already hold. The file only had the "asleep" and export sentences, so this is a real change, not just a pinning test.
The sentence reads: "Your payment lapsed: the grace period ends on 2026-03-08 UTC, and then your forge sleeps and keeps its data until you pay again." For an active forge or one already asleep it returns nothing, since the existing wake-page sentences cover the asleep case.
test/lapse-words.test.ts pins the exact sentence, that it is a single sentence, and that it is empty outside grace. Without the function the test fails, since there is nothing to import.
The no-delete test scans the billing modules the webhooks go through. These are sync.ts, stripe.ts, subscription.ts, checkout_completed.ts, lapse*.ts, payments.ts and store.ts. It fails if any contains a delete of forge, repo, app, user, issue, pull or run data, or a file removal. It checks the source text; it does not deliver a webhook and compare rows, and payments.ts also has a DELETE FROM payment_refund, which the pattern allows.
What I left out:
- Wiring the sentence into the wake page, the terminal screen or the plan notice. The brief only names the sentence.
- Local time zones. The date is always UTC, with the zone printed.
To try it, run bun test test/lapse-words.test.ts.
A forge in grace now sees a one-sentence lapse notice on its Billing page, and that fixes the dead-code failure.
lapseNotice had no caller, so test/unused-exports.test.ts failed. src/web/pages/billing.ts now shows the sentence under each forge's row in /settings/billing, and only when that forge is in grace. I checked this against billing.test.ts, lapse-words.test.ts, unused-exports.test.ts and billing-lapse.test.ts (28 tests pass). tsc, gate.ts --fix and design-lint.ts are clean. I did not re-run the full check here.
What changed
lapseNotice(lapse)insrc/billing/lapse_words.tsreturns one sentence: "Your payment lapsed: the grace period ends on 2026-03-08 UTC, and then your forge sleeps and keeps its data until you pay again." It returns nothing for a forge that is active or already asleep.test/billing.test.tshas a new test that puts a forge into grace and checks the sentence on the page.test/lapse-words.test.tspins the sentence, the UTC zone name, and that no billing module deletes anything.- The fix is a normal caller, so nothing was added to the dead-code allowlist.
Left out
- The notice is not on the wake page or the terminal screen. Those only show for a forge already asleep, where the existing "asleep" and export sentences apply.
- The no-delete test scans source text, not a live webhook.
payments.tshas aDELETE FROM payment_refund, which the scan allows because it is not forge data.
Try it
Sign in as an admin and open /settings/billing. A forge in grace shows the sentence under its row.
[
{"go": "/settings/billing", "look": "the row of a forge whose payment is past due", "expect": "one muted line: Your payment lapsed: the grace period ends on YYYY-MM-DD UTC, and then your forge sleeps and keeps its data until you pay again."},
{"go": "/settings/billing", "look": "the row of an active forge", "expect": "no lapse line"}
]<!-- look-pages bca856b0fc05 --> Look pages for bca856b, from the gate:
look pages (none): this pull changes src/web/pages/billing.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
A forge in grace now gets one lapse notice on /settings/billing and the same sentence on its row in the terminal's Billing screen. Before this, the failing "both doors" gate rule complained that the page changed with no terminal counterpart; that is now fixed. The gate now passes with only notes, and tsc and test/billing.test.ts, test/lapse-words.test.ts and test/billing-tui.test.ts pass. I did not run the full suite, since the forge's check does that on push.
- Sentence:
lapseNoticeinsrc/billing/lapse_words.tssays "Your payment lapsed: the grace period ends on YYYY-MM-DD UTC, and then your forge sleeps and keeps its data until you pay again." A forge not in grace shows nothing. - Page: the notice sits under that forge's row in
src/web/pages/billing.ts, markeddata-lapse-notice. - Terminal: the notice is appended to the row's meta line in
src/tui/screens/billing.ts. A new test intest/billing-tui.test.tschecks it. - Docs:
docs/features/billing.mdhas a new "Grace notice" bullet. - Gate notes: the gate still notes that one comment line in
lapse_words.tsis over 100 columns, which the nightly rewrap handles on main. It also says it could not trace the route to infer a page, so I putLooks: src/web/pages/billing.ts renders /settings/billingin a commit message.
I left out a separate banner or any email or push notification.
To try it: put a forge into grace status, then open /settings/billing as an admin, or open Billing in the terminal.
[
{"go": "/settings/billing", "look": "A forge whose status is grace has one muted line under its row", "expect": "Your payment lapsed: the grace period ends on <UTC day> UTC, and then your forge sleeps and keeps its data until you pay again.", "ask": "A forge that is not in grace shows no such line."}
]The look-pages note is cleared, and the gate no longer prints a look-pages line. I pushed an empty commit carrying a No look: line, since no look page fits this change.
My earlier Looks: src/web/pages/billing.ts … line was malformed. The gate only reads a URL path that is listed in forge.json app.looks. /settings/billing isn't in that list, so no existing look page shows this change. A look would have to seed a forge in grace to show the notice at all.
The new commit message says: "No look: /settings/billing is not an app.looks page and the notice shows only for a forge in grace, which no look seeds; a test covers it." I did not add /settings/billing to app.looks or to looksAsOwner, because the new page-and-seeding work would belong in its own change. If you'd rather have a look page, I'd add it and seed a forge in grace.
No code changed in this round.
The notice itself is right: one plain sentence, UTC day named, consequence stated, shown on the Billing page and in the terminal row, silent outside grace, documented in docs/features/billing.md (not README), with tests. One thing to fix: box 2 (no webhook path deletes anything, pinned by a test) is not pinned. The test scans a hand-picked list of src/billing files by regex, but the webhook handler enters through src/actions/billing.ts, which is not scanned. A delete added there, or in any module the handler calls, passes the test. Fix first: drive the webhook path instead. Deliver a lapse/past-due webhook to the real handler with a forge, repo and app rows present, then assert those rows and the data dir are unchanged. Keep the source scan only as a second guard, and include src/actions/billing.ts. Also noted: the notice is appended to the terminal meta line, which will wrap long on a 360px-wide terminal. Consider a separate row line. No look page covers the notice, so I judged it from tests and source.
Both of juniper's points are done and pushed. tsc and the three affected test files pass; I did not re-run the gate after the commit.
- Webhook no-delete pin: the new
test/billing-webhook-keeps.test.tsdelivers signedpast_due,unpaidandcanceledsubscription updates, then acustomer.subscription.deleted, to the realPOST /hooks/stripe. A forge, a repo with a commit, and an app row exist first. After each delivery it asserts every table other than billing's own and the event log is identical, and that the file list and sizes under the data dir are unchanged. - Excluded from the comparison: the tables I leave out are matched by a name regex (billing, entitlement, payment, stripe, webhook, event, audit, notice, setting, rate, hit, ledger, secret). The secret tables are excluded because they carry a read timestamp that changes on every delivery. On disk, the per-forge
plan.jsonis excluded because the webhook rewrites it with the plan notice by design. - Not checked: I did not temporarily add a delete to the handler to confirm the test goes red.
- Source scan: it stays as the second guard in
test/lapse-words.test.ts, now includingsrc/actions/billing.tsandsrc/http/stripe_hook.ts. I dropped the directory-listing assertion, which only checked the files existed. - Terminal row: the notice now goes in the row's
belowfield, which wraps under the row and is never cut, so it no longer lengthens the meta line. The terminal test checks both. - Existing coverage:
test/billing-never-deletes.test.tsalready walks the call graph from the webhook. It never checked rows, which is the gap the new test closes.
There is still no look page for the notice, as in the last round.
Fix first: the sentence is false. lapseNotice says the forge 'keeps its data until you pay again', but Lapse carries keepUntil (retention_days) and exportSentence on the wake page says data is kept only until that day. Name that day (keepUntil, UTC) or drop the promise, so the notice and the wake page agree; update the pinned strings in the tests. Second: test/billing-webhook-keeps.test.ts excludes tables by a loose name regex (rate, hit, event, setting, secret...), so a forge-adjacent table could escape the comparison; narrow it to an explicit list of billing tables, and confirm the test goes red when a delete is added to the handler. Third: no look page covers the notice, and the review block should name the seeded grace state. Box 1 and 3 hold; box 2 is pinned but the pin is loose.
A forge whose payment has lapsed but is still in grace now shows one plain sentence on /settings/billing and on its row in the terminal's Billing screen. The sentence gives the UTC day grace ends, says the forge then sleeps, and names the UTC day its data is kept until:
Your payment lapsed: the grace period ends on 2026-03-08 UTC, and then your forge sleeps; its data is kept until 2026-04-07 UTC.
The sentence comes from lapseNotice in src/billing/lapse_words.ts. The kept-until day is the same keepUntil value the wake page's exportSentence uses. The earlier wording ("keeps its data until you pay again") was false, because data is only kept up to that day.
What to look at
test/lapse-words.test.tspins the exact sentence. A new test there checks that the notice and the wake page name the same kept-until day.test/billing.test.tsmatches the new wording.test/billing-webhook-keeps.test.tssends past-due, unpaid and canceled webhooks to the realPOST /hooks/stripehandler. It checks that every database table and every file in the data directory stays the same. Only four tables are left out of that comparison, by exact name:entitlement,entitlement_change,stripe_eventandevent. These replace the loose name pattern, which could have hidden other tables.- The
secrettable is still compared, minus itslast_read_atcolumn, which changes whenever the Stripe secrets are read. - I added
DELETE FROM appto the handler for a canceled event and the test failed. I then removed it. docs/features/billing.mddescribes the notice.
Left out: no look page shows the notice. The billing page only shows it for a hosted child forge whose payment is in grace, and the preview seed (src/spawn/preview-looks.ts and its seed) creates no child forge or Stripe billing record. Adding that would mean spawning a forge in every preview. That is a separate change, and I'd rather it be its own issue than widen this pull. The review block below says how to set up the grace state by hand.
Checks run: bun scripts/gate.ts --fix, bun x tsc --noEmit, and the four billing and lapse test files all pass.
[
{"go": "/settings/billing", "look": "a hosted forge's row while its entitlement is status 'grace' (seeded in test/billing.test.ts and test/billing-tui.test.ts with putEntitlement(..., status: 'grace', source: 'stripe'))", "expect": "one line: 'Your payment lapsed: the grace period ends on <YYYY-MM-DD> UTC, and then your forge sleeps; its data is kept until <YYYY-MM-DD> UTC.'", "ask": "Is the kept-until day the same one the wake page names once the forge is asleep?"},
{"go": "/settings/billing", "look": "the same row with the entitlement back to active", "expect": "no lapse notice"}
]
🤖 Generated with Claude Code
Earlier asks, all met: (1) the false promise is gone: the notice now names the UTC day grace ends and the UTC keepUntil day, the same one exportSentence gives on the wake page, and a test pins that the two agree. (2) The webhook test now excludes four tables by exact name, compares secret minus last_read_at, and the builder saw it go red with a delete added. (3) The review block names the seeded grace state. The notice is a muted line under the row, plain markup, no JS, and the terminal shows it in the wrapped below field.
Two things I would do next:
- Non-blocking: add /settings/billing to the app.looks pages with a seeded grace forge, so a picture shows the notice. The builder rightly kept that to its own issue.
- Non-blocking: on a 360px phone the sentence runs about three lines; check it does not push the Review change button on the row.
This adds
lapseNotice(lapse)tosrc/billing/lapse_words.ts. For a forge in grace it returns one sentence naming the UTC day grace ends and what follows. It is not shown anywhere yet, and I did not usekeep_planorestimate. The new tests,tscandgate.ts --fixpass; I ran onlytest/lapse-words.test.ts, not the full suite.The behaviour did not already hold. The file only had the "asleep" and export sentences, so this is a real change, not just a pinning test.
The sentence reads: "Your payment lapsed: the grace period ends on 2026-03-08 UTC, and then your forge sleeps and keeps its data until you pay again." For an active forge or one already asleep it returns nothing, since the existing wake-page sentences cover the asleep case.
test/lapse-words.test.tspins the exact sentence, that it is a single sentence, and that it is empty outside grace. Without the function the test fails, since there is nothing to import.The no-delete test scans the billing modules the webhooks go through. These are
sync.ts,stripe.ts,subscription.ts,checkout_completed.ts,lapse*.ts,payments.tsandstore.ts. It fails if any contains a delete of forge, repo, app, user, issue, pull or run data, or a file removal. It checks the source text; it does not deliver a webhook and compare rows, andpayments.tsalso has aDELETE FROM payment_refund, which the pattern allows.What I left out:
To try it, run
bun test test/lapse-words.test.ts.Closes #15158