6. The type system
The standard signature is the vocabulary every Reaktor runtime understands. Four rules shaped it.
Factor, do not enumerate. A port type is a product of independent dimensions, a node kind is a set of facets, and two hyperedge families are separate only when their operational laws differ. The 2026 catalogue named 40 node kinds, 24 port profiles and 36 hyperedge kinds [291, 292]. Many of these were combinations of independent dimensions, and the same concept often appeared as a node, a port and a relation (Appendix B).
Protocol is orthogonal to realization. A family fixes what an interaction means. A binding fixes how it is carried: an in-process reference, an FFI trunk, inter-process messaging, RPC, a broker, a durable workflow engine or a peer mesh. Placement chooses the binding, which is admissible only if it refines the family’s protocol at the required quality of service. “rpc” and “ffi” are therefore realizations, not port kinds. This is Service Weaver’s split between logical components and deployment [143], made typed. It also keeps the Reaktor rule that location may be abstracted but latency and partial failure may not.
Derived kinds are definitional extensions. A screen, an actor, a workflow or a topic is a name for a pattern of base kinds, facets and families. Adding the name adds no semantics, so the kernel never depends on it.
Facets, not subclasses. Node kinds are archetypes of facets, as in entity–component systems [130, 157]. Unknown optional facets round-trip intact; unknown required semantics block activation.
6.1 Node kinds#
Table 5 lists the fourteen base kinds, and Figure 2 uses all of them. Behaviour lives in Component. Its profile facet selects among pure, effectful, exclusive (actor), stream, durable, native and human, and each profile carries laws, not just a label. An exclusive component processes one message at a time from its mailbox and owns its state. A durable component’s progress is persisted at a named store, so a coroutine stack is never treated as a checkpoint. Scope is the unit of composition, isolation, supervision and update. Route is an addressable navigation state. Being scope-like, routes nest, and a surface mounted at a route is its child. Store is a consistency domain, a named authority that commits state. Dataset is a logical relation whose schema is a Contract. A table is therefore part of the graph, but a row never is. A dataset’s contract may also declare invariants (row checks, uniqueness, acyclicity, referential integrity, sums over rows), which its store enforces inside its transactions (Section 9).
Anatomy of a node#
Every node has five parts:
a stable identifier;
a kind, which fixes its layer and its required facets;
an owner in the containment forest: its scope, or, for a port, its node;
a set of facets, typed attribute groups that compose like the components of an entity–component system;
the ports it owns.
Identifiers derive from declaration paths: the scopes from the root, the local name and the kind, hashed to 128 bits. They survive rebuilds, reordering and moves between files. Elements that placement or the runtime create (realizations, activations, observations) derive theirs from the element they realize, a key and an epoch. A restarted activation therefore has a new identifier that still traces back to its definition.
Facets#
A facet is a typed record with required and optional fields and its own rules. A kind declares the facets its nodes must carry, and a node may carry more. No two facets may define the same field, so facets compose without conflicts, and a tool that does not know a facet passes it through unchanged (T4). Labels, tenancy, retention and supervision are facets. That is why the additions of Section 6.4 needed no new kind.
Profiles#
The profile facet of a Component carries laws, not just a label. Table 4 states what the runtime guarantees for each profile, what the checker verifies before activation, and how the reference stack realizes it.
| Profile | Law the runtime guarantees | Checked before activation | Typical realization |
|---|---|---|---|
| pure | No effects; the same inputs give the same outputs, so results may be cached or replayed | No Access writes and no effectful sessions; captures only values | Inline call; memoised |
| effectful | Effects only through declared Access and Session ports; its effect is the join of that footprint | Footprint within the ceiling (W10) and covered by grants (A5) | Any compute place |
| exclusive | One message at a time from its mailbox; owns its state; one live instance per key | A single mailbox consumer; no shared mutable state | Durable Object; actor host |
| stream | Ordered inputs with windows, watermarks and back-pressure | Ordered input channels; time attributes present | Coroutine flow; stream processor |
| durable | Progress persisted at a named store; resumes by replaying committed outcomes | Steps are code entries; no captured stacks | Workflows; Temporal; alarms |
| native | Runs in a native runtime behind an FFI trunk; ownership enforced at the boundary | Ownership modes declared; a borrow stays inside its owner’s scope (W9) | C++ via JNI, cinterop, JSI or Wasm |
| human | A person acts through a surface; a step may wait for days | A deadline and an escalation on every human session | Approval surface with a durable wait |
Derived kinds#
A derived kind is a definitional extension (T3): a name for a base kind with required facets, ports and constraints. For example, The kernel stores only base kinds and facets. A derived kind is a query over them, so a tool that does not know the name still handles the element correctly.
| Base kind | Layer | Characteristic facets and attributes | Derived kinds (definitional) |
|---|---|---|---|
| Scope | Def | boundary ports; supervision (one-for-one, all-for-one, escalate); isolation (none, process, memory, principal); update unit; edit owner (source or graph); opacity | module, feature, region, factory, external system |
| Component | Def | profile (pure, effectful, exclusive, stream, durable, native, human); code entry; turn policy; effect ceiling | interactor, repository, service, actor, worker, workflow, step, policy, adapter, model, controller, check |
| Surface | Def | named slots; form-factor guards; renderer profile | screen, container, input source, form |
| Route | Def | path pattern; argument contract; history (shallow, deep) | deep link, modal, tab |
| Store | Def | consistency profile (transactional, serialized, consensus, convergent, append-only); isolation; durability | database, key–value store, blob store, actor store, ledger |
| Dataset | Def | schema contract; representation (authoritative, derived, replica); data family (relational, document, graph, vector, search, log); invariants; retention | table, view, index, materialization |
| Contract | Def | fingerprint; compatibility relation; interaction protocol | schema, service contract, capability, event type |
| Principal | Def | type (person, role, service account, agent, organization) | agent, tenant |
| Artifact | Src | digest; format; target; authored or built | module, bundle, binary, manifest, patch, plan, release, migration |
| Place | Dep | runtime (ART, JVM, Native, V8, Hermes, CPython, database); trust tier; region; capacity; offered capability ports | device, browser tab, isolate, process, host, pool, region |
| Resource | Dep | provider; locator; configuration | bucket, topic, queue, database instance, Durable Object namespace |
| Activation | Run | key; epoch; lifecycle state; parent activation | run, attempt, session instance, mount |
| Observation | Obs | type (span, event, metric, log, receipt); time; coverage; normally virtual | trace, receipt, sample |
| Claim | Ass | proposition; assumptions; bounds; status per dimension | invariant, finding, approval, objective |
6.2 Ports#
Definition 5 (Port type). A port type is : a family , a role , a contract fingerprint , an ownership mode and a quality-of-service requirement . Polarity is derived, ; it states which side offers a contract, not which way each message travels.
The ownership modes carry the obligations that FFI needs [349]. A port transfers a resource that must be accepted exactly once. A port lends a view whose lifetime nests inside the owner’s scope and which cannot leave its process. A port grants a read lease. A camera frame handed to a native encoder, a model’s weights shared between workers and a FlexBuffers view decoded in place are three modes over the same families. The quality-of-service lattice is a product of chains (synchrony, delivery, ordering, retention, durability, deadline, capacity), ordered by strength, and the requirement of a hyperedge is the join of its ports’ requirements. The terms in common use map onto port types as follows. A provider port is or . A receiver is . A broadcast port is a on a fan-out channel. An rpc port is a call realized over a network, and an ffi port is any port realized by an FFI trunk, a typed connection between two runtimes in one process, such as JSI between a Hermes engine and its host. Its ownership is usually or .
Polarity#
Polarity says which side offers the contract. The provider of a Bind, the server of a Session, the producer of a Channel and the pre-state of a Transition offer; the others require. An interceptor does both: it requires what it forwards and offers what it returns.
Contracts and compatibility#
A contract is a schema or protocol in a canonical form, and its fingerprint is a digest of that form. Compatibility means that may be used where is required. It is computed, never declared: a version number is a label, not evidence.
Records. An offered record may add optional fields, but it may not drop or retype a field that the requirement reads.
Sessions. The server must accept every request the client may send, so requests are contravariant. The client must accept every outcome the server may return, so outcomes are covariant.
Channels. Every consumer must accept every producer’s messages, so the channel’s message type is the join of what producers send, and it must lie below what each consumer accepts.
Equal fingerprints decide compatibility in constant time. Otherwise the kernel computes the relation once per pair of fingerprints and caches it.
Quality of service#
Table 6 lists the dimensions of . Each is a chain ordered by strength. Capacity and overflow are attributes rather than chains, because no overflow policy is stronger than another in every use. A binding qualifies for a hyperedge when its guarantee dominates the join of its ports’ requirements in every dimension (A2).
| Family | Dimensions of , each ordered from weak to strong |
|---|---|
| Bind | resolution: lazy eager; selection is an attribute (exclusive, ordered fallback, all, keyed) |
| Session | synchrony: asynchronous synchronous; deadline: none seconds milliseconds; effect identity: none keyed keyed with request digest; acceptance: volatile durable; retry, hedging and batching policies are attributes |
| Channel | delivery: best effort at least once effectively once; order: none per key total; retention: transient bounded durable; replay: none from offset; capacity and overflow are attributes |
| Transition | durability: volatile durable; firing: at most once exactly once per token; the join policy is an attribute |
Figure 8. Typed ports and one hyperedge from the chat scope. Each port carries a full type . The Channel hyperedge joins one producer and two consumers; its requirement is the join of theirs, and every offered contract must be compatible with every required one. A filled square offers its contract and a hollow one requires it.
6.3 Families and hyperedges#
Table 7 gives the four connection and ten assertion families. Connections have operational semantics (Section 7), so they participate in execution. Assertions are facts used by analysis, planning and admission; they never execute. This is the corpus’s own distinction between executable connections, semantic relations and local facets [287], now made precise.
@l >
p3.4cm >
X >
p3.0cm@
Family & Roles (multiplicity) & Meaning and principal attributes & Derived forms
Bind & provider (1..), consumer (0..), selector (0..1) & A co-located reference or value, resolved at activation and invoked as a direct call. Selection is exclusive, ordered fallback, all, or keyed. It never leaves a process. & DI binding, capability binding, fallback ladder, multibinding, source import
Session & roles of a global type ; interceptor (0..) & A multi-message protocol whose participants follow the projections of [173]. An interceptor sits on the path between two roles: it receives each message first and passes, rejects or annotates it, so its local type is fixed by those two roles’ projections. Attributes: synchrony, deadline, idempotency key, durability of acceptance. & call, stream (credit-based), duplex, durable call, multiparty session
Channel & producer (0..), consumer (0..) & One-way messages through a buffer. Distribution: fan-out or competing consumers. Also retention, delivery, ordering, scope, capacity, overflow and dead-letter target. & event, signal (state), topic, queue, mailbox, timer (fed by a schedule)
Transition & pre (1..), post (1..), trigger (0..1) & Transfer of control with Petri-net firing [258]. Join: all, any, first, quorum or barrier. Also guard, mode (push, replace, pop, return) and durability. Hierarchy comes from containment, as in statecharts [163]. & navigation, workflow step, fork, join, compensation
Export & inner (1), outer (1) & Aliases a scope’s boundary port to an inner port: the leg of an open graph. & route export
Access & accessor (1), dataset (1..) & Effect footprint: read, write or subscribe, and the atomicity domain. & transaction scope
References & from (1), to (1) & Reference between elements (dataset fields, artefacts, principals), with a kind, cardinality and integrity rule. & foreign key, citation
Replicates & authority (0..1), replica (1..) & Replication with direction, checkpoints and conflict law. & cache, sync view
Grant & grantor (1), grantee (1), resource (1..), policy (0..1) & Authority to act on resources, with actions, expiry, delegation depth, rate and budget. & delegation
Places & subject (1..), target (0..1), peer (0..) & Desired placement: on, near or apart, or partitioned by key. & affinity, shard map
Realizes & spec (1), impl (1..) & Implementation, binding or instance, with epoch and key. & instance, cohort member
Derives & input (0..), transform (0..1), output (1..) & Provenance and lineage under a revision cut [255]. & build, migration, projection
Observes & observer (1), subject (1..) & An observation of elements, with coverage and sampling. & span, metric
Attests & claim (1), subject (0..), evidence (0..), verifier (0..) & Claim-indexed evidence with method, assumptions and freshness. & finding, approval
Four choices in Table 7 need justification. First, Bind is local by construction. A reference between processes would pretend that a network call cannot fail. Within one process, runtimes are places nested in the process’s place, and a Bind between them is realized by an FFI trunk that checks ownership. Remote dependencies are therefore Sessions, and the type checker can see the difference. Second, Session subsumes request–reply, streams and duplex sessions because each is a global type: a call is , where distinguishes a domain rejection, a failure and an unknown effect. Third, Channel is separate from Session because its participants are dynamic and decoupled by a buffer. A topic does not know its subscribers, whereas a session’s roles are fixed when it opens. Fourth, navigation, workflow steps and sagas share Transition: each moves control between states under a guard, and they differ in their attributes. A bottom-navigation container, whose tabs keep separate back stacks, is a statechart: orthogonal regions with history states (Figure 13).
Anatomy of a hyperedge#
A hyperedge has an identifier, a family, the scope that declares it, attributes, and a set of incidences. An incidence is : the hyperedge, the participant, the role and a position. For a connection the participant is a port; for an assertion it may be any element. The position orders participants within one role, where order matters: the fallback order of a Bind selector, or the order in which interceptors see a call. Otherwise it is zero. In the 140 published design graphs, 542 of 648 relations are binary, 88 ternary and 18 have four participants. The 16% that are not binary include sessions with interceptors, fan-out channels, joins and grants. Encoded as binary edges they would lose their identity and their roles (Figure 3).
Typing rules#
The judgments of Section 6.5 are generated by a few rules. Figure 9 gives the core ones. Here is the type of port , the multiplicity of role , polarity, and the requirement of hyperedge . (Inc) types one incidence. (Conn) types a connection: roles within their multiplicities, every offer compatible with every requirement, and a requirement that is the join of its ports’ requirements. (Sess) adds the global type. (Exp) types the leg of an open graph, and (Real) says when a binding may carry a connection.
Figure 9. Core typing rules for incidences, connections, sessions, exports and realizations. Here and are the offering and requiring ports of , the boundary ports of scope , and the projection of the global type onto role .
A typed example#
In the chat scope of Listing 7, the timeline is a Channel hyperedge with one producer incidence (the actor’s timeline port) and two consumer incidences (the two surfaces’ events ports). Its requirement is the join of theirs: fan-out, latest value, at least once, ordered per room. A Durable Object’s hibernatable WebSockets meet that requirement, while a competing-consumer queue does not, because it delivers each message to one consumer. The call to MessagingApi is a Session with a client, a server and one interceptor at position 0. (Sess) checks the three local types against the call’s global type, and (Real) admits a service binding that carries the deadline and the idempotency key.
Services#
A Service of the current runtime becomes a Component whose Session server ports are its operations, typed by one Contract. The client’s port references the same contract fingerprint, so client and server cannot drift. The HTTP method and route, a Cloudflare service binding or a Durable Object stub are attributes of the binding chosen at placement, derived from the contract rather than written twice. A worker’s graph and a phone’s graph are no longer joined after the fact by matching contract names: both are fibres of one graph, and the operation that crosses between them is one hyperedge.
Networking#
Networking needs no family of its own. A service binding, an HTTP route, a WebSocket or a database connection is a connection in the deployment layer, between ports of Places and Resources, with the network’s latency, bandwidth and trust as attributes. The definition-layer connection that uses it is related to it by Realizes. Condition (A2) below is the check that such a realization exists and is qualified.
6.4 Effects, labels, tenancy and time#
Four further rules came from mapping a production platform onto the signature (Section 20.2). None adds a kind or a family.
Effects#
The signature fixes one effect lattice: An operation’s effect is the join of the effects in its declared Access and Session footprint, never something inferred from its name. Effect ceilings (W10), and the effect class above which a plan needs approval (Figure 15), are stated in this lattice. It replaces the separate effect vocabularies that tools otherwise invent.
Labels#
A Grant says who may act; it does not say where data may flow. RG therefore adds a label facet on dataset fields, contracts, channels and observations [91, 259]. Labels are drawn from a lattice of confidentiality levels (public internal personal sensitive secret), refined by purpose tags such as model use or analytics.
Propagation. Labels propagate along connections and Derives by a monotone traversal, so derived data inherits the strictest label of its inputs.
Declassification. A declassifier is a component holding a grant to lower a label for a stated purpose. It is the only legal way across.
Checking. Rule W11 checks statically known paths, and executors check the rest at run time.
Privacy rules, restrictions on model use and the containment of untrusted input to agents thereby become one mechanism. Figure 10 shows both orders.
Figure 10. The two orders that every operation and datum carries (Section 6.4), each with an example per level. An operation’s effect is the join of its footprint; a datum’s label is the join of its sources, refined by purpose tags such as model use or analytics.
Tenancy#
A multi-tenant store, place or activation carries a tenant partition facet. Rule A6 makes isolation a checked property of the graph rather than a convention of each query.
Time#
Time is a capability of a place. A schedule is a derived kind of Component: a Channel producer that binds the clock capability of its place, so the channel stays in the definition layer. It has calendar semantics (a cron or recurrence rule and a time zone), a misfire policy (skip, fire once, or catch up) and jitter. Durable timers inside durable transitions are its other form. Scheduled work is therefore a connection in the graph rather than a synthetic request. Listing 1 declares all four in one scope.
val Ledger = scope("ledger", owner = Source, tenancy = PerTenant) {
val bank = require(Session.call<BankApi>())
val db = store("ledger-db", Transactional) {
dataset<Entry>("entries") {
key(Entry::id)
label(Entry::counterparty, Personal)
label(Entry::memo, Sensitive, purpose = Audit)
invariant("balanced") { groupBy(Entry::transferId).sum(Entry::amount) eq 0 }
retention(years = 8)
}
}
val nightly = schedule("reconcile", cron = "0 2 * * *", zone = UTC, misfire = CatchUp)
component("reconciler", ::Reconciler, profile = Durable, ceiling = ReversibleProductionWrite) {
consumes(nightly); reads(db["entries"]); calls(bank)
}
grant(to = role("finance"), on = db["entries"], actions = setOf(Read), rate = perMinute(120))
}
Listing 1.
Labels, invariants, tenancy, schedules and quotas in one scope (proposed API).
6.5 Well-formedness#
Well-formedness has a static part, which every revision must satisfy, and an activation part, which depends on placement.
Static ()#
Forest. is total, and is acyclic.
Kinding. is a morphism; every node has the ports its kind requires, or a typed hole in their place [271].
Roles. For each hyperedge of family and each , the number of incidences of in role lies in .
Nets. A port is incident to at most one connection, in the family and role fixed by its kind. A port is a pin, a connection is a net, and fan-out is expressed by the net, not by the pin.
Contracts. In every data-carrying connection, each offered contract is compatible with each required one, , and the session participants’ local types are projections of one well-formed global type; an interceptor’s local type is fixed by the two roles it sits between. The outcome type of every Session whose effect is above read-only includes UNKNOWN.
Layers. Connections are intra-layer; each assertion role is filled from its declared layers.
Boundaries. Every participant of a hyperedge declared in scope lies in the subtree of , except through boundary ports related by Export.
Cycles where they matter. Eager Bind edges are acyclic; a cycle of pure value dependencies needs a declared delay; other cycles (loops, recursion, feedback) are legal.
Ownership. A port is consumed by exactly one participant, and a incidence stays within its owner’s scope.
Effect ceiling. A scope’s Access footprint and outgoing sessions are within its declared ceiling. This bound is what a pushed bundle may touch.
Flow. A connection carries values only to ports whose clearance dominates the values’ labels, unless a declassifier on the path holds a grant for that purpose (Section 6.4).
Activation (, for a placement )#
Locality. Every Bind joins ports of components in one process: on the same place, or on runtime places nested in the process and joined by an FFI trunk.
Realizability. Every connection has a binding whose guarantees meet the hyperedge’s requirement and that refines the family protocol on the runtimes involved. A synchronous session in a browser cannot be silently realized as asynchronous RPC.
Availability. Every capability port, a port whose provider must be an offer of the component’s place, is offered by that place at or above its required support (Section 6.6).
Closure. There are no typed holes, and every required port is bound.
Authority. Every effectful connection is covered by a Grant. The default is deny, and reads count as effects. A grant to approve a proposal never covers the proposal’s author.
Tenancy. Every Access to a multi-tenant dataset carries the activation’s tenant, and every flow across tenants is covered by an explicit Grant.
These are the judgments of the stable-foundations audit (, ) with their content made explicit [295]. A draft may violate (W2) and (A4) and still be saved, shown and analysed, but it cannot be activated.
6.6 Support lattices and resolution#
The design corpus contains four ordered vocabularies that answer the same question: can this offer meet this requirement, and how well? They are capability tiers (unavailable, fallback, basic, standard, full); data bindings (unsupported, emulated by a reviewed plan, supported); renderer support; and FFI schema matching (incompatible, keyed compatibility, positional). RG treats them uniformly.
Definition 6 (Support). A support lattice is a finite bounded lattice. Requirements and offers are related by a support function that is monotone in the offer and antitone in the requirement. A requirement carries a threshold . The eligible offers are , and resolution picks a -maximal element of , breaking ties by preference.
and its dual, the set of requirements that every offer in a set meets, form a Galois connection between sets of offers and sets of requirements [137]. The resulting closure is what placement computes: the largest set of places that satisfies every hard requirement. Preferences such as cost, latency or energy rank only within that set, so “no silent downgrade” becomes a property of the threshold rather than a review comment. The support of a composite is the meet of its parts’ supports, which makes eligibility monotone and computable by the traversals of Section 8. Authority is not a support level. Availability says what a place can do; a Grant says who may ask it to.