-
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
inspect
command does not always detect undefined functions
#6946
Comments
Yeah, I saw the same running I'm however still seeing other errors that are likely related, but harder to understand, like:
and:
|
So these additional failing checks fail due to Rego-defined functions returning the return value of "undefined" built-in functions, and those have no known return type... TBH, I think a better solution would be to have a proper |
Just a small improvement from looking into open-policy-agent#6946 This doesn't necessarily solve all issues reported there, but I figured I might as well commit this anyway. Signed-off-by: Anders Eknert <[email protected]>
Just a small improvement from looking into open-policy-agent#6946 This doesn't necessarily solve all issues reported there, but I figured I might as well commit this anyway. Signed-off-by: Anders Eknert <[email protected]>
Just a small improvement from looking into #6946 This doesn't necessarily solve all issues reported there, but I figured I might as well commit this anyway. Signed-off-by: Anders Eknert <[email protected]>
Not sure I understand how this relates to adding caps. The former seems like a bug and later would be good to have. Maybe I'm missing something. |
Essentially, there could be two types of "missing" functions:
Both of these should arguably be covered by "allowing undefined functions". The errors returned when running My question was whether one should expect |
The command is configured to always allow undefined functions. So if |
Agreed. This change fixes the "undefined function" error reported here. But there are still cases where that's not going to be enough for the type checker to be happy, as the return value type, or the arguments, of an unknown function are still uknknown. This can cause new and different issues. Example: p.rego package p
import rego.v1
f(x) := custom_function(x)
bug if x := f("foo")
|
This issue has been automatically marked as inactive because it has not had any activity in the last 30 days. Although currently inactive, the issue could still be considered and actively worked on in the future. More details about the use-case this issue attempts to address, the value provided by completing it or possible solutions to resolve it would help to prioritize the issue. |
I think I have just run under this issue with the following code: bug.rego package bug
import data.lib
import rego.v1
dispatcher(arg) := dispatcher_impl(arg.type, arg)
dispatcher_impl("type1", arg) := lib.f1(arg) lib.rego package lib
import rego.v1
f1(arg) := arg.value
It does work fine if I inspect the whole bundle at once. |
This issue has been automatically marked as inactive because it has not had any activity in the last 30 days. Although currently inactive, the issue could still be considered and actively worked on in the future. More details about the use-case this issue attempts to address, the value provided by completing it or possible solutions to resolve it would help to prioritize the issue. |
Short description
The
inspect
command does not detect undefined functions directly called in a rule, but it does detect them in a list comprehension.Opa: 0.67.1
Steps To Reproduce
File:
Expected behavior
All cases of using the undefined function will be detected
The text was updated successfully, but these errors were encountered: