apache / incubator-kie-drools

Drools is a rule engine, DMN engine and complex event processing (CEP) engine for Java.
http://www.drools.org
5.85k stars 2.49k forks source link

Kie issues#1448 - matches() function wrongly behaves - negation syntax translation #6083

Closed bncriju closed 2 weeks ago

bncriju commented 2 weeks ago

Fixes https://github.com/apache/incubator-kie-issues/issues/1448

Thank you for submitting this pull request

NOTE!: Double-check the target branch for this PR. The default is main so it will target Drools 8 / Kogito.

Ports If a forward-port or a backport is needed, paste the forward port PR here

Issue: (please edit the GitHub Issues link if it exists)

referenced Pull Requests: (please edit the URLs of referenced pullrequests if they exist)

How to replicate CI configuration locally? Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use [build-chain tool](https://github.com/kiegroup/github-action-build-chain) to handle cross repository builds and be sure that we always use latest version of the code for each repository. [build-chain tool](https://github.com/kiegroup/github-action-build-chain) is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See [local execution](https://github.com/kiegroup/github-action-build-chain#local-execution) details to get more information about it.
How to retest this PR or trigger a specific build: - for pull request and downstream checks - Push a new commit to the PR. An empty commit would be enough. - for a full downstream build - for github actions job: add the label `run_fdb` - for Jenkins PR check only - If you are an ASF committer for KIE podling, login to Jenkins (https://ci-builds.apache.org/job/KIE/job/drools/), go to the specific PR job, and click on `Build Now` button.
kie-ci3 commented 2 weeks ago

PR job #1 was: UNSTABLE Possible explanation: This should be test failures

Reproducer build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-drools -u https://github.com/apache/incubator-kie-drools/pull/6083 --skipParallelCheckout NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution

Please look here: https://ci-builds.apache.org/job/KIE/job/drools/job/main/job/pullrequest_jobs/job/drools-pr/job/PR-6083/1/display/redirect

Test results:

Those are the test failures:

org.kie.dmn.feel.documentation.ADocFEELExamplesTest.test Cannot invoke "java.net.URL.toURI()" because "resource" is null
org.kie.dmn.feel.documentation.FromSpecificationNotInAdocTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[21] [Evaluating: 'matches("foobar", "^fo*b") = true']
expected: true
but was: false
org.kie.dmn.feel.documentation.FromSpecificationNotInAdocTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[22] [Evaluating: 'matches("foobar", "^fo*b") = true']
expected: true
but was: false
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[3] [Evaluating: 'replace( " foo bar zed ", "^(\s)+|(\s)+$|\s+(?=\s)", "" )']
expected: "foo bar zed"
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[4] [Evaluating: 'replace( " foo bar zed ", "^(\s)+|(\s)+$|\s+(?=\s)", "" )']
expected: "foo bar zed"
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[71] [Evaluating: 'matches("foo", "[a-z]{3}")']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[72] [Evaluating: 'matches("foo", "[a-z]{3}")']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[73] [Evaluating: 'matches("banana", "[a-z]{3}")']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[74] [Evaluating: 'matches("banana", "[a-z]{3}")']
expected: true
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[75] [Evaluating: 'matches("two \n lines", "two.*lines")']
expected: false
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[76] [Evaluating: 'matches("two \n lines", "two.*lines")']
expected: false
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[79] [Evaluating: 'matches("one\ntwo\nthree", "^two$")']
expected: false
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[80] [Evaluating: 'matches("one\ntwo\nthree", "^two$")']
expected: false
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[83] [Evaluating: 'matches("FoO", "foo")']
expected: false
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[84] [Evaluating: 'matches("FoO", "foo")']
expected: false
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[87] [Evaluating: 'replace("banana","a","o")']
expected: "bonono"
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[88] [Evaluating: 'replace("banana","a","o")']
expected: "bonono"
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[89] [Evaluating: 'replace("banana","(an)+", "**")']
expected: "b**a"
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[90] [Evaluating: 'replace("banana","(an)+", "**")']
expected: "b**a"
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[91] [Evaluating: 'replace("banana","[aeiouy]","[$0]")']
expected: "b[a]n[a]n[a]"
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[92] [Evaluating: 'replace("banana","[aeiouy]","[$0]")']
expected: "b[a]n[a]n[a]"
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[93] [Evaluating: 'replace("0123456789","(\d{3})(\d{3})(\d{4})","($1) $2-$3")']
expected: "(012) 345-6789"
but was: null
org.kie.dmn.feel.runtime.FEELFunctionsTest.instanceTest(String, Object, Severity, FEEL_TARGET, Boolean, FEELDialect)[94] [Evaluating: 'replace("0123456789","(\d{3})(\d{3})(\d{4})","($1) $2-$3")']
expected: "(012) 345-6789"
but was: null
org.kie.dmn.feel.runtime.functions.RangeFunctionTest.evaluateWithInvalidFunctionInvocationNode Expected 'retrieved.isLeft()' from, [matches("foo", "[a-z]{3}")..matches("foo", "[a-z]{3}")]
org.kie.dmn.feel.runtime.functions.ReplaceFunctionTest.invokeWithoutFlagsPatternNotMatches java.lang.ClassCastException: Cannot cast net.sf.saxon.str.BMPString to java.lang.String
org.kie.dmn.feel.runtime.functions.ReplaceFunctionTest.invokeWithFlagDotAll java.lang.ClassCastException: Cannot cast net.sf.saxon.str.BMPString to java.lang.String
org.kie.dmn.feel.runtime.functions.ReplaceFunctionTest.invokeWithFlagMultiline java.lang.ClassCastException: Cannot cast net.sf.saxon.str.BMPString to java.lang.String
org.kie.dmn.feel.runtime.functions.ReplaceFunctionTest.invokeWithAllFlags java.lang.ClassCastException: Cannot cast net.sf.saxon.str.BMPString to java.lang.String
org.kie.dmn.feel.runtime.functions.ReplaceFunctionTest.invokeWithFlagCaseInsensitive java.lang.ClassCastException: Cannot cast net.sf.saxon.str.Twine16 to java.lang.String
org.kie.dmn.feel.runtime.functions.ReplaceFunctionTest.invokeWithoutFlagsPatternMatches java.lang.ClassCastException: Cannot cast net.sf.saxon.str.Twine16 to java.lang.String
org.kie.dmn.feel.util.XQueryImplUtilTest.executeReplaceFunctionTest java.lang.ClassCastException: Cannot cast net.sf.saxon.str.Twine16 to java.lang.String
yesamer commented 2 weeks ago

Superseded by https://github.com/apache/incubator-kie-drools/pull/6085