Files
zen/core/engine/src/compiled/exact/mod.rs
T
Stefan 8a82650fff feat(engine): compiled engine for columnar graphs and policies
New engine for decisions and policies built on the lane VM: a compiled
graph plan that evaluates batches column-wise (typed kernels where
expressions allow, lane programs otherwise), a row runner for batch and
single-row evaluation, and a compiled policy runtime with a columnar pass.

- Decision::evaluate_columns / Workspace::evaluate_columns return one
  ColumnarOutput type; diagnostics live in zen_engine::diagnostics
- rows the plan cannot finish are deferred to the row runner and never
  re-run nodes; sub-decisions run inside the parent plan; date input
  schemas stay on the plan
- DecisionEngine keeps compiled graphs, sub-decisions and policies per key
  while the loader returns the same content
- failed $dictionary imports are retried, not cached
- the old engine stays available behind the driver feature for
  comparisons; there is no fallback to it
- benchmark harness (tests/bench_matrix.rs) comparing old and new across
  the spec corpus, fixtures and policies
2026-11-02 15:27:19 +01:00

52 lines
1.2 KiB
Rust

pub(crate) mod graph;
pub(super) mod policy;
mod table;
pub(crate) use table::RowTable;
use zen_expression::Variable;
pub(crate) struct Failure;
impl Failure {
pub const EXPRESSION: &'static str = "Failed to evaluate expression";
pub fn expression(source: &str) -> String {
format!(r#"{}: "{source}""#, Self::EXPRESSION)
}
pub fn input(error: impl std::fmt::Display) -> String {
format!("{}: {error}", Self::EXPRESSION)
}
}
pub(crate) struct Attributes;
impl Attributes {
pub fn item(pass_through: bool, item: &Variable, output: Variable) -> Variable {
match pass_through {
true => item.clone().merge_clone(&output),
false => output,
}
}
pub fn finish(
output_path: Option<&str>,
pass_through: bool,
input: &Variable,
output: Variable,
) -> Variable {
let output = match output_path {
Some(path) => {
let wrapped = Variable::empty_object();
wrapped.dot_insert(path, output);
wrapped
}
None => output,
};
match pass_through {
true => input.clone().merge_clone(&output),
false => output,
}
}
}