apache / incubator-kie-drools

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

kie-issues#1448: `matches()` function wrongly behaves #6085

Closed yesamer closed 2 months ago

yesamer commented 2 months ago

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

According to the DMN specs, the matches() and replace() functions should behave according to the xQuery 1.0 specification. Our current implementation doesn't rely on that, using the native Java implementation to manage both. Unfortunately, the Java regex management differs from the xQuery specs, and natively implementing the xQuery specs leads to huge effort (and complex) work. For that reason, we agreed to rely on an external library that already implemented xQuery specs in Java. After a quick analysis (https://en.wikipedia.org/wiki/XQuery#Implementations), we choose Saxon-He as the best fit for this purpose.

The scope of the ticket is to integrate this new external dependency into our code base, so that both matches() and replace() can rely on that implementation to correctly behave.

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 months 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/6085 --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-6085/1/display/redirect

Test results:

Those are the test failures:

org.kie.maven.plugin.it.kie-maven-plugin-test-kjar-2.kie-maven-plugin-test-kjar-2 The build exited with code 143. See /home/jenkins/jenkins-agent/workspace/llrequest_jobs_drools-pr_PR-6085/kogito-pipelines/bc/apache_incubator-kie-drools/kie-maven-plugin/target/it/kie-maven-plugin-test-kjar-2/build.log for details.
yesamer commented 2 months ago

@gitgabrio Tests fixed.

yesamer commented 2 months ago

@pibizza I applied your suggestion in all the places where I'm sure the parameter will always be a constant (basically all the exceptions). Thank you!

yesamer commented 2 months ago

Failures:

apache_incubator-kie-kogito-runtimes/quarkus/integration-tests/integration-tests-quarkus-processes/src/test/java/org/kie/kogito/integrationtests/quarkus/ProcessSvgAddonIT.java
apache_incubator-kie-kogito-runtimes/springboot/addons/process-svg/src/test/java/org/kie/kogito/svg/service/SpringBootProcessSvgServiceTest

on runtimes are unrelated to these PR changes.