topdown: and/or expression evaluation (#8793)

Contains simplified PE: expressions are plugged and saved, but not
optimized. PE optimization to follow in #8680

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
This commit is contained in:
Johan Fylling
2026-06-26 14:07:16 +02:00
committed by GitHub
parent 6543ddebf6
commit 37b14851b8
25 changed files with 3082 additions and 78 deletions
@@ -1,3 +1,4 @@
# Exception Format is <test name>: <reason>
"data/toplevel integer": "https://github.com/open-policy-agent/opa/issues/3711"
"data/nested integer": "https://github.com/open-policy-agent/opa/issues/3711"
"logic_op/**": "No planner support"
@@ -19,6 +19,7 @@ import (
"testing"
"time"
"github.com/gobwas/glob"
"github.com/open-policy-agent/opa/internal/wasm/sdk/opa"
"github.com/open-policy-agent/opa/v1/ast"
"github.com/open-policy-agent/opa/v1/rego"
@@ -34,6 +35,13 @@ var exceptionsFile = flag.String("exceptions", "./exceptions.yaml", "set file to
var exceptions map[string]string
type exceptionPattern struct {
g glob.Glob
r string
}
var exceptionGlobs []exceptionPattern
func TestMain(m *testing.M) {
exceptions = map[string]string{}
@@ -48,6 +56,19 @@ func TestMain(m *testing.M) {
os.Exit(1)
}
for pattern, reason := range exceptions {
if !strings.Contains(pattern, "*") {
continue
}
g, err := glob.Compile(pattern, '/')
if err != nil {
fmt.Printf("Invalid glob pattern %q in exceptions file: %v\n", pattern, err)
os.Exit(1)
}
exceptionGlobs = append(exceptionGlobs, exceptionPattern{g: g, r: reason})
}
addTestSleepBuiltin()
os.Exit(m.Run())
@@ -123,6 +144,13 @@ func shouldSkip(t *testing.T, tc cases.TestCase) bool {
return true
}
for _, p := range exceptionGlobs {
if p.g.Match(tc.Note) {
t.Log("Skipping test case: " + p.r)
return true
}
}
return false
}