A community based topic aggregation platform built on atproto

refactor: update backend code for community.comment namespace

Update all backend code to use social.coves.community.comment
namespace instead of social.coves.feed.comment.

Changes:
- comment_consumer.go: Update collection constant and URI construction
- vote_consumer.go: Update comment collection matching for votes
- comment.go: Update lexicon reference in documentation
- comment_service.go: Update record type in buildCommentRecord
- view_models.go: Update lexicon references in comments
- lexicon.go: Update ValidateComment to use new namespace
- record_utils.go: Update example documentation

All URI construction now uses social.coves.community.comment
for new comment records and collection filtering in Jetstream
consumers.

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

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

+17 -17
+9 -9
internal/atproto/jetstream/comment_consumer.go
··· 17 17 // Constants for comment validation and processing 18 18 const ( 19 19 // CommentCollection is the lexicon collection identifier for comments 20 - CommentCollection = "social.coves.feed.comment" 20 + CommentCollection = "social.coves.community.comment" 21 21 22 22 // ATProtoScheme is the URI scheme for atProto AT-URIs 23 23 ATProtoScheme = "at://" ··· 28 28 ) 29 29 30 30 // CommentEventConsumer consumes comment-related events from Jetstream 31 - // Handles CREATE, UPDATE, and DELETE operations for social.coves.feed.comment 31 + // Handles CREATE, UPDATE, and DELETE operations for social.coves.community.comment 32 32 type CommentEventConsumer struct { 33 33 commentRepo comments.Repository 34 34 db *sql.DB // Direct DB access for atomic count updates ··· 89 89 } 90 90 91 91 // Build AT-URI for this comment 92 - // Format: at://commenter_did/social.coves.feed.comment/rkey 93 - uri := fmt.Sprintf("at://%s/social.coves.feed.comment/%s", repoDID, commit.RKey) 92 + // Format: at://commenter_did/social.coves.community.comment/rkey 93 + uri := fmt.Sprintf("at://%s/social.coves.community.comment/%s", repoDID, commit.RKey) 94 94 95 95 // Parse timestamp from record 96 96 createdAt, err := time.Parse(time.RFC3339, commentRecord.CreatedAt) ··· 149 149 } 150 150 151 151 // Build AT-URI for the comment being updated 152 - uri := fmt.Sprintf("at://%s/social.coves.feed.comment/%s", repoDID, commit.RKey) 152 + uri := fmt.Sprintf("at://%s/social.coves.community.comment/%s", repoDID, commit.RKey) 153 153 154 154 // Fetch existing comment to validate threading references are immutable 155 155 existingComment, err := c.commentRepo.GetByURI(ctx, uri) ··· 202 202 // deleteComment soft-deletes a comment and updates parent counts 203 203 func (c *CommentEventConsumer) deleteComment(ctx context.Context, repoDID string, commit *CommitEvent) error { 204 204 // Build AT-URI for the comment being deleted 205 - uri := fmt.Sprintf("at://%s/social.coves.feed.comment/%s", repoDID, commit.RKey) 205 + uri := fmt.Sprintf("at://%s/social.coves.community.comment/%s", repoDID, commit.RKey) 206 206 207 207 // Get existing comment to know its parent (for decrementing the right counter) 208 208 existingComment, err := c.commentRepo.GetByURI(ctx, uri) ··· 382 382 WHERE uri = $1 AND deleted_at IS NULL 383 383 ` 384 384 385 - case "social.coves.feed.comment": 385 + case "social.coves.community.comment": 386 386 // Reply to comment - update comments.reply_count 387 387 updateQuery = ` 388 388 UPDATE comments ··· 475 475 WHERE uri = $1 AND deleted_at IS NULL 476 476 ` 477 477 478 - case "social.coves.feed.comment": 478 + case "social.coves.community.comment": 479 479 // Reply to comment - decrement comments.reply_count 480 480 updateQuery = ` 481 481 UPDATE comments ··· 600 600 } 601 601 602 602 // CommentRecordFromJetstream represents a comment record as received from Jetstream 603 - // Matches social.coves.feed.comment lexicon 603 + // Matches social.coves.community.comment lexicon 604 604 type CommentRecordFromJetstream struct { 605 605 Labels interface{} `json:"labels,omitempty"` 606 606 Embed map[string]interface{} `json:"embed,omitempty"`
+2 -2
internal/atproto/jetstream/vote_consumer.go
··· 204 204 ` 205 205 } 206 206 207 - case "social.coves.feed.comment": 207 + case "social.coves.community.comment": 208 208 // Vote on comment - update comments table 209 209 if vote.Direction == "up" { 210 210 updateQuery = ` ··· 317 317 ` 318 318 } 319 319 320 - case "social.coves.feed.comment": 320 + case "social.coves.community.comment": 321 321 // Vote on comment - update comments table 322 322 if vote.Direction == "up" { 323 323 updateQuery = `
+1 -1
internal/atproto/utils/record_utils.go
··· 20 20 // Format: at://did/collection/rkey -> collection 21 21 // 22 22 // Returns: 23 - // - Collection name (e.g., "social.coves.feed.comment") if URI is well-formed 23 + // - Collection name (e.g., "social.coves.community.comment") if URI is well-formed 24 24 // - Empty string if URI is malformed or doesn't contain a collection segment 25 25 // 26 26 // Note: Empty string indicates "unknown/unsupported collection" and should be
+1 -1
internal/core/comments/comment.go
··· 33 33 34 34 // CommentRecord represents the atProto record structure indexed from Jetstream 35 35 // This is the data structure that gets stored in the user's repository 36 - // Matches social.coves.feed.comment lexicon 36 + // Matches social.coves.community.comment lexicon 37 37 type CommentRecord struct { 38 38 Embed map[string]interface{} `json:"embed,omitempty"` 39 39 Labels *SelfLabels `json:"labels,omitempty"`
+1 -1
internal/core/comments/comment_service.go
··· 381 381 // Deserializes JSONB fields (embed, facets, labels) for complete record (Phase 2C) 382 382 func (s *commentService) buildCommentRecord(comment *Comment) *CommentRecord { 383 383 record := &CommentRecord{ 384 - Type: "social.coves.feed.comment", 384 + Type: "social.coves.community.comment", 385 385 Reply: ReplyRef{ 386 386 Root: StrongRef{ 387 387 URI: comment.RootURI,
+2 -2
internal/core/comments/view_models.go
··· 5 5 ) 6 6 7 7 // CommentView represents the full view of a comment with all metadata 8 - // Matches social.coves.feed.getComments#commentView lexicon 8 + // Matches social.coves.community.comment.getComments#commentView lexicon 9 9 // Used in thread views and get endpoints 10 10 type CommentView struct { 11 11 Embed interface{} `json:"embed,omitempty"` ··· 24 24 } 25 25 26 26 // ThreadViewComment represents a comment with its nested replies 27 - // Matches social.coves.feed.getComments#threadViewComment lexicon 27 + // Matches social.coves.community.comment.getComments#threadViewComment lexicon 28 28 // Supports recursive threading for comment trees 29 29 type ThreadViewComment struct { 30 30 Comment *CommentView `json:"comment"`
+1 -1
internal/validation/lexicon.go
··· 86 86 87 87 // ValidateComment validates a comment record 88 88 func (v *LexiconValidator) ValidateComment(comment map[string]interface{}) error { 89 - return v.ValidateRecord(comment, "social.coves.feed.comment") 89 + return v.ValidateRecord(comment, "social.coves.community.comment") 90 90 } 91 91 92 92 // ValidateVote validates a vote record