Skip to content

Commit

Permalink
topdown: Fixing overactive Early Exit suppression
Browse files Browse the repository at this point in the history
Fixing two issues where Early Exit was being suppressed when it shouldn't have been:

1. A cache hit for a rule/function discards EE for the call-site.
2. Non-EE rule/func discards EE for call-site.

Fixes: #6566
  • Loading branch information
johanfylling authored Mar 21, 2024
1 parent 629669e commit 143a8e6
Show file tree
Hide file tree
Showing 3 changed files with 1,258 additions and 77 deletions.
112 changes: 111 additions & 1 deletion test/cases/testdata/disjunction/test-disjunction-0775.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,117 @@ cases:
}
xs = {1, 2}
q = xs[_]
note: "disjunction/complete: conflict involving early-exit complete rule"
note: "disjunction/complete: conflict involving early-exit complete rule (set enumeration)"
query: data.test.p = x
want_error: complete rules must not produce multiple outputs
want_error_code: eval_conflict_error
- data:
modules:
- |
package test
p {
q
}
xs = [1, 2]
q = xs[_]
note: "disjunction/complete: conflict involving early-exit complete rule (array enumeration)"
query: data.test.p = x
want_error: complete rules must not produce multiple outputs
want_error_code: eval_conflict_error
- data:
modules:
- |
package test
p {
q
}
xs = {"a": 1, "b": 2}
q = xs[_]
note: "disjunction/complete: conflict involving early-exit complete rule (object enumeration)"
query: data.test.p = x
want_error: complete rules must not produce multiple outputs
want_error_code: eval_conflict_error

- data:
modules:
- |
package test
p {
q
}
xs = {1, 2}
q[y] := x {
x := xs[_]
y := 1
}
note: "disjunction/complete: conflict involving early-exit partial rule"
query: data.test.p = x
want_error: object keys must be unique
want_error_code: eval_conflict_error

- data:
modules:
- |
package test
p {
q
}
xs = {1, 2}
q = false {
false
} else = xs[_]
note: "disjunction/complete: conflict involving early-exit complete rule, else"
query: data.test.p = x
want_error: complete rules must not produce multiple outputs
want_error_code: eval_conflict_error

- data:
modules:
- |
package test
p {
q
}
xs = {1, 2}
q = xs[_]
note: "disjunction/complete: conflict involving early-exit complete rule, multiple"
query: data.test.p = x
want_error: complete rules must not produce multiple outputs
want_error_code: eval_conflict_error

- note: "disjunction/complete: conflict involving early-exit complete rule, data array enumeration"
data:
arr: [1, 2]
modules:
- |
package test
p {
q
}
q := data.arr[_]
query: data.test.p = x
want_error: complete rules must not produce multiple outputs
want_error_code: eval_conflict_error

- note: "disjunction/complete: conflict involving early-exit complete rule, data object enumeration"
data:
obj:
a: 1
b: 2
modules:
- |
package test
p {
q
}
q := data.obj[_]
query: data.test.p = x
want_error: complete rules must not produce multiple outputs
want_error_code: eval_conflict_error
Loading

0 comments on commit 143a8e6

Please sign in to comment.