Skip to content

Releases: microsoft/rego-cpp

v0.4.5

27 Sep 08:40
e64553b
Compare
Choose a tag to compare

Point release addressing some issues in the Python and Rust wrappers.

New Features

  • The Python wrapper now packages the tzdata database inside the wheel to ensure consistent performance across platforms.
  • The Rust wrapper now has the ability to download a fresh copy of the tzdata database if needed
  • Added a regoSetTZDataPath method to the C API and exposed it for the Python and Rust wrappers.
  • The regoNew C API method now supports the v1_compatible flag for interpreter creation
  • The library embeds the windowsZones.xml mapping file so it can provide it where needed
  • The Python wrapper provides a more natural interface for sets and objects
  • The CMake system will now look for a REGOCPP_TZDATA_PATH environment variable to use for setting the default path

Bug Fix

  • Fixed a bug where builtins would not be available if an interpreter was re-used
  • Fixed a bug with the Rust wrapper where it was aggressively trimming strings

v0.4.4 - Adding `time` and `uuid` builtins

24 Sep 16:10
3eb9a7c
Compare
Choose a tag to compare

Point release adding the uuid, time, and walk builtins.

In order to add support for the time built-ins that worked cross-platform and with the widest
range of C++ compilers, we had to introduce a dependency on the date
library. This contains a full implementations of the std::chrono functionality which will eventually be
supported across most c++ compilers as part of the STL. In particular, it provides the crucial Time Zone
lookup functionalities required by the Rego time built-ins. The Time Zone lookup requires a valid
tzdata database from the IANA. This can either be configured to use the local
system TZ data (default for Linux variants) or a manual database (default for Windows). If the REGOCPP_USE_MANUAL_TZDATA flag
is set, then the project will download the latest database and install it as part of its build process.

New Features

  • Added the uuid built-ins
  • Added the time built-ins
  • Added the walk built-in
  • It is now possible for BuiltInDef implementations to cache values or otherwise maintain state. To facilitate this,
    a new virtual clear() method has been added which will be called at the start of each query evaluation.

Bug Fixes

  • Fixed a bug with adding zero to negative integers.

v0.4.3 - Upgrade to Rego v0.68.0

10 Sep 13:13
cc42534
Compare
Choose a tag to compare

Point release updating to Rego v0.68.0

New Features

  • Updated the support version of Rego to v0.68.0
  • Updated to the latest build of Trieste.
  • Added a v1-compatible flag to the test driver and interpreter which forces rego-v1 compliance
  • Added code to run both the v0 and v1 OPA test suites
  • Added the new strings.count built-in
  • Improved the tool messaging around debug options

Bug Fixes

  • Fixed an issue with recursion errors being swallowed by not
  • Fixed issues where undefined values were not handled correctly during unification
  • Fixed issue with whitespace after package definitions
  • Fixed issue where internal values were lingering in rule evaluations

v0.4.2

29 Jun 13:47
eccb13c
Compare
Choose a tag to compare

Point release updating the Trieste version.

This change should address build instability due to snmalloc updates.

v0.4.1

24 Jun 17:20
b9278ad
Compare
Choose a tag to compare

Point release containing doc updates and bug fixes.

  • Updated the docs to reflect the new interfaces and outputs

Bug Fixes

  • Fixed an issue with actions attached to an In statement for some builds/environments
  • Fixed a bug with modules that start with comments
  • Fixed a bug with comprehension contexts when an assigned variable is shadowed in the body of the comprehension

v0.4.0 - Upgrade to Rego v0.65.0

18 Jun 10:53
cfabe01
Compare
Choose a tag to compare

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

v0.3.11

19 Jan 17:30
6d84fc7
Compare
Choose a tag to compare

Minor improvements and bug fixes.

New Features

  • Updated to more recent Trieste version
  • More sophisticated logging

Bug fixes

  • Comprehensions over local variables were not properly capturing the local (regression due to optimization)
  • Local variable initializations were order-dependent (regression due to optimization)
  • In some circumstances, indexing the data object with an undefined key caused a segfault.

Other

  • Various CI changes due to issues with Github actions.

v0.3.10 - Performance improvements

22 Sep 23:57
4bf774b
Compare
Choose a tag to compare

Instrumentation and optimization.

New Features

  • A new REGOCPP_ACTION_METRICS option is available. When turned on, it will compile rego-cpp with
    instrumentation to measure the number of times a Trieste action is executed and how long is spent
    in each.
  • A new internal join method.

Improvements

  • ValueDef now caches its str and json representations instead of computing them each time.
    This has had a significant impact on unification (~5x speedup)
  • Use of the new join method reduces allocations and copies for common string operations
  • The unifier can now act over Object, Set, and Array nodes directly.
  • The functions pass has been refactored to produce fewer temporary variables and to perform
    fewer rewrites, reducing its runtime by half.
  • The local variable fixing that used to happen in implicit_enums now happens in its own pass, enum_locals.

v0.3.9

20 Sep 14:08
5be2edf
Compare
Choose a tag to compare

Fixing several impactful bugs.

Bug fixes

  • The ACI tests were incorrectly written in such a way that they would always pass. This has been addressed,
    and safeguards put in place in the test driver to detect this in the future.
  • Some statements nested in an every block would break the conditions if the item sequence was an array for
    which multiple elements could be identified by the some that were valid (see the new every_some test for
    a minimal reproduction). This has been fixed.
  • Dead links were being incorrectly identified in some cases. This has been addressed by making the check
    more precise and moving it to the functions pass.
  • Var lookups into a virtual or base document would resolve the entire document, causing needless recursion.
    This has been fixed.

Python and Rust wrappers

19 Sep 00:23
26fd07d
Compare
Choose a tag to compare

This release marks the first versions of the Rust and Python APIs, along with their example code.

Adding new examples for Python and Rust usage.

Python API

  • wrappers/python/ contains a Python package, regopy, which wraps the library
    and exposes a Python API. It is published on PyPi here

Rust API

  • wrappers/rust/ contains a Rust crate, regorust, which wraps the library
    and exposes a Rust API. It is published on crates.io here

Bug Fixes

  • Fixed a bug where to_json() was incorrectly sorting arrays when the sort
    flag was set to true.
  • Removes a memory leak caused by a cyclic graph of Unifiers
  • Fixes various use-after-free violations caused by missing clone() invocations.

New Features

  • The C++ API is now documented using Doxygen. The documentation can be found
    here.
  • Logging levels have been added and can be set via the API (instead of just
    binary enabled/disabled)
  • The library can now be built to target the C++ 17 standard (for older compilers)

Breaking changes

  • C API: The regoSetLoggingEnabled function has been replaced with
    regoSetLoggingLevel. This is also reflected in the C++ and Rust APIs.h
  • C API: The regoSetExecutablePath function has been removed due to the
    Interpreter::executable() property being removed from the C++ API.
  • The to_json method flag rego_set has been changed to set_as_array and
    the order of its flag inverted (it is now false by default).
  • C API: The regoAddInput* functions are now named regoSetInput* and can
    be used multiple times on the same interpreter.
  • C API: regoGet/SetStrictBuiltInErrors has been added.
  • The public headers have been reduced to just two files:
    • rego.hh which contains the C++ API
    • rego_c.h which contains the C API
  • The rego.hh header is now a C++ header and will not compile in C.
  • Many definitions have been moved to the (non-public) internal.hh header,
    and code which relied on having access to those definitions will break.