Skip to content

feat: allow any operator in segment top rule#7427

Merged
Zaimwa9 merged 12 commits intomainfrom
feat/allow-any-operator-in-segment-top-rule
May 8, 2026
Merged

feat: allow any operator in segment top rule#7427
Zaimwa9 merged 12 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 7, 2026 3:28pm
flagsmith-frontend-staging Ready Ready Preview, Comment May 7, 2026 3:28pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview May 7, 2026 3:28pm

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)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  39.2 seconds
commit  984ef89
info  🔄 Run: #16597 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  37.8 seconds
commit  4b8ece9
info  🔄 Run: #16598 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  31.6 seconds
commit  4b8ece9
info  🔄 Run: #16598 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  53.6 seconds
commit  984ef89
info  🔄 Run: #16597 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  56.9 seconds
commit  4b8ece9
info  🔄 Run: #16598 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  47.9 seconds
commit  984ef89
info  🔄 Run: #16597 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  45.7 seconds
commit  4b8ece9
info  🔄 Run: #16598 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  49.9 seconds
commit  984ef89
info  🔄 Run: #16597 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  39.2 seconds
commit  2ad9089
info  🔄 Run: #16599 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  43.8 seconds
commit  2ad9089
info  🔄 Run: #16599 (attempt 1)

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  51.1 seconds
commit  2ad9089
info  🔄 Run: #16599 (attempt 1)

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

failed  1 failed
passed  1 passed

Details

stats  2 tests across 2 suites
duration  1 minute, 22 seconds
commit  2ad9089
info  📦 Artifacts: View test results and HTML report
🔄 Run: #16599 (attempt 1)

Failed tests

firefox › tests/environment-permission-test.pw.ts › Environment Permission Tests › Environment-level permissions control access to features, identities, and segments @enterprise

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

passed  18 passed

Details

stats  18 tests across 14 suites
duration  1 minute, 6 seconds
commit  2ad9089
info  🔄 Run: #16599 (attempt 2)

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

passed  1 passed

Details

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  36.5 seconds
commit  e821a39
info  🔄 Run: #16602 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  50.8 seconds
commit  e821a39
info  🔄 Run: #16602 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  35.9 seconds
commit  e821a39
info  🔄 Run: #16602 (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
Copy link
Copy Markdown
Contributor Author

Zaimwa9 commented May 7, 2026

@claude review

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, comment @claude review on this pull request to trigger a review.

@Zaimwa9
Copy link
Copy Markdown
Contributor Author

Zaimwa9 commented May 7, 2026

@claude review

Copy link
Copy Markdown
Contributor

@talissoncosta talissoncosta left a comment

Choose a reason for hiding this comment

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

Good job @Zaimwa9. I really like this new approach.

Image

I just left some comments to clarify some points and some suggestions.
The only blocker is the dark mode version for the component.

Comment thread frontend/web/styles/components/_inline-pill-toggle.scss
Comment thread frontend/web/components/modals/CreateSegmentRulesTabForm.tsx Outdated
Comment thread frontend/web/components/base/forms/InlinePillToggle.tsx
Comment thread frontend/e2e/helpers/e2e-helpers.playwright.ts Outdated
Comment thread frontend/web/styles/components/_inline-pill-toggle.scss
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels May 7, 2026
Comment thread frontend/web/components/modals/CreateSegment.tsx
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels May 7, 2026
@talissoncosta
Copy link
Copy Markdown
Contributor

Thanks @Zaimwa9 for addressing the changes, I just left a new comment in order to clarify a behaviour

Copy link
Copy Markdown
Contributor

@talissoncosta talissoncosta left a comment

Choose a reason for hiding this comment

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

Good job @Zaimwa9. Thanks for addressing all the adjusts. It looks pretty good!

@Zaimwa9 Zaimwa9 merged commit 53fc1bf into main May 8, 2026
29 checks passed
@Zaimwa9 Zaimwa9 deleted the feat/allow-any-operator-in-segment-top-rule branch May 8, 2026 07:19
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.

2 participants