Ending a plan's delivery runs the same four steps in three places, with the pool locked at different points #180

Open
opened 2026-10-06 21:25:01 +00:00 by cgalo5758 · 1 comment
Owner

When a plan stops delivering, the console ends its positions, resumes the grants it replaced if anything ended, restores the org-type default if the ladder is vacant, and recomputes the pool. Resumption must precede the default. The sequence is written in RevokeGrantTx and ExpireGrantTx (internal/entitlements/grant_acts.go) and in the ended branch of ReconcileSubscription (internal/fulfillment/reconcile.go). Revocation and expiry lock the pool first; the subscription path ends positions first and locks the pool only when resumption starts. A purchase source would add a fourth copy.

Done when: one entitlements act, given the pool, the ended source and an actor, locks the pool first and runs the four steps; the three callers use it; and a test ends a subscription concurrently with an operator act on the same pool. If #154 merges the default and resumption, it happens inside this act.

When a plan stops delivering, the console ends its positions, resumes the grants it replaced if anything ended, restores the org-type default if the ladder is vacant, and recomputes the pool. Resumption must precede the default. The sequence is written in `RevokeGrantTx` and `ExpireGrantTx` (`internal/entitlements/grant_acts.go`) and in the ended branch of `ReconcileSubscription` (`internal/fulfillment/reconcile.go`). Revocation and expiry lock the pool first; the subscription path ends positions first and locks the pool only when resumption starts. A purchase source would add a fourth copy. Done when: one entitlements act, given the pool, the ended source and an actor, locks the pool first and runs the four steps; the three callers use it; and a test ends a subscription concurrently with an operator act on the same pool. If #154 merges the default and resumption, it happens inside this act.
cgalo5758 added the
kind
design
area/entitlementsarea/billing
labels 2026-10-06 21:25:01 +00:00
Author
Owner

The test kit's world.EndSubscription (internal/testkit/world/acts.go) repeats the reconcile's ended branch step for step: end the subscription's provisions, resume the grants it replaced when something ended, restore the floor, materialize, close the scheduled changes. That makes four copies. The reconcile's branch now sits in its own function, reconcileEnded, which is the place to replace.

The test kit's `world.EndSubscription` (internal/testkit/world/acts.go) repeats the reconcile's ended branch step for step: end the subscription's provisions, resume the grants it replaced when something ended, restore the floor, materialize, close the scheduled changes. That makes four copies. The reconcile's branch now sits in its own function, `reconcileEnded`, which is the place to replace.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wiki-cafe/member-console#180