Skip to content

Epic: Segment membership inspection V1 #7405

@khvn26

Description

@khvn26

Ship the ability to count, list, sample, and stream the identities matching a segment, in both self-hosted and Edge API projects.

Settings

  • settings.SEGMENT_MEMBERSHIP_ENABLED — Django boolean. Off by default, gates index maintenance signals so the feature is a dark no-op in self-hosted and SaaS until enabled.

Feature flags

  • segment_membership_index (Flagsmith on Flagsmith) — gates the SaaS rollout per organisation, plus the denylist for outlier orgs.

Core concept

Reduce segment evaluation to set algebra over a finite atom basis, materialise atoms as Roaring bitmaps in core Postgres, compose bitmaps to compute membership. Async maintenance via task processor. Read API exposes count / sample / members. Edge envs populated via DDB scan during backfill (no CDC in v1).

PK-as-ordinal: Identity.id is the bitmap ord directly — no IdentityOrdinal table, no allocation hot path.

User-facing documentation PR: #7399.

Notes

The RFC is the source of truth for design decisions: https://www.notion.so/355a2b634bf9815289b3d070e164f9eb (private to the Flagsmith team). Notable choices baked into v1:

Tech debt knowingly taken on:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions