Proof of concept mechanical port of ircnet/ircd to Rust as part of a bit about C being insecure for network services
0

Configure Feed

Select the types of activity you want to include in your feed.


name: leveva-command-folder description: "leveva post-registration handlers live in leveva/src/command/ — one client command per file, tests local; how to add a new handler slice" metadata: node_type: memory type: project originSessionId: 11051b76-df69-4363-81f5-94c4f2ab617c#

leveva/src/command.rs was split (2026-06-08, P11 WHO slice) into a command/ folder: one client command handler per file with its #[cfg(test)] mod tests local to that file.

To add a new client command handler (a P11 slice):

  • Create command/<cmd>.rs: use crate::command::*; at top, then pub(crate) fn <cmd>(client: &Registered, msg: &Message, ctx: &ServerContext) -> Vec<Message> + any handler-private helpers + a local #[cfg(test)] mod tests { use super::*; use crate::command::testutil::*; … }.
  • Add mod <cmd>; to command/mod.rs and a "<CMD>" => <cmd>::<cmd>(client, msg, ctx), arm to dispatch (graduate out of the 421 fallback).
  • command/mod.rs owns Registered, dispatch, and the cross-handler reply helpers (mask, is_channel, no_such_channel, no_such_nick, chanop_needed, need_more_params, topic_reply, names_reply, end_of_names) as pub(crate); the shared imports are re-exported pub(crate) use so each submodule just does use crate::command::*.
  • Shared test fixtures (ctx/client/run/codes/uid_for/claim_observed/mb/delivered/claim_and_join/force_flag) live in #[cfg(test)] pub(crate) mod testutil.

S2S handlers live in their own modtree leveva/src/s2s/ (created P11 slice 31, 2026-06-09 — the server-to-server link protocol): one handler per file (handshake/unick/njoin/mode/save/eob/squit) + network (the RemoteServer/RemoteUser/Network remote-state model) + mod.rs (PeerLink, MemberPrefix codec, dispatch), mirroring command/'s shape. The shared remote-state table is ServerContext.net: s2s::Network (named net, NOT networkpub network: String is the network name). main.rs routes a server-only connection to serve_server (not serve_client); session.rs has a Phase::Server(PeerLink). Do not mix S2S handlers into command/ (the oper-facing SQUIT client command is the one exception — it lives in command/squit.rs and shares s2s::squit::squit_subtree). Known-latent (deferred to a multi-link slice): the burst SERVER prefix uses own-SID not parent-SID; no S2S keepalive yet.

See [[blog-series]] for the narration cadence and the P11 slice pattern (handler + boot golden + proptest fuzzing, divergences documented). Per-slice detail: docs/progress-log/p11.md.