buzz icon indicating copy to clipboard operation
buzz copied to clipboard

Make per-owner community limit configurable via env var

Open Christian-Sidak opened this issue 4 months ago • 0 comments

Summary

  • Replace hardcoded MAX_COMMUNITIES_PER_OWNER = 3 const with max_communities_per_owner() that reads BUZZ_MAX_COMMUNITIES_PER_OWNER at 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_owner and transfer_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_transferee integration 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

Christian-Sidak avatar Jul 24 '26 04:07 Christian-Sidak