FluxGraph Semantics Specification
Status: Baseline semantics specification
Version: 0.1.0
Last Updated: March 1, 2026
1. Scope and Authority
This document is the normative semantic contract for FluxGraph runtime behavior.
- If this document conflicts with README, architecture notes, examples, or API docs, this document is authoritative.
- All public claims about execution behavior must be derivable from this document.
- Any semantic change requires an update to this document before merge.
2. Evaluated Execution Models and Selection
Option A: Snapshot Staged Semantics
Definition: every edge reads from a fixed pre-tick snapshot and writes to next-state storage; no within-tick graph propagation.
Pros:
- Very simple reasoning model.
- Strong isolation between read and write phases.
Cons:
- Hidden one-tick latency across edge chains.
- Topological ordering has reduced semantic impact.
- Difficult to align with user expectation for DAG dataflow.
Option B: Immediate Topological Propagation Semantics
Definition: edges execute in deterministic topological order and read latest visible values; upstream edge writes are visible to downstream edges in the same tick.
Pros:
- Natural DAG signal-flow semantics.
- Explicit delays are the only source of temporal delay.
- Better alignment with scientific communication for causal graphs.
Cons:
- Requires stricter compiler/runtime contracts (cycle policy, writer policy, deterministic ordering).
Selected Model (Normative)
FluxGraph adopts Immediate Topological Propagation Semantics.
3. Time and Tick Model
We define a discrete tick index k with tick boundaries t_k.
dt_k > 0is required for every tick.- The state visible to application and providers before
tick(k)isS_k. tick(k)computesS_{k+1}and command setC_{k+1}.- No concurrent tick execution is permitted.
- For publication-grade reproducibility, runs are expected to use constant
dtunless explicitly documented otherwise.
4. Normative Tick Ordering
Each tick(dt, store) executes in this order:
- Input Boundary Freeze
- Provider/application writes completed before tick begin are considered part of
S_k.
- Provider/application writes completed before tick begin are considered part of
- Model Update Stage
- Models advance internal state by
dtand write model outputs into store.
- Models advance internal state by
- Edge Propagation Stage
- Edges execute in deterministic topological order.
- Edge output writes are immediately visible to downstream edges in the same stage.
- Rule Evaluation Stage
- Rules evaluate against post-model/post-edge state (
S_{k+1}). - Matching rules emit commands for external execution.
- Rules evaluate against post-model/post-edge state (
- Tick Commit
S_{k+1}andC_{k+1}become externally visible.
Determinism requirements:
- Topological ordering tie-break must be stable and deterministic.
- Command ordering must be deterministic for identical inputs and configuration.
5. Cycle and Algebraic Loop Policy
- The directed graph induced by all non-delay edges must be acyclic.
- A cycle is only legal if every feedback loop is broken by at least one explicit delay element.
- Compile-time cycle diagnostics must identify at least one concrete loop path.
- Cycles without explicit delay are compile-time errors.
6. Delay Semantics
Delay behavior is explicit and never implicit.
- Delay transform parameter
delay_secmaps to integer ticks by:N = max(1, round(delay_sec / dt_ref))
dt_refis the runtime tick period used for model execution in the deployment profile.- Delay output at tick
kis input value from tickk-N. - Initial delay buffer fill value is
0.0unless an explicit initializer is introduced in a future spec revision. - If runtime
dtdeviates fromdt_refbeyond tolerance, runtime must reject execution or reinitialize delay buffers according to documented policy.
7. Signal Ownership and Write Authority
Each signal has exactly one owning writer class per tick:
- Model-owned (physics-owned): writable by model stage only.
- Edge-owned (derived): writable by edge stage only.
- External-owned (provider/application input): writable by external update path only.
Rules:
- Multi-writer targets are compile-time errors.
- External writes to model-owned or edge-owned signals are runtime errors.
- Engine internal stages must not overwrite signals owned by different stages.
8. Unit Semantics
Unit handling policy is strict and deterministic.
- Every signal has declared unit metadata (
"dimensionless"allowed). - Writes must match declared unit policy exactly unless explicit conversion rules are defined.
- Load/compile must reject incompatible unit contracts where inferable from graph specification.
- Runtime unit mismatch is a hard error (not silent coercion).
- Claims of dimensional analysis are only valid when compile/load/runtime unit contracts are all enforced.
9. Timestep and Stability Policy
dt <= min(model_stability_limit)is required unless a model explicitly documents unconditional stability.- Stability validation must run in active compile/load path for target runtime
dt. - Server CLI
--dtmust be wired into runtime tick behavior and stability checks. - Violations are hard failures (load rejection), not warnings.
10. Non-goals in This Spec Version
- Parallel edge execution semantics.
- Adaptive timestep controller semantics.
- Implicit solver algebraic-loop handling.
- Automatic unit conversion ontology.
11. Conformance Snapshot (March 1, 2026)
This section records current implementation alignment against the normative contract.
- Engine stage order now executes models before edges with immediate topological propagation: conformant with Section 4 baseline.
- Rule conditions now support comparator expressions (
<,<=,>,>=,==,!=) over scalar signal paths: partial for Section 4 (minimum subset implemented). - Stability validation is active in server load/compile path and enforced at runtime in
Engine::tick: conformant with Section 9 baseline. - Server CLI
--dtis wired into service runtime timestep and compile-time stability validation: conformant with Section 9. - External writes to protected model-owned and derived target signals are rejected in server update flow: conformant with Section 7 for server path.
- Unit checks enforce declared/first-write consistency and runtime mismatches throw: partial for Section 8 (compile-time inferential checks remain limited).
- Delay-mediated cycle acceptance is implemented via non-delay subgraph cycle policy: partial pending deeper delay-buffer semantics validation in complex mixed-order graphs.
Remaining gaps define follow-up hardening and expanded evidence work.