+923
docs/COMMENT_SYSTEM_IMPLEMENTATION.md
···+This document details the complete implementation of the comment system for Coves, a forum-like atProto social media platform. The comment system follows the established vote system pattern, with comments living in user repositories and being indexed by the AppView via Jetstream firehose.+1. **User-Owned Records**: Comments live in user repositories (like votes), not community repositories (like posts)+4. **Out-of-Order Indexing**: No foreign key constraints to allow Jetstream events to arrive in any order+- **No FK on `commenter_did`**: Allows out-of-order Jetstream indexing (comment events may arrive before user events)+- **Vote counts included**: The vote lexicon explicitly allows voting on comments (not just posts)+ListByCommenter(ctx context.Context, commenterDID string, limit, offset int) ([]*Comment, error)+Standard error types following the vote system pattern, with helper functions `IsNotFound()` and `IsConflict()`.+func (c *CommentEventConsumer) HandleEvent(ctx context.Context, event *JetstreamEvent) error {+func (c *CommentEventConsumer) validateCommentEvent(ctx, repoDID string, comment *CommentRecord) error {+commentJetstreamURL = "ws://localhost:6008/subscribe?wantedCollections=social.coves.feed.comment"+commentJetstreamConnector := jetstream.NewCommentJetstreamConnector(commentEventConsumer, commentJetstreamURL)+The vote lexicon explicitly states: *"Record declaring a vote (upvote or downvote) on a **post or comment**"*+The comment system has successfully completed **Phase 1 (Indexing)** and **Phase 2A (Query API)**, providing a production-ready threaded discussion system for Coves:+The implementation provides a solid foundation for building rich threaded discussions in Coves while maintaining compatibility with the broader atProto ecosystem and following established patterns from platforms like Lemmy and Reddit.+TEST_DATABASE_URL="postgres://test_user:test_password@localhost:5434/coves_test?sslmode=disable" \+TEST_DATABASE_URL="postgres://test_user:test_password@localhost:5434/coves_test?sslmode=disable" \+TEST_DATABASE_URL="postgres://test_user:test_password@localhost:5434/coves_test?sslmode=disable" \+GOOSE_DBSTRING="postgres://test_user:test_password@localhost:5434/coves_test?sslmode=disable" \+export COMMENT_JETSTREAM_URL="ws://localhost:6008/subscribe?wantedCollections=social.coves.feed.comment"+export TEST_DATABASE_URL="postgres://test_user:test_password@localhost:5434/coves_test?sslmode=disable"