-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add In operator edge cases
#38
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: khvn26 <[email protected]>
|
@copilot for test cases involving floats, we should use values that add ambiguity when loosely compared — i.e. |
… vs 2) Co-authored-by: khvn26 <[email protected]>
In operator edge cases
|
@copilot make sure the new test cases are compliant with their JSON schema — |
Co-authored-by: khvn26 <[email protected]>
| { | ||
| "operator": "IN", | ||
| "property": "level", | ||
| "value": "[1,2,3,4]" |
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.
This is still a list of integer?
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.
Currently, we expect the engine to coerce the unmarshalled json-encoded values to an array of strings — see https://github.com/Flagsmith/flagsmith-engine/blob/3c28ed5a578c5782c3f289c51cab97cb0f4d6c09/flag_engine/segments/evaluator.py#L277-L287.
Is this a concern for Go and Rust?
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.
This is a concern for Rust. When converting floats to strings, Rust removes trailing zeros—for example, 2.0.to_string() returns "2" instead of "2.0". This causes the IN operator tests to fail because the string representation of the float trait value ("2")
doesn't match the comma-delimited float values in the condition ("1.0,2.0,3.0,4.0").
Added 12 new test cases for IN operator edge cases:
Native list condition properties:
Comma-delimited string condition properties:
JSON-encoded list condition properties:
All test cases follow the existing naming convention and structure, with descriptive comments explaining each scenario. Float values use
2.0(vs int2) to test ambiguous cases that are equal in loose comparison but distinct in type-strict comparison. Native array values are now strings to comply with the JSON schema.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.