{{ message }}
Repository navigation
feat: plan states and caps for billing, off until BILLING_STARTS_AT - #144
Merged
Merged
Conversation
Accounts get a plan worked out from their sign-up date: a 30-day trial for new ones, a free year for those made before billing starts, or an admin's free-until date. Caps follow the plan; a lapsed account keeps reading and exporting but is refused anything new with 402 subscription_required, and the worker stops its feeds and monthly topics. Unset, nothing changes. Amp-Thread-ID: https://ampcode.com/threads/T-01a151f5-d1bb-745b-9889-2cc115dd4227 Co-authored-by: Amp <amp@ampcode.com>
…and topic runs Also lets an admin's date end a trial, counts plan days as 24 hours whatever the session's time zone, and refuses a lapsed feed follow before fetching it. Amp-Thread-ID: https://ampcode.com/threads/T-01a151f5-d1bb-745b-9889-2cc115dd4227 Co-authored-by: Amp <amp@ampcode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Why
Klipstack will charge for hosted accounts: a 30-day trial, then a paid plan, with existing accounts free for a while. This lays the ground in the database and the caps before any payment provider (Polar comes later). Nothing changes until
BILLING_STARTS_ATis set.What changes
BILLING_STARTS_AT, each account has a plan: a 30-day trial for accounts made after it, the paid plan free for a year from it for older ones, always free for admins, or an admin's "free until" date, which replaces either. Worked out in SQL (packages/db/src/plan.ts), so web and worker agree.LIMIT_TRIAL_*/LIMIT_PAID_*setting.402 subscription_required, from the commands, so web, API and MCP agree. The worker stops its feeds and topic runs.Verification
pnpm verifypasses. New tests cover plan dates and caps, every refusal above, the API's 402, the admin change and its audit event, and the worker's filters; each was seen failing without its code.Risk and follow-ups
account_billing.BILLING_STARTS_ATunset.subscription_requiredyet: the add-feed dialog would say the link is invalid. Needed before billing starts, with the trial banner.