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

Open
opened 2026-10-05 23:38:39 +00:00 by cgalo5758 · 0 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
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