Skip to content

chore(flag-evaluation): improve SET/NOT_SET operator evaluations#439

Merged
pavkam merged 7 commits intomainfrom
harden-evaluation
Jun 26, 2025
Merged

chore(flag-evaluation): improve SET/NOT_SET operator evaluations#439
pavkam merged 7 commits intomainfrom
harden-evaluation

Conversation

@pavkam
Copy link
Contributor

@pavkam 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.
@pavkam pavkam self-assigned this Jun 25, 2025
@pavkam pavkam requested review from Copilot and roncohen June 25, 2025 14:40
- Adjusted the resolution for "@bucketco/flag-evaluation" to version 0.1.4.
- Updated dependency details including checksum and link type.
@pavkam pavkam changed the title chore(flag-evaluation): improve operator evaluations chore(flag-evaluation): improve SET/NOt_SET operator evaluations Jun 25, 2025
@pavkam pavkam changed the title chore(flag-evaluation): improve SET/NOt_SET operator evaluations chore(flag-evaluation): improve SET/NOT_SET operator evaluations Jun 25, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ===/!== for SET and NOT_SET in evaluate().
  • Updated evaluateRecursively to exempt SET and NOT_SET from 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.

pavkam added 2 commits June 25, 2025 15:48
- 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.
@pavkam pavkam requested a review from matus-vacula June 26, 2025 08:33
pavkam added 2 commits June 26, 2025 17:24
- 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.
@pavkam pavkam enabled auto-merge June 26, 2025 16:24
@pavkam pavkam added this pull request to the merge queue Jun 26, 2025
Merged via the queue into main with commit b4ad5e1 Jun 26, 2025
6 checks passed
@pavkam pavkam deleted the harden-evaluation branch June 26, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants