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.

ircd.rs / docs / claude-memory / ircd-common-native-boot.md
3.1 kB

name: ircd-common-native-boot description: "ircd-common has a clap entrypoint + an embedded in-process boot() API (ircd-common/src/boot.rs) so the faithful oracle daemon can be booted in a test thread, paired natively with leveva; plus the standing leveva testing plan location" metadata: node_type: memory type: reference originSessionId: 335039bb-9134-491e-a78c-4b71eeee1e72#

ircd-common/src/boot.rs (added 2026-06-10) gives the faithful oracle daemon a Rust-native entrypoint and an embedded in-process boot, so a test binary can boot it without a subprocess (the seam to "link ircd-rs and leveva together natively").

  • ircd_common::boot::Options — clap #[derive(Parser)], one field per the historical getopt flag (-a -b -c -q -i -p{strict|on|off|standalone} -s -t -T -v; C's -h servername is --servername so -h stays clap --help). to_bootopt() reproduces the exact bootopt bitmask; to_argv() rebuilds canonical argv.
  • ircd_common::boot::run() -> ! — the production path. ircd-rs/src/main.rs is now just fn main() { ircd_common::boot::run() }. It clap-parses, then hands canonical flags to the faithful ircd::c_ircd_main (LEFT BYTE-FOR-BYTE UNTOUCHED — daemonize, signals, iauth child, infinite io_loop). So the documented faithful-translation bytes the ircd-rs goldens pin are preserved; all goldens stayed green.
  • ircd_common::boot::boot(Options) -> Result<Server, BootError> — the embedded path. Runs ircd::boot_embedded (a documented minimal adaptation of the c_ircd_main sequence: same faithful init fns/order, forces BOOT_TTY|BOOT_NOIAUTH, skips setuid/iauth-vfork/ setup_signals, uses s_bsd::init_sys_embedded so it does NOT close the test process's fds, and returns Err instead of exit(-1) on validation failure), then spawns ONE OS thread running a stop-checked io_loop. Server exposes port()/local_addr() (discovered via s_bsd::bound_listener_port, scanning local[] for the FLAGS_LISTEN client) and shutdown() (cooperative AtomicBool + a connect-poke to wake the blocking select(); also on Drop). Config comes from the usual IRCD_TEST_CONFIG seam.

ONE world per process — all daemon state is process-global static mut, so at most one embedded Server at a time (fine for one-oracle + one-leveva pairing; leveva keeps its own ServerContext). Serialize boots with the shared port lock — ircd-rs/tests/harness::lock_boot_port(). Worked example: ircd-rs/tests/inprocess_boot.rs (boots in-process, registers a client to RPL_WELCOME, shuts down by joining the loop thread). ircd-common gained a clap dep.

Standing testing plan: docs/superpowers/specs/2026-06-10-leveva-testing-plan.md — the P11 completeness verdict, the test layers, how this native-boot capability is used (skeleton differential, since leveva diverges from the oracle at the wire level by design — a byte-diff is the wrong granularity), the fuzzing gap list, and the per-slice cadence. Related: [[leveva-next-step-s2s-completeness]], [[leveva-ircv3-track]], [[boot-golden-harness]].