Skip to content
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

CEL Filter not working with tkn-result #569

Closed
khrm opened this issue Aug 22, 2023 · 12 comments
Closed

CEL Filter not working with tkn-result #569

khrm opened this issue Aug 22, 2023 · 12 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@khrm
Copy link
Contributor

khrm commented Aug 22, 2023

Running below command fails:
`./tkn-results list default --filter="summary.status=='SUCCESS'"

Expected Behavior

ListResults: rpc error: code = InvalidArgument desc = error compiling CEL filters: ERROR: :1:15: found no matching overload for '==' applied to '(int, string)'
| summary.status=='SUCCESS'
| ..............^
Error: rpc error: code = InvalidArgument desc = error compiling CEL filters: ERROR: :1:15: found no matching overload for '==' applied to '(int, string)'
| summary.status=='SUCCESS'
| ..............^

/cc @avinal

@khrm khrm added the kind/bug Categorizes issue or PR as related to a bug. label Aug 22, 2023
@khrm khrm mentioned this issue Aug 22, 2023
8 tasks
@khrm
Copy link
Contributor Author

khrm commented Aug 22, 2023

@avinal Let's continue our discussion here regarding broken cel filter.

@avinal
Copy link
Member

avinal commented Aug 22, 2023

Note: this particular expression was working before a few updates. I am unable to pinpoint where it changed. Furthermore, only this expression is failing. All other filters I tested work fine. Somehow, the summary.status field is interpreted as int.

@khrm
Copy link
Contributor Author

khrm commented Aug 23, 2023

The issue might not be with the tkn-results, then. It might be with CEL-related changes in API.

@khrm
Copy link
Contributor Author

khrm commented Aug 23, 2023

These are the two PRs that we need to test for this error by running -1 commit:
#544
#495

@avinal
Copy link
Member

avinal commented Aug 23, 2023

I would also widen the subject from just tkn-results to REST and gRPC as well, I checked, it doesn't work there either. Yes this seems to be a CEL change.

@avinal
Copy link
Member

avinal commented Aug 28, 2023

/assign

@alan-ghelardi
Copy link
Contributor

alan-ghelardi commented Sep 2, 2023

Yes, the summary.status is an integer because it is declared like this in the proto definition and mapped to an integer in the database. When I redesigned the search mechanism to support an interpreter from CEL to SQL, one of the things that I tried to do was preserving the types that people see when viewing the wire types in the search. I believe that this reduces cognitive load and the continuous mental mapping between things - if the summary.status is an integer I don't need to remember of referencing it as a string when searching.

In addition, there're a few constants to help people to reference the enum values instead of using the numeric values (the constants are the string representation of the enums in the proto format). Could you try the following instead?
./tkn-results list default --filter="summary.status==SUCCESS"

@avinal
Copy link
Member

avinal commented Sep 4, 2023

@alan-ghelardi that makes sense. I tested it and it works fine without strings. I will close this issue and update this detail in docs. Thank You

@avinal
Copy link
Member

avinal commented Sep 4, 2023

/close

@tekton-robot
Copy link

@avinal: You can't close an active issue/PR unless you authored it or you are a collaborator.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@avinal
Copy link
Member

avinal commented Sep 4, 2023

I must have messed up while testing and used quotes. I have added a clear paragraph to avoid this mistake by others.

@khrm
Copy link
Contributor Author

khrm commented Sep 4, 2023

/close Fixed

@khrm khrm closed this as completed Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

4 participants