Tiering: language contract for multi-tier runtimes#
Tiered DS runtimes, from the language side: what the language guarantees rule authors about cross-tier fact flow, regardless of how many tiers a runtime has or how they are named. The runtime's specific topology (how many tiers, what each is for, how they clock, how they connect) is a runtime concern; see [RARC].
Paired with:
[LFAC] — the lifecycle categories (
logical/ttl) a receiving tier's schema gives a published fact.[LLOG] — truth maintenance within a single tier.
[LDIA] — how per-tier capability differences are expressed through dialects.
[LSTO] — the cache plane, which is each tier's own.
What this is not#
Not a topology spec. The language does not commit to a specific number of tiers, their purposes, clocks, or names. Integrators pick those.
Not a process-model spec. Whether tiers run as separate processes, threads, or in-process modules is a runtime concern.
Not a wire-protocol spec. How tiers communicate physically is integrator-bridged; the engine ships no transport, so the encoding and the wire are the integrator’s.
Not a cross-tier
logical-maintenance spec.
What a tier is [LTIE.1]#
[LTIE.1.1] A tier is a runtime-engine instance with its own working memory, its own clock source, and its own dialect. A DS deployment may have one tier (simplest case, "run as-is" single-engine) or many (integrator-defined topology). The language does not commit to how many.
[LTIE.1.2] Each tier independently:
[LTIE.1.3] Maintains its own working memory.
[LTIE.1.4] Runs its own Rete network against its own rule set (compiled for the tier's dialect).
[LTIE.1.5] Reads its own clock.
[LTIE.1.6] Connects to the adapters relevant to its role, including the storage adapter where it needs one.
[LTIE.1.7] Tiers cooperate through cross-tier fact flow. Everything else is local to one tier, its cache included ([LSTO.4.7.1]).
see also: LSTO.4.7.1
Topology is the integrator's choice [LTIE.2]#
[LTIE.2.7] The language is agnostic to which reason drives a particular topology. Any reason is valid if the resulting tier graph satisfies the contract below.
The upward-only rule [LTIE.3]#
[LTIE.3.1] Facts flow upward through tier boundaries; they never flow downward.
checks: alloy×3
[LTIE.3.2] The tier graph is a directed acyclic graph of tiers, with edges pointing from a lower tier to a higher tier. Facts produced in a lower tier may be published to a higher tier. Facts produced in a higher tier may not be published to a lower tier.
checks: alloy×2
[LTIE.3.3] Upward-only keeps the cross-tier fact graph acyclic, and each tier's behaviour locally comprehensible.
[LTIE.3.4] Higher-tier decisions affect lower-tier behaviour only through control-plane calls — not through facts. See [LTIE.4] below.
see also: LTIE.4
[LTIE.3.5] The compiler does not enforce [LTIE.3.2]'s acyclicity. A
compile takes one tier's program, and its cycle check runs within that tier
([LCYC.6.3]), so a cycle that closes across a tier boundary through publish
edges is not detected. The integrator wires tiers together ([NCBK.10.1]), and
the integrator must keep the tier graph acyclic.
emit vs publish [LTIE.4]#
[LTIE.4.1] Two assertion actions, two scopes:
[LTIE.4.2]
emit X— assert X into the current tier's working memory. The fact is visible to rules in this tier only. Same-tier assertion.
[LTIE.4.3]
publish X— send X to every tier connected upstream from here. The engine asserts nothing in the current tier's working memory, so no rule on this tier matches what this tier publishes. A rule that wants both writesemit Xandpublish X.
ratified
[LTIE.4.4] The choice between emit and publish is the
author's, and neither mistake has a silent runtime
fallback: an emit that should have been a publish
leaves higher tiers blind to local decisions, and a
publish that should have been an emit pollutes them
with facts they do not need and leaves this tier's rules
without them.
[LTIE.4.5] Semantics of publish for each lifecycle category.
publish on a logical schema [LTIE.4.6]#
[LTIE.4.6.1] The fact is sent to every upstream tier, which asserts it under its own declaration of the schema ([LTIE.9.4]). Upstream tiers treat the incoming fact as if emitted by an adapter: they subject it to the same no-op reassertion discipline (per [LFAC]) and the same retract-on-key-change semantics.
see also: LTIE.9.4
[LTIE.4.6.2] Truth maintenance does not cross a tier boundary. A
published fact reaches another tier as its schema name and slot values,
asserted there ([NCBK.10.1]), so the receiving tier holds it as an assertion
of its own, with no justifier from the publishing tier, and one fact per
identity ([LFAC.1.7]). If two tiers publish a logical fact with the same key
to a third, the third holds one fact; an identical second assert is a no-op
reassertion ([LFAC.2.5]). A retraction in the publishing tier reaches the
receiving tier only if the integrator carries it, and [NCBK.10.1]'s bridge does
not. An author needing tier-wide truth maintenance structures rules so that
exactly one tier publishes a given fact.
publish on a ttl schema [LTIE.4.7]#
[LTIE.4.7.1] The fact is sent to every upstream tier, which asserts it under its own declaration of the schema ([LTIE.9.4]). No cross-tier coalescence is needed or claimed — TTL facts accumulate anyway, so multiple publishers producing overlapping facts is the expected case.
see also: LTIE.9.4
[LTIE.4.8] What a publish judges. The engine must judge a publish's values
as it judges an emit's: it fills ts first ([LFAC.9.2]), a fault in a slot value
abandons the activation ([LERR.1]), a value its slot does not admit raises a
TypeError ([RARC.5.2.7]), and a String longer than its slot's capacity is
refused ([LSTR.11.3]). A publish the engine refuses sends nothing. No bound on
working memory or a series applies to a publish, and it has no deadline.
ratified — see also: LERR.1, LFAC.9.2, LSTR.11.3, RARC.5.2.7
[LTIE.4.9] A publish takes no lifetime. The compiler must refuse the logical
keyword and a retain: kwarg on a publish with DS_VALIDATE_PUBLISH_MODIFIER. A
published fact's lifetime is the receiving schema's ([LTIE.9.4]).
ratified — see also: LTIE.9.4
Downward influence [LTIE.5]#
[LTIE.5.1] When a higher-tier decision needs to affect lower-tier behaviour, the mechanism is a control-plane call, not a fact the higher tier sends down.
[LTIE.5.2] Cache plane. Each tier's engine owns its own cache ([LSTO.4.7.1]); no tier reads another's.
see also: LSTO.4.7.1
[LTIE.5.3] Calls. If a tier's rules invoke a service (adapter-backed or integrator-registered), the call is dispatched through the runtime's tier-bridged call path. Call responses follow the normal async fact-plane contract.
[LTIE.5.4] A call introduces no cross-tier fact edge. The higher tier's call reaches integrator code, and what that code asserts into a lower engine is that engine's recorded input ([NFCT.2.3]), not a fact the higher tier emitted. The fact graph stays acyclic.
checks: alloy — see also: NFCT.2.3
Per-tier capability differences [LTIE.6]#
[LTIE.6.1] Different tiers often have different capability constraints — a fast-local tier may not permit blocking call / response, a slower tier may. The language expresses these differences through dialects (see [LDIA]).
[LTIE.6.2] Each tier runs a dialect that enables the forms the tier's runtime can handle. Rules compiled against the wrong dialect for their tier are compile errors — authors see the mismatch at build time, not at runtime.
[LTIE.6.3] The language does not commit to specific dialect names or specific tier-to-dialect mappings. Integrators register dialects for their topology; the language validates rule files against the declared dialect.
Adapter binding to tiers [LTIE.7]#
[LTIE.7.1] Adapters connect to specific tiers. The tier an
adapter connects to is the tier whose rules see
the adapter's emitted facts natively. Rules at
other tiers see those facts only if a rule at the
adapter's tier publishes them upstream.
[LTIE.7.2] Integrators choose per-adapter where to connect. Typical patterns:
[LTIE.7.3] Adapters reading frequent, local, latency- sensitive events connect at the lowest applicable tier.
[LTIE.7.4] Adapters serving cross-site or high-level orchestration connect at a higher tier.
[LTIE.7.5] Storage adapters connect wherever their consumers live; typically the highest tier that needs direct storage access.
[LTIE.7.6] The language commits to the contract (adapters
belong to one tier; facts cross boundaries only
via publish); the topology choice is the
integrator's.
Language scope vs runtime scope [LTIE.8]#
The language commits to [LTIE.8.1]#
[LTIE.8.1.1] Tiers may exist, numbering not spec-committed.
[LTIE.8.1.2] Cross-tier fact flow is upward-only through
publish.
[LTIE.8.1.3] Same-tier assertion uses
emit; cross-tier usespublish; both are explicit at the rule level.
[LTIE.8.1.4] Cross-tier flow preserves
logical/ttllifecycle categories.
[LTIE.8.1.5] Cross-tier logical facts do not coalesce across publishers; truth maintenance is per-tier ([LTIE.9.5]).
see also: LTIE.9.5
[LTIE.8.1.7] Each tier's cache is its own ([LTIE.5.2]); downward influence is not through facts.
see also: LTIE.5.2
[LTIE.8.1.8] Per-tier capability differences are expressed through dialects.
The runtime owns [LTIE.8.2]#
[LTIE.8.2.1] Topology. How many tiers exist, what each is for, how they clock, how they connect.
[LTIE.8.2.2] Tier-to-dialect mapping. Which dialect runs on which tier.
[LTIE.8.2.3] Wire protocol. How
publishpackets cross tier boundaries physically.
[LTIE.8.2.4] Adapter binding. Which tier each adapter connects to.
[LTIE.8.2.5] Tier lifecycle. Startup order, failure handling, reconnect behaviour.
Tiering commitments [LTIE.9]#
[LTIE.9.1] Language is tier-count-agnostic. One tier or many, the contract is the same.
[LTIE.9.2] Upward-only fact flow. The fact graph is a DAG of tiers; downward influence uses calls, never facts.
ratified
[LTIE.9.3]
publishis explicit. Cross-tier assertion requirespublish;emitstays intra-tier.
[LTIE.9.4] Lifecycle comes from the receiving tier. A published fact crosses a tier boundary as its schema name and slot values ([NCBK.10.1]). The receiving tier asserts it under its own declaration of that schema, so its lifecycle category and any TTL are the receiving schema's, the TTL counted from that assert.
ratified — see also: NCBK.10.1
[LTIE.9.5] Cross-tier logical facts are uncoalesced. Truth maintenance is per-tier: the receiving tier holds a published fact as an assertion of its own, one fact per identity, with no justifier from the publishing tier. An author needing tier-wide truth maintenance structures rules so that exactly one tier publishes a given logical fact. Restates [LTIE.4.6.2].
ratified — see also: LTIE.4.6.2
[LTIE.9.6] Cycle detection is per-tier.
publishedges between tiers are not part of the compile-time cycle check, and the integrator keeps the tier graph acyclic. Restates [LTIE.3.5].
see also: LTIE.3.5
[LTIE.9.7] A tier's cache is its own ([LTIE.5.2]). Not a fact path, and not a path between tiers. See [LSTO].
see also: LTIE.5.2
[LTIE.9.8] Per-tier capabilities are expressed through dialects. See [LDIA]. Restates [LTIE.6.1].
ratified — see also: LTIE.6.1