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>
Push coverage from 88.5% to 93.1% by testing:
- writeTLV failures at each Write call (tag, length, value)
- ReadAndVerify io.ReadAll failure after 0xFF tag
- writeTLV and ReadAndVerify now at 100% function coverage
Co-Authored-By: Charon <charon@lethean.io>
Implements Phase 4 of the go-p2p task queue. The Dispatcher routes
HMAC-verified UEPS packets to registered IntentHandlers by IntentID,
enforcing a threat circuit breaker that drops packets with ThreatScore
exceeding 50,000 (logged as threat events at WARN level).
Design choices:
- IntentHandler is a func type (not interface) for lightweight registration
- 1:1 mapping of IntentID to handler, replacement on re-register
- Threat check fires before intent routing (hostile packets never reach handlers)
- Sentinel errors (ErrThreatScoreExceeded, ErrUnknownIntent, ErrNilPacket)
- RWMutex protects handler map for concurrent safety
Tests: 10 test functions, 17 subtests — 100% dispatcher coverage.
Race detector clean. All 102 existing tests continue to pass.
Co-Authored-By: Charon <developers@lethean.io>
14 tests covering request-response correlation, timeout handling,
auto-connect, parallel stat collection, ping RTT with metrics update,
concurrent multi-peer requests, and dead peer channel cleanup.
Also fixes a pre-existing data race (P2P-RACE-1) in GracefulClose where
SetWriteDeadline was called outside writeMu, racing with concurrent
Send() calls.
Co-Authored-By: Charon <developers@lethean.io>
25 subtests covering all 9 TODO items: round-trip, HMAC tampering
(payload + header), wrong shared secret, empty payload, ThreatScore
uint16 boundary, missing HMAC tag, TLV overflow, truncated packets,
and unknown tag handling. Also adds KB wiki docs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Coverage gaps (UEPS 0%, transport 0%, controller 0%),
priority work items, and architecture map for guided
Claude session on test coverage and dispatcher implementation.
Co-Authored-By: Virgil <virgil@lethean.io>