Skip to content

v0.4.0 - Upgrade to Rego v0.65.0

Compare
Choose a tag to compare
@matajoh matajoh released this 18 Jun 10:53
· 6 commits to main since this release
cfabe01

This minor version release updates rego-cpp to use the latest version of Trieste and also brings it into line with OPA Rego v0.65.0, while fixing many bugs and adding some quality of life improvements.

New Features

  • Updated the supported version of Rego to v0.65.0.
  • json.marshal_with_options
  • numbers.range_step
  • rego.v1 import and behaviour, plus a set of tests in regov1.yaml
  • The interpreter now returns more than one Result when appropriate, and separates out the Bindings and Terms.
  • The output of rego is now JSON instead of plain text
  • Added regoOutputSize, regoExpressions, regoBindingsAtIndex, and regoExpressionsAtIndex to the C API
  • Updated the Python and Rust wrappers to use the new API
  • Updated to latest version of Trieste
  • Uses Trieste's YAML and JSON parsers and emitters
  • Uses Trieste's more robust Unicode support
  • Passes broken up into a Reader, which parses Rego files, and a Rewriter which performs unification
  • Added the encoding and graphs builtins
  • Added set_log_level_from_string and setLogLevelFromString to make it easier to set the log level. All executables now use this option.

Improvements

  • The Interpreter caches intermediate versions of all modules, reducing query execution time
  • All of the early passes have been rewritten and are more efficient, resulting in reduced parsing time
  • The reduction of the input passes (and their restriction to a single file) along with other optimizations to header files has resulted in reduced compile times
  • The rego_fuzzer xecutable allows for more fine-grained fuzzing and testing of the Rego toolchain
  • Multiple bug fixes

Deprecation

  • The regoSetInputJSON method is a misnomer, as the input does not strictly need to be JSON. This has been replaced with an (otherwise identical) function called regoSetInputTerm which does the same thing, and the JSON version has been deprecated.

Breaking Changes

  • Output of rego tool has changed. Any downstream tooling that was parsing that will need to be updated to parse the JSON.
  • rego::wf_result has changed. Any tooling that was using the output node directly will need to be updated
  • the add_* methods on Interpreter, as they now perform parsing, now produce either a nullptr if successful or an error Node.
    Downstream consumers that were checking the boolean return value will need to be updated. Behavior in the C API is unchanged, but
    there will now be detailed parse/compile errors when an individual module etc. fails to compile.
  • The rego_trieste executable has been replaced by the new rego_fuzzer executable

New Test Coverage

  • base64builtins
  • base64urlbuiltins
  • hexbuiltins
  • jsonbuiltins
  • reachable
  • urlbuiltins