A community based topic aggregation platform built on atproto

docs(backlog): Add code TODOs from codebase to PRD_BACKLOG

Added infrastructure/technical TODOs:
- OAuth authentication for community actions (P1)
- Jetstream consumer race condition (P2)
- Structured logging migration (P3)
- PDS URL resolution from DID (P3)
- PLC directory registration for prod (P3)

Feature-specific TODOs (avatars, moderator checks, update/delete handlers)
are tracked in their respective PRDs (PRD_COMMUNITIES, PRD_GOVERNANCE).

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

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

+57
+57
docs/PRD_BACKLOG.md
··· 35 35 36 36 **Solution:** Auto-refresh tokens before PDS operations. Parse JWT exp claim, use refresh token when expired, update DB. 37 37 38 + **Code:** TODO in [communities/service.go:123](../internal/core/communities/service.go#L123) 39 + 40 + --- 41 + 42 + ### OAuth Authentication for Community Actions 43 + **Added:** 2025-10-11 | **Effort:** 2-3 days 44 + 45 + **Problem:** Subscribe/unsubscribe and community creation need authenticated user DID. Currently using placeholder. 46 + 47 + **Solution:** Extract authenticated DID from OAuth session context. Requires OAuth middleware integration. 48 + 49 + **Code:** Multiple TODOs in [community/subscribe.go](../internal/api/handlers/community/subscribe.go#L46), [community/create.go](../internal/api/handlers/community/create.go#L38) 50 + 38 51 --- 39 52 40 53 ## 🟢 P2: Nice-to-Have ··· 64 77 65 78 --- 66 79 80 + ### Jetstream Consumer Race Condition 81 + **Added:** 2025-10-11 | **Effort:** 1 hour 82 + 83 + **Problem:** Multiple goroutines can call `close(done)` concurrently in consumer shutdown. 84 + 85 + **Solution:** Use `sync.Once` for channel close or atomic flag for shutdown state. 86 + 87 + **Code:** TODO in [jetstream/user_consumer.go:114](../internal/atproto/jetstream/user_consumer.go#L114) 88 + 89 + --- 90 + 67 91 ## 🔵 P3: Technical Debt 68 92 69 93 ### Consolidate Environment Variable Validation ··· 84 108 **Added:** 2025-10-11 | **Effort:** Ongoing 85 109 86 110 Document: did:plc choice, pgcrypto encryption, Jetstream vs firehose, write-forward pattern, single handle field. 111 + 112 + --- 113 + 114 + ### Replace log Package with Structured Logger 115 + **Added:** 2025-10-11 | **Effort:** 1 day 116 + 117 + **Problem:** Using standard `log` package. Need structured logging (JSON) with levels. 118 + 119 + **Solution:** Switch to `slog`, `zap`, or `zerolog`. Add request IDs, context fields. 120 + 121 + **Code:** TODO in [community/errors.go:46](../internal/api/handlers/community/errors.go#L46) 122 + 123 + --- 124 + 125 + ### PDS URL Resolution from DID 126 + **Added:** 2025-10-11 | **Effort:** 2-3 hours 127 + 128 + **Problem:** User consumer doesn't resolve PDS URL from DID document when missing. 129 + 130 + **Solution:** Query PLC directory for DID document, extract `serviceEndpoint`. 131 + 132 + **Code:** TODO in [jetstream/user_consumer.go:203](../internal/atproto/jetstream/user_consumer.go#L203) 133 + 134 + --- 135 + 136 + ### PLC Directory Registration (Production) 137 + **Added:** 2025-10-11 | **Effort:** 1 day 138 + 139 + **Problem:** DID generator creates did:plc but doesn't register in prod mode. 140 + 141 + **Solution:** Implement PLC registration API call when `isDevEnv=false`. 142 + 143 + **Code:** TODO in [did/generator.go:46](../internal/atproto/did/generator.go#L46) 87 144 88 145 --- 89 146