-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[DROOLS-7493] [DROOLS-7497] executable model wrongly rewrites modify in if-block #5380
Conversation
- Additional tests to cover setter order for properperty reactivity [DROOLS-7497]
This PR is still draft and has several test failures. Firstly, this PR solves the issue in https://issues.redhat.com/browse/DROOLS-7493 A) In exec-model, So I explicitly add Then, another concern arises. Do we want to enlist properties for property reactivity which are set after e.g. In this case,
C) In non-exec-model, So, more or less, there is inconsistency in the behavior. Personaly, I like C.2) behavior (= analyze whole RHS and make them all property reactive), because Could you share your thoughts on this? Thanks! (Sorry, in my |
(tests) - drools job Reproducerexport BUILD_MVN_OPTS_CURRENT=-Dfull -Prun-code-coverage NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution Test results:
Those are the test failures: org.drools.model.codegen.execmodel.PropertyReactivityMatrixTest.assignmentBeforeAndAfterModify_shouldTriggerReactivity[STANDARD_FROM_DRL JAVA][Should trigger property reactivity on value1]Expecting actual: [] to contain exactly (and in same order): ["R2 fired"] but could not find the following elements: ["R2 fired"] org.drools.model.codegen.execmodel.PropertyReactivityMatrixTest.assignmentBeforeAndAfterUpdate_shouldTriggerReactivity[STANDARD_FROM_DRL JAVA][Should trigger property reactivity on value1]Expecting actual: [] to contain exactly (and in same order): ["R2 fired"] but could not find the following elements: ["R2 fired"] org.drools.model.codegen.execmodel.PropertyReactivityMatrixTest.assignmentAfterIfBlockModify_shouldTriggerReactivity[STANDARD_FROM_DRL JAVA][Should trigger property reactivity on value1]Expecting actual: [] to contain exactly (and in same order): ["R2 fired"] but could not find the following elements: ["R2 fired"] org.drools.model.codegen.execmodel.PropertyReactivityMatrixTest.assignmentAfterModify_shouldTriggerReactivity[STANDARD_FROM_DRL JAVA][Should trigger property reactivity on value1]Expecting actual: [] to contain exactly (and in same order): ["R2 fired"] but could not find the following elements: ["R2 fired"] org.drools.model.codegen.execmodel.PropertyReactivityMatrixTest.assignmentBeforeAndAfterUpdate_shouldTriggerReactivity[PATTERN_DSL JAVA][Should trigger property reactivity on value1]Expecting actual: [] to contain exactly (and in same order): ["R2 fired"] but could not find the following elements: ["R2 fired"] org.drools.model.codegen.execmodel.PropertyReactivityMatrixTest.assignmentAfterIfBlockModify_shouldTriggerReactivity[PATTERN_DSL JAVA][Should trigger property reactivity on value1]Expecting actual: [] to contain exactly (and in same order): ["R2 fired"] but could not find the following elements: ["R2 fired"] org.drools.model.codegen.execmodel.PropertyReactivityMatrixTest.assignmentBeforeAndAfterUpdate_shouldTriggerReactivity[PATTERN_DSL MVEL][Should trigger property reactivity on value1]Expecting actual: [] to contain exactly (and in same order): ["R2 fired"] but could not find the following elements: ["R2 fired"] org.drools.model.codegen.execmodel.PropertyReactivityMatrixTest.assignmentAfterIfBlockModify_shouldTriggerReactivity[PATTERN_DSL MVEL][Should trigger property reactivity on value1]Expecting actual: [] to contain exactly (and in same order): ["R2 fired"] but could not find the following elements: ["R2 fired"] |
I agree there should be some consistency eventually, and C.2 seems the good choice. We have considered using the mvel-compiler for MVEL and Java "classic" (non exec model) evaluation as well so once we solve it there it could be possible to have it everywhere, eventually |
Great. It should be nice :) |
This not an obvious choice and deserves a few considerations. First of all, let me do a small digression, starting from user's expectations (that unfortunately cannot be fulfilled and I will explain why). If I write a consequence like:
I would expect that it would be syntactic sugar for something like:
meaning that I'd expect the instruction to be executed in that order. First I set As anticipated however, given the current implementation, this expectation cannot be satisfied because what the Long story short, ideally I'd prefer C.1, but since it doesn't reflect how the fact update is propagated into the engine we are practically obliged to go with C.2. More importantly we need to make sure that the C.2 behavior is enforced consistently with and without exec model and regardless of the dialect. |
Thanks, I completely agree with you. I will also add docs to explain the behavior. |
(tests) - drools job Reproducerexport BUILD_MVN_OPTS_CURRENT=-Dfull -Prun-code-coverage NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution Test results:
Those are the test failures: none See console log: Console Logs[2023-07-11T09:17:30.832Z] at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)[2023-07-11T09:17:30.832Z] at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293) [2023-07-11T09:17:30.832Z] at org.apache.maven.cli.MavenCli.main (MavenCli.java:196) [2023-07-11T09:17:30.832Z] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) [2023-07-11T09:17:30.832Z] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) [2023-07-11T09:17:30.832Z] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) [2023-07-11T09:17:30.832Z] at java.lang.reflect.Method.invoke (Method.java:566) [2023-07-11T09:17:30.832Z] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) [2023-07-11T09:17:30.832Z] at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) [2023-07-11T09:17:30.832Z] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) [2023-07-11T09:17:30.832Z] at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347) [2023-07-11T09:17:30.832Z] [ERROR] [2023-07-11T09:17:30.832Z] [ERROR] Re-run Maven using the -X switch to enable full debug logging. [2023-07-11T09:17:30.832Z] [ERROR] [2023-07-11T09:17:30.832Z] [ERROR] For more information about the errors and possible solutions, please read the following articles: [2023-07-11T09:17:30.832Z] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException [2023-07-11T09:17:30.832Z] [ERROR] [2023-07-11T09:17:30.832Z] [ERROR] After correcting the problems, you can resume the build with the command [2023-07-11T09:17:30.832Z] [ERROR] mvn -rf :drools-drlonyaml-cli-tests [2023-07-11T09:17:31.086Z] + test 1 -eq 0 [Pipeline] } [Pipeline] // withCredentials [Pipeline] } [Pipeline] // dir [Pipeline] } [Pipeline] // script [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Upload artifacts to repository) Stage "Upload artifacts to repository" skipped due to earlier failure(s) [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (check space after build) Stage "check space after build" skipped due to earlier failure(s) [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Declarative: Post Actions) [Pipeline] script [Pipeline] { [Pipeline] sh [2023-07-11T09:17:32.028Z] + wget --no-check-certificate -qO - https://eng-jenkins-csb-business-automation.apps.ocp-c1.prod.psi.redhat.com/job/KIE/job/drools/job/main/job/pullrequest/job/drools.tests.drools/1532/api/json [Pipeline] readJSON [Pipeline] sh [2023-07-11T09:17:32.349Z] + wget --no-check-certificate -qO - https://eng-jenkins-csb-business-automation.apps.ocp-c1.prod.psi.redhat.com/job/KIE/job/drools/job/main/job/pullrequest/job/drools.tests.drools/1532/consoleText [2023-07-11T09:17:32.349Z] + tail -n 50 |
SonarCloud Quality Gate failed. 0 Bugs 96.4% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@mariofusco please merge this PR, thanks! |
…in if-block (apache#5380) * [DROOLS-7493] executable model wrongly rewrites modify in if-block - Additional tests to cover setter order for properperty reactivity [DROOLS-7497] * - analyze whole RHS and make all modification as property reactive * - Add docs about fact modification after modify or update in RHS * - fixing code smells
…in if-block (apache#5380) * [DROOLS-7493] executable model wrongly rewrites modify in if-block - Additional tests to cover setter order for properperty reactivity [DROOLS-7497] * - analyze whole RHS and make all modification as property reactive * - Add docs about fact modification after modify or update in RHS * - fixing code smells
…s modify in if-block (#8) * [DROOLS-7195] Modify syntax fails when using executable model, works … (apache#4846) (apache#4868) * [DROOLS-7195] Modify syntax fails when using executable model, works with mvel runtime (nested properties) * - Dropping 'with' statement support * [DROOLS-7493] [DROOLS-7497] executable model wrongly rewrites modify in if-block (apache#5380) * [DROOLS-7493] executable model wrongly rewrites modify in if-block - Additional tests to cover setter order for properperty reactivity [DROOLS-7497] * - analyze whole RHS and make all modification as property reactive * - Add docs about fact modification after modify or update in RHS * - fixing code smells
…s modify in if-block (#8) (#9) * [DROOLS-7195] Modify syntax fails when using executable model, works … (apache#4846) (apache#4868) * [DROOLS-7195] Modify syntax fails when using executable model, works with mvel runtime (nested properties) * - Dropping 'with' statement support * [DROOLS-7493] [DROOLS-7497] executable model wrongly rewrites modify in if-block (apache#5380) * [DROOLS-7493] executable model wrongly rewrites modify in if-block - Additional tests to cover setter order for properperty reactivity [DROOLS-7497] * - analyze whole RHS and make all modification as property reactive * - Add docs about fact modification after modify or update in RHS * - fixing code smells
Ports
This is a PR for main
for 7.x ? ->
JIRA:
https://issues.redhat.com/browse/DROOLS-7493
https://issues.redhat.com/browse/DROOLS-7497
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 checks
Please add comment: Jenkins retest this
for a specific pull request check
Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] tests
for a full downstream build
run_fdb
a compile downstream build please add comment: Jenkins run cdb
a full production downstream build please add comment: Jenkins execute product fdb
an upstream build please add comment: Jenkins run upstream
for quarkus branch checks
Run checks against Quarkus current used branch
Please add comment: Jenkins run quarkus-branch
for a quarkus branch specific check
Run checks against Quarkus current used branch
Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-branch
for quarkus main checks
Run checks against Quarkus main branch
Please add comment: Jenkins run quarkus-main
for a specific quarkus main check
Run checks against Quarkus main branch
Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-main
for quarkus lts checks
Run checks against Quarkus lts branch
Please add comment: Jenkins run quarkus-lts
for a specific quarkus lts check
Run checks against Quarkus lts branch
Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-lts
for native checks
Run native checks
Please add comment: Jenkins run native
for a specific native check
Run native checks
Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] native
for native lts checks
Run native checks against quarkus lts branch
Please add comment: Jenkins run native-lts
for a specific native lts check
Run native checks against quarkus lts branch
Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] native-lts
How to backport a pull request to a different branch?
In order to automatically create a backporting pull request please add one or more labels having the following format
backport-<branch-name>
, where<branch-name>
is the name of the branch where the pull request must be backported to (e.g.,backport-7.67.x
to backport the original PR to the7.67.x
branch).Once the original pull request is successfully merged, the automated action will create one backporting pull request per each label (with the previous format) that has been added.
If something goes wrong, the author will be notified and at this point a manual backporting is needed.