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.
Implement Jetstream consumer for indexing comment CREATE/UPDATE/DELETE events
from atProto firehose. Handles out-of-order events, soft deletes, and atomic
parent count updates.
Key features:
- CREATE path with resurrection support (deleted comments recreated with same rkey)
- UPDATE path with threading immutability validation (prevents thread hijacking)
- DELETE path with soft delete (preserves thread structure)
- Atomic parent count updates (posts.comment_count, comments.reply_count)
- Out-of-order reconciliation (children arriving before parents)
- Input validation (DID format, content length, AT-URI structure)
Security:
- Threading references (root/parent) are immutable after creation
- Malicious UPDATE events attempting to move comments are rejected
- Content length limits enforced (30000 bytes max)
- AT-URI structure validation prevents injection
WebSocket connector provides reliable firehose connection with automatic
reconnection and ping/pong keepalive.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add repository implementation for comment CRUD and thread queries.
Handles PostgreSQL-specific operations including array marshaling for langs
field and proper NULL handling for optional JSON fields.
Key operations:
- Create/Update/Delete with soft delete support
- GetByURI with ErrCommentNotFound for missing records
- ListByRoot/ListByParent for thread traversal
- ListByCommenter for user history
- CountByParent for pagination
All queries filter out soft-deleted comments (deleted_at IS NULL).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Define core comment domain model and repository interface for AppView indexing.
Comment entity tracks threading references (root/parent), soft delete state,
and denormalized reply count.
Repository interface provides:
- CRUD operations (Create, GetByURI, Update, Delete)
- Thread queries (ListByRoot, ListByParent, CountByParent)
- User queries (ListByCommenter)
Designed for read-heavy workload with denormalized counts for performance.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add PostgreSQL schema for comment indexing from Jetstream firehose.
Supports threaded discussions with root/parent references, soft deletes,
and denormalized counts (reply_count on comments, comment_count on posts).
Key features:
- Composite indexes for efficient thread queries
- Soft delete preserving thread structure
- Out-of-order event handling via denormalized counts
- GIN index on content for future full-text search
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add convenient shell script for validating all lexicon schemas and test data.
**Added:**
- scripts/validate-schemas.sh - Wrapper around cmd/validate-lexicon
**Usage:**
```bash
./scripts/validate-schemas.sh
```
**Features:**
- Validates all 58 lexicon schema files
- Validates cross-references between schemas
- Tests all lexicon test data files (15 valid, 11 invalid)
- Reports test coverage per record type
This script makes it easy to verify lexicon changes before committing,
addressing the PR review requirement for lexicon validation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Remove test data files that are no longer valid after enum → knownValues changes:
**Removed obsolete enum validation tests:**
- post/post-invalid-enum-type.json - knownValues allow unknown types
- community/moderator-invalid-permissions.json - knownValues allow extension
- interaction/share-valid*.json (2 files) - interaction lexicons removed
- interaction/tag-*.json (3 files) - interaction lexicons removed
**Fixed invalid test data:**
- moderation/tribunal-vote-valid.json - corrected invalid AT-URI format
Changed: at://$1/... → at://did:plc:testuser123/...
**Rationale:**
With knownValues (vs strict enums), the lexicon validator accepts unknown
values for extensibility. These test files expected rejection of unknown
enum values, which no longer applies under the knownValues pattern.
**Validation Status:** All 58 lexicons validated successfully
- 15/15 valid test files passing
- 11/11 invalid test files correctly rejected
- 13 record types with test coverage
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>