-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PE with shallow inlining producing incorrect result for some function calls #3681
Labels
Comments
srenatus
added a commit
to srenatus/opa
that referenced
this issue
Jul 30, 2021
Before, we had been passing `len(e.terms)` to `saveCall`, thereby sidestepping the checks that would get the output variable into the save set. In the problematic policy, y = f(1) count(y) with f(x) = [] { _ = input } the call to `count(y)` would be mishandled: it would be evaluated, since its arguments aren't in the saveset. Eval would fail because its argument was a variable (see also open-policy-agent#3680) Fixes open-policy-agent#3681. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
srenatus
added a commit
that referenced
this issue
Aug 12, 2021
Before, we had been passing `len(e.terms)` to `saveCall`, thereby sidestepping the checks that would get the output variable into the save set. In the problematic policy, y = f(1) count(y) with f(x) = [] { _ = input } the call to `count(y)` would be mishandled: it would be evaluated, since its arguments aren't in the saveset. Eval would fail because its argument was a variable (see also #3680) Fixes #3681. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
jgchn
pushed a commit
to jgchn/opa
that referenced
this issue
Aug 20, 2021
…-agent#3683) Before, we had been passing `len(e.terms)` to `saveCall`, thereby sidestepping the checks that would get the output variable into the save set. In the problematic policy, y = f(1) count(y) with f(x) = [] { _ = input } the call to `count(y)` would be mishandled: it would be evaluated, since its arguments aren't in the saveset. Eval would fail because its argument was a variable (see also open-policy-agent#3680) Fixes open-policy-agent#3681. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
dolevf
pushed a commit
to dolevf/opa
that referenced
this issue
Nov 4, 2021
…-agent#3683) Before, we had been passing `len(e.terms)` to `saveCall`, thereby sidestepping the checks that would get the output variable into the save set. In the problematic policy, y = f(1) count(y) with f(x) = [] { _ = input } the call to `count(y)` would be mishandled: it would be evaluated, since its arguments aren't in the saveset. Eval would fail because its argument was a variable (see also open-policy-agent#3680) Fixes open-policy-agent#3681. Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com> Signed-off-by: Dolev Farhi <farhi.dolev@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given the following policy:
PE w/ shallow inlining produces the following:
Running PE with --strict-builtin-errors reveals the following:
The problem with the trace above is here:
In this case, the Fail on L5 is actually due to the type error above. However,
count()
should either be invoked with[]
or it should not be invoked at all and it should be saved.Note, evaluating without shallow inlining produces the expected answer (
_ = input
); PE also returns the correct answer when the output contains unknowns if shallow inlining is off (count([input])
).The text was updated successfully, but these errors were encountered: