Skip to content

Index segment references to dependent flags #8412

Description

@khvn26

Add a dependency index model:

SegmentFlagReference(segment, prerequisite_feature, rule_path)

Acceptance criteria

  • Creating a segment with $.flags conditions creates one index row per referenced feature.
  • Conditions nested in ALL/ANY/NONE rules at any depth are indexed, with a rule_path that points to the originating condition.
  • Editing a segment to add, change or remove a $.flags condition updates the index to match.
  • Deleting or soft-deleting a segment removes its index rows.
  • Publishing a new segment version updates the index row.

    Moved to https://github.com/Flagsmith/flagsmith-private/issues/296.
    -- Evandro

  • A condition referencing a non-existent feature name does not break indexing.

    Decided to reject referencing unknown features, as that would lead to a stale index if the prerequisite feature is created at a later moment. Therefore, a feature needs to exist prior to being made a prerequisite.
    -- Evandro

  • Indexing adds no measurable latency to segment writes on a project with a realistic segment count.
  • Attempting to persist a condition that would close a cycle against live versions any of the project's environment via any amount of nodes raises a validation error that would translate to a user-facing 400 with code: circular_dependency and a path naming each feature + segment.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions