Skip to content

feat(PoC): Segment membership inspection#7394

Draft
khvn26 wants to merge 2 commits intomainfrom
spike/5663-segment-identity-list
Draft

feat(PoC): Segment membership inspection#7394
khvn26 wants to merge 2 commits intomainfrom
spike/5663-segment-identity-list

Conversation

@khvn26
Copy link
Copy Markdown
Member

@khvn26 khvn26 commented May 3, 2026

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to #5663.

PoC for segment membership inspection. Adds the segment_membership Django app: a Roaring-bitmap-backed index that lets us count, list, sample, and stream the identities matching a segment.

Atoms are unary predicates over (property, operator, operand); each unique atom owns one bitmap of Identity.id values, and segment membership composes via Boolean ops on those bitmaps. Async maintenance runs through flagsmith-task-processor.

Maintenance fires only when settings.SEGMENT_MEMBERSHIP_ENABLED = True, so this is a dark no-op in self-hosted and SaaS until the flag is flipped. User-facing docs and the API surface will follow in separate PRs.

How did you test this code?

  • pytest tests/unit/segment_membership — smoke tests cover the operator vocabulary end-to-end with a differential check against is_context_in_segment.
  • mypy segment_membership tests/unit/segment_membership clean in strict mode.
  • Stress-tested locally up to 1M identities × 311 segments via manage.py stress_test_segment_membership.

Adds the `segment_membership` Django app — a Roaring-bitmap-backed index
that lets us count, list, sample, and stream the identities matching a
segment. Atoms are unary predicates over (property, operator, operand);
each unique atom gets one bitmap of `Identity.id` values, and segment
membership composes via Boolean ops on those bitmaps. Async maintenance
runs via flagsmith-task-processor.

Includes smoke tests covering the operator vocabulary end-to-end with a
differential check against `is_context_in_segment`.

Maintenance fires only when `settings.SEGMENT_MEMBERSHIP_ENABLED = True`,
so this is dark-no-op in self-hosted and SaaS until enabled.

beep boop
@vercel
Copy link
Copy Markdown

vercel Bot commented May 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment May 4, 2026 9:28am
flagsmith-frontend-preview Ready Ready Preview, Comment May 4, 2026 9:28am
flagsmith-frontend-staging Ready Ready Preview, Comment May 4, 2026 9:28am

Request Review

@github-actions github-actions Bot added api Issue related to the REST API docs Documentation updates labels May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant