Skip to content

Connection-aware WIT codegen: emit aligned cross-component contracts (producer export == consumer import) for inter-core RPC #282

@avrabe

Description

@avrabe

Connection-aware WIT codegen: turn AADL connections into aligned cross-component WIT contracts

To use spar as the place we "architect wRPC" for a multi-core wasm-component system, the load-bearing need is: a connection between two processes should become a shared WIT interface that the producer exports and the consumer imports, with matching types.

Current behavior (crates/spar-codegen/src/wit_gen.rs)

generate_wit() emits, per process, a <proc>-ports interface from that process's own features and a self-contained <proc>-world that imports its own ports. It never walks ConnectionInstances. So for estimator.state_out -> falcon.state_in:

  • estimator gets set-state-out(val: vehicle-state) in its ports interface,
  • falcon gets state-in() -> vehicle-state in its ports interface,
  • there is no shared interface, no package cross-reference, and no guarantee the types line up — the connection that links them isn't represented in the generated WIT.

So the "A.export == B.import" alignment needed for cross-core RPC doesn't exist in codegen (the type-level machinery in transform/wit.rs + wac.rs exists but isn't wired to the instance connection graph).

Request

Teach wit_gen to walk connections and, per cross-component connection (or connected port-set), emit a shared interface in a common WIT package, then have the producer process export it and the consumer import it — so both sides reference the same WIT interface with matching types. Ideally:

  • group ports connected across processes into one interface (request/response port-tuples → a single func(req) -> resp, recognizing the rpc.aadl idiom),
  • when the connection is bound (Actual_Connection_Binding) to a wRPC/transport bus, emit the transport wiring/metadata alongside the WIT (which transport, endpoint), so "fused same-core vs RPC cross-core" is a deployment choice over one contract.

This is the single highest-value change to make spar the architecture source for a meld-fuse-or-wRPC component system. (Context: jess fuses same-core via meld and wants the same WIT contract served over a shared-memory/CAN transport across cores.)

Related: the wrpc-binding false-positive (filed separately) and the WRPC_Properties set from docs/plans/2026-03-10-wasm-as-architecture-design.md (appears doc-only today).

Filed from jess Phase-2 (Pixhawk 6X-RT) wRPC architecture; tracked jess-side as DD-009.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions