tkobayas commented on PR #6768:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6768#issuecomment-4775257968

   Note that this fix is to make the tuple in the correct state.
   
   Actually, even without this fix, the rule execution works correctly by the 
NPE guard implemented by 
https://github.com/apache/incubator-kie-drools/pull/6707.
   
   ---
   
   UPDATE path (orphan receives UPDATE from a different rule):
   
   With the guard:
   1. modifyActiveTuple → guarded removeDormantTuple detects orphan → skips 
remove
   2. addActiveTuple → tuple enters active → fires
   
   With Approach C:
   1. modifyActiveTuple → removeDormantTuple succeeds (tuple is in dormant, not 
orphan)
   2. addActiveTuple → tuple enters active → fires
   
   Same result. The tuple correctly fires because the no-loop condition no 
longer applies (different rule triggered the UPDATE).
   
   DELETE path (orphan receives DELETE):
   
   With the guard:
   1. doLeftDelete → guarded removeDormantTuple detects orphan → skips remove
   2. setContextObject(null) → tuple cleaned up
   
   With Approach C:
   1. doLeftDelete → removeDormantTuple succeeds (tuple is in dormant, not 
orphan)
   2. setContextObject(null) → tuple cleaned up
   
   Same result.
   
   So functionally the NPE guard is sufficient. The advantage of this fix is:
   - No log noise on every orphan encounter
   - The tuple's list membership is always consistent — no "not in any list but 
still alive" state
   - Doesn't mask a genuine bug where a tuple was incorrectly removed from 
dormant
   


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