Originally, we conceived the segment rules data model so that the frontend would only send a sandwich-like ruleset, in which:
- The root rule has no conditions; rather, it's an
ALL rule housing subrules.
- Subrules of the root rule must own conditions, but could have no subrules.
The API wouldn't imply any restrictions to the shape of a ruleset, so none of these matter when managing segments via the API. However, this means that our UI cannot manage some segments our customer created/updated via the API, because of being incompatible to their ruleset shape.
Some interesting timeline to keep in mind:
The goal of this issue is to yet again simplify segments.
Acceptance criteria
- The frontend can manage segment rules and their conditions given any shape — it might need a major redesign of managing rules.
- The backend loses all logic that restrict or imply that rules cannot be nested, or cannot have conditions, at any nesting level, in all segment write paths.
Originally, we conceived the segment rules data model so that the frontend would only send a sandwich-like ruleset, in which:
ALLrule housing subrules.The API wouldn't imply any restrictions to the shape of a ruleset, so none of these matter when managing segments via the API. However, this means that our UI cannot manage some segments our customer created/updated via the API, because of being incompatible to their ruleset shape.
Some interesting timeline to keep in mind:
SegmentSerializerskips any rules nested deeper than a second level — which arguably makes it worse, as there's no error raised to inform the requester.ANYroot rules.Segment.rulesbecame a JSON field, which greatly simplified the multiple parts of the system dealing with segment rules.SegmentSerializerwas improved to reject rules nested too deep, and typing was improved a notch.The goal of this issue is to yet again simplify segments.
Acceptance criteria