FedWiki sites stay active after a plan ends when no remaining rule covers sites #330

Open
opened 2026-11-14 21:23:05 +00:00 by cgalo5758 · 1 comment
Owner

What happens

An organization holds a plan whose entitlement set (the list of rules a product delivers) carries a limit on FedWiki sites. The plan ends: the subscription is cancelled, a grant expires or is revoked, or the subscription is suspended for non-payment. If nothing the organization still holds carries a rule for fedwiki_sites, the limit becomes 0 and the create form refuses a new site, but every existing site stays active and writable for as long as the organization likes.

The maintenance sweep that makes surplus sites read-only does nothing for that organization. It acts only when a rule that still funds the limit carries the reduction policy "Force reduce" (the rule's setting for what happens to sites above a lowered limit), and here no rule is left to carry it.

The same happens when an operator removes the fedwiki_sites rule from an entitlement set. Every organization that held the limit only through that rule drops to 0 and keeps all its sites active.

What should happen

When no active rule funds fedwiki_sites for an organization's pool (the place its limits and usage are counted), the sweep makes the pool's active sites read-only, as it does for a surplus under a rule set to "Force reduce". The content is kept, and the sites come back when a plan funds them again.

"Leave the surplus alone" is a promise a rule makes to an organization that still has a plan. With no rule left, nobody has made that promise.

The fix makes removing a rule consequential for every organization that relied on it, so the preview an operator sees before committing a rule change has to count those organizations and say what happens to their sites.

Where

  • internal/integrations/fedwiki/workflows/reconcile.go, reconcilePoolQuota: parks only when the governing policy reads force_reduce, and reads no policy when nothing funds the key.
  • internal/entitlements/queries/entitlement_set_rules.sql, GetGoverningReductionPolicy: returns no row for a key no active rule funds.
  • openspec/specs/fedwiki-sites/spec.md, the requirement that the quota sweep "SHALL NOT park unconditionally": it names what the sweep does under each policy and is silent on a limit no rule funds.
  • internal/integrations/fedwiki/workflows/reconcile_db_test.go, TestReconcileUngovernedParksNothing: asserts the current behaviour and changes with the fix.

Steps

  1. Give an organization a plan whose entitlement set carries a fedwiki_sites limit of 3 with the reduction policy "Force reduce", and create 3 sites.
  2. Make sure the default plan of the organization's type carries no fedwiki_sites rule, or that the type has no default plan.
  3. End the plan: cancel the subscription or revoke the grant.
  4. Run FedWiki maintenance.

The limit reads 0 and the 3 sites are still active.

If the default plan does carry a fedwiki_sites rule set to "Force reduce", the sweep parks the surplus as expected. That is the only configuration in which a plan's end reaches the sites today.

Why it matters

A member who pays once and then cancels keeps every site they made in full use, for nothing. An operator has to know to give the default plan a fedwiki_sites rule of 0 set to "Force reduce" to prevent it, and an operator who configures nothing gives the service away.

### What happens An organization holds a plan whose entitlement set (the list of rules a product delivers) carries a limit on FedWiki sites. The plan ends: the subscription is cancelled, a grant expires or is revoked, or the subscription is suspended for non-payment. If nothing the organization still holds carries a rule for `fedwiki_sites`, the limit becomes 0 and the create form refuses a new site, but every existing site stays active and writable for as long as the organization likes. The maintenance sweep that makes surplus sites read-only does nothing for that organization. It acts only when a rule that still funds the limit carries the reduction policy "Force reduce" (the rule's setting for what happens to sites above a lowered limit), and here no rule is left to carry it. The same happens when an operator removes the `fedwiki_sites` rule from an entitlement set. Every organization that held the limit only through that rule drops to 0 and keeps all its sites active. ### What should happen When no active rule funds `fedwiki_sites` for an organization's pool (the place its limits and usage are counted), the sweep makes the pool's active sites read-only, as it does for a surplus under a rule set to "Force reduce". The content is kept, and the sites come back when a plan funds them again. "Leave the surplus alone" is a promise a rule makes to an organization that still has a plan. With no rule left, nobody has made that promise. The fix makes removing a rule consequential for every organization that relied on it, so the preview an operator sees before committing a rule change has to count those organizations and say what happens to their sites. ### Where - `internal/integrations/fedwiki/workflows/reconcile.go`, `reconcilePoolQuota`: parks only when the governing policy reads `force_reduce`, and reads no policy when nothing funds the key. - `internal/entitlements/queries/entitlement_set_rules.sql`, `GetGoverningReductionPolicy`: returns no row for a key no active rule funds. - `openspec/specs/fedwiki-sites/spec.md`, the requirement that the quota sweep "SHALL NOT park unconditionally": it names what the sweep does under each policy and is silent on a limit no rule funds. - `internal/integrations/fedwiki/workflows/reconcile_db_test.go`, `TestReconcileUngovernedParksNothing`: asserts the current behaviour and changes with the fix. ### Steps 1. Give an organization a plan whose entitlement set carries a `fedwiki_sites` limit of 3 with the reduction policy "Force reduce", and create 3 sites. 2. Make sure the default plan of the organization's type carries no `fedwiki_sites` rule, or that the type has no default plan. 3. End the plan: cancel the subscription or revoke the grant. 4. Run FedWiki maintenance. The limit reads 0 and the 3 sites are still active. If the default plan does carry a `fedwiki_sites` rule set to "Force reduce", the sweep parks the surplus as expected. That is the only configuration in which a plan's end reaches the sites today. ### Why it matters A member who pays once and then cancels keeps every site they made in full use, for nothing. An operator has to know to give the default plan a `fedwiki_sites` rule of 0 set to "Force reduce" to prevent it, and an operator who configures nothing gives the service away.
cgalo5758 added the
kind
bug
area/entitlementsarea/fedwiki
labels 2026-11-14 21:23:05 +00:00
Author
Owner

Three things found after filing. They mean the fix described above should not go into the sweep alone.

  1. A failed payment. A subscription is suspended at the first failed charge (internal/fulfillment/reconcile.go, where past_due, unpaid and paused are classed as suspended), and a suspended subscription funds nothing. The default plan is not restored while a plan is suspended, because a suspended plan still counts as held (docs/models/plan-ladders-transitions.md, where restoration is described as a floor). With the fix as written, a card that fails at renewal would make every site read-only at once, including the sites the default plan allows. A member whose card failed would be treated worse than a member who cancelled.
  2. A plan switch. When a member moves to a plan that is not on every plan ladder the old plan was on, the old plan's places on the other ladders end too (the same page, where a switch is described as replacing the whole bundle). A limit funded only there loses its last rule, and the fix as written would make those sites read-only because of the member's own upgrade.
  3. The same giveaway where a rule remains. If the default plan carries a fedwiki_sites rule whose reduction policy is anything other than "Force reduce", every site stays active after a plan ends, because the sweep reads the policy of the rules that remain. A new rule opens on "Clamp" (#105). An explicit rule of 0 sites on the default plan therefore leaves a member more than no rule at all.

So this needs one decision on what a plan's end, a downgrade and a failed payment each do to existing sites, and the sweep follows from it.

Three things found after filing. They mean the fix described above should not go into the sweep alone. 1. **A failed payment.** A subscription is suspended at the first failed charge (`internal/fulfillment/reconcile.go`, where `past_due`, `unpaid` and `paused` are classed as suspended), and a suspended subscription funds nothing. The default plan is not restored while a plan is suspended, because a suspended plan still counts as held (`docs/models/plan-ladders-transitions.md`, where restoration is described as a floor). With the fix as written, a card that fails at renewal would make every site read-only at once, including the sites the default plan allows. A member whose card failed would be treated worse than a member who cancelled. 2. **A plan switch.** When a member moves to a plan that is not on every plan ladder the old plan was on, the old plan's places on the other ladders end too (the same page, where a switch is described as replacing the whole bundle). A limit funded only there loses its last rule, and the fix as written would make those sites read-only because of the member's own upgrade. 3. **The same giveaway where a rule remains.** If the default plan carries a `fedwiki_sites` rule whose reduction policy is anything other than "Force reduce", every site stays active after a plan ends, because the sweep reads the policy of the rules that remain. A new rule opens on "Clamp" (#105). An explicit rule of 0 sites on the default plan therefore leaves a member more than no rule at all. So this needs one decision on what a plan's end, a downgrade and a failed payment each do to existing sites, and the sweep follows from it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wiki-cafe/member-console#330