mirror of
https://github.com/gorules/zen.git
synced 2026-11-28 08:06:20 +00:00
feat/engine-version
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e3d32a210d |
feat: trace format lane (#573)
* feat(trace): trace format v1 with TraceCollector on the compiled engine Adds trace format v1 to the compiled engine, recorded by explicit trace recorders and written natively. The interpreted engine keeps the legacy trace. - EvaluationOptions.trace is a TraceFormat (off, v1, legacy). Legacy traces are produced directly from the same recording. - zen_engine::trace exposes convert, restore and inspect for stored documents, with redaction and truncation markers. - The trace header takes evaluatedAt, timezone and seed from the evaluation context, so an evaluation replays from its own trace. - Batch and columnar evaluations record events as columns and write one document per row. - Bindings accept the trace format (true, 'v1', 'legacy'); the Node binding ships TypeScript types for the v1 document. - Golden, fixture and damaged-document tests cover byte identity with the legacy trace, restore, interop with the reference fixtures and malformed input. * perf(trace): build columnar request rows once with precomputed paths * perf(trace): write a node's edits from its written columns * perf(trace): capture node columns instead of row values in the columnar plan * perf(trace): reuse a node's rendered body for rows with the same rule and cell values * perf(trace): size the batch trace buffer up front, key node bodies on typed column words, share request rows as the input * perf(trace): read the request from input columns and build request rows only on demand * perf(trace): key node bodies on per-column codes and precompute node heads and result labels * perf(trace): keep first-hit table facts and their referenced fields as columns * perf(trace): write per-row expression results in the batch writer * perf(columnar): write result rows as JSON straight from output columns * perf(trace): keep collect-policy rule hits as columns and reuse hit text * perf(trace): pack loop results from columns and resolve result column accessors once per batch * perf(trace): share row-wise node outputs with the trace when nothing can alias them * perf(trace): pack lists without a string per distinct item * perf(trace): write new lists from columns and decide references by where a list came from * perf(trace): write wide list items from columns while the list has never been built * perf(trace): read list cells once while rendering * feat(trace): list table inputs once per node and key rule cells by column id * feat(trace): name matched policy table rows by rule id * feat(trace): store loop results as one column per key * build: optimise test builds |
||
|
|
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 |