A failed read of the sites entitlement tells the member they have reached their site limit #231

Closed
opened 2026-10-16 02:59:51 +00:00 by cgalo5758 · 1 comment
Owner

What happens

Before a site create, the create workflow asks CheckQuotaActivity (internal/integrations/fedwiki/workflows/activities.go:581) whether the workspace may have another site. The activity reads three things: the workspace's pool, the pool's fedwiki_sites entitlement and the pool's usage. A failed read of the pool or of the usage returns an error, and the workflow then fails the request as quota_unavailable (internal/integrations/fedwiki/workflows/requests.go:319-322), which the member reads as "Couldn't check your site limit. Try again later."

A failed read of the entitlement is handled differently. Any error from GetNumericEntitlementByPoolAndResource (activities.go:602-614), not only "no row", is answered as a quota of 0 with CanCreate false, and logged at Info as "no sites entitlement found" without the error. The workflow then declines the request as site_limit_reached (requests.go:323-325), and the member reads "You have reached your site limit." (internal/integrations/fedwiki/web/requests.go:37).

What should happen

Only a pool that has no fedwiki_sites entitlement (sql.ErrNoRows) is answered as a quota of 0. Any other error from that read returns an error, as the pool and usage reads do, so the request fails as quota_unavailable and the member is told the limit could not be checked.

Where

  • internal/integrations/fedwiki/workflows/activities.go:602-614, CheckQuotaActivity
  • internal/integrations/fedwiki/workflows/requests.go:319-325, the create workflow's use of the answer

Steps

Found by reading the code; not reproduced.

  1. Start a site create while the entitlement read fails (a dropped connection, a statement timeout).
  2. The request is declined, and the site list shows "You have reached your site limit."

Why it matters

A member under their limit is told they have reached it, and the request is declined rather than failed, so nothing tells them to try again. The log line that would explain it says no entitlement was found and drops the error.

## What happens Before a site create, the create workflow asks `CheckQuotaActivity` (`internal/integrations/fedwiki/workflows/activities.go:581`) whether the workspace may have another site. The activity reads three things: the workspace's pool, the pool's `fedwiki_sites` entitlement and the pool's usage. A failed read of the pool or of the usage returns an error, and the workflow then fails the request as `quota_unavailable` (`internal/integrations/fedwiki/workflows/requests.go:319-322`), which the member reads as "Couldn't check your site limit. Try again later." A failed read of the entitlement is handled differently. Any error from `GetNumericEntitlementByPoolAndResource` (`activities.go:602-614`), not only "no row", is answered as a quota of 0 with `CanCreate` false, and logged at Info as "no sites entitlement found" without the error. The workflow then declines the request as `site_limit_reached` (`requests.go:323-325`), and the member reads "You have reached your site limit." (`internal/integrations/fedwiki/web/requests.go:37`). ## What should happen Only a pool that has no `fedwiki_sites` entitlement (`sql.ErrNoRows`) is answered as a quota of 0. Any other error from that read returns an error, as the pool and usage reads do, so the request fails as `quota_unavailable` and the member is told the limit could not be checked. ## Where - `internal/integrations/fedwiki/workflows/activities.go:602-614`, `CheckQuotaActivity` - `internal/integrations/fedwiki/workflows/requests.go:319-325`, the create workflow's use of the answer ## Steps Found by reading the code; not reproduced. 1. Start a site create while the entitlement read fails (a dropped connection, a statement timeout). 2. The request is declined, and the site list shows "You have reached your site limit." ## Why it matters A member under their limit is told they have reached it, and the request is declined rather than failed, so nothing tells them to try again. The log line that would explain it says no entitlement was found and drops the error.
cgalo5758 added the
kind
bug
area/entitlementsarea/fedwiki
priority
low
labels 2026-10-16 02:59:52 +00:00
Author
Owner

Fixed in 9027c0b1: CheckQuotaActivity answers "no entitlement" only when the pool has no sites entitlement, and returns any other read failure, so the create ends failed with quota_unavailable and the notice " wasn't created. Couldn't check your site limit. Try again later." The slot gate and every quota read now follow the same rule through usage.Limit.

Fixed in 9027c0b1: `CheckQuotaActivity` answers "no entitlement" only when the pool has no sites entitlement, and returns any other read failure, so the create ends failed with `quota_unavailable` and the notice "<domain> wasn't created. Couldn't check your site limit. Try again later." The slot gate and every quota read now follow the same rule through `usage.Limit`.
cgalo5758 referenced this issue from a commit 2026-10-22 18:40:40 +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#231