Expand description
The Transform node’s evaluator: shape lists and objects with a restricted expression language and no code execution (docs/specs/SPEC_DRONE_GENERAL_AUTOMATION_2026_11_11.md §3.9).
Module A of the engine. The types, the bounds and taint_out are
fixed here; evaluate is the module’s job. Its acceptance tests are
transform_acceptance_tests.rs. The language itself (the tokenizer, the
parser and the evaluator) is in expr.rs, the operations are in ops.rs,
and the module’s own unit tests are in tests.rs; all three are private to
this module.
§Expression grammar
Lowest precedence first; all binary operators are left associative.
expr := or
or := and ( "||" and )*
and := not ( "&&" not )*
not := "!" not | cmp
cmp := sum ( ( "==" | "!=" | "<" | "<=" | ">" | ">=" | "contains" | "matches" | "in_set" ) sum )?
sum := prod ( ( "+" | "-" ) prod )*
prod := unary ( ( "*" | "/" | "%" ) unary )*
unary := "-" unary | atom
atom := number | string | "true" | "false" | "null" | list | call | path | "(" expr ")"
list := "[" ( expr ( "," expr )* )? "]"
call := name "(" ( expr ( "," expr )* )? ")" // lower, trunc, default, exists
path := name ( "." name )* // item, item.user.login, index
string := 'text' or "text" // no escapes beyond \' \" \\itemis the current element andindexits position (0-based) insidemap,filterand the key expressions (by). A missing path isnull, never an error.a contains b: a string contains a substring, or a list holds an element.a matches 're': the Rustregexcrate (linear time) on a string. The pattern must be a string literal, compiled once when the chain is read, so no element pays for a compile.a in_set [..]: the list holdsa(JSON equality).lower(s),trunc(s, n)(at mostncharacters),default(x, d)(dwhenxis null),exists(path)(the path is not null). No other function exists, no variable, no assignment, no loop, no recursion, no call to the host and no network: an unknown name isTransformError::Expr.- Arithmetic is on numbers only;
/by zero and%by zero are errors; an integer result stays an integer (1 + 2is3, not3.0). - Comparing values of different types is
falsefor==,truefor!=, and an error for<,<=,>,>=.
Re-exports§
pub use condition::evaluate_condition;
Modules§
- condition 🔒
- The Condition block’s richer expressions run on the Transform expression language
(docs/specs/SPEC_DRONE_REAL_WORLD_JOBS_2026_11_11.md §4.1):
&&,||,!, grouping,contains,matches,in_set,existsand the filters, with every bound the language has (source size, nesting, operations, a linear-time regex). The block turns each{{reference}}into a name bound to the value it holds, so the expression is read as written and what a reference holds is never read as syntax. - expr 🔒
- The Transform expression language: the tokenizer, the parser and the evaluator (docs/specs/SPEC_DRONE_GENERAL_AUTOMATION_2026_11_11.md §3.9).
- ops 🔒
- The Transform operations: one function per
TransformOp, and the chain runner (docs/specs/SPEC_DRONE_GENERAL_AUTOMATION_2026_11_11.md §3.9).
Structs§
Enums§
- Bound
Kind - Which bound a node went over.
- Transform
Error - Transform
Op - One step of a chain. A chain reads top to bottom, each result feeding the next.
Constants§
- MAX_
ITEMS - An input of at most this many items (§3.9).
- MAX_
OPERATIONS - An evaluation budget per node: one unit per element an operation visits and per expression node evaluated (§3.9).
- MAX_
OUTPUT_ BYTES - An output of at most the state cap, in bytes of JSON (§3.2).
- MAX_
REGEX_ 🔒BYTES - A compiled
matchespattern may be at most this big: a pattern that would compile to more is an expression error, so a hostile one cannot make the compiler work without bound.
Functions§
- chain_
taint - The bits of a chain’s output:
taint_outapplied step by step, starting from the input’s. - check_
items 🔒 - The item bound: an input list, or a list a step makes, of more than
MAX_ITEMS. - check_
output 🔒 - The output bound, checked after every step so a runaway intermediate stops early rather than filling memory first.
- evaluate
- Run
toverinput. The output’s bits arechain_taintof the chain. Every bound of §3.9 is checked and named inTransformError::Bound. - expr_
step 🔒 - expressions_
of - The expressions an op carries, for the validator and the canvas.
- op_
names - Every op as it is written in a graph, with a few words for the canvas.
- op_step 🔒
- taint_
out - What an operation does to the taint bits of the value it reads (the table
of §3.9 and the derived-value rule of §4.5). Returns
(tainted, derived).