mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-09-14 14:01:28 +08:00
b50d4dd7a2
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>
81 lines
2.6 KiB
YAML
81 lines
2.6 KiB
YAML
name: federation-peer-rust
|
|
|
|
# Builds + tests the v3/crates/ruflo-federation-peer crate (ADR-120
|
|
# Step 3). Triggers only on changes to the crate or this workflow.
|
|
# Two jobs:
|
|
#
|
|
# stable-noop — cargo build + cargo test without --features native.
|
|
# Verifies the trait surface compiles in a tree that
|
|
# doesn't have the upstream crate deps materialized.
|
|
#
|
|
# stable-native — cargo check --features native. Pulls in
|
|
# midstreamer-quic@0.2.1 + aimds-*@0.1.1 from
|
|
# crates.io. Type-checks only (the placeholder impls
|
|
# don't yet exercise the upstream APIs).
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'v3/crates/ruflo-federation-peer/**'
|
|
- '.github/workflows/federation-peer-rust.yml'
|
|
pull_request:
|
|
paths:
|
|
- 'v3/crates/ruflo-federation-peer/**'
|
|
- '.github/workflows/federation-peer-rust.yml'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
stable-noop:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust stable
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
v3/crates/ruflo-federation-peer/target
|
|
key: federation-peer-${{ runner.os }}-${{ hashFiles('v3/crates/ruflo-federation-peer/Cargo.toml') }}
|
|
|
|
- name: cargo build (no native features)
|
|
working-directory: v3/crates/ruflo-federation-peer
|
|
run: cargo build --verbose
|
|
|
|
- name: cargo test (no native features)
|
|
working-directory: v3/crates/ruflo-federation-peer
|
|
run: cargo test --verbose
|
|
|
|
- name: cargo clippy (no native features)
|
|
working-directory: v3/crates/ruflo-federation-peer
|
|
run: cargo clippy --all-targets -- -D warnings
|
|
continue-on-error: true
|
|
|
|
stable-native:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust stable
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
v3/crates/ruflo-federation-peer/target
|
|
key: federation-peer-native-${{ runner.os }}-${{ hashFiles('v3/crates/ruflo-federation-peer/Cargo.toml') }}
|
|
|
|
- name: cargo check --features native (resolves midstreamer-quic + aimds-*)
|
|
working-directory: v3/crates/ruflo-federation-peer
|
|
run: cargo check --features native --verbose
|