A community based topic aggregation platform built on atproto

feat(lexicon): make moderator roles and permissions extensible

BREAKING: This is a pre-alpha schema fix. Must be applied before any
moderator records are created.

Changes to social.coves.community.moderator:
- Change role from enum to knownValues (enables future role types)
- Change permissions from enum to knownValues (enables new permissions)
- Add maxLength: 64 to both fields per atProto style guide

Future extensibility examples:
- Roles: "owner", "trainee", "emeritus"
- Permissions: "manage_bots", "manage_flairs", "manage_automoderator"

Documented in PRD_GOVERNANCE.md:
- Technical decision rationale
- atProto style guide reference
- Future beta phase extensibility plan
- Security considerations

This enables Beta Phase 2 (Moderator Tiers & Permissions) without
requiring V2 schema migration or breaking existing records.

Per atProto style guide (bluesky-social/atproto#4245): enum sets
cannot be extended without breaking schema evolution rules.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Changed files
+30 -3
docs
internal
atproto
lexicon
social
coves
community
+25
docs/PRD_GOVERNANCE.md
···
## Technical Decisions Log
+
### 2025-10-18: Moderator Lexicon Extensibility
+
**Decision:** Use `knownValues` instead of `enum` for moderator roles and permissions in `social.coves.community.moderator` record schema
+
+
**Rationale:**
+
- Moderator records are immutable once published (atProto record semantics)
+
- Closed `enum` values cannot be extended without breaking schema evolution rules
+
- Using `knownValues` allows adding new roles/permissions in Beta Phase 2 without requiring V2 schema migration
+
- Zero cost to fix during alpha planning; expensive to migrate once records exist in production
+
+
**Changes Made:**
+
- `role` field: Changed from `enum: ["moderator", "admin"]` to `knownValues: ["moderator", "admin"]` with `maxLength: 64`
+
- `permissions` array items: Changed from closed enum to `knownValues` with `maxLength: 64`
+
+
**Future Extensibility Examples:**
+
- **New roles**: "owner" (full transfer rights), "trainee" (limited trial moderator), "emeritus" (honorary former moderator)
+
- **New permissions**: "manage_bots", "manage_flairs", "manage_automoderator", "manage_federation", "pin_posts"
+
- Can add these values during Phase 2 (Moderator Tiers & Permissions) without breaking existing moderator records
+
+
**atProto Style Guide Reference:**
+
Per [atproto#4245](https://github.com/bluesky-social/atproto/discussions/4245): "Enum sets are 'closed' and can not be updated or extended without breaking schema evolution rules. For this reason they should almost always be avoided. For strings, `knownValues` provides more flexible alternative."
+
+
**Implementation Status:** ✅ Fixed in lexicon before alpha launch
+
+
---
+
### 2025-10-11: Moderator Records Storage Location
**Decision:** Store moderator records in community's repository (`at://community_did/social.coves.community.moderator/{tid}`), not user's repository
+5 -3
internal/atproto/lexicon/social/coves/community/moderator.json
···
},
"role": {
"type": "string",
-
"enum": ["moderator", "admin"],
+
"knownValues": ["moderator", "admin"],
+
"maxLength": 64,
"description": "Level of moderation privileges"
},
"permissions": {
···
"description": "Specific permissions granted",
"items": {
"type": "string",
-
"enum": [
+
"knownValues": [
"remove_posts",
"remove_comments",
"ban_users",
···
"manage_wiki",
"manage_moderators",
"manage_settings"
-
]
+
],
+
"maxLength": 64
}
},
"createdAt": {