docs(relay): state limit_reached for both owner caps and pin the can_create contract

Signed-off-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz>
This commit is contained in:
Elrond
2026-09-29 17:32:04 -04:00
parent c35c74fb18
commit 63623fee55
5 changed files with 11 additions and 11 deletions

View File

@@ -44,7 +44,7 @@ pub enum CreateCommunityWithOwnerResult {
Created(CreatedCommunityRecord),
/// The host already belongs to another owner.
HostExists,
/// The intended owner already owns the maximum number of communities.
/// The intended owner has reached the active or lifetime community limit.
LimitReached,
}
@@ -68,7 +68,7 @@ pub struct OwnedCommunitiesPage {
pub communities: Vec<OwnedCommunityRecord>,
/// De-duplicated live memberships and incomplete owner deletion reservations.
pub quota_used: i64,
/// Configured maximum hosted communities for one owner.
/// Configured active limit only; the lifetime cap is reflected in `can_create`.
pub quota_limit: i64,
/// Whether the snapshot leaves room under both the active and lifetime caps.
pub can_create: bool,

View File

@@ -544,7 +544,7 @@ pub enum TransferResult {
LifecycleConflict,
/// Durable deletion intent exists and wins over ownership mutation.
DeletionPending,
/// The transferee already owns the maximum number of communities.
/// The transferee has reached the active or lifetime community limit.
/// Enforced atomically inside the transfer transaction so concurrent
/// transfers to the same recipient cannot both pass the limit.
LimitReached,
@@ -684,8 +684,8 @@ pub(crate) async fn owner_quota_in_transaction(
/// 3. Locks the current owner row `FOR UPDATE` and verifies
/// `expected_owner_pubkey` matches. This prevents a stale-owner race where
/// a delayed/retried request overwrites a completed transfer.
/// 4. Enforces the [`MAX_COMMUNITIES_PER_OWNER`] limit on the transferee by
/// counting owned communities inside the same transaction.
/// 4. Enforces the transferee's active and lifetime limits
/// ([`OwnerQuota::admits`]) inside the same transaction.
/// 5. Upserts `new_owner_pubkey` as `owner` (insert or promote).
/// 6. Demotes every other owner in this community to `member` — **not**
/// `admin`, per product decision: the former owner retains no management

View File

@@ -722,7 +722,7 @@ pub async fn transfer_community(
buzz_db::relay_members::TransferResult::LimitReached => {
return Err(api_error(
StatusCode::CONFLICT,
"limit_reached: transferee already owns the maximum number of communities",
"limit_reached: transferee has reached the community limit",
));
}
};

View File

@@ -287,10 +287,7 @@ pub async fn provision_community(
return Err("community already exists".to_string());
}
buzz_db::CreateCommunityWithOwnerResult::LimitReached => {
return Err(
"limit_reached: owner already owns the maximum number of communities"
.to_string(),
);
return Err("limit_reached: owner has reached the community limit".to_string());
}
};

View File

@@ -172,7 +172,10 @@ The relay enforces two per-owner caps on create and on transfer-in, both as
and count only through its live membership.
Owner-list responses carry `quota_used` (active), `quota_limit` (active), and
`can_create` (both caps). The projection is advisory: clients may use it for
`can_create` (both caps). `can_create: false` is the only signal a client needs:
show a generic community-limit message and do not derive a reason from the
counts, because an owner at the lifetime cap can have `quota_used` below
`quota_limit`. The projection is advisory: clients may use it for
UX, but the relay's `limit_reached` is authoritative, and quota changes have no
deployment order. Keep owner deletion off until this relay and the drain
executor are live; on rollback, turn deletion off before rolling back the relay.