flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

feat: Add `version_of` and matches to rules and conditions

Open zachaysan opened this issue 9 months ago • 4 comments

Changes

When creating a new change request for segments we need a way of tracing which provided rules and conditions match the candidate change request so that the frontend can more visually associate which rules and conditions match between the change request and the targeted segment (the one that will be updated).

To do so I've reused the concept of version_of which was originally used for segments and I associate a rule to another rule (or sub-rule to sub-rule) and in that process also match up conditions at the same layer. If at least one condition matches, then the sub-rule and rule match and future matching for the subsequent sub-rule is guided by holding onto the match between the parent rule and its sister rule. This way matches are only ever tree like in nature.

Remaining work

Since the matching code is ready in this PR another PR will need to be opened to tie in these changes into the relevant code. Probably both the Workflows and Commons will need to be updated.

How did you test this code?

Lots of new tests. Some are simple, like checking that version_of gets correctly set, which is necessary due to an audit log bug we had when version_of was setup for the segments work.

zachaysan avatar Jan 10 '25 14:01 zachaysan