aner-perez opened a new issue, #6509:
URL: https://github.com/apache/incubator-kie-drools/issues/6509

   When multiple rules belonging to the same activation group are activated 
repeatedly by fact changes, only the first activation fires the cancellation of 
other activations in the activation-group.  Subsequent activations result in 
the firing of ALL activated rules in the activation group.  None are cancelled.
   
   A simple ruleset that demonstrates this behavior is as follows.
   
   ```
   package com.example
               
   import StringFact;
               
   rule "First rule in first activation group"
       activation-group "first-group"
       salience 10
   when
       $strf : StringFact(value == "force", count < 5)
   then
   end
   
   rule "Second rule in first activation group"
       activation-group "first-group"
       salience 5
   when
       $strf : StringFact(value == "force", count < 5)
   then
       modify($strf) { setValue("fail") }
   end
   
   rule "Rule without activation group"
       salience 2
   when
       $strf : StringFact(value == "force", count < 1)
   then
       modify($strf) { incrementCount() }
   end
   ```
   The second rule should never fire as long as the first rule has also been 
activated.
   
   This test fails in the 7.x branch as well as the main branch.
   
   I tracked down the issue to differences in 
PhreakRuleTerminalNode.doLeftTupleInsert(...) vs 
PhreakRuleTerminalNode.doLeftTupleUpdate(...).  The insert method calls         
activationsManager.addItemToActivationGroup( leftTuple ) but the update method 
does not.  Adding this call to the update methods allows the test to succeed.
   
   See attached test class for the Drools::Model::Codegen module and 
PhreakRuleTerminalNode.java with suggested fix.  This is my first time looking 
at  this code base so "fix" needs to be evaluated for correctness.
   
   
[ActivationGroupReactivateTest.java](https://github.com/user-attachments/files/23243570/ActivationGroupReactivateTest.java)
   
   
[PhreakRuleTerminalNode.java](https://github.com/user-attachments/files/23243581/PhreakRuleTerminalNode.java)


-- 
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]

Reply via email to