ADR-022: Plans Set by the Operator¶
Status: Proposed Deciders: @grokify Relates to: ADR-021 (billing, whose events store the plan this overrides), and the internal plans of the pricing spec.
Context¶
An organization's plan is its platform subscription's plan_tier, which
billing events write. Some organizations need a plan nobody pays for:
- the deployment's own accounts, which run and test the service and should meet no limits;
- a customer given a plan by agreement, such as a partner, a pilot or a replacement for a plan sold elsewhere.
A pricing spec can now mark a plan internal: never sold, left out of the
pricing view, with no price. Something still has to put an organization on
it. Writing plan_tier by hand does not last: the next subscription event
for the organization writes it again. Each application could keep a plan of
its own, but then every application of a deployment needs the same
override, and the console, the authorization graph and the entitlements in
tokens would all disagree with it.
Decision¶
- The platform subscription holds an operator's plan, beside the plan
billing stores:
operator_plan, withoperator_note(why, at most 200 characters) andoperator_set_at. A nulloperator_planmeans there is none. - It wins while it is set.
Subscription.GrantedPlanreturns the operator's plan whatever the subscription's status, and otherwise the subscription's plan while it is active, in a trial or past due.billing.OrganizationPlan,Service.OrganizationPlan, the entitlements, andGetPlanTier(the seller's plan for marketplace fees) all use it. The entitlement it grants has no end date. It applies in free mode too, where a paid subscription grants nothing, so a deployment that takes no payments can still put its own accounts on an internal plan. - Billing never writes it. Subscription events keep updating
plan_tier, the status and the period, so a paid subscription is kept accurately underneath and takes effect again when the operator's plan is cleared. - Checkout does not sell over it. While it is set, plan checkout is
refused with 409, since the organization would pay for a plan it would
not be on. The customer portal still opens, to manage or cancel a paid
subscription. The console reports
setByOperator; the note is for operators and is not shown to members. - Any plan of the spec may be set, internal or not. A plan that is not in the spec is refused when it is set; one later removed from the spec resolves to the default plan, like any stored plan.
- Operators set it with a command,
billing plan list|show|set|clearinbillingcmd, which a host adds to its CLI. An organization is named by its slug, its ID, or its owner's email address.
Consequences¶
- A deployment's own accounts go on an internal plan with one command, and stay on it through any billing activity.
- Every reader of the plan agrees, so an application reads the plan from SystemForge and keeps no copy of its own.
- An operator's plan has no expiry; it lasts until it is cleared. A time-limited grant would need an end date of its own.
- Setting it is not an audited event; the note and the time are kept on the
row, and
billing plan listshows every organization that has one.