fix: respect rule type for sub-rules in segment evaluation#36
Merged
Conversation
Sub-rules were always evaluated with ALL logic, ignoring the parent rule's type field (ANY/ALL/NONE). Now uses type-aware matching for sub-rules in both the new context-based evaluator and the legacy evaluator. Also fixes the NONE rule type in the legacy evaluator which was hardcoded to always return true. Bumps engine-test-data from v3.5.0 to v3.7.0 which includes test cases for this fix. Equivalent fix to flagsmith-engine#313. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
khvn26
previously approved these changes
May 7, 2026
gagantrivedi
requested changes
May 7, 2026
Address review feedback: - Replace imperative loop in matches_sub_rules_by_rule_type with iterator combinators (all/any/!any) matching the legacy form - Extract matches_by_rule_type helper in legacy evaluator to DRY up the duplicated ANY/ALL/NONE match blocks Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
gagantrivedi
approved these changes
May 8, 2026
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.
Summary
engine_eval/segment_evaluator.rs): sub-rules now respect the parent rule's type (ANY/ALL/NONE) instead of hardcoding ALLsegments/evaluator.rs): same sub-rules fix + fixed NONE rule type for conditions (was hardcoded totrue)Equivalent fix to flagsmith-engine#313.
Test plan