chore(flag-evaluation): improve SET/NOT_SET operator evaluations#439
Merged
chore(flag-evaluation): improve SET/NOT_SET operator evaluations#439
Conversation
Contributor
pavkam
commented
Jun 25, 2025
- Refined evaluation logic for "SET" and "NOT_SET" operators to use strict equality checks.
- Added tests to ensure correct behavior for missing context fields with "SET" and "NOT_SET" operators, including handling empty string values.
…aluations - Updated version in package.json to 0.1.5. - Refined evaluation logic for "SET" and "NOT_SET" operators to use strict equality checks. - Added tests to ensure correct behavior for missing context fields with "SET" and "NOT_SET" operators, including handling empty string values.
- Adjusted the resolution for "@bucketco/flag-evaluation" to version 0.1.4. - Updated dependency details including checksum and link type.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refines flag-operator evaluations by enforcing strict equality for SET/NOT_SET, updates recursive evaluation to skip missing-field flags for these operators, and adds tests to verify behavior with missing or empty-string context values.
- Switched
==/!=to===/!==forSETandNOT_SETinevaluate(). - Updated
evaluateRecursivelyto exemptSETandNOT_SETfrom marking fields as missing. - Added tests covering missing-context and empty-string cases for
SET/NOT_SET; bumped version to 0.1.5.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/flag-evaluation/src/index.ts | Enforced strict checks for SET/NOT_SET and refined missing-field logic. |
| packages/flag-evaluation/test/index.test.ts | Added end-to-end tests for SET/NOT_SET with absent and empty context fields. |
| packages/flag-evaluation/package.json | Updated package version to 0.1.5. |
- Added tests to verify behavior of `SET` and `NOT_SET` operators when field values are missing or empty strings. - Improved clarity and organization of test cases for better readability and maintainability.
… undefined values - Updated the flattenJSON function to return empty strings for null values and skip undefined values. - Improved handling of empty nested objects and arrays, ensuring consistent output. - Added comprehensive tests to cover new edge cases, including handling of top-level primitives and special characters.
roncohen
approved these changes
Jun 26, 2025
- Updated the recurse function in flattenJSON to require a prop parameter, enhancing type safety and clarity. - Ensured consistent handling of input data by explicitly passing an empty string for the initial prop value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.