Skip to content

Connectors and outcomes

After this chapter you can distinguish a Connector declaration from its Driver, find the supported modes in your binary, and route both useful data and terminal outcomes. You can explain why admission, completion and business success are different facts.

Run this command from the checkout or an installed CLI:

Terminal window
rastok connectors

It lists compiled capabilities without starting a Driver. Read the exact Contract id, mode, port types, required attributes, checker support, Lab support and installed implementations separately. A Contract known to the compiler does not imply that your binary includes its physical Driver. Likewise, listing a conformance fixture does not mean the command ran it.

The executable standard families are Process, File, HttpClient, HttpServer, WebSocketClient and WebSocketServer. The catalogue also describes deferred families or modes. A File watch entry is not permission to use it today. The current status remains the starting point for the alpha’s limits.

The reader in examples/file-pipeline.rkg, lines 10–15, declares one bounded operation per input:

connector read_file : File {
mode = read
path = data as string
max_read = "64KiB"
timeout = duration("2s")
}

path is resolved for the invocation from its input. It is a logical path relative to the root supplied to the physical File Driver, not permission to read an arbitrary host path. That root is a resolution base, not a portable security sandbox. The read publishes the complete bytes or no out value; exceeding max_read produces ReadLimitExceeded.

The writer, lines 26–30, selects another mode of the same Contract:

connector write_file : File {
mode = replace
path = "copy.txt"
timeout = duration("2s")
}

It consumes bytes and reports a terminal outcome. Replacement is atomic where the platform supports the promised operation; otherwise the result is AtomicReplaceUnavailable, not an in-place fallback. Atomic visibility does not promise crash durability. Directories are refused by name rather than traversed as an implicit collection of files.

A mode resolves the operation’s direction, exchange and port behavior. The physical Driver and the Lab model implement the same checked Contract. Simulation substitutes the external work while preserving request validation and the declared ports. Driver selection is a deployment choice.

For File read, out carries bytes and exit closes the Call. For File replace, successful out is impossible; completion is still reported on exit. Process uses err for stderr. HTTP Contracts have no implicit err. The names are conventions whose actual meaning comes from the resolved Contract, not three universal success and fault channels.

The file Graph names each outcome on both exits. Here is the reader at lines 37–41:

read_file.exit -> match {
Completed -> nothing
AtomicReplaceUnavailable | InvalidPath | IoFailed | NotAFile | NotFound
| OutcomeUnknown | PermissionDenied | ReadLimitExceeded | TimeoutExpired -> failed
}

Successful terminals are deliberately discarded. Other cases cross the App’s failed output. These emissions remain observable in the journal even when their destination is nothing. An invocation’s exit does not stop the whole Node instance; an instance may serve further invocations.

When joining a Call’s body and exit, route every terminal that accompanies a body to that join. Otherwise a retained body can pair with another Call’s terminal: W-JOIN-UNPAIRED warns about this. A streamed port cannot pair zero or more frames with one terminal. To isolate Calls, use a correlation key shared by the body and terminal of just that Call. Declare the joining Operator’s lifetime and bound the join with within or last, with expired routed. A join bound neither separates Calls nor closes their instances. See joins and expiry.

The webhook listener, from examples/webhook-to-partner.rkg, lines 23–28, uses the default ack mode:

connector listener : HttpServer {
listen = "127.0.0.1:8080"
path = "/events"
codec = json
max_body = "16 KiB"
}

A successful accepting commit precedes the HTTP 202 response. That response means admitted, not processed. Decoded but business-invalid data can then reach the validation Operator and be rejected. Malformed JSON refused before admission creates no invented graph Call or exit to assert on. A decoded Lab injection therefore cannot qualify the physical JSON decoder.

For an outbound HttpClient, a usable decoded 500–599 response produces ServerError and a response body, not a transport fault. Other decoded statuses use Completed; the graph still decides which mean business success. An incompatible response body produces DecodeFailed. A timeout does not establish that the remote side did nothing.

Before asking an outbound Driver to act, the runtime commits the operation’s obligation. Its completion then returns through the typed boundary and journal. In this alpha that journal is in memory; ordering before an effect is not a claim of durable recovery after process loss.

The normative descriptions are docs/spec/stdlib.md, docs/spec/delivery-semantics.md and docs/spec/envelope.md. Checking rejects unknown settings, incompatible port types and missing possible-output destinations before execution. Real-world compliance still needs separate Driver and integration evidence.

  • Contract, mode and physical implementation answer different questions.
  • Payload outputs and the terminal exit are independently typed.
  • Explicit dispositions account for every possible result.
  • Admission and a decoded HTTP response are not business success.

Continue with The Lab. Use File pipeline to inspect named file refusals, then Webhook to partner to follow admission, validation and the partner’s terminal outcome together.

Diagram