mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
Lands the remaining ADR-120 work in ruflo now that upstream ruvnet/midstream#81 shipped midstreamer@0.3.1 with real QUIC. ## Step 3 — `v3/crates/ruflo-federation-peer/` New Rust crate that composes the QUIC transport (midstreamer-quic or any TransportProvider impl) with the AIMDS 3-gate safety pipeline (any SafetyGate impl) into a single Peer<T, G, D> dispatch loop. Replaces today's Node-bridge → Node-MCP → Rust-crate path with one process per federation peer. Surface: * `TransportProvider`, `SafetyGate`, `Dispatcher` traits — async, Send + Sync, so the Peer can run in any tokio executor. * `Peer::run()` — inbound dispatch loop. `Pass` → dispatch; `Block` → quarantine (never reaches dispatch); `Redact` → dispatch the cleaned variant. * `Peer::send()` — outbound through the gate first; Block error bubbles back to the caller. * `--features native` — pulls in midstreamer-quic@0.2.1 + aimds-{core,detection,analysis,response}@0.1.1 from crates.io. Without it, the binary builds and the trait surface compiles so CI / `cargo check` work in any tree. Verified: * `cargo build` and `cargo test` — 3/3 unit tests pass (dispatch loop with PassThroughGate, BlockEverythingGate, and outbound-send-blocks-when-gate-blocks). * `cargo check --features native` — resolves the upstream deps cleanly. ## Step 2 update — `midstream-aware-loader.ts` Probes `midstreamer/quic` (the new sub-path added in midstreamer@0.3.1) first, falls back to the root `midstreamer` import for older versions. Accepts both ESM and CommonJS shapes (via `.default`) since the upstream sub-path is CJS. ## CI guards * New workflow `.github/workflows/federation-peer-rust.yml`: two jobs — `stable-noop` (cargo build + cargo test without features) and `stable-native` (cargo check --features native). Triggers on changes to the crate or this workflow. * `scripts/audit-fix-invariants.mjs` gains 4 invariants pinning the crate name + the midstreamer-quic version + the two pluggable trait names. 31 invariants now present across 18 files (was 27/16). ## Verification matrix * `node scripts/audit-fix-invariants.mjs` → 31/31 ✓ * `npx vitest run` in plugin-agent-federation → 22 files, 555/555 ✓ * `cargo test` in v3/crates/ruflo-federation-peer → 3/3 ✓ Co-authored-by: Reuven <cohen@ruv-mac-mini.local>