This reduces std::mem::size_of::<Value>() to 16 bytes.
String values are also efficiently copied like Objects, arrays, sets etc.
When multiple function rules are evaluated, ensure that constant argument values
match before running the rule. If actual parameter does not match the constant parameter,
then the rule is skipped.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
- units.parse, units.parse_bytes
- json.is_valid, json.marshal, json.unmarshal
- yaml.is_valid, yaml.marshal, yaml.unmarshal
- object.subset
- set_diff
* Also print number of errors due to each missing function
* Also lock down fully passing OPA suites
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Run regorus against OPA test suite.
To run full test suite:
cargo test --test opa
To run specific folder (e.g semver):
cargo test --test opa -- semver
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This allows holding onto objects, caching results etc easily.
However it does introduce the overhead of ref counting.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
1. Numeric indices will be converted to strings for refs beginning with `data`
if there is not valid numeric key
2. Error out if input document already contains value for a ref
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
`OPA_TESTS_DIR=path/to/testsuite cargo test opa -- --shot-output` to run opa tests.
Failing test cases are saved in target/opa/folder for investigation.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
1. Skip recording undefined variables
2. Parse `in` correctly if it is not imported.
3. base64.decode
4. Handle `with` modifier for qualified data and input.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Expressions are scheduled based on dependencies and thusthe gathered
expression values may not be in the same order as in source.
Reorder to match the source.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
When evaluating rules, upon error the last pushed scope wasn't being
popped from the stack of scopes. This causes incorrect behavior
when there are multiple definitions for the same rule name.
The fix is to make sure that the scopes are popped manually upon encountering errors.
Once the interpreter logic is locked down, then we need to clean up scope management
using Drop functions so that the cleanup happens even during short circuited return.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This needs to be flushed out to be compatible with https://pkg.go.dev/fmt.
All the features of the go format string don't need to be implemented,
only those that are relevant for Rego.
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
cargo config
1. MUSL is no longer the default target. This allows building on Mac and Windows.
2. On Linux, code coverage compiler options are supplied by default.
pre-commit, pre-push
- Coverage is turned on only on Linux
- clippy is run on all platforms
github
- MUSL build is tested to ensure that stand alone executables can be created
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>