mdproctor opened a new issue, #6712: URL: https://github.com/apache/incubator-kie-drools/issues/6712
## Summary Build `ReteEngine` — the real incremental Rete evaluation engine for vol2. Replaces `BruteForceCompiledEngine` (explicitly temporary stub) as the default engine returned by `EvaluationEngine`. ## Context `BruteForceCompiledEngine` re-reads `RuleDescriptor` sources/filters/heads directly at `createUnit()` time rather than traversing the Rete network. It was written explicitly to keep tests green while the real engine was designed. The design is now complete (see DESIGN-NOTES.md, 2026-05-07). ## Design (from DESIGN-NOTES.md) **Two-phase lifecycle:** 1. `compile(finalizedRuleBase)` — called once per rulebase change. Traverses the finalized Rete network using `isAssociatedWith(rule)`. For each rule, resolves its JoinNode chain and slot assignments. Creates stateless `UnitProcessor` instances (`JoinLeftInlet`, `JoinRightInlet`, filter wrappers, `Action1`/`Fn1` heads). Pre-compiles fan-out where multiple rules share a slot (via `FanOutUnitProcessor`). Returns a `CompiledEngine`. 2. `CompiledEngine.createUnit(ctx)` — called per unit instance. Allocates per-unit state (`NodeMemories`, `Agenda`, `ContextPojoDS`). Subscribes the pre-compiled `UnitProcessor`s to the Router. Zero traversal, zero allocation of new processors. **UnitProcessor instances are stateless → shared across unit instances.** Same processor objects created in `compile()` serve all unit instances of the same compiled rulebase. `createUnit()` is just reference subscription. **Router is shared, configured in `compile()`** — not per unit as in BruteForceCompiledEngine. ## Scope - `ReteEngine implements EvaluationEngine` — `compile()` traverses finalized Rete, builds shared Router + stateless `UnitProcessor` chain - `ReteCompiledEngine implements CompiledEngine` — holds shared Router + pre-compiled processors; `createUnit()` appends context to Router, returns `UnitInstance` - Wire up `RuleBase` to use `ReteEngine` by default - All existing tests must pass against the real engine ## Parent epics #6684, #6639 -- 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]
