Fixes #23469: Reporting by node is not correct on directives and Rules
https://issues.rudder.io/issues/23469
This pr is mostly replicating ComponentStatusReport behavior on other compliance view/types (mostly, applying blocks reporting logic)
I guess that we may have to refactor this and find out how to provide some abstraction over this. I have quite some idea but ...
It also simplifies a lot how the reports were regrouped by node, we were doing something really complicated but we just need to go deeper first (https://github.com/Normation/rudder/pull/5050/files#diff-c69298aa223fd7b6060cbed8a56d0472af28fd9ca9acdd466afc4f599ca56b8cL390 ) no more group by. Just explore at each level then regroup, almost again like we are doing for ComponentStatusReport ...
I also changed some "static" def, on several objects from def to val or lazy val. I think that may save us some computation time if we called them several times
So, better understanding: it is not something that was wrong, more a missing feature. I think it needs at least a second pass to:
- change val into lazy val,
- be more specific about what is necessary at each level, remove code duplication. There is several part where we have the same or almost the same logic copy/pasted, it will be extremelly hard to maintain
- add unit tests to have non-regression tests on meaning going forward. These parts are horrible to track for subtile changes, we need assessment of these changes and have automatic alarms when we are changing behavior