Skip to content

feat: allow any operator in segment top rule#7427

Open
Zaimwa9 wants to merge 6 commits intodeps/bump-flag-engine-versionfrom
feat/allow-any-operator-in-segment-top-rule
Open

feat: allow any operator in segment top rule#7427
Zaimwa9 wants to merge 6 commits intodeps/bump-flag-engine-versionfrom
feat/allow-any-operator-in-segment-top-rule

Conversation

@Zaimwa9
Copy link
Copy Markdown
Contributor

@Zaimwa9 Zaimwa9 commented May 6, 2026

Thanks for submitting a PR! Please check the boxes below:

  • 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 #7400

Adds frontend support for top-level ANY rule type in the segment editor, enabling segments like (env=Prod AND id=1) OR (env=QA AND id=2).

  • New InlinePillToggle component (with small/medium/large sizes + Storybook story) for the ALL/ANY selector
  • Selector is gated behind the segment_any_rule_type feature flag
  • Switching between ALL and ANY converts all sub-rule types accordingly (ANY ↔ ALL)
  • Sub-rule dividers and condition labels (And/Or) update based on top-level type
  • "Add AND NOT Condition" hidden in ANY mode
  • Warning shown when top-level rules have mixed types (from API-created segments)
  • Diff display (diff-utils.ts) handles ALL sub-rule types and dynamic connectors

How did you test this code?

Manually:

  1. Enable segment_any_rule_type flag, open a project, create a new segment
  2. Toggle the pill to ANY — verify labels become "Or", button becomes "Add OR Condition", "Add AND NOT" disappears
  3. Add multiple OR groups with AND-ed conditions, save, reload — structure persists
  4. Toggle back to ALL — sub-rules convert back to ANY
  5. Open an API-created segment with mixed top-level types — warning displays

@Zaimwa9 Zaimwa9 requested a review from a team as a code owner May 6, 2026 07:24
@Zaimwa9 Zaimwa9 requested review from talissoncosta and removed request for a team May 6, 2026 07:24
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

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

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

Request Review

@github-actions github-actions Bot added the front-end Issue related to the React Front End Dashboard label May 6, 2026
@Zaimwa9 Zaimwa9 changed the title Feat/allow any operator in segment top rule feat: allow any operator in segment top rule May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Docker builds report

Image Build Status Security report

@chromatic-com
Copy link
Copy Markdown

chromatic-com Bot commented May 6, 2026

Important

Testing in progress…

UI Tests: Running 294 tests…
UI Review: Comparing 147 stories…
Storybook icon Storybook Publish: 147 stories published

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

failed  1 failed

Details

stats  1 test across 1 suite
duration  20.1 seconds
commit  aff9247
info  📦 Artifacts: View test results and HTML report
🔄 Run: #16531 (attempt 1)

Failed tests

firefox › tests/segment-test.pw.ts › Segment test 4 - Create ANY rule type segment and verify match changes when rule is updated @oss

### Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

failed  2 failed

Details

stats  2 tests across 1 suite
duration  21.3 seconds
commit  aff9247
info  📦 Artifacts: View test results and HTML report
🔄 Run: #16531 (attempt 1)

Failed tests

firefox › tests/segment-test.pw.ts › Segment test 1 - Create, update, and manage segments with multivariate flags @oss
firefox › tests/segment-test.pw.ts › Segment test 4 - Create ANY rule type segment and verify match changes when rule is updated @oss

### Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 1 suite
duration  42.8 seconds
commit  da5bb98
info  🔄 Run: #16532 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

failed  1 failed

Details

stats  1 test across 1 suite
duration  40.5 seconds
commit  da5bb98
info  📦 Artifacts: View test results and HTML report
🔄 Run: #16532 (attempt 1)

Failed tests

firefox › tests/segment-test.pw.ts › Segment test 4 - Create ANY rule type segment and verify match changes when rule is updated @oss

### Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  57.6 seconds
commit  da5bb98
info  🔄 Run: #16532 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

failed  1 failed

Details

stats  1 test across 1 suite
duration  40.5 seconds
commit  da5bb98
info  📦 Artifacts: View test results and HTML report
🔄 Run: #16532 (attempt 1)

Failed tests

firefox › tests/segment-test.pw.ts › Segment test 4 - Create ANY rule type segment and verify match changes when rule is updated @oss

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Visual Regression

16 screenshots compared. See report for details.
View full report

…flagsmith into feat/allow-any-operator-in-segment-top-rule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant