A subscription's next reconcile confers its tier again over the operator's grant that replaced it, and ends the grant #212
Closed
opened 2026-10-09 16:08:24 +00:00 by cgalo5758
·
2 comments
Labels
Clear labels
accessibility
area/billing
area/catalog
area/discourse
area/domains
area/entitlements
area/fedwiki
area/identity
area/integrations
area/licensing
area/member-ui
area/meta
area/operator-ui
area/ops
area/testing
duplicate
good-first-issue
invalid
privacy
security
upstream
wontfix
A barrier for people using assistive technology or a keyboard alone.
The Stripe mirror, checkout, subscriptions, invoices, fulfillment.
Products, prices, plan ladders, purchasability.
The Discourse integration.
The domains registry, claims, placements, the certificate ask.
Entitlement sets, rules, grants, pools, provisioning.
The Federated Wiki integration and farm sync.
Sign-in, sessions, persons, organizations, workspaces, roles.
The provider registry, outbox and webhooks in general.
Licenses, the contributor agreement, SPDX headers.
Member pages.
The repository itself, its contributing guide, CI, the tracker and the workflow.
Operator pages, forms, lists, the design system.
Deployment, configuration, migrations, workflows, instance settings.
The test stack, screens, lint, walkthroughs.
Closed because another issue already covers it.
Small, self-contained, and explained enough to be a first contribution.
Closed because it is not a ticket for this repository.
Touches what a person's data reveals.
Touches authentication, authorization, secrets or data exposure.
Waits on another repository or project before it can move.
Closed because it will not be done, with the reason in the last comment.
kind
bug
The software does something other than what it promises; closed when it again does what it promises.
kind
debt
Code, tests or tooling to clean up with nothing visible changing; closed when they are cleaner.
kind
design
A question to settle before work can be defined; closed when the decision is written down.
kind
docs
Documentation that is wrong or missing; closed when it says the right thing.
kind
enhancement
Something the software does not do yet; closed when it does.
priority
critical
Blocks the active milestone or harms members now.
priority
high
Next in line inside the active milestone.
priority
low
Inside the active milestone, when nothing else is left.
priority
medium
Inside the active milestone, after the high ones.
Milestone
No items
No Milestone
Public launch
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: wiki-cafe/member-console#212
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What happens
An operator can issue a grant to an organization whose tier on a ladder is paid for by a subscription. (A ladder is a sequence of tiers such as Plus, Pro and Max. An organization holds one tier on each ladder at a time, from a subscription or from a grant.) The grant's conferral,
core.confer, ends the subscription's provision, and the grant takes the ladder. The issue form says the subscription keeps billing until it is changed in the billing view.The subscription's next reconcile undoes this.
reconcileItemscompares the products on the Stripe subscription with the subscription's provisions that have not ended. The grant ended the subscription's provision, so its product reads as missing, and the reconcile callscore.conferfor it. That conferral ends the grant's provision and puts the subscription's tier back on the ladder. Nothing asks whether another source took the ladder from the subscription.Any reconcile of an active subscription does this: the
customer.subscription.updatedevent at each renewal or after any other edit, the invoice reconcile, and the sweep's reconcile of a period-end downgrade. A subscription that was past due when the grant was issued does the same when it recovers.SyncSourceStatusresumes nothing, as it should, and the item pass that follows confers the tier again. The test for that case callsSyncSourceStatusdirectly, so it never runs the item pass.A grant that is not marked to resume stays recorded as active and never delivers again, even after the subscription ends. A grant marked to resume is recorded as replaced by the subscription, so it comes back only when the subscription is canceled.
#202 is a race in the member's plan change whose last step is this same reconcile. Closing that race leaves this case open.
What should happen
A grant that replaced a subscription's tier keeps the ladder until it ends or is revoked, and the subscription keeps billing, as the issue form says. The subscription management spec says the same for the past-due case: the subscription does not regain the superseded position. A reconcile leaves a ladder alone when another source ended the subscription's provision on it.
Where
internal/fulfillment/reconcile.go:reconcileItems, which lists the subscription's provisions throughGetLivePoolProvisionsBySubscriptionIDand callsConferfor every product with none.core.conferis ininternal/db/migrations/00023_grant_resumption.sql.Steps
customer.subscription.updatedevent is reconciled. Its items have not changed.A grant of the subscription's own tier ends the same way.
Why it matters
An operator's grant over a paid tier lasts only until the subscription's next event, usually within one billing period, and a grant that is not marked to resume is lost without anyone revoking it.
The same re-conferral happens when the subscription's provision was ended by the subscription itself. A subscription can carry two items whose products are two tiers of one ladder. The console never creates one, but an edit at Stripe can, as #200 describes.
convergeConferrals(internal/fulfillment/reconcile.go:638-668, called fromreconcileItems) reads the subscription's live provisions once, then confers each desired product that has none.core.conferends every provision on a ladder the new product sits on, the subscription's own provision of the other tier included. So:desiredmap (line 658), which can differ from run to run.I have read this, not run it. A fix that leaves a ladder alone only when a different source ended the subscription's provision does not cover this case. The reconcile needs a rule for a subscription that pays for two tiers of one ladder, for example conferring only the higher-ranked tier and logging the other, and it should walk
desiredin a fixed order either way.A grant that replaced a subscription's tier now keeps the ladder until it ends or is revoked. (A ladder is a sequence of tiers such as Plus, Pro and Max; an organization holds one tier on each ladder at a time, from a subscription or from a grant.)
The subscription reconcile now checks, for each product the subscription pays for, whether another plan took one of that product's ladders from the subscription and still holds it. It reads this from the tier-change history: the subscription's last position on the ladder ended in a supersession, and the plan that took it is not the subscription. While a plan other than the organization type's default holds that ladder, the reconcile confers nothing there and logs it. The subscription keeps billing, as the issue form says, and nothing is sent to Stripe. Once the grant ends and only the default holds the ladder, or nothing does, the subscription's next reconcile puts its tier back.
This holds on every path that reconciles a subscription: renewals and other edits, the checkout return, the invoice reconcile, the sweeper's runs, and a member's move on another ladder of the same subscription. A subscription that recovers from past due goes through the same check, so the recovery no longer takes the ladder back. A downgrade that lands while a grant holds the ladder is recorded as applied, and its tier is not conferred. A new purchase over a grant still replaces the grant.
The case in the comment above is fixed as well: a subscription that carries two tiers of one ladder gets the higher-ranked one, and the other is logged as a warning, so the tier no longer alternates. The reconcile now confers in a fixed order, by product id. Two subscriptions of one organization on one ladder no longer alternate either: the later one keeps the ladder.
On the organization page, the Billing card's Subscriptions row now shows a "Not delivering" badge beside the subscription's state when a subscription keeps billing while another plan holds one of its ladders. The text shown on the badge when the pointer rests on it names the ladder and what holds it (a grant, another subscription, or another plan), for example "Billing continues while a grant holds Hosting." The subscription's row in the operator's subscriptions list carries the same badge, and the list and the card apply the same check. The Issue grant form's warning now says that the subscription keeps billing and delivers nothing on that ladder until the grant ends, instead of pointing at the billing views, which cannot change a subscription.
Not changed here: the subscription keeps billing while the grant holds the ladder, and the member's Products page says nothing new about it; pausing its collection, and what the member then sees, is #269. A subscription delivers again at its next reconcile after the grant ends, not at the moment the grant ends (#270).
Commits:
16cc1de6(the reconcile takes the pool row first in every branch, #193),bb90c5fa,1b1ab1d8,8181d546,76ff9d69,e3f3ec56,04862abe,335aa857,2f1803d1.