mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-13 03:42:35 -06:00
3ebbeede6c
These changes modify topdown evaluation to use a binding list that namespaces variables. This allows topdown to propagate partially ground ref operands into child query evaluation. These changes also prepare topdown evaluation to support a partial evaluation mode. With these changes, evaluation is no longer performed in two steps (i.e., first pass of evaluating individual terms, second pass of evaluating built-in expressions.) Instead, evaluation assumes queries have been rewritten to eagerly evaluate refs and comprehension. This way, ref and comprehension bindings do not have to be maintained separately: they are handled by the normal variable binding list. This commit contains some breaking changes to the topdown APIs, namely... 1. Truth explanation has been removed. This feature was not used and the tracing changes broke it. We can revisit in future if necessary. 2. Data indexing has been removed. Data indexing can be re-added in future if necessary however it should be handled outside of topdown to avoid potential memory leaks. 3. Built-in functions produce at-most-one output now. Functions that used to produce multiple outputs (e.g., io.jwt.decode) can produce a composite value if they need to. Fixes #131