···
421
+
### Post comment_count Reconciliation Missing
422
+
**Added:** 2025-11-04 | **Effort:** 2-3 hours | **Priority:** ALPHA BLOCKER
425
+
When comments arrive before their parent post is indexed (common with cross-repo Jetstream ordering), the post's `comment_count` is never reconciled. Later, when the post consumer indexes the post, there's no logic to count pre-existing comments. This causes posts to have permanently stale `comment_count` values.
427
+
**End-User Impact:**
428
+
- ๐ด Posts show "0 comments" when they actually have comments
429
+
- โ Broken engagement signals (users don't know there are discussions)
430
+
- โ UI inconsistency (thread page shows comments, but counter says "0")
431
+
- โ ๏ธ Users may not click into posts thinking they're empty
432
+
- ๐ Reduced engagement due to misleading counters
435
+
- Comment consumer updates post counts when processing comment events ([comment_consumer.go:323-343](../internal/atproto/jetstream/comment_consumer.go#L323-L343))
436
+
- If comment arrives BEFORE post is indexed, update query returns 0 rows (only logs warning)
437
+
- When post consumer later indexes the post, it sets `comment_count = 0` with NO reconciliation
438
+
- Comments already exist in DB, but post never "discovers" them
441
+
Post consumer MUST implement the same reconciliation pattern as comment consumer (see [comment_consumer.go:292-305](../internal/atproto/jetstream/comment_consumer.go#L292-L305)):
444
+
// After inserting new post, reconcile comment_count for out-of-order comments
445
+
reconcileQuery := `
447
+
SET comment_count = (
450
+
WHERE c.parent_uri = $1 AND c.deleted_at IS NULL
454
+
_, reconcileErr := tx.ExecContext(ctx, reconcileQuery, postURI, postID)
457
+
**Affected Operations:**
458
+
- Post indexing from Jetstream ([post_consumer.go](../internal/atproto/jetstream/post_consumer.go))
459
+
- Any cross-repo event ordering (community DID โ author DID)
461
+
**Current Status:**
462
+
- ๐ด Issue documented with FIXME(P1) comment at [comment_consumer.go:311-321](../internal/atproto/jetstream/comment_consumer.go#L311-L321)
463
+
- โ ๏ธ Test demonstrating limitation exists: `TestCommentConsumer_PostCountReconciliation_Limitation`
464
+
- ๐ Fix required in post consumer (out of scope for comment system PR)
466
+
**Files to Modify:**
467
+
- `internal/atproto/jetstream/post_consumer.go` - Add reconciliation after post creation
468
+
- `tests/integration/post_consumer_test.go` - Add test for out-of-order comment reconciliation
470
+
**Similar Issue Fixed:**
471
+
- โ
Comment reply_count reconciliation - Fixed in comment system implementation (2025-11-04)
## ๐ด P1.5: Federation Blockers (Beta Launch)
### Cross-PDS Write-Forward Support for Community Service