mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-13 03:42:35 -06:00
372f07e3b2
In topdown, we have two different error modes: strict/non-strict. In WASM, everything is meant to be non-strict. Thus errors that only appear in topdown with strict mode are annotated as such, and checked for an empty result-set in the WASM test runner. Several WASM builtins that have returned an error where they should return NULL have been adjusted. This allows us to fix most of the exceptions brought up in #2954. Notable pieces: * wasm sdk: ignore builtin errors This should be in line with the non-strict builtin error semantics used in WASM. Before, when the WASM SDK had called out top a topdown-defined builtin, and that builtin had returned an error, the WASM caller returned that error. It's been at odds with how topdown evaluated builtin errors when run without strict builtin errors. Now, the errors are properly ignored, except for topdown.Halt. That one doesn't seem like it's used at the moment, at least from this code base. * cases: add want_result where non-strict eval yields something This happens to work for both topdown and wasm: - in topdown, the test runner checks for expected errors first, and ignores the wanted result; - in wasm, we check for a desired result first, checking the error if no result was defined. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>