Releases: microsoft/rego-cpp
v0.4.5
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 thev1_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
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 virtualclear()
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
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
v0.4.1
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
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 inregov1.yaml
- The interpreter now returns more than one
Result
when appropriate, and separates out theBindings
andTerms
. - The output of
rego
is now JSON instead of plain text - Added
regoOutputSize
,regoExpressions
,regoBindingsAtIndex
, andregoExpressionsAtIndex
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 aRewriter
which performs unification - Added the
encoding
andgraphs
builtins - Added
set_log_level_from_string
andsetLogLevelFromString
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 calledregoSetInputTerm
which does the same thing, and theJSON
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 onInterpreter
, as they now perform parsing, now produce either anullptr
if successful or an errorNode
.
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 newrego_fuzzer
executable
New Test Coverage
base64builtins
base64urlbuiltins
hexbuiltins
jsonbuiltins
reachable
urlbuiltins
v0.3.11
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
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 itsstr
andjson
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
, andArray
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
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 newevery_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
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 thesort
flag was set totrue
. - 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 flagrego_set
has been changed toset_as_array
and
the order of its flag inverted (it is nowfalse
by default). - C API: The
regoAddInput*
functions are now namedregoSetInput*
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++ APIrego_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.