Runic.IncompatiblePortError exception (Runic v0.1.0-alpha.7)

Copy Markdown View Source

Raised when connecting two components with incompatible port contracts.

This occurs when Workflow.add/3 detects that a producer's output ports are not type-compatible with a consumer's input ports.

Example

require Runic
alias Runic.Workflow

int_step = Runic.step(fn x -> x + 1 end,
  name: :int_producer,
  outputs: [out: [type: :integer]]
)

string_consumer = Runic.step(fn x -> String.upcase(x) end,
  name: :string_consumer,
  inputs: [in: [type: :string]]
)

# This raises IncompatiblePortError
Workflow.new()
|> Workflow.add(int_step)
|> Workflow.add(string_consumer, to: :int_producer)

Solutions

  1. Ensure output types match expected input types
  2. Use type: :any for flexible ports
  3. Pass validate: :off to bypass validation during prototyping