Skip to content

Evaluate segments from the stored JSON #7816

@khvn26

Description

@khvn26

Migrate Core API flag evaluation logic onto Segment.rules_data.

Scope

  1. 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().
  2. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiIssue related to the REST API

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions