Migrate Core API flag evaluation logic onto Segment.rules_data.
Scope
- Rewrite
map_segment_to_engine and map_segment_rule_to_engine to build engine models from Segment.rules_data instead of segment.rules.all() / rule.conditions.all().
- Remove the
rules / rules__conditions / rules__rules__conditions prefetch chains from the evaluation read path:
projects/services.py.
environments/managers.py.
environments/models.py.
environments/identities/models.py.
Acceptance criteria
- Identity segment evaluation (
Identity.get_segments) returns the same matching segments before and after the change.
- The DynamoDB environment document and the compressed environment document contain identical segment data to the pre-change output.
- The project and environment segment caches feeding the mappers no longer issue rule or condition queries (assert query counts drop).
Migrate Core API flag evaluation logic onto
Segment.rules_data.Scope
map_segment_to_engineandmap_segment_rule_to_engineto build engine models fromSegment.rules_datainstead ofsegment.rules.all()/rule.conditions.all().rules/rules__conditions/rules__rules__conditionsprefetch chains from the evaluation read path:projects/services.py.environments/managers.py.environments/models.py.environments/identities/models.py.Acceptance criteria
Identity.get_segments) returns the same matching segments before and after the change.