oschingka opened a new issue, #2346: URL: https://github.com/apache/incubator-kie-issues/issues/2346
Problem Statement In B-FEEL dialect, relational comparison expressions with non-boolean operands evaluate to false even when they should evaluate to true. This affects operators: >, >=, <, <=, and between. Examples of incorrect behavior: - 5 > 2 returns false - 2 < 5 returns false - 5 >= 5 returns false - count([1,2,3]) > 0 returns false - 5 between 2 and 9 returns false Expected Behavior B-FEEL should produce the same logical comparison result as FEEL for valid numeric/date/duration comparisons. Actual Behavior B-FEEL returns false for these non-boolean comparison expressions without raising an error (silent failure). Root Cause The issue appears in B-FEEL relational operator predicate matching order in kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/ast/dialectHandlers/BFEELDialectHandler.java. A buggy predicate is present in all four operator maps: - getGteOperations at line 218 - getGtOperations at line 264 - getLteOperations at line 300 - getLtOperations at line 346 For non-boolean operands, this predicate matches too early, coerces values to Boolean.FALSE, and returns false before the correct numeric comparison predicate can run. Between is affected transitively because it delegates to GTE/LTE in kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/ast/BetweenNode.java at line 116. Impact Assessment Severity: High Impact details: - Threshold logic silently collapses to else branch - Eligibility/range checks can fail open or fail closed depending on model design - Decision table rules using numeric ranges are unreliable under B-FEEL - Silent failure makes this hard to detect in production Observed impact matrix: - 5 > 2: B-FEEL false, FEEL true - 2 < 5: B-FEEL false, FEEL true - 5 >= 5: B-FEEL false, FEEL true - count(list) > 0: B-FEEL false, FEEL true - 5 between 2 and 9: B-FEEL false, FEEL true Reproduction A regression test was added here: kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/BFeelRelationalOperatorRegressionTest.java Command: mvn test -pl kie-dmn/kie-dmn-feel -Dtest=BFeelRelationalOperatorRegressionTest Notes: - Min/max-based workaround expressions evaluate correctly under B-FEEL - Raw relational operators currently reproduce the bug Suggested Fix Direction Remove the four buggy early-match predicates in BFEELDialectHandler so non-boolean comparisons are handled by the correct numeric/date/duration comparison predicates. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
