Skip to content

feat: allow any operator in segment top rule#7427

Open
Zaimwa9 wants to merge 8 commits intomainfrom
feat/allow-any-operator-in-segment-top-rule
Open

feat: allow any operator in segment top rule#7427
Zaimwa9 wants to merge 8 commits intomainfrom
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)
flagsmith-frontend-preview Ready Ready Preview, Comment May 6, 2026 9:35am
flagsmith-frontend-staging Ready Ready Preview, Comment May 6, 2026 9:35am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview May 6, 2026 9:35am

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
ghcr.io/flagsmith/flagsmith-api-test:pr-7427 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-7427 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7427 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7427 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7427 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-7427 Finished ✅ Results

@chromatic-com
Copy link
Copy Markdown

chromatic-com Bot commented May 6, 2026

Important

UI Tests need review – Review now

🟡 UI Tests: 10 changes must be accepted as baselines
🟡 UI Review: Go review the new and updated UI
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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  39.3 seconds
commit  c7c04e7
info  🔄 Run: #16538 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  42.2 seconds
commit  c7c04e7
info  🔄 Run: #16538 (attempt 1)

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  50.3 seconds
commit  c7c04e7
info  🔄 Run: #16538 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  37.5 seconds
commit  c7c04e7
info  🔄 Run: #16538 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  37.3 seconds
commit  2faa840
info  🔄 Run: #16541 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  42.3 seconds
commit  2faa840
info  🔄 Run: #16541 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  56 seconds
commit  2faa840
info  🔄 Run: #16541 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  48 seconds
commit  2faa840
info  🔄 Run: #16541 (attempt 1)

@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

@Zaimwa9 Zaimwa9 changed the base branch from main to deps/bump-flag-engine-version May 6, 2026 09:08
…flagsmith into feat/allow-any-operator-in-segment-top-rule
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels May 6, 2026
Base automatically changed from deps/bump-flag-engine-version to main May 6, 2026 09:34
@Zaimwa9 Zaimwa9 requested a review from a team as a code owner May 6, 2026 09:34
@Zaimwa9 Zaimwa9 removed the request for review from a team May 6, 2026 09:34
@Zaimwa9 Zaimwa9 requested a review from gagantrivedi May 6, 2026 09:34
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