Files
ruflo/scripts
rUvandReuven 8f5934dea5 feat(federation): ADR-120 Step 2 — midstream-aware transport loader (#2007)
Lands the ruflo-side of ADR-120 (cross-port agentic-flow QUIC into
midstream + Rust inflight agentics) Step 2: extend the federation
plugin's transport loading to prefer midstream's real QUIC build
when MIDSTREAMER_QUIC_NATIVE=1, with a transparent fallthrough to
the existing agentic-flow loader (which itself handles ADR-108
native QUIC and ADR-104 WebSocket fallback).

Surface:

  • New `src/transport/midstream-aware-loader.ts` —
    `loadFederationTransport(config)` probes midstreamer first,
    refuses the WASM stub via `isStub()` if reported (ADR-119),
    returns a `LoadedFederationTransport` envelope with `source`
    + optional `fallbackReason` for log/metric visibility.

  • `src/plugin.ts` now imports from the wrapper instead of
    `agentic-flow/transport/loader` directly. Logs the resolved
    source on successful load.

  • 5 unit tests covering both branches (env unset / "0" / "1"
    without package), config passthrough, envelope shape.

Behavior unchanged today: midstream's WASM build is a counter-
tracking stub per ADR-119, so `MIDSTREAMER_QUIC_NATIVE=1` falls
through to agentic-flow's loader on every install. The wrapper
activates the moment `midstreamer@0.3.0` ships real QUIC (ADR-120
Step 1, upstream work in ruvnet/midstream).

Test results in the worktree:
  • Full plugin suite: 22 files, 555/555 tests passing
  • audit-fix-invariants.mjs: 27 invariants across 16 files,
    all present (was 25/14)

Two new invariants added to the audit guard so a refactor can't
silently revert to the bare `loadQuicTransport` import and bypass
the midstream preference.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 22:28:20 -04:00
..
2026-01-04 19:30:59 +00:00