-
Notifications
You must be signed in to change notification settings - Fork 53
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
fix(i): Panic in object equal filter #3143
fix(i): Panic in object equal filter #3143
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3143 +/- ##
===========================================
- Coverage 78.13% 78.04% -0.09%
===========================================
Files 353 353
Lines 34647 34647
===========================================
- Hits 27068 27038 -30
- Misses 5965 5987 +22
- Partials 1614 1622 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 9 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Nice simple fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Are you absolutely certain this kind of bug is only present in _eq
? Other operators are completely fine?
If so, LGTM :)
d := data.(map[string]any) | ||
if len(d) != len(condition) { | ||
d, ok := data.(map[string]any) | ||
if !ok || len(d) != len(condition) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: It would be worth documenting how this can come about, especially given that it was missed originally. Otherwise someone in the future may remove it (and hopefully hit the test, but it will still cost time).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a developer note to the connor.go
header since this will apply to all operators moving forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay cheers, I am somewhat sceptical as to whether people will usually read/remember that before reading this line(s), but it saves duplicating the comment in a bunch of places and we can move it inline in the future if people end up tripping up on this.
I'm noticing a few other areas that will have a similar bug. The filters were originally written to be somewhat type safe, but we can't rely on that because the JSON type can be anything. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Relevant issue(s)
Resolves #3141
Description
This PR fixes a bug where the object equality check would panic when comparing with a non object type.
Tasks
How has this been tested?
Added integration test.
Specify the platform(s) on which this was tested: