Incomplete "Rules to be applied" summary when accepting a new nodes when using groups of groups
I defined a Group A, dynamic, with all nodes
I defined Group B, dynamic, that contains all nodes of group A
I defined a Rule Z, applied to group B
When I accept a node, I'd expect Rule Z to show up in the list of rules to be applied, but it ain't
Note: the same issue will happen with Nodecycle for rules on non-default lifecycle
Fixes #12060: Incomplete \"Rules to be applied\" summary when accepting a new nodes when using groups of groups
#6 Updated by François ARMAND 9 months ago
So, this is how I think we can solve it.
We already have a function which, given a query, is able to tell which nodes match it.
Any dyngroup can be decompose in a simple, fully computable query and the dependance towards other groups, i.e towards other queries (and that, recursively).
The composition between the simple part and the group is either an AND (intersection of nodeids set) or an OR (union of nodeids).
So now, we can build a simple algo with 3 queues: TODO, BLOCKED, DONE. All dyn groups start in TODO. Then, we proceed the TODO queue iteratively. When a node has N dep (N > 0), it goes into BLOCKED.
Then, each time a group is fully computable (no dep), the set of nodeid matching it is evaluated, and it goes into DONE.
At that point, we put back each group in BLOCKED which were only blocked by the newly finished group at the end of TODO queue, and for each, we intersect or union the set of nodes matching.
We are sure to progress by at least one element in TODO (even when we put back some from BLOCKED, and BLOCKED never get refilled), so at some point TODO is empty. If some groups remain in BLOCKED, it means their dependencies can't be computed (mutual dependencies of dep towards static groups). We set these dependencies to nodeids == empty set, and we do the final TODO processing (after union/intersec).
An imagine to illustrate the process (it misses the last step where we zeroïze dependencies of group in the BLOCKED queue at the end)
#7 Updated by François ARMAND 9 months ago
Work in progess here: https://github.com/fanf/rudder/commit/61c5af46ec0842e832a29c7247178f7f3ff1e5f2
#8 Updated by François ARMAND 9 months ago
Work in progess here: https://github.com/fanf/rudder/commit/f12ddd4f751d67f1d9abdf6d5413c9bcd20f05d6