Link [ pkgsrc | NetBSD | pkgsrc git mirror | PR fulltext-search | netbsd commit viewer ]


   
        usage: [branch:branch] [user:user] [path[@revision]] keyword [... [-excludekeyword [...]]] (e.g. branch:MAIN pkgtools/pkg)




switch to index mode

recent branches: MAIN (32m)  pkgsrc-2024Q1 (10d)  pkgsrc-2023Q4 (57d)  pkgsrc-2023Q2 (90d)  pkgsrc-2023Q3 (169d) 

2024-05-28 11:34:45 UTC Now

2023-09-06 09:24:49 UTC MAIN commitmail json YAML

opa: Update to 0.56.0

Changes:
v0.56.0
-------
This release contains a mix of new features, bugfixes and a new builtin
function.

### Support for General References in Rule Heads (Experimental)

A new experimental feature in OPA is support for general refs in rule
heads. Where a general ref is a reference with variables at arbitrary
locations.

```rego
package example

import future.keywords

# Converting a flat list of users to a mapping by "role" and then "id".
users_by_role[role][id] := user if {
    some user in data.users
    id := user.id
    role := user.role
}

# Explicit "admin" key override to the above mapping.
users_by_role.admin[id] := user if {
    some user in data.admins
    id := user.id
}

# Leaf entries can be multi-value.
users_by_country[country] contains user.id if {
    some user in data.users
    country := user.country
}
```

General refs are currently not supported by the OPA planner, making
this feature unsupported for Wasm and IR.

Note: this feature is disabled by default, and needs to be enabled by
setting the `EXPERIMENTAL_GENERAL_RULE_REFS` environment variable (once
the feature is complete - supports Wasm and IR - this requirement will
be dropped).

### New Built-In Function: `numbers.range_step`

Similar to the `numbers.range` built-in function, `numbers.range_step`
returns an array of numbers in a given range. The new built-in function
also allows you to control the _step between each entry_.

### Breaking changes

Since its introduction in 0.34.0, the `--exit-zero-on-skipped` option
always made the `opa test` command return an exit code 0. When used, it
now returns the exit code 0 only if no failed tests were found.

Test runs on existing projects using `--exit-zero-on-skipped` will fail
if any failed tests were inhibited by this behavior.

(leot)