Files
zen/core/engine/tests/data/compiled/objects.json
T
stefan-gorules 9550b33429 feat: lane compiled engine (#555)
* 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

* refactor(engine): isolate compiled engine from release node and graph code

Release code outside core/engine/src/compiled is restored to release/2.2.
The compiled engine keeps its own copy of the node, graph and JS function
implementation under compiled/host and reaches release only through types
and pure helpers. Release files gain only additive hooks: the
ZEN_CONFIG.compiled runtime flag (off by default), per-instance
interpreted()/compiled_engine() on Decision, DecisionEngine and
PolicyWorkspace, and the batch and columnar entry points.

- the driver feature and the modified old engine are removed; tests compare
  the compiled engine against the unmodified release engine
- compiled-only behaviour (#7 empty collect columns, #16 collect order,
  BC1 thrown-object message) is allowlisted in the comparisons
- #14 (policy whitespace cells) is dropped: release analysis rejects it
- goldens re-recorded from the release engine
- spec 42 nested-chain case lowered to depth 200: the release engine's JS
  conversion overflows a 2 MB debug thread at depth 500

* fix(engine): keep interpreted engines interpreted and tighten engine comparisons

- DecisionEngine::interpreted() now holds while ZEN_CONFIG.compiled is on:
  decisions it creates (get_decision, create_decision, evaluation) carry its
  engine, and its release path runs in an interpreting scope so the
  Workspace built by the lazy policy path stays interpreted too
- policy batches (DecisionEngine and PolicyWorkspace) deep-copy their inputs
  like graph batches, so callers' contexts are no longer written into
- release test files run on the release engine again: the compiled-by-default
  ctor moved out of tests/support into tests/compiled_default, included only
  by the compiled test suites
- spec `engines` notes are structured ({modes, intended, why}); unlisted modes
  are still compared with the reference, intended modes are checked against
  the spec, and open differences fail once they match the reference again.
  Stale notes found this way were removed; golden skips are per mode, and
  generated rows no longer inherit the first case's note

* fix(engine): platform-independent spec suite ids and rustfmt

- spec suite file paths are joined with '/', so suite ids and golden keys
  match on Windows (backslash paths missed every recorded golden)
- engine spec json5 files are checked out with LF line endings
- cargo fmt
2026-11-03 17:25:56 +01:00

226 lines
3.2 KiB
JSON

{
"nodes": [
{
"id": "in",
"type": "inputNode",
"position": {
"x": 0,
"y": 0
},
"name": "Request"
},
{
"id": "e1",
"type": "expressionNode",
"position": {
"x": 0,
"y": 0
},
"name": "Pass",
"content": {
"expressions": [
{
"id": "e1x0",
"key": "profile",
"value": "{ 'name': user.name, 'age': user.age, 'missing': user.none, 'tags': [user.name, 'x'] }"
},
{
"id": "e1x1",
"key": "meta",
"value": "{}"
},
{
"id": "e1x2",
"key": "nested",
"value": "{ 'a': { 'b': user.age * 2, 'c': null }, 'd': 'lit' }"
},
{
"id": "e1x3",
"key": "user",
"value": "{ 'extra': 1, 'age': user.age + 1 }"
}
],
"passThrough": true
}
},
{
"id": "e2",
"type": "expressionNode",
"position": {
"x": 0,
"y": 0
},
"name": "Strict",
"content": {
"expressions": [
{
"id": "e2x0",
"key": "out",
"value": "{ 'n': user.age / user.div, 'flag': user.age > 30 }"
},
{
"id": "e2x1",
"key": "computed",
"value": "{ [user.name]: 1 }"
}
],
"passThrough": false
}
},
{
"id": "e3",
"type": "expressionNode",
"position": {
"x": 0,
"y": 0
},
"name": "Dollar",
"content": {
"expressions": [
{
"id": "e3x0",
"key": "x",
"value": "{ 'a': user.age }"
},
{
"id": "e3x1",
"key": "y",
"value": "$.x.a + 1"
}
],
"passThrough": false
}
},
{
"id": "e4",
"type": "expressionNode",
"position": {
"x": 0,
"y": 0
},
"name": "Down",
"content": {
"expressions": [
{
"id": "e4x0",
"key": "seen",
"value": "profile.name"
},
{
"id": "e4x1",
"key": "deep",
"value": "nested.a.b"
}
],
"passThrough": true
}
},
{
"id": "out",
"type": "outputNode",
"position": {
"x": 0,
"y": 0
},
"name": "Response"
}
],
"edges": [
{
"id": "x0",
"sourceId": "in",
"targetId": "e1",
"type": "edge"
},
{
"id": "x1",
"sourceId": "e1",
"targetId": "e4",
"type": "edge"
},
{
"id": "x2",
"sourceId": "e4",
"targetId": "out",
"type": "edge"
},
{
"id": "x3",
"sourceId": "in",
"targetId": "e2",
"type": "edge"
},
{
"id": "x4",
"sourceId": "e2",
"targetId": "out",
"type": "edge"
},
{
"id": "x5",
"sourceId": "in",
"targetId": "e3",
"type": "edge"
},
{
"id": "x6",
"sourceId": "e3",
"targetId": "out",
"type": "edge"
}
],
"tests": [
{
"input": {
"user": {
"name": "ann",
"age": 40,
"div": 2
},
"profile": {
"keep": 1,
"name": "old"
},
"nested": "text"
}
},
{
"input": {
"user": {
"name": "bob",
"age": 20,
"div": 0
}
}
},
{
"input": {
"user": {
"name": null,
"age": null
}
}
},
{
"input": {
"user": "str"
}
},
{
"input": {}
},
{
"input": {
"user": {
"name": "cy",
"age": 31,
"div": 3,
"none": 5
},
"meta": {
"k": 1
}
}
}
]
}