Host values in browser expressions
@erpforall/expr evaluates a ValidatedAst from the bounded AST reader/decoder.
Host record and context bindings use tagged ExprValue values, not raw JS
primitives. Use intVal, strVal, listVal and the other value constructors.
Integers crossing the evaluator boundary must fit i64; use bigint for exact
values instead of converting through JavaScript number.
Names, resolver values, registered host attribute results and host call results are admitted under the current evaluation budget. Admission validates the data, checks depth/work/logical bytes, charges the copy, then snapshots it. Container wrappers/arrays are frozen and byte buffers are isolated from their source. Replacing a field/context signal is how hosts publish changes. Treat returned values as read-only; changing a source container cannot change a cached result.
Budget.admit(value) now returns the admitted snapshot. A low-level caller that
uses this method must retain the returned value; ignoring it keeps the original
host reference. Evaluator-owned producers reserve their output and work under the invocation
budget before returning; their results use checkValue without charging them
again. Internal capability provenance belongs to one evaluation, so exporting a
bound method and reintroducing it as a host value admits its captured receiver
under the new evaluation budget. Native objectVal/callableVal constructors register explicit trusted
capabilities. A structural cast to those tags does not register a capability.
The sandbox never derives a callback from a data property.
Malformed tags/payloads, holes, cyclic data and data accessors fail explicitly. Quota errors are sticky for the evaluation. Proxies are not a supported data transport; native callback implementations remain trusted host code. Errors from those callbacks propagate rather than becoming successful expression values.
The reactive adapter validates context data once per evaluation, while charging each expression reference. It indexes primitive keys with Python numeric key equivalence; compound-key equality uses an explicit work budget. Container structure is normalized once; each reference snapshots its leaf data. A trusted native callback that changes a source leaf between references can therefore publish a newer value to the later reference; earlier admitted values remain isolated. A fresh signal reevaluation validates the source again with a new budget. This cache does not survive disposal or a later evaluation.
Known integration limitation: FORMAT R2-11’s string/bytes/dict * unpacking and
call-error precedence remain open and do not block this delivery. This repair does not declare the full interpreter or
Odoo behavior accepted. Product performance remains deferred to milestone end.