Replace internal task tracking (TODO.md, FINDINGS.md) with structured
documentation in docs/. Trim CLAUDE.md to agent instructions only.
Co-Authored-By: Virgil <virgil@lethean.io>
Add Authenticator interface with AuthenticatorFunc adapter and built-in
APIKeyAuthenticator for Bearer token validation. Hub.Handler() now gates
connections when an Authenticator is configured on HubConfig, responding
HTTP 401 for failed auth. Client.UserID and Client.Claims are populated
on successful upgrade. OnAuthFailure callback enables logging/metrics.
Nil authenticator preserves full backward compatibility — all existing
tests pass unchanged. 18 new tests (unit + integration) cover valid/
invalid/missing/malformed headers, func adapter, multi-client auth,
message delivery post-auth, and the OnAuthFailure callback.
Co-Authored-By: Virgil <virgil@lethean.io>
Phase 0: Fix SendToChannel data race (client map iterated outside lock),
add 16 test functions covering all edge cases, benchmarks, and integration
tests. Coverage 88.4% -> 98.5%. go vet clean, race detector clean.
Phase 1: Add HubConfig with configurable heartbeat/pong/write timeouts
and OnConnect/OnDisconnect callbacks. Add ReconnectingClient with
exponential backoff, max retries, and OnConnect/OnDisconnect/OnReconnect
state callbacks. Full test coverage for all resilience features.
Co-Authored-By: Charon <developers@lethean.io>