What an unlimited numeric limit is, and how it is stored and delivered #164

Closed
opened 2026-10-05 23:38:39 +00:00 by cgalo5758 · 2 comments
Owner

The question

The designed data model (design/data-model.md) says a limit of -1 means unlimited, but almost nothing built treats it that way:

  • The capability-set rule form accepts any whole number as a limit, including -1 and other negative numbers, and the CHECK on core.entitlement_set_rules has no sign rule.
  • The materializer adds contributions together (effectiveLimit in internal/entitlements/materialize.go), so an unlimited rule plus a rule for 10 materializes as 9.
  • FedWiki compares sites in use against the limit (internal/integrations/fedwiki/web/api.go, web/partials.go, workflows/activities.go), so a limit of -1 lets no site be created.
  • Only the rule-change preview reads -1 as "no ceiling" (unlimitedLimit in internal/entitlements/rule_change.go).

Is "unlimited" something a plan can grant? If so, how is it stored, how does it combine with other rules for the same resource key, and how does an integration receive it?

What depends on the answer

  • Validation on the rule form. A negative limit is accepted today and produces a meaningless number.
  • The combination rule for one resource key, which #127 also touches.
  • Every consumer's limit check.
  • What a connector receives for a numeric key. An unlimited grant should be explicit there, not a -1 that every connector has to know about.

Options known so far

  • No unlimited value. Limits are zero or more, the form and a CHECK refuse negatives, an operator sets a large number instead, and unlimitedLimit goes away.
  • Unlimited as its own state rather than a number, such as a rule flag or a NULL value. It materializes as "no ceiling", overrides any other contribution to the same key, and is delivered as its own field.
  • Keep -1 in storage. The fold and every consumer treat it as no ceiling, and it is translated at the delivery boundary.

Decided when

The entitlements model page states what an unlimited grant is and how it combines, and the rule form refuses whatever the answer makes invalid.

## The question The designed data model (`design/data-model.md`) says a limit of -1 means unlimited, but almost nothing built treats it that way: - The capability-set rule form accepts any whole number as a limit, including -1 and other negative numbers, and the CHECK on `core.entitlement_set_rules` has no sign rule. - The materializer adds contributions together (`effectiveLimit` in `internal/entitlements/materialize.go`), so an unlimited rule plus a rule for 10 materializes as 9. - FedWiki compares sites in use against the limit (`internal/integrations/fedwiki/web/api.go`, `web/partials.go`, `workflows/activities.go`), so a limit of -1 lets no site be created. - Only the rule-change preview reads -1 as "no ceiling" (`unlimitedLimit` in `internal/entitlements/rule_change.go`). Is "unlimited" something a plan can grant? If so, how is it stored, how does it combine with other rules for the same resource key, and how does an integration receive it? ## What depends on the answer - Validation on the rule form. A negative limit is accepted today and produces a meaningless number. - The combination rule for one resource key, which #127 also touches. - Every consumer's limit check. - What a connector receives for a numeric key. An unlimited grant should be explicit there, not a -1 that every connector has to know about. ## Options known so far - **No unlimited value.** Limits are zero or more, the form and a CHECK refuse negatives, an operator sets a large number instead, and `unlimitedLimit` goes away. - **Unlimited as its own state rather than a number,** such as a rule flag or a NULL value. It materializes as "no ceiling", overrides any other contribution to the same key, and is delivered as its own field. - **Keep -1 in storage.** The fold and every consumer treat it as no ceiling, and it is translated at the delivery boundary. ## Decided when The entitlements model page states what an unlimited grant is and how it combines, and the rule form refuses whatever the answer makes invalid.
cgalo5758 added the
kind
design
area/entitlementsarea/fedwiki
labels 2026-10-05 23:38:39 +00:00
cgalo5758 added this to the Public launch milestone 2026-10-20 23:14:02 +00:00
Author
Owner

Settled: the console has no unlimited limit.

  • A limit is a whole number, zero or more, wherever a machine reads it: in a rule, in what a pool holds once its plans are combined, and in what a connected application receives. The database refuses a negative value. The -1 the data model names goes away, and so does the one place in the code that reads it (unlimitedLimit in internal/entitlements/rule_change.go).
  • Why not a flag or a -1. Nothing a deployment issues is without limit: there is always a number, however large, and a real ceiling also stops a bug or an abuser at some point. "Unlimited" is something a page says to a person, not something the model holds. A resource nobody intends to count is not a numeric key at all; it is on/off access.
  • A limit rule can carry a mark that hides its ceiling from members, for a limit so high that showing it as something being used up only misleads. With the mark, a member's usage row shows the count with no ceiling and no bar, and a plan card names the resource with no number. Operator pages always show the number, and show the mark. Three rules go with it: the console never prints the word "unlimited" itself; the ceiling shows again once usage reaches it, so nobody is stopped by a limit they cannot see; and when several plans feed one resource the limits combine as they do today, and the mark carries if any of the rules has it. The mark changes nothing about enforcement.
  • For the contract (#171): a numeric entry always carries a limit of zero or more, and there is no unlimited value. Whether the mark travels to an application as a display hint is decided with the contract's design; a connector can ignore such a hint safely.

What the code does today: the rule form refuses a negative number in the row being edited (entitlementSetRuleValueField in internal/server/operator_entitlement_set_forms.go), but the step that applies a staged change parses the value again without that check (ruleInputFromDelta in internal/server/operator_entitlement_set_rule_change.go), and the database accepts a negative, so a crafted request stores one. A -1 stored that way would be added like any other number, so -1 and 10 give 9; it would stop every FedWiki create; and it would crash FedWiki's reconcile under the force-reduce policy, which slices the active sites at the limit (internal/integrations/fedwiki/workflows/reconcile.go).

Settled: the console has no unlimited limit. - **A limit is a whole number, zero or more,** wherever a machine reads it: in a rule, in what a pool holds once its plans are combined, and in what a connected application receives. The database refuses a negative value. The -1 the data model names goes away, and so does the one place in the code that reads it (`unlimitedLimit` in `internal/entitlements/rule_change.go`). - **Why not a flag or a -1.** Nothing a deployment issues is without limit: there is always a number, however large, and a real ceiling also stops a bug or an abuser at some point. "Unlimited" is something a page says to a person, not something the model holds. A resource nobody intends to count is not a numeric key at all; it is on/off access. - **A limit rule can carry a mark that hides its ceiling from members,** for a limit so high that showing it as something being used up only misleads. With the mark, a member's usage row shows the count with no ceiling and no bar, and a plan card names the resource with no number. Operator pages always show the number, and show the mark. Three rules go with it: the console never prints the word "unlimited" itself; the ceiling shows again once usage reaches it, so nobody is stopped by a limit they cannot see; and when several plans feed one resource the limits combine as they do today, and the mark carries if any of the rules has it. The mark changes nothing about enforcement. - **For the contract (#171):** a numeric entry always carries a limit of zero or more, and there is no unlimited value. Whether the mark travels to an application as a display hint is decided with the contract's design; a connector can ignore such a hint safely. What the code does today: the rule form refuses a negative number in the row being edited (`entitlementSetRuleValueField` in `internal/server/operator_entitlement_set_forms.go`), but the step that applies a staged change parses the value again without that check (`ruleInputFromDelta` in `internal/server/operator_entitlement_set_rule_change.go`), and the database accepts a negative, so a crafted request stores one. A -1 stored that way would be added like any other number, so -1 and 10 give 9; it would stop every FedWiki create; and it would crash FedWiki's reconcile under the force-reduce policy, which slices the active sites at the limit (`internal/integrations/fedwiki/workflows/reconcile.go`).
Author
Owner

Answered and built: the console has no unlimited limit.

Stored. A limit is a whole number of zero or more wherever the console holds one: on a rule in an entitlement set (the list of what a plan grants), on each plan's contribution to an organization's pool (what the organization holds), and on the pool's total for a resource key. The rule form refuses a negative number, and so do CHECK constraints on all three columns, so -1 has no meaning anywhere. The rule-change preview compares usage with the limit as the number it is.

Combined. When several plans fund one resource key, their limits add as before. The sum stops at the largest value the column holds instead of wrapping to a negative number.

Why no unlimited value. Nothing a deployment hands out is truly without limit, and a real ceiling also stops a runaway script. A resource nobody intends to count is on-or-off access, which a boolean rule already grants.

Hiding a limit instead. "Unlimited" is really something a page says to a member, so an operator can hide a limit instead. A limit rule of 1 or more can be marked "Hide limit". While usage is below the limit, the member's pages show the count alone, with no limit and no bar, and a plan card names the resource without a number. FedWiki's sites card does the same. Once usage reaches the limit, the number shows again, so nobody is stopped by a ceiling they cannot see. When several plans fund one key, the limit is hidden if any of them hides it. Operator pages always show the number. The console never prints the word "unlimited": a lint check refuses it in the console's own copy, and text an operator writes on a product prints as given.

Delivered. A connected application receives the number. The hide mark is display only and is not part of what an application receives. The integration contract (#171) states that a numeric entry always carries a limit of zero or more.

The entitlements model page (docs/models/entitlements.md) states the rule and how limits combine, and the rule form refuses a negative limit and a hidden limit below 1.

Answered and built: the console has no unlimited limit. **Stored.** A limit is a whole number of zero or more wherever the console holds one: on a rule in an entitlement set (the list of what a plan grants), on each plan's contribution to an organization's pool (what the organization holds), and on the pool's total for a resource key. The rule form refuses a negative number, and so do CHECK constraints on all three columns, so -1 has no meaning anywhere. The rule-change preview compares usage with the limit as the number it is. **Combined.** When several plans fund one resource key, their limits add as before. The sum stops at the largest value the column holds instead of wrapping to a negative number. **Why no unlimited value.** Nothing a deployment hands out is truly without limit, and a real ceiling also stops a runaway script. A resource nobody intends to count is on-or-off access, which a boolean rule already grants. **Hiding a limit instead.** "Unlimited" is really something a page says to a member, so an operator can hide a limit instead. A limit rule of 1 or more can be marked "Hide limit". While usage is below the limit, the member's pages show the count alone, with no limit and no bar, and a plan card names the resource without a number. FedWiki's sites card does the same. Once usage reaches the limit, the number shows again, so nobody is stopped by a ceiling they cannot see. When several plans fund one key, the limit is hidden if any of them hides it. Operator pages always show the number. The console never prints the word "unlimited": a lint check refuses it in the console's own copy, and text an operator writes on a product prints as given. **Delivered.** A connected application receives the number. The hide mark is display only and is not part of what an application receives. The integration contract (#171) states that a numeric entry always carries a limit of zero or more. The entitlements model page (`docs/models/entitlements.md`) states the rule and how limits combine, and the rule form refuses a negative limit and a hidden limit below 1.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wiki-cafe/member-console#164