-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
This compiles:
package p
rule if {
some root in ["foo", "bar"]
data[root].sub
}Whereas this doesn't:
package p
rule if {
some root in ["foo", "bar"]
data[root].rule
}->
rego_recursion_error: rule data.p.rule is recursive: data.p.rule -> data.p.rule
Which we know is wrong since none of the values root resolves will produce the recursive data.p.rule ref that the error message claims. Without having looked at the code, I assume that root is considered dynamic, even though all possible values are known and could be checked at compile time. I don't think this check would need to cover all possible cases, but it should be able to identify at least simple cases like this where the variable part of a ref is just an enumeration of values known at compile time, and even local in scope. The use case is if course (not so dynamic) policy composition, where we want to run an input across a number of roots we know exist.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Backlog