Skip to content
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

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

Merged
merged 23 commits into from
Sep 18, 2024

Conversation

yesamer
Copy link
Contributor

@yesamer yesamer commented Sep 16, 2024

Closes: apache/incubator-kie-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 to handle cross repository builds and be sure that we always use latest version of the code for each repository.

build-chain tool 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 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

Copy link
Contributor

@gitgabrio gitgabrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @yesamer
I would ask just a couple minor adjustments

@kie-ci3
Copy link

kie-ci3 commented Sep 16, 2024

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 #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:

  • PASSED: 22180
  • FAILED: 1

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
Copy link
Contributor Author

yesamer commented Sep 17, 2024

@gitgabrio Tests fixed.

Copy link
Contributor

@gitgabrio gitgabrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx @yesamer !

Copy link
Contributor

@pibizza pibizza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly some fixes to make the tests clearer and crisper.

@yesamer
Copy link
Contributor Author

yesamer commented Sep 17, 2024

@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!

Copy link
Contributor

@pibizza pibizza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yesamer
Copy link
Contributor Author

yesamer commented Sep 18, 2024

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.

@gitgabrio gitgabrio merged commit 8dac313 into apache:main Sep 18, 2024
9 of 10 checks passed
@yesamer yesamer deleted the kie-issues#1448-2 branch September 18, 2024 07:04
rgdoliveira pushed a commit to rgdoliveira/drools that referenced this pull request Oct 3, 2024
* matches and replace using saxon

* saxon usage simplified and modified tests

* clean up code as per standards

* changes as per suggestions

* changes as per suggestions and restored the earlier tests

* changes as per suggestions and restored the earlier tests

* changes as per suggestions

* exceptions handled and changes to util class

* wip

* wip

* wip

* wip

* wip

* CR

* CR

* CR

* CR

* Notice updated

* CR

---------

Co-authored-by: bncriju <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

matches() function wrongly behaves
6 participants