⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@racoelhosilva
Copy link

@racoelhosilva racoelhosilva commented Jan 29, 2026

Update Query Engine to Rego v1

Description

After some research, we found that converting the existing queries from Rego v0 to v1 can be done mostly with a single command: opa fmt --rego-v1 -w .
This pull request does that conversion to all implemented queries up to this point. Currently, this requires further testing and discussion before merging (namely regarding new syntax changes introduced in v1 and adding a timeout context to Rego evaluations).
This update should, in theory, allow queries to be written in both v0 and v1. However, further discussion and testing should be done related to this.
See notes below.

Testing

All tests related to these changes are passing and working as expected.

Notes

  • A change was made to glitch_lib due to "contains" being a keyword on Rego v1
  • Some changes were made to the Go Library: strict mode is now enabled on queries and empty results are also now filtered
  • As stated, formatting is done with opa fmt --rego-v1 -w .
  • Discussion topic: currently, the context passed to the evaluation is just background, but this can be changed to specify a general timeout when running the queries
  • As expected, this should also change the current library version

This work was developed as part of the Infragov Project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant