Skip to content

P3 async — cross-component stream adapter (#94 sub-A) #141

@avrabe

Description

@avrabe

Sub-issue of #94 — outstanding deliverable A from the audit.

Today meld lowers each component's stream intrinsics to host imports under `pulseengine:async`. When two fused components share a `stream` endpoint, those calls still go through the host even when both sides live in the merged module. The umbrella asks for a stream-bridging adapter that fuses both ends.

Scope

Two modes, mirroring the existing multi-memory / shared-memory split for synchronous data:

Mode Adapter shape
Same memory (single-memory fusion) Direct ring buffer — sender and receiver share an in-module queue page; zero-copy.
Different memories (multi-memory, default) `stream_read` → in-module copy loop → `stream_write` chain. `cabi_realloc`-style allocation on the receiver side, identical null-guard policy as LS-A-7.

Deliverables

  • New emitter in `adapter/fact.rs` (or a sibling file) that detects intra-fusion `stream` pairs at merge time and emits the adapter.
  • Resolver extension: track `(source_component, source_stream_handle) → (sink_component, sink_stream_handle)` pairs.
  • Tests: same-memory zero-copy, different-memory chain, backpressure propagation through the adapter, EOF passthrough.
  • Mythos check on the new emitter (same Tier-5 process as fact.rs).
  • ADR-3: cross-component stream adapter design.

Dependencies

Rivet artifact

  • New requirement SR-33 — "Cross-component `stream` fusion at merge time".

Milestone

v0.9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions