-
Notifications
You must be signed in to change notification settings - Fork 39
Runtime rules engine #54
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: master
Are you sure you want to change the base?
Runtime rules engine #54
Conversation
TODO: update constructors, then write first +/- test using rules engine
It was a faulty rule, logic works perfectly
Helps with debugging.
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.
Pull request overview
This PR introduces a runtime rules engine for feature flags using JsonLogic, enabling complex runtime evaluation rules beyond the simple key-value matching previously supported. The implementation maintains backward compatibility by keeping the legacy runtime evaluation alongside the new JsonLogic-based system.
Key Changes
- Added JsonLogic dependency for complex rule evaluation with case-insensitive matching
- Introduced new utility classes (
JsonLogicEngine,JsonCaseDesensitizer) to handle JsonLogic rule evaluation and case normalization - Extended
Rolloutmodel to support both legacy and new runtime evaluation formats
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Added json-logic-java dependency (v1.1.0) and configured Surefire plugin for test logging |
| src/test/resources/logging.properties | New logging configuration for test output |
| src/main/java/com/mixpanel/mixpanelapi/featureflags/model/Rollout.java | Extended to support both legacy runtime evaluation and new JsonLogic rules with backward-compatible constructors |
| src/main/java/com/mixpanel/mixpanelapi/featureflags/provider/LocalFlagsProvider.java | Updated flag evaluation logic to check both legacy and new runtime conditions |
| src/main/java/com/mixpanel/mixpanelapi/featureflags/util/JsonLogicEngine.java | New utility class for evaluating JsonLogic rules with case-insensitive data handling |
| src/main/java/com/mixpanel/mixpanelapi/featureflags/util/JsonCaseDesensitizer.java | New utility for case-insensitive normalization of JSON structures and Maps |
| src/test/java/com/mixpanel/mixpanelapi/featureflags/provider/LocalFlagsProviderTest.java | Added comprehensive tests for new JsonLogic runtime evaluation (16 new test cases) and updated existing tests to use constants |
src/main/java/com/mixpanel/mixpanelapi/featureflags/util/JsonLogicEngine.java
Outdated
Show resolved
Hide resolved
src/main/java/com/mixpanel/mixpanelapi/featureflags/util/JsonLogicEngine.java
Outdated
Show resolved
Hide resolved
src/main/java/com/mixpanel/mixpanelapi/featureflags/util/JsonCaseDesensitizer.java
Outdated
Show resolved
Hide resolved
src/main/java/com/mixpanel/mixpanelapi/featureflags/util/JsonCaseDesensitizer.java
Outdated
Show resolved
Hide resolved
src/main/java/com/mixpanel/mixpanelapi/featureflags/util/JsonLogicEngine.java
Show resolved
Hide resolved
src/main/java/com/mixpanel/mixpanelapi/featureflags/provider/LocalFlagsProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/com/mixpanel/mixpanelapi/featureflags/util/JsonCaseDesensitizer.java
Show resolved
Hide resolved
…ogicEngine.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…aseDesensitizer.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ocalFlagsProvider.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…out.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…anel-java into runtime-rules-engine
reduce likelihood of future bug due to edge case in the util
Support complex runtime rules defined in JsonLogic DML.