code
Clone this repository
https://tangled.org/bretton.dev/coves
git@knot.bretton.dev:bretton.dev/coves
For self-hosted knots, clone URLs may differ based on your setup.
Create comprehensive database schema for aggregator system with
3 tables, 2 triggers, and optimized indexes.
Tables:
- aggregators: Service declarations indexed from Jetstream
- aggregator_authorizations: Community authorizations
- aggregator_posts: Rate limiting tracking (AppView-only)
Key features:
- Optimized indexes for <5ms authorization checks
- Partial indexes WHERE enabled=true for performance
- Foreign keys with CASCADE delete
- Auto-updating stats via triggers
Triggers:
- update_aggregator_communities_count: Tracks communities_using
- update_aggregator_posts_count: Tracks posts_created
Security:
- Audit trail fields (created_by, disabled_by, disabled_at)
- Unique constraint on (aggregator_did, community_did)
- NOT NULL constraints on required fields
Performance:
- idx_aggregator_auth_lookup: Fast (aggregator, community, enabled) checks
- idx_aggregator_posts_rate_limit: Fast rate limit queries
- idx_aggregators_created_at: Sorting by creation date
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add complete lexicon definitions for the aggregator system following
atProto patterns (Feed Generator + Labeler model).
Records (2):
- service.json: Aggregator service declaration with config schema
- authorization.json: Community authorization with enabled status
Procedures (3):
- enable.json: Enable aggregator for community (moderator only)
- disable.json: Disable aggregator
- updateConfig.json: Update aggregator configuration
Queries (3):
- getServices.json: Fetch aggregator details by DIDs
- getAuthorizations.json: List communities using aggregator
- listForCommunity.json: List aggregators for community
Definitions:
- aggregatorView: Basic aggregator metadata
- aggregatorViewDetailed: Aggregator with stats
- authorizationView: Authorization from community perspective
- communityAuthView: Authorization from aggregator perspective
Design decisions:
- Removed aggregatorType enum (too rigid for alpha)
- Used JSON Schema for configSchema (validation + UI generation)
- Followed Bluesky feed generator patterns
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Adds complete community feed infrastructure with sort algorithms and XRPC endpoints.
Summary of changes:
- Core feed service with hot/new/top sorting algorithms
- PostgreSQL repository with optimized queries
- XRPC handler for social.coves.feed.getCommunity
- PostView types for rich feed responses
- Comprehensive integration tests
- Documentation for feeds and future aggregators
Key features:
✅ Public feed endpoint (no auth required for reading)
✅ Multiple sort algorithms (hot, new, top)
✅ Cursor-based pagination
✅ Proper input validation and error handling
✅ Full test coverage
This implements the read path for community feeds per atProto patterns.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
New Tests:
- TestGetCommunityFeed_BasicRetrieval: Verifies feed endpoint works
- TestGetCommunityFeed_SortOrders: Tests hot/new/top algorithms
- TestGetCommunityFeed_Pagination: Validates cursor-based paging
- TestGetCommunityFeed_EmptyFeed: Handles communities with no posts
- TestGetCommunityFeed_LimitValidation: Ensures limit clamping works
Test Fix:
- community_consumer_test.go: Changed collection from app.bsky.feed.post
to app.bsky.communityFeed.post to better demonstrate non-Coves namespace
filtering (the test verifies we ignore non-social.coves.community.* events)
Test Coverage:
- Feed retrieval with real post data
- Sort algorithm behavior
- Pagination edge cases
- Input validation
- Error handling
All tests use the shared test infrastructure (SetupTestDB, test user helpers)
and follow integration test patterns.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Comprehensive documentation for feed systems and future aggregator features:
New Documentation:
- COMMUNITY_FEEDS.md: Complete guide to feed architecture and implementation
- aggregators/PRD_AGGREGATORS.md: Product spec for RSS/aggregator features
- aggregators/PRD_KAGI_NEWS_RSS.md: Kagi News integration design
Updated:
- PRD_POSTS.md: Refined post creation flow and security model
Feed Documentation Coverage:
- Architecture overview (service → repo → postgres)
- Sort algorithms (hot, new, top)
- Query optimization and indexing strategy
- Security considerations
- API examples and usage
Aggregator PRDs:
- RSS feed generation per community
- External content aggregation
- Kagi News integration patterns
- Federation considerations
These docs provide context for current feed implementation and roadmap
for future aggregator features.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Extends post types to support feed views and updates lexicon definitions:
Post Types Added:
- PostView: Full post representation with all metadata for feeds
- AuthorView: Author info (DID, handle, displayName, avatar, reputation)
- CommunityRef: Minimal community reference in posts
- PostStats: Aggregated statistics (votes, comments, shares)
- ViewerState: User's relationship with post (votes, saves, tags)
Lexicon Updates:
- social.coves.post.get: Restructured postView definition
- social.coves.feed.getCommunity: Updated query parameters and response
These types align with atProto patterns:
- Follows app.bsky.feed.defs#feedViewPost structure
- Supports viewer-specific state
- Enables efficient feed rendering
- Provides all data clients need in single request
The PostView types are used by feed endpoints to return rich post data.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>