Repository navigation
v5.8.0 #83
v5.8.0
#83
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Added
Engine::operators()describes every built-in operator compiledinto the build: canonical name and aliases, family and gating feature,
the argument counts it reads (declared on every row whose body does not
take any count, so
==reports 2 or more andmapexactly 2), whetherit reads the data context, its effect
(
pure,clock,throws,catches), its cost class, and whichargument (if any) runs under a pushed frame (
ScopedArg). It is readfrom the same table that drives compilation and dispatch, so it cannot
drift from what the engine does. New public types:
OperatorInfo,ScopedArg(both#[non_exhaustive]).Logic::facts()reports what a compiled rule reads, whichoperators it uses, and whether its result is a function of its data,
from one walk over the compiled tree.
reads()lists the data pathsread from the root as
DataPathsegment lists (sorted, with any path ashorter one covers dropped); reads inside iterator bodies and
trycatch arms resolve against the element or the error and are left out,
while a level marker that climbs back to the root is kept.
has_computed_reads()flags a path only known at runtime, andreads_complete()says whetherreads()is everything the rule canread (no computed path, no custom operator).
operators()listscanonical built-in names, matching
Engine::operators();custom_operators()the custom ones;is_deterministic()is false fornowand any custom operator. The facts describe the rule after theoptimizer, so a folded branch is neither read nor listed. A generated
test checks every suite case: evaluating against data pruned to the
reported reads gives the same outcome. New public types:
Facts,DataPath.Rootsevaluates several values as the fields of one top-levelobject without building it:
Roots::from([("data", &payload), ("metadata", &metadata)])reads as{"data": .., "metadata": ..}.Each root is borrowed and viewed in place like a single input of its
type (
&serde_json::Value,&OwnedDataValue,&ParsedData,&DataValue, mixed freely), so a host no longer copies its parts intoa combined value per evaluation. Accepted by every entry point that
takes input, by reference or by value. Against a per-evaluation
json!merge it measured 7 to 10 times faster for payloads of 4 to1,024 fields. A generated test splits every suite case's data into
roots and checks the outcome is unchanged. New public types:
Roots,RootValue.Engine::truthy_ofapplies the engine's configured truthiness toa value the host already holds:
&serde_json::Value,&OwnedDataValue,&ParsedDataor&DataValue(sealedTruthyInput). Hand-written checks on an evaluated result tend todiffer from the engine: under the default rules an empty object is
falsy, like an empty array, and a configured
TruthyEvaluatorapplies.Tested against the engine's own
!!for every representation andevaluator.
Engine::checkreports every problem the engine can see in a rulebefore it runs, in one pass, as
Diagnostics (aDiagnosticCode, aSeverity, a message and an RFC 6901 JSON Pointer into the rule). Errorsare what will fail: an object with several keys outside templating
mode, an unknown operator (with a "did you mean" suggestion one edit
away),
and/or/ifwithout an argument array, an argument countthe operator rejects (read from the operator table, or from a custom
operator's declared
CustomOperatorInfo), and a literal timezone thatdoes not exist. Warnings run but are probably mistakes: arguments an
operator never evaluates, and in a template an output key one edit away
from an operator name.
CheckModechecks in the engine's mode, strictlyor as a template.
Engine::compile_checkedcompiles only a rule withno error diagnostic and otherwise returns a
CompileErrorlisting themall. A generated test checks that
compilefails exactly whencheckreports a compile-level problem. Run over the 525 rules stored in Orion
and dataflow-rs, it reports nothing in the mode they are compiled in. New
public types:
CheckMode,Diagnostic,DiagnosticCode,Severity,CompileError.EvaluationConfig::missing_varchooses what avar/valread thatfinds nothing evaluates to:
MissingVar::Null(the default, JSONLogic'srule) or
MissingVar::Error, which raisesVariableNotFoundnaming thepath, so a typo in a path fails instead of flowing on as
null. Adefault (
{"var": ["x", 0]}), a presentnull,missing,missing_some,existsand iteration metadata are not misses, andtrycatches the error. The iterator fast paths that read fieldsinline step aside in error mode so every read raises the same way. Also
settable from the bindings' JSON config as
"missing_var": "error". Newpublic type:
MissingVar.SharedSession, aSessionthat holds its engine byArc, so itis
'static + Send: it can be a struct field, move to another thread orlive across an
.awaitwithout borrowing the engine(
SharedSession::new(Arc<Engine>)orFrom<Arc<Engine>>). It isSession<'static, Arc<Engine>>:Sessiongained a defaulted typeparameter for how it holds the engine, so
Session<'_>still names theborrowed form and both have the same methods.
Session::engine()returnsthe engine either way. A host that kept a thread-local arena because a
session borrowed the engine can keep a session per worker instead.
Error::code()returns anErrorCode, the error's kind without itspayload: one variant per
ErrorKindvariant,Copy,Eq,Hash,present in every build.
ErrorCode::as_str()is the nameError::tag()has always returned (
tag()is now defined through it), it parses backwith
FromStr, andErrorCode::ALLlists every code, so a host canswitch on the kind instead of comparing tag strings.
ErrorKind::code()gives the same for a bare kind. New public types:
ErrorCode,UnknownErrorCode.EngineBuilder::try_add_operatorrefuses a name that a built-inoperator of the build answers to (aliases included), where the custom
operator would never run, with a
ConfigurationErrornaming thebuilt-in.
add_operatoris unchanged.EngineBuilder::check_operator_namegives the same refusal without consuming the builder, which the C ABI's
strict-names registration uses, so it follows the builder's families too.
EngineBuilder::try_buildchecks every nametry_add_operatortook against the builder's final families (
Engine::to_builder()carries them over), and refuses a
max_recursion_depthof 0, asEvaluationConfig::from_json_strdoes;build()is unchanged.Engine::compile_templateandEngine::compile_strictchoosethe templating mode for one compile instead of for the engine. The
engine's custom operators, template key escape and folding setting
still apply, so one engine can check a condition strictly and compile
an output template, where a host used to build an engine per mode and
keep their operator registrations in step. A generated test checks
every suite case: each mode gives the same compiled rule and outcome as
an engine built in that mode.
CustomOperator::checklets a custom operator validate a call'sarguments as written, before anything runs.
Engine::checkandcompile_checkedcall it for each call whose argument count fits theoperator's declaration;
compiledoes not. It returnsDiagnostic::errororDiagnostic::warning, optionally narrowed withat_argument(i), and the checker fills in the JSON Pointer and theoperator name, under the new code
DiagnosticCode::OperatorCheck. Thedefault accepts every call.
Box<dyn CustomOperator>andArc<T>forward it.
EngineBuilder::with_families(..)keeps an engine to the JSONLogic core plus the families it names
(
Family::ExtString,Family::DateTime, ...), whatever this buildcompiled in; by default an engine has every compiled family, as before.
A family left out is not there for that engine: its names compile as
unknown operators (an error at evaluation, or from
compile_checkedand
check), as output fields in templating mode, or as a customoperator registered under that name.
Engine::operators(),builtin_operator_names(),check's suggestions andtry_add_operatorfollow the engine's families. The set applies atcompile time: a rule compiled on another engine keeps its operators.
New public type:
Family(#[non_exhaustive], every family named inevery build, with
Family::ALL,name()andis_compiled()). This isthe 5.x step towards turning the
ext-*features into runtimefamilies in 6.0.
TracedSession::compile(rule)compiles a rulethe way the one-shot trace does (no folding) and records, for every node
id, the RFC 6901 JSON Pointer of the rule value that node was compiled
from.
Logic::pointer(id)andLogic::pointers()read them back, so adebugger places each
ExpressionNodeandExecutionStepin the rule aswritten (
"/if/1","/!"for a lone argument, the key as written for analias such as
?:) instead of re-deriving the compiler's canonical forms.An ordinary compile records none.
Logic::compiled_on(&engine)tells whether that engine instancecompiled the rule (not one built alike or rebuilt from it). Any engine
can still evaluate any rule; in 6.0 a rule evaluates only on its own
engine, so a host can use this to find the places that rely on the
name lookup now.
Engine::to_builder()starts a builder from a running engine: thesame custom operators, config, templating mode, template key escape and
folding setting. Both engines share each operator instance, so a host
that rebuilds on every reload changes only what differs instead of
registering every operator again. The engine now stores its operators
as
Arc<dyn CustomOperator>.CustomOperator::infolets a custom operator declare what theengine may assume about it, as a
CustomOperatorInfo: whether it isdeterministic, whether it reads the data context, and how many arguments
it takes. The default method returns
CustomOperatorInfo::opaque()(nondeterministic, may read the context, any count), so existing
operators are unchanged. A deterministic operator that does not read the
context, called with constant arguments, is evaluated once at compile
time and folded like a built-in.
Logic::facts()trusts the declaration(
is_deterministic(),reads_complete()), and a declared argument countis checked before any argument runs.
Engine::custom_operator_info(name)reads it back.
Box<dyn CustomOperator>andArc<T>forward it.Arc<T>implementsCustomOperator(for anyT: CustomOperator + ?Sized,Arc<dyn CustomOperator>included), soone operator instance and its state can be registered on several
engines, for example on every engine a host builds on hot reload,
without a wrapper type.
all-operatorsfeature enables every operator family. Thebindings and the benchmark now depend on it instead of listing the
families one by one.
docs/src/operators/operators.json, a machine-readable operatorcatalogue rendered from the table and checked by a snapshot test. The
feature table in the operators overview is generated from the same
table, and the React editor's registry test checks its picker entries
and argument counts against the catalogue.
Added (bindings)
The 5.8 API in every binding. WASM, Node, Python, Go, JVM, .NET and
PHP gain the per-compile templating mode (
compileTemplate/compileStrict),compileChecked(failing with error typeCompileErrorand its diagnostics),checkwith a mode, the operatorcatalogue (
operators, the schema ofdocs/src/operators/operators.json),rule facts (
Rule.facts), the engine'struthy, and an option thatrefuses a custom operator named like a built-in (
strictOperatorNamesand its per-language spellings). Errors also carry their node-id
breadcrumb. Python gains
template_key_escape, which the other bindingsalready had.
truthyreads a string as JSON text in every binding(
truthy("[]")isfalse), and no binding reads a metered budget of0as a budget nothing fits in: it is the engine's own budget acrossthe C ABI and refused where the budget can be left out (Python,
JavaScript). .NET takes an escape outside the BMP (
Runeorstring).C ABI v2, minor 1. New entry points:
datalogic_engine_compile_mode,datalogic_engine_compile_checked,datalogic_engine_check,datalogic_engine_operators,datalogic_engine_truthy,datalogic_rule_facts,datalogic_session_evaluate_metered,datalogic_engine_builder_set_template_key_escape,datalogic_engine_builder_set_strict_operator_names,datalogic_error_diagnostics_json,datalogic_error_node_ids_json,datalogic_traced_session_evaluate_modeanddatalogic_abi_minor(). Existing symbols are unchanged, so v2 wrapperskeep working; a wrapper that calls the new ones checks
datalogic_abi_minor() >= 1at load. The mode enum is exported asdatalogic_mode.evaluateInt/evaluateFloatin Node and WASM, the typed-resultnames the other bindings use.
evaluateNumberis deprecated.One JSON wire format per document. The bindings share
crates/datalogic-bind(not published), which defines the traced-run,catalogue, facts and diagnostics JSON and the custom-operator bridge,
replacing four copies of the trace serialiser and the type-name helper.
Operator families in every binding:
families(Node, WASM,Python),
Families(Go),withFamilies(JVM, PHP),WithFamilies(.NET), over the new C entry point
datalogic_engine_builder_set_families(a JSON array of family names).An unknown family name is a
ConfigurationError; five scenarios checkthe option in all eight bindings.
Traced runs carry
pointers. Every binding'sevaluateWithTraceenvelope (
datalogic_bind::traced_json) addspointers, mapping eachnode id to the JSON Pointer of the rule value it was compiled from; the
JVM, .NET and PHP
TracedRunmodels expose it (pointers(),Pointers,$pointers). It is absent when the rule does not compile.schemas/trace.v1.jsonlists it, and two scenarios check it in all eightbindings. Each binding's traced evaluation also takes a compile mode
(
"template"/"strict", or itsCompileMode), asTracedSession::with_modedoes in Rust, so a rule compiled withcompileTemplatecan be traced; a scenario checks it in all eight.A scenario suite every binding runs (
bindings/scenarios/api.json),and a test that keeps PHP's FFI header and the JVM and .NET native
declarations in step with the generated
datalogic.h.Versioned wire schemas (
schemas/*.v1.json, JSON Schema 2020-12)for the traced-run envelope, serialised errors, the operator catalogue,
rule facts and check diagnostics.
datalogic-bind's tests validate realoutput against them and reject unlisted properties, so a format change
is a reviewed schema change.
Fixed (UI)
each trace node to the rule by re-implementing the compiler's canonical
forms (alias folding,
var/valnormalisation, single-argumentunwrapping) and fell back to loose and positional guesses, so a compiler
change could silently attach steps to the wrong node. It now resolves each
node's pointer against the rule it shows and pairs operands by identity;
child-matching.tsand its heuristics are gone, and a step no nodeclaims goes to the nearest placed node whose pointer strictly encloses it.
A trace without pointers, or converted without the rule as written, pairs
operands with children by their expression text, then by position.
switchin the editor works again. The editorcompared the operator's argument limit (3) against the node's cells (a
switchwith one case has four), so "add case" did nothing once thecatalogue gave
switchits real limit, and the context menu andproperties panel hid it. Every add action now asks one check
(
canAddArgument), which lets the case, else-if and path-segment editorsgrow a node past the limit, since they grow one argument rather than
adding one.
@goplasmatic/datalogic-wasm5.4.0devDependency; every build already resolved the package to the WASM built
from this tree. A build-time type check keeps the editor's hand-written
WASM interface in step with the generated typings.
require) starts the WASM engine again; Jest,CJS SSR and older-bundler consumers got an editor without evaluation.
The editor shows a banner when the engine fails to load.
instead of taking keys from the host page and driving every editor on
it.
onChangeround trip in a controlled editor; they reset ~300 ms aftereach edit. Two editors on a page keep their properties-panel labels and
focus to themselves.
overrides no longer restyle other React Flow canvases on the page, and
touch panning gets upstream's
touch-action: noneback.traces no longer slow playback quadratically. Inline
config/customOperatorsobjects no longer make the editor re-check its inputsevery render.
uuid,lucide-reactand@dagrejs/dagreare no longer installed asdependencies (they were always bundled), and
distno longer carriesdangling
sourceMappingURLcomments.Deprecated
CompiledRuleclass and the freeevaluate(logic, data, templating)andevaluateWithTrace(logic, data, templating)functions:build an
Engineand use itscompile,evalStrandevaluateWithTrace.evaluateNumberin Node and WASM: useevaluateFloat. All are removed in 6.0.Changed
compiler records the operator's slot on the engine that compiled the
rule, and dispatch indexes it directly; a rule evaluated on another
engine still finds that engine's operator by name, as before. A rule
calling eight custom operators measured 181 ns per evaluation before and
75 ns after.
ErrorKind::BudgetExceededexists in every build. The variantwas compiled in only with the
budgetfeature, so code outsidedatalogic had to match on
Error::tag() == "BudgetExceeded". It is nowalways present (
ErrorKindis#[non_exhaustive], so this isadditive); only the
budgetfeature raises it.row in
operators/table.rsplus one function. TheOpCodeenum, namelookup, dispatch arms,
builtin_operator_names(), and the constantfolding, CSE and scope classifications are generated from the row or
derived from the facts it declares, replacing six hand-maintained
classifier lists. Fixed-arity operators (the string, object, datetime,
math, tensor and flagd
sem_verfamilies, plus!,!!,in,substr,type,length) are plain typed functions whose argument counting, evaluationand result conversion are generated. Every
InvalidArgumentsmessageis unchanged, all suites pass on every compile path, and the canonical
benchmark is within noise.
!=,!==,switchandmatch. TheReact editor offered
!=and!==as chainable, but the enginecompares only the first two operands and ignores the rest; they are now
two-operand nodes.
switch/matchaccept at most a value, the caselist and a default, as the engine reads. Found by the registry test
against the catalogue's new argument counts.
!/!!always collapse to one operator. The optimizeralready rewrote
!(!x)to!!xand!!(!!x)to!!x; it now alsorewrites
!(!!x)and!!(!x)to!x, except under a custom truthyevaluator (see Fixed). Results are unchanged; a rule with that shape
shows the shorter form in
Logic::to_json()and in traces.problems, a different one may now be reported: a missing argument is
reported before any argument is evaluated, and an error raised while
evaluating a later argument now wins over a coercion error on an
earlier one. Calls that succeed are unaffected.
sortwith a literal key expression is no longer constant-folded.Its key runs per element, like every other iterator body, and is now
classified that way. Results are unchanged; the rule is simply
evaluated at run time.
Fixed
operators read whether an argument is written as a literal: a single
literal array is an error for
+,*,maxandminbut a computedone is summed or scanned;
sortrejects a literalnullsource butreturns
nullfor a computed one; a literalvar/valpath is splitdifferently from a computed one;
switchreads only a literal casetable. Folding turned an expression with no data reads into a literal
first, so
{"+": [{"if": [true, [1, 2], 0]}]}wasNaNon the defaultengine and
3with folding off or in a trace, and{"var": {"cat": ["a", ".b"]}}readathenbinstead of the key"a.b". Those positions are now declared in the operator table(
literal_args) and an expression there keeps its own node; everythinginside it still folds.
Logic::facts()follows: a path computed fromliterals is reported as computed.
sortby a field reads a missing field asnull. With a plain{"var": ..}key, an element without the field sorted before one whosefield is
null; with any other key expression they tied and kept theirinput order. They now tie on both paths.
slicebound is an error whether written or computed.A literal
1.5was silently ignored while a computed one raisedNaN;both raise
NaNnow. Whole floats (2.0) are still indices.missing_someminimum rounds up.2.5means at least 3present, as JSONLogic's
present >= needreads it. A literal minimum wastruncated and a computed one fell back to 1.
These were found by a new reference interpreter in the test suite
(
tests/oracle/), which evaluates rules without any optimization and iscompared with the engine on every suite case and on generated rules.
filterwith a strict comparison againstnullnow sees missingfields.
{"filter": [list, {"===": [{"var": "v"}, null]}]}dropped theitems that have no
vfield (and!==kept them), although a missingfield reads as
nulleverywhere else. Onlyfilter'sfield-against-literal fast path was affected;
all/some/noneand traced evaluation were already right.
maparithmetic stays exact next to an overflowing element. Amapwhose body is+,-or*on a field and a literal, or on twofields, computed the whole array in
f64as soon as one elementoverflowed
i64, rounding exact neighbours past 2^53:{"map": [list, {"+": [{"var": "x"}, {"var": "y"}]}]}turnedi64::MIN + 3intoi64::MIN, and{"-": [{"var": ""}, i64::MAX]}returned
i64::MINfor every element. Each element is now computedexactly as the arithmetic operators compute it. This also affected
reduceover such amapwhen the fold could not be fused (forexample with a non-number initial value).
Partial constant folding of
+and*gives what evaluation gives.The static arguments of a call with dynamic ones were regrouped and
folded together, but integer overflow into
f64,f64rounding andnumeric-string coercion do not regroup:
{"*": [0.1, {"var": "x"}, 10]}was3folded and3.0000000000000004with folding off. Only a leading run of integerliterals that folds exactly is folded now, and only while three or more
arguments remain, since the two-argument forms coerce differently.
Iterator predicates compare as
==,===andindo. Thefilter/all/some/nonefast paths compared integers exactlyunder
===(the operator compares numbers asf64) and compared twostrings byte for byte, without the
datetimefeature's check for twospellings of one instant.
{"filter": [xs, {"===": [{"var": "k"}, 9007199254740992]}]}overk = 9007199254740993returned[]thoughthe bare
===is true, and"2024-01-01T00:00:00Z"did not match"2024-01-01T00:00:00+00:00"inside an iterator. A comparison thatneeds the datetime check now runs on the general path.
Nested
!/!!keep their meaning under a custom truthyevaluator. Folding collapsed
{"!": [{"!": [x]}]}into{"!!": [x]}(and, new in this release, the other nested forms), which assumes a
boolean's truthiness is itself; a
TruthyEvaluator::Customneed notagree. The collapse is skipped under a custom evaluator, as the CSE
pass already was.
A computed timezone fails the same way folded or not. Folding
turned
{"cat": ["Nowhere/", "Zone"]}informat_date/parse_dateinto a literal, which the compile-time zone check rejected with a bare
InvalidArguments; unfolded it wasUnknown timezone: Nowhere/Zone.The zone position is declared
literal_args.Traced
sortby a field records each key. The keys were read on afast path, so the trace showed no step for them.
Error-path pointers escape like trace pointers.
PathStep'sjson_pointerdid not escape/and~in an operator name (/~1/0under
/), and for a rule compiled for tracing it is now that rule'srecorded pointer.
A huge
missing_someminimum stays huge on 32-bit targets. Onwasm32 a minimum past
u32::MAXwrapped to a small one.Logic::to_json()reads back as the rule. A call with one argumentwas written with the argument in place, so an argument that is an
array read back as the argument list (
{"max": [[1, 2]]}became{"max": [1, 2]}), andand/or/if, which take only an array,read back as an error (
{"or": [0]}became{"or": 0}). Both now keepthe array. Literal-shape arguments staying unfolded in this release made
the shapes reachable on the default engine.
A
reducecan no longer build a value deep enough to abort theprocess. A fold that wraps its accumulator each step
(
{"reduce": [xs, [{"var": "accumulator"}], null]}) nested one level peritem, and serialising, comparing or copying the result recursed once per
level: 100,000 items overflowed an 8 MiB stack and aborted with
fatal runtime error: stack overflow, which nocatch_unwindcan stop.The accumulator may now nest at most 1,024 levels (four times what the
parser accepts as input), and passing that is an
InvalidArgumentserror. Accumulators are measured against the previous step's parts and,
for bodies of built-ins, only every few steps, so folds to numbers and
folds that rebuild flat lists cost what they did.
format_datewith an unknown chrono specifier is an error, not apanic. A raw specifier chrono does not know (
"%Q") or a trailing%panicked inside chrono's formatter. It is now
InvalidArguments("Invalid date format").A rule compiled on one engine follows the evaluating engine's
settings. Constant folding evaluates under the compiling engine's
number coercion, NaN and division handling, loose equality and
truthiness, so
{"/": [1.5, 0]}compiled on a default engine kept1.797e308on an engine set to returnnullon division by zero, whilethe same division computed at runtime returned
null; a deadifbranchwas dropped by the compiling engine's truthiness. A rule whose compile
folded something under those settings now keeps its source and is
compiled again on an engine whose settings differ (once per distinct
setting, cached on the rule). Rules evaluated on the engine that
compiled them, or on one with the same settings, are unchanged.
A record with a
datetimeortimestampfield is ordinary data.Any object carrying such a key was taken for the boundary form of a
datetime, so
===and==judged two different records equal by thatfield alone,
inmatched them,distinctdropped all but one, andtypereported"datetime"or"duration". Only the single-key form(
{"datetime": "..."},{"timestamp": "..."}) is a datetime now.Logic::to_jsonwrites valid JSON and keeps dottedvalkeys.Paths,
missing/existspaths, template keys, custom operator namesand
throwtypes holding quotes, backslashes or control characterscame out unescaped (so the trace tree's
expressionstrings broketoo), and
{"val": "a.b"}came back as{"var": "a.b"}, which readsathenb. Such reads are now written in thevalform; other outputis unchanged.
Error::resolve_pathnames avardefault and template fieldsright on a rule not compiled for tracing:
/var/1(was/var/0) and/b(was/1), as a traced compile records them.Error::operatornames the innermost failing operator, customoperators included, and plain and traced runs agree. It was the root
operator unless a deeper site set one, and the traced run always
reported the root. Behaviour change in that field and in the
serialized error's
"operator".fractionalweights past 32 bits no longer overflow.[i64::MAX, 1]returned null and[2^40, 2^40]split differently from[1, 1]inrelease builds (a debug build panicked). Weights clamp to
i32::MAX, asflagd's are 32-bit; weights within 32 bits pick exactly as before.
Tensor constructors refuse more than 2^28 elements.
zeros,full,scatter,rle_expand,one_hotandpadsized a buffer from therule's dimensions with only a
usizeoverflow check, so{"zeros": [[1000000, 1000000], "f64"]}asked for 8 TB and hung oraborted the process. Past 2^28 elements (2 GiB of
f64) they are nowInvalidArguments.Metered counts no longer depend on data types, tracing or
MissingVar. Iterator fast paths now charge what the general pathcharges for the same data, and the double charge when a fused
reduce(map(...))gave up is gone. Behaviour change: counts forfast-path shapes rise to match the general path.
The
reducefast path no longer treatsaccumulator.xas the wholeaccumulator (
{"+": [{"var": "current"}, {"var": "accumulator.x"}]}summed the accumulator itself).
Datetime arithmetic takes any number of operands, in either order:
{"+": [dt, "1d", "1d"]},{"+": ["1d", dt]}and{"-": [dt, "1d", "1d"]}raised NaN.Integers above 2^53 compare, divide and sort exactly in
==(withinteger strings),
===,<and friends,/,%andsort, andvariadic
+/*coerce numeric strings as the binary forms do.Behaviour change: such values are no longer rounded or judged equal.
NanHandling::CoerceToZerosubstitutes 0 as documented instead ofskipping the value:
{"*": [2, "x", 3]}is0, not6.The strings
"NaN","inf","infinity"and overflowing literals nolonger coerce to non-finite numbers. Arithmetic applies NaN handling
to them (it produced
null),==and<raise NaN, andabs,ceiland
floorraiseInvalidArguments.ceil/floorkeep results outside thei64range as floatsinstead of saturating to
i64::MAX/i64::MIN.lower/upperapply context-sensitive Unicode case rules(
"ΟΔΟΣ"→"οδος").typeclassifies strings with the datetime and duration parsers:"password1"is"string"(it was"duration"), and an offset ornaive ISO datetime is
"datetime".Fixed (bindings)
@goplasmatic/datalogic-nodeships itsindex.jsloader andindex.d.tstypings again. 5.1.1 through 5.7.1 published thepackage with only
package.json, the README and the LICENSE, sorequire('@goplasmatic/datalogic-node')failed withMODULE_NOT_FOUND(the per-platform packages were complete). Therelease now hands the generated loader to the publish job, and refuses
to publish the package without it.
export was guarded, so any panic killed the process (and a panic in
evaluateStrAsyncran unguarded on the libuv pool). Every export nowcarries
#[napi(catch_unwind)], and every call into the engine turns apanic into a thrown error (or a rejected promise) with
name/errorType"InternalError".collected.
Engine.Close()(also its finalizer) deleted the callbackhandles that Rules and Sessions from that engine still call, so a later
evaluation crashed the process with
misuse of an invalid Handle. Thehandles now belong to a registry that the Engine, every Rule, Session
and TracedSession keep alive, and the callback state passes through C as
a C-allocated box rather than a Go pointer, as cgo's pointer rules
require.
finalized.
Engine.Dispose()freed the delegates'GCHandles whileRules and Sessions still called them, failing with
operator handle had wrong type. The handles now belong to an objectthat the Engine, every Rule, Session and TracedSession hold.
it gets
DATALOGIC_STATUS_INVALID_ARGinstead of undefined behaviour(memory corruption in Go, JVM, .NET and PHP);
reset/freeon thatsession do nothing, and
allocated_bytesreturns 0.datalogic_engine_builder_buildfail with
DATALOGIC_STATUS_INVALID_ARG(set_config_json,set_families,set_template_key_escape,add_operator); theyreturned OK and did nothing.
binding; keys came back sorted.
allocatedBytesno longer wraps above 4 GiB. Python releasesthe GIL while compiling and checking. A typed-result mismatch on a
datetime or duration reports
got string, notgot object.Buildno longerleaks its native builder, and Go, .NET and JVM
Close/Dispose/close()free a handle exactly once under concurrent calls. JVM handlesnever closed are freed by a shared
Cleaner.custom operators) alive, wrapping a native handle a second time throws
InvalidArgumentExceptioninstead of double-freeing it later(behaviour change), and the native library is found on Windows (the
machine name was matched case-sensitively against
AMD64/ARM64).decodes like the other hosts, as tag
"InternalError"with the rawJSON as the message.
its SHA-256 (
~/.cache/datalogic/native/or the platformequivalent, falling back to a temp directory) instead of a fresh temp
directory per start, which piled up on Windows. The jar declares
Automatic-Module-Name: com.goplasmatic.datalogic.(darwin/arm64 81.6 → 13.5 MB): a debuginfo-free, LTO'd
go-releaseprofile. .NET ships
net8.0andnet10.0builds.engines.node >=18, matching theNode package. Python wheels list Python 3.14.
Performance
Rootsinput brings in onlywhat the rule reads. A compiled rule whose reads are all known
(
Logic::facts(),reads_complete()) and that does not read the wholeinput now views just those paths: on the way down each path only the
object keys it names, and the whole value at its end. Reading one field
of an 8 MB context through
Engine::evaluateor aSessiontakes 36 nsowned and 41 ns serde, where viewing the whole input took 2.96 ms and
15.7 ms; a 1 KB context is 3 to 12 times faster.
Rootskeeps only theroots a rule reads. Results are unchanged: every suite case gives the
same outcome projected and whole, under default, unfolded and
MissingVar::Errorengines. A rule with a computed path, a customoperator that reads the context, or a read of the whole input is viewed
whole as before, as is a rule evaluated on an engine other than the one
that compiled it, and traced runs. JSON text and
ParsedDatainputsare unaffected.
tools/benchmarkgains aprojectionbinary for thesenumbers.
filter,all,someandnoneover a comparison predicate arefaster and no longer layout-sensitive. The recognised predicate shape
is now dispatched once per call instead of once per item. Over 1,000
items:
{">": [{"var": ""}, 500]}filters in 1.17 µs (was 3.2 µs, or6.0 µs in some builds of the same code), full
all/somescans are3.7 to 3.9 times faster, and comparisons on a field are 26 to 31% faster.
mapandreducearithmetic fast paths fix their operation outsidethe loop. Over 1,000 items:
reducewith{"+": [{"var": "current.score"}, {"var": "accumulator"}]}is 21% faster, a fusedreduceovermap9 to 16%,mapwith two fields 13% and with afractional literal 38%; the remaining shapes are flat to 5% faster. The
timings are now the same across builds of the same code.
Engine::eval*and the top-leveleval*functions projectowned,
serde_jsonandRootsinput the same way.subtrees at every node; a projection binary-searches wide read sets;
template keys are borrowed instead of copied per evaluation; compiling
a borrowed
&OwnedDataValueno longer deep-clones it;split, steppedstring
slice,format_date,parse_date,nowandmissingcopyless.
before it, moves the canonical bench geomean +1.0% on the suites whose
cases did not change; macro suites stay within +3% (
checkout-40+1.4%).
Changed (tooling)
Cargo.lockof every shipping workspace is committed and releasesbuild
--lockedwith a pinned toolchain; CI gains cargo-semver-checks,cargo-deny, a docs check, a WASM size gate, fuzzing and weekly macOS /
Windows runs, and the release runs all of CI on the tag before
publishing. Integration tests declare their
required-features.napi3.14.2in the Node binding). UI:
@xyflow/react12.12.0 (its bundled baseCSS regenerated),
vite8.3.3,vitest5.0.3,eslint10.12.0,typescript-eslint8.71.1,lucide-react1.52.0 and smaller bumps;source-map-js1.2.2 (build(deps): bump source-map-js from 1.2.1 to 1.2.2 in /ui #82, an event-loop DoS advisory). TypeScript stays on6.x until
typescript-eslintadmits 7. Node:@napi-rs/cli3.10.8.JVM:
maven-jar-plugin3.5.1. .NET, Python, PHP and Go were alreadycurrent.
@goplasmatic/datalogic-uitarballagain; the asset step looked for the package one directory too deep.
Every binding passes the same conformance battery: 66 suites / 2,128 cases.
Try rules live in the playground.
Running datalogic-rs in production? Add your project.
This discussion was created from the release v5.8.0.
All reactions