···
**Solution:** Auto-refresh tokens before PDS operations. Parse JWT exp claim, use refresh token when expired, update DB.
38
+
**Code:** TODO in [communities/service.go:123](../internal/core/communities/service.go#L123)
42
+
### OAuth Authentication for Community Actions
43
+
**Added:** 2025-10-11 | **Effort:** 2-3 days
45
+
**Problem:** Subscribe/unsubscribe and community creation need authenticated user DID. Currently using placeholder.
47
+
**Solution:** Extract authenticated DID from OAuth session context. Requires OAuth middleware integration.
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)
···
80
+
### Jetstream Consumer Race Condition
81
+
**Added:** 2025-10-11 | **Effort:** 1 hour
83
+
**Problem:** Multiple goroutines can call `close(done)` concurrently in consumer shutdown.
85
+
**Solution:** Use `sync.Once` for channel close or atomic flag for shutdown state.
87
+
**Code:** TODO in [jetstream/user_consumer.go:114](../internal/atproto/jetstream/user_consumer.go#L114)
### Consolidate Environment Variable Validation
···
**Added:** 2025-10-11 | **Effort:** Ongoing
Document: did:plc choice, pgcrypto encryption, Jetstream vs firehose, write-forward pattern, single handle field.
114
+
### Replace log Package with Structured Logger
115
+
**Added:** 2025-10-11 | **Effort:** 1 day
117
+
**Problem:** Using standard `log` package. Need structured logging (JSON) with levels.
119
+
**Solution:** Switch to `slog`, `zap`, or `zerolog`. Add request IDs, context fields.
121
+
**Code:** TODO in [community/errors.go:46](../internal/api/handlers/community/errors.go#L46)
125
+
### PDS URL Resolution from DID
126
+
**Added:** 2025-10-11 | **Effort:** 2-3 hours
128
+
**Problem:** User consumer doesn't resolve PDS URL from DID document when missing.
130
+
**Solution:** Query PLC directory for DID document, extract `serviceEndpoint`.
132
+
**Code:** TODO in [jetstream/user_consumer.go:203](../internal/atproto/jetstream/user_consumer.go#L203)
136
+
### PLC Directory Registration (Production)
137
+
**Added:** 2025-10-11 | **Effort:** 1 day
139
+
**Problem:** DID generator creates did:plc but doesn't register in prod mode.
141
+
**Solution:** Implement PLC registration API call when `isDevEnv=false`.
143
+
**Code:** TODO in [did/generator.go:46](../internal/atproto/did/generator.go#L46)