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

Config v6 #44

Merged
merged 39 commits into from
Mar 4, 2024
Merged

Config v6 #44

merged 39 commits into from
Mar 4, 2024

Conversation

adams85
Copy link
Contributor

@adams85 adams85 commented Jan 25, 2024

Implements config v6 support.

Features/improvements:

  • Fetch new config json version (config_v6.json) and update config model
  • SDK key format validation (when client is not set up to use local-only flag overrides)
  • AND conditions
  • New condition types
    • Prerequisite flag condition
    • Segment condition
  • Changed comparison operators
    • (NOT) CONTAINS ANY OF
  • New comparison operators
    • BEFORE/AFTER
    • TEXT (NOT) EQUALS (both hashed and cleartext)
    • TEXT (NOT) STARTS/ENDS WITH ANY OF (both hashed and cleartext)
    • ARRAY CONTAINS ANY OF (both hashed and cleartext)
  • Percentage options within targeting rules
  • Percentage options based on custom attributes
  • Custom User Object attribute handling (don't force string values + autoconversions under the hood)
  • User Object attribute/comparison value trimming
  • Comparison value hashing changes (SHA256, salting)
  • Flag overrides vs. config json salt and segments
  • EvaluationDetails.getMatchedTargetingRule/getMatchedPercentageOption properties (rename + set combinations correctly)
  • Update ConfigCatClient.getKeyAndValue

Tests:

  • Update cache key/payload tests
  • Evaluation matrix tests
    • Config v1 features (both V1 & V2)
    • Config v2 features
  • Evaluation log tests
  • SDK key format validation
  • Custom User Object attribute handling (don't force string values + autoconversions under the hood)
  • Flag overrides vs. prerequisite flags (circular dependency, comparison value type mismatch, dependent/prereq flag overriding)
  • Flag overrides vs. config json salt and segments
  • EvaluationDetails.getMatchedTargetingRule/getMatchedPercentageOption properties (rename + set combinations correctly)
  • Special character tests (https://trello.com/c/qh4jHrvm)
  • Comparison attribute and comparison value trimming tests (https://trello.com/c/vt8FFrSZ)
  • Comparison attribute conversion to canonical string representation tests (https://trello.com/c/CZgGrrcb)

Related improvements/fixes:

Additional fixes:

  • Fix inconsistent logging of error 1000 in the case of flag overrides.

Additional improvements:

  • Improve consistency of config JSON deserialization error reporting.
  • Add exception message and stack trace to the log format of the default logger.
  • When evaluation fails and there is a related Throwable object, also expose it EvaluationDetails via the new getErrorException property.

Breaking changes:

  • Rename the getError property to getErrorMessage in EvaluationDetails.
  • Rename the getMatchedEvaluationRule property to getMatchedTargetingRule and the getMatchedEvaluationPercentageRule property to getMatchedPercentageOption in EvaluationDetails.
  • Move config JSON attribute descriptor classes from the ConfigCat\Attributes to the ConfigCat\ConfigJson namespace and update them to support config JSON schema v6.

Requirement checklist (only if applicable)

  • I have covered the applied changes with automated tests.
  • I have executed the full automated test set against my changes.
  • I have validated my changes against all supported platform versions.
  • I have read and accepted the contribution agreement.

@adams85 adams85 requested a review from a team as a code owner January 25, 2024 18:28
@adams85 adams85 marked this pull request as draft January 25, 2024 18:29
Copy link

codecov bot commented Jan 25, 2024

Codecov Report

Attention: Patch coverage is 89.11672% with 138 lines in your changes are missing coverage. Please review.

Project coverage is 87.98%. Comparing base (7cb49a4) to head (3db0359).

Files Patch % Lines
src/RolloutEvaluator.php 92.91% 47 Missing ⚠️
src/EvaluateLogBuilder.php 89.77% 23 Missing ⚠️
src/ConfigCatClient.php 80.28% 14 Missing ⚠️
src/Utils.php 83.13% 14 Missing ⚠️
src/ConfigJson/SettingValue.php 73.17% 11 Missing ⚠️
src/Override/LocalFileDataSource.php 50.00% 10 Missing ⚠️
src/ConfigJson/Setting.php 87.17% 5 Missing ⚠️
src/ConfigJson/TargetingRule.php 73.68% 5 Missing ⚠️
src/Cache/ConfigCache.php 0.00% 2 Missing ⚠️
src/ConfigJson/ConditionContainer.php 86.66% 2 Missing ⚠️
... and 3 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #44      +/-   ##
============================================
+ Coverage     86.13%   87.98%   +1.85%     
- Complexity      352      782     +430     
============================================
  Files            28       35       +7     
  Lines           981     1890     +909     
============================================
+ Hits            845     1663     +818     
- Misses          136      227      +91     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adams85 adams85 force-pushed the config-v6 branch 2 times, most recently from d027e39 to 351bd53 Compare January 26, 2024 15:38
…g + improve config json deserialization error reporting
@adams85 adams85 force-pushed the config-v6 branch 2 times, most recently from 75b95da to f47f104 Compare February 8, 2024 21:38
@adams85 adams85 force-pushed the config-v6 branch 4 times, most recently from 106106c to fbb09f8 Compare February 22, 2024 18:02
@adams85 adams85 marked this pull request as ready for review February 23, 2024 10:22
*
* @internal
*/
public static function fixup(array &$config): void
Copy link
Contributor

@kp-cat kp-cat Feb 29, 2024

Choose a reason for hiding this comment

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

I'd prefer a more descriptive function name here: like for example inlineSaltAndSegments

Copy link

sonarcloud bot commented Mar 4, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarCloud

@adams85 adams85 merged commit 60f4f5e into master Mar 4, 2024
15 of 16 checks passed
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.

3 participants