Rikkola opened a new issue, #7134:
URL: https://github.com/apache/incubator-kie/issues/7134
### Describe the bug
When two or more rules in **different packages** share a not-subnetwork of
the form `not( X() and Y() from $list )`, incremental compilation calls
`EagerPhreakBuilder.processSplit()` to split the inner subnetwork segment.
After the split, the rule fires initially but then silently stops firing in two
distinct scenarios:
**Scenario A — fact retraction**
Insert a Container that suppresses the rule, then retract it. The rule never
re-fires.
**Scenario B — sibling rule removal**
Remove one of the sharing rules at runtime (`removeRule`). The surviving
rule never re-fires after the sibling is removed.
**Root causes**
_Scenario A — four defects in the split/unlink path:_
- `EagerPhreakBuilder` left sibling `PathMemory.segmentMemories[]` slots
`null` after the split, corrupting bitmask and linking calculations.
- `SegmentMemorySupportImpl.initializeChildSegmentsIfNeeded` early-returned
if the segment already had one child, skipping sibling sinks introduced by the
split.
- T`upleToObjectNode.unlinkedSegment` did not notify downstream subnetwork
sinks unless the full rule link status transitioned.
- `SingleObjectSinkAdapter` re-linked `NotNode` without staging existing
left tuples as updates, so re-evaluation was never scheduled.
_Scenario B — missing guard in `removeExistingPaths`:_
The second loop (lines 651–686) in `EagerPhreakBuilder.removeExistingPaths`
did not guard against shared `TupleToObjectNode` end nodes
(`associatedTerminalsSize > 1`), unlike the first loop which already skipped
them. This caused the `SubnetworkPathMemory` to be stripped from the inner
segment's `pathMemories`, breaking the re-link notification chain.
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
```
// Package B
not ( $c : Container() and String( this == "blocked" ) from $c.items )
// Package C (triggers the segment split)
not ( $c : Container() and String( this == "special" ) from $c.items )
```
1. Build a `KieBase` from both packages.
2. Insert `new Container("blocked")` → only package C's rule fires.
3. Retract the Container → **expected**: both rules fire. **Actual**:
package C's rule never fires again.
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Kogito version or git rev (or at least Quarkus version if you are using
Kogito via Quarkus platform BOM)
_No response_
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_
--
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]