-
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
Input unset after negative rule evaluation #2142
Comments
Poking around at it this does appear to be an issue using
And just query for Haven't spent a ton of time looking for the fix yet, but at a guess when we are done evaluating the negated expression we aren't restoring the original But in I'll check and see if its as simple as just calling |
In `evalNot` when it succeeds we were calling `e.next(..)` to continue evaluation, but if the previous expression was from `evalWith` the original state was not being restored. This caused the patched data to persist for subsequent expression evaluation(s) until `iter()` was used. Similar treatment was required in `evalNotPartial` for the partial evaluation case. Fixes: open-policy-agent#2142 Signed-off-by: Patrick East <east.patrick@gmail.com>
In `evalNot` when it succeeds we were calling `e.next(..)` to continue evaluation, but if the previous expression was from `evalWith` the original state was not being restored. This caused the patched data to persist for subsequent expression evaluation(s) until `iter()` was used. Similar treatment was required in `evalNotPartial` for the partial evaluation case. Fixes: #2142 Signed-off-by: Patrick East <east.patrick@gmail.com>
Expected Behavior
opa test .
should be validActual Behavior
The test fails, specifically, it seems
input
is not there anymore after thenot is_faking_apple
line. If you comment out the secondinput.type == "apple"
statement, the test passes.Steps to Reproduce the Problem
See above
Additional Info
Rewriting as follows makes it work:
but either that should not be necessary or possibly the original example should fail parsing.
The text was updated successfully, but these errors were encountered: