Skip to content

refactor: channel reduction and terminology alignment#90

Merged
maxholman merged 5 commits into
mainfrom
refactor/channel-terminology-cleanup
Mar 19, 2026
Merged

refactor: channel reduction and terminology alignment#90
maxholman merged 5 commits into
mainfrom
refactor/channel-terminology-cleanup

Conversation

@maxholman
Copy link
Copy Markdown
Contributor

Summary

  • Align 16 internal Rust names with the proto/CLI/MCP/REST naming convention (noun-verb pattern: info, hint_set, route_del, peer_disconnect)
  • Eliminate the latency_tx/latency_rx channel — Pong handler updates the peer registry directly instead of forwarding through an mpsc channel
  • Remove the always-None role_transition_tx field from ControlChannels

How to verify

  • cargo clippy --all-targets -- -D warnings — zero warnings on both default and slim builds
  • cargo test -q — all tests pass including the rewritten ping latency test
  • Range deploy: verify peers show latency, wallhack info/peers/ping all functional
  • MCP tools: info, peers, stats, ping, hint_set, hint_set_auto, route_del all respond correctly
  • OpenAPI spec operationIds match the new naming pattern

🤖 Generated with Claude Code

maxholman and others added 4 commits March 18, 2026 21:58
NodeApi trait methods, handler structs, and REST/MCP function names now
follow the same noun-verb pattern used by the management protocol and
CLI/REPL (e.g. hint_set, route_del, peer_disconnect). OpenAPI
operationIds updated to match (e.g. peersList, peerDisconnect,
infoGet). Stale comments referencing old names cleaned up.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The role_transition_tx field was always None at every construction site.
The RoleTransition message is still decoded and logged but no longer
forwarded through a channel that nothing reads.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ctly

The Pong handler in the control loop now calls
registry.update_latency() directly instead of forwarding RTT
measurements through a dedicated mpsc channel. This removes 4 channel
pair creations (one per transport impl), the latency_rx field from
ConnectResult/AcceptResult, and the latency_rx parameter from
spawn_heartbeat.

The peer name for registry lookups is extracted from the Handshake
message — on the server side at construction, on the client side when
the first Handshake arrives through the control stream. QuicClient and
WsClient gain a peer_registry field that daemon modes set before
calling connect().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract spawn_client_tasks() in client.rs — shared by both QUIC and WS
connect paths. Handles the oneshot handshake channel, control stream
task, data-in task, and ConnectResult construction that was previously
copy-pasted across both transports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@maxholman maxholman force-pushed the refactor/channel-terminology-cleanup branch from 7aaf90d to 346d390 Compare March 18, 2026 14:58
Extract spawn_server_tasks() in server.rs — resolves shared resources
from ServerOptions, spawns the control loop with a Handler, and builds
the AcceptResult. Replaces ~35 lines of identical setup in both QUIC
and WS accept paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@maxholman maxholman merged commit afc7671 into main Mar 19, 2026
9 of 11 checks passed
@maxholman maxholman deleted the refactor/channel-terminology-cleanup branch March 19, 2026 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant