Commit graph

61 commits

Author SHA1 Message Date
Claude
a60dfdf93b
feat: implement UEPS packet dispatcher with threat circuit breaker
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>
2026-02-20 00:23:10 +00:00
Claude
de36ce991a
docs: mark Phase 3 complete in TODO.md with commit hash
Co-Authored-By: Charon <developers@lethean.io>
2026-02-20 00:17:45 +00:00
Claude
33eda7b656
test: add controller tests (Phase 3) — node/ coverage 63.5% to 72.1%
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>
2026-02-20 00:17:31 +00:00
Claude
62935bc515
docs: mark Phase 1-2 complete in TODO.md
UEPS: 88.5% coverage (2bc53ba)
Transport: node/ 42% → 63.5% (3ee5553)

Co-Authored-By: Charon <developers@lethean.io>
2026-02-20 00:10:36 +00:00
Claude
3ee5553d18
test: add transport layer tests (Phase 2) — node/ coverage 42% to 63.5%
13 tests covering all Phase 2 TODO items: reusable test pair helper,
full handshake with challenge-response verification, protocol version
rejection, allowlist rejection, SMSG encrypted message round-trip,
message deduplication, rate limiting (100 burst verified), MaxConns
enforcement, keepalive timeout cleanup, graceful disconnect, and
concurrent sends with race detection clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:08:35 +00:00
Claude
2bc53bac61
test: add UEPS wire protocol tests (Phase 1) — 0% to 88.5% coverage
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>
2026-02-19 23:44:09 +00:00
Claude
6d71da4065
docs: restructure TODO.md with phased task queue
Phase 1 (UEPS tests) → Phase 2 (transport) → Phase 3 (controller)
→ Phase 4 (dispatcher) → Phase 5 (integration/benchmarks)

Known issues and wiki inconsistencies documented.

Co-Authored-By: Charon <developers@lethean.io>
2026-02-19 23:29:36 +00:00
Snider
c9ac361f63 docs: assign to Linux homelab agent with platform-specific tasks
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-19 19:40:19 +00:00
Snider
cba084acde docs: add CLAUDE.md, TODO.md, and FINDINGS.md for expert session
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-19 17:42:52 +00:00
Snider
9df1d523c1 docs: add session brief for expert agent work
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>
2026-02-19 17:39:03 +00:00
Claude
8f94639ec9
feat: extract P2P networking and UEPS protocol from Mining repo
P2P node layer (peer discovery, WebSocket transport, message protocol,
worker pool, identity management) and Unified Ethical Protocol Stack
(TLV packet builder with HMAC-signed frames).

Ported from github.com/Snider/Mining/pkg/{node,ueps,logging}

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:47:10 +00:00