Skip to content

Add list value filtering across experiments, feature flags, and segments - #3286

Open
zackcl wants to merge 3 commits into
devfrom
feature/3284-list-value-filtering
Open

Add list value filtering across experiments, feature flags, and segments#3286
zackcl wants to merge 3 commits into
devfrom
feature/3284-list-value-filtering

Conversation

@zackcl

@zackcl zackcl commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Resolves #3284

Changes

  • Add a List Value filter to the Experiments, Feature Flags, and Segments pages.
  • Include list values in each page's All search.
  • Support case-insensitive partial matching for individual and group IDs in direct and nested lists.
  • Respect Include All behavior while searching applicable inclusion and exclusion lists.
  • Add unit and integration coverage for list-value filtering.

@zackcl
zackcl requested review from bcb37 and danoswaltCL and a lite review from Copilot August 12, 2026 17:42
@zackcl zackcl self-assigned this Aug 12, 2026
@zackcl
zackcl marked this pull request as ready for review August 12, 2026 17:43
@zackcl
zackcl requested a lite review from Copilot and removed request for Copilot August 12, 2026 18:06
@zackcl
zackcl requested a balanced review from Copilot August 12, 2026 18:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds list-value filtering to experiments, feature flags, and segments, resolving #3284.

Changes:

  • Adds List Value search options and API enums.
  • Implements partial, case-insensitive recursive list matching.
  • Adds unit and integration coverage.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/types/src/Experiment/enums.ts Adds shared search keys.
packages/frontend/.../segment-root-section-card.component.ts Adds segment filter option.
packages/frontend/.../feature-flag-root-section-card.component.ts Adds feature-flag filter option.
packages/frontend/.../experiment-root-section-card.component.ts Adds experiment filter option.
packages/backend/src/api/services/listValueSearchHelpers.ts Builds recursive list-value predicates.
packages/backend/src/api/services/SegmentService.ts Applies segment list-value filtering.
packages/backend/src/api/services/FeatureFlagService.ts Applies feature-flag filtering.
packages/backend/src/api/services/ExperimentService.ts Applies experiment filtering.
packages/backend/src/api/controllers/validators/SegmentPaginatedParamsValidator.ts Accepts segment search key.
packages/backend/src/api/controllers/validators/FeatureFlagsPaginatedParamsValidator.ts Accepts feature-flag search key.
packages/backend/src/api/controllers/SegmentController.ts Documents the new filter.
packages/backend/src/api/controllers/FeatureFlagController.ts Documents the new filter.
packages/backend/src/api/controllers/ExperimentController.ts Documents the new filter.
packages/backend/test/unit/services/SegmentService.test.ts Tests segment search clauses.
packages/backend/test/unit/services/FeatureFlagService.test.ts Tests feature-flag search clauses.
packages/backend/test/unit/services/ExperimentService.test.ts Tests experiment search clauses.
packages/backend/test/unit/services/listValueSearchHelpers.test.ts Tests shared query helpers.
packages/backend/test/integration/ListValueFiltering/index.ts Tests end-to-end filtering behavior.
packages/backend/test/integration/index.test.ts Registers the integration scenario.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/backend/src/api/services/listValueSearchHelpers.ts Outdated
@zackcl
zackcl marked this pull request as draft August 12, 2026 18:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated no new comments.

Suppressed comments (2)

packages/backend/src/api/controllers/FeatureFlagController.ts:246

  • The updated OpenAPI enum is still incomplete: id is accepted by FLAG_SEARCH_KEY and exposed by the feature-flag page, but is omitted here. Add it so generated API documentation accurately describes the endpoint.
   *                    enum: [all, name, key, status, tag, context, listValue]

packages/backend/src/api/services/listValueSearchHelpers.ts:14

  • These leading-wildcard ILIKE predicates cannot use the existing primary-key B-tree indexes, and no trigram indexes exist for these columns. Consequently, every List Value search—and now every All search—sequentially scans both membership tables (once for data and again for counts), which will become expensive on large lists. Add a migration enabling pg_trgm and GIN trigram indexes for individual_for_segment."userId" and group_for_segment."groupId".
    WHERE "userId" ILIKE :${LIST_VALUE_SEARCH_PATTERN_PARAMETER} ESCAPE '\\'
    UNION
    SELECT "segmentId" AS "id"
    FROM "group_for_segment"
    WHERE "groupId" ILIKE :${LIST_VALUE_SEARCH_PATTERN_PARAMETER} ESCAPE '\\'

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated no new comments.

Suppressed comments (1)

packages/backend/src/api/services/listValueSearchHelpers.ts:14

  • These leading-wildcard ILIKE checks are executed on every keyup for both List Value and All, but the membership tables only have their composite primary-key indexes and no trigram indexes. PostgreSQL therefore must scan both complete value tables for each data and count query before running the recursive traversal, so root-page searches will scale with total list membership. Add pg_trgm indexes for individual_for_segment.userId and group_for_segment.groupId in a migration; also gate or debounce very short searches, for which trigram indexes cannot help effectively.
    WHERE "userId" ILIKE :${LIST_VALUE_SEARCH_PATTERN_PARAMETER} ESCAPE '\\'
    UNION
    SELECT "segmentId" AS "id"
    FROM "group_for_segment"
    WHERE "groupId" ILIKE :${LIST_VALUE_SEARCH_PATTERN_PARAMETER} ESCAPE '\\'

@zackcl
zackcl marked this pull request as ready for review August 12, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support filtering experiments, feature flags, and segments by list values

2 participants