buzz
buzz copied to clipboard
Make per-owner community limit configurable via env var
Summary
- Replace hardcoded
MAX_COMMUNITIES_PER_OWNER = 3const withmax_communities_per_owner()that readsBUZZ_MAX_COMMUNITIES_PER_OWNERat runtime - Fall back to 3 when the env var is absent, non-numeric, or non-positive, so existing deployments are unaffected
- Enforcement stays in the two authoritative relay-layer sites:
create_community_with_ownerandtransfer_ownership - Adds a pure
effective_owner_limit()helper with unit tests covering default, invalid, zero, negative, and positive-override cases
Test plan
- [x]
effective_owner_limit(None)returns 3 (default) - [x]
effective_owner_limit(Some("abc"))returns 3 (invalid fallback) - [x]
effective_owner_limit(Some("0"))returns 3 (non-positive fallback) - [x]
effective_owner_limit(Some("-5"))returns 3 (negative fallback) - [x]
effective_owner_limit(Some("100"))returns 100 (positive override) - [x] Existing
transfer_ownership_returns_limit_reached_for_maxed_transfereeintegration test unaffected (still enforces default of 3 with no env var set)
Note: cargo test --lib is blocked by a pre-existing workspace dependency resolution failure (mesh-llm-host-runtime tag v0.73.1 is absent; tracked separately). The new tests are pure unit tests with no DB dependency and will pass once the workspace compiles.
Fixes #2600