Skip to content

feat(fe): flag-driven warehouse plan gating for free orgs - #8379

Merged
Zaimwa9 merged 3 commits into
mainfrom
feat/experimentation-default-on-fe
Aug 27, 2026
Merged

feat(fe): flag-driven warehouse plan gating for free orgs#8379
Zaimwa9 merged 3 commits into
mainfrom
feat/experimentation-default-on-fe

Conversation

@Zaimwa9

@Zaimwa9 Zaimwa9 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor
  • 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

Makes warehouse plan gating flag-driven so free orgs can access experimentation when enabled.

  • getPlanPermission checks getRequiredPlan before the free-plan bail-out — if a feature resolves to 'free', all plans pass. No regression risk: every other feature returns a hardcoded plan string that is never 'free'.
  • getRequiredPlan('WAREHOUSE') supports both the legacy array format and a new object format ({ allowed_plans: [...] }).
  • Plan type and planHierarchy include 'free'.

Companion API PR: #8377

Flag configuration

Set the experimentation_warehouse_connection segment override value to:

{"allowed_plans": ["free"]}

Or use the legacy array format: ["free"].

Revert by removing "free" from the array — warehouse reverts to enterprise-only plan gate. No code deploy needed.

How did you test this code?

  • No regression for existing getPlanPermission callers: every other feature returns a hardcoded plan string, so the new 'free' early-return never fires for them.
  • Lint passes.

@Zaimwa9
Zaimwa9 requested a review from a team as a code owner August 26, 2026 08:32
@Zaimwa9
Zaimwa9 requested review from kyle-ssg and removed request for a team August 26, 2026 08:32
@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview Aug 27, 2026 8:32am
flagsmith-frontend-staging Ready Ready Preview Aug 27, 2026 8:32am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Aug 27, 2026 8:32am

Request Review

@github-actions github-actions Bot added the front-end Issue related to the React Front End Dashboard label Aug 26, 2026
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The utility module retains featureStateToValue on Utils. The Plan type now includes free. getPlanPermission supports free-plan features and warehouse configuration supplied as an array or an object with allowed_plans. Tests cover hardcoded permissions, both configuration formats, and malformed values.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🟡 Moderate · up to 53c85

The PR makes warehouse access UI-gating configurable for free organizations. Merge readiness is currently moderate because the changed helper may fail strict TypeScript checks, the import path violates frontend conventions, a conversion edge-case concern remains open, and server-side enforcement for the newly relaxed entitlement has not been confirmed.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-8379 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-8379 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-8379 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-8379 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-8379 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-8379 Finished ✅ Results

@github-actions github-actions Bot added the feature New feature or request label Aug 26, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cbbef2c3-7424-44bb-86ca-10eb85f417d6

📥 Commits

Reviewing files that changed from the base of the PR and between 0be48ea and 94055b1.

📒 Files selected for processing (1)
  • frontend/common/utils/utils.tsx

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment thread frontend/common/utils/utils.tsx Outdated
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19862 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 10 seconds
commit  53c85b2
info  🔄 Run: #19862 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-16 — run #19862 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  32.6 seconds
commit  53c85b2
info  🔄 Run: #19862 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19862 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  41.6 seconds
commit  53c85b2
info  🔄 Run: #19862 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19862 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  40.5 seconds
commit  53c85b2
info  🔄 Run: #19862 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #19834 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  54.5 seconds
commit  8162b9c
info  🔄 Run: #19834 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19834 (attempt 1)

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

passed  4 passed

Details

stats  4 tests across 3 suites
duration  38.9 seconds
commit  8162b9c
info  🔄 Run: #19834 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19834 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  37.5 seconds
commit  8162b9c
info  🔄 Run: #19834 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19834 (attempt 1)

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

passed  16 passed
skipped  1 skipped

Details

stats  17 tests across 11 suites
duration  1 minute, 8 seconds
commit  8162b9c
info  🔄 Run: #19834 (attempt 1)

Skipped tests

firefox › tests/onboarding-tests.pw.ts › Onboarding › New user connects via the single-page onboarding flow @oss

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #19793 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  1 minute, 5 seconds
commit  94055b1
info  🔄 Run: #19793 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #19793 (attempt 1)

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  33.2 seconds
commit  94055b1
info  🔄 Run: #19793 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #19793 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  39.7 seconds
commit  94055b1
info  🔄 Run: #19793 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #19793 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  41 seconds
commit  94055b1
info  🔄 Run: #19793 (attempt 1)

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

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

@Zaimwa9

Zaimwa9 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

@themis-blindfold review

Comment thread frontend/common/utils/utils.tsx
@themis-blindfold

Copy link
Copy Markdown
Contributor

⚖️ Themis review: 🟠 Fix before merge

The free-plan warehouse rollout is not covered by a direct regression test, and the unrelated inlined feature-state converter regresses its established input contract. Completed lint, unit, build, E2E, and CodeQL checks passed, but they did not catch either path.

Area Score
🎯 Correctness 2/5
🧪 Test coverage 1/5
📐 Code quality 2/5
🚀 Product impact 3/5

🟠 Majors

  • frontend/common/utils/utils.tsx:183 — Observed: the inlined converter returns null for false and '', and undefined for other flat values or missing numeric values, unlike the established converter contract.
  • frontend/common/utils/utils.tsx:562 — Add regression coverage for both warehouse configuration formats and their plan outcomes.
📝 Walkthrough
  • Plan resolution - accepts the legacy plan array and the new allowed_plans object, with free as the lowest eligible tier.
  • Plan permission - evaluates the required tier before rejecting a free organisation so a free warehouse configuration can unlock the tab.
  • Feature-state conversion - replaces the Flux-free helper with a local implementation, but does not preserve its supported flat-value and missing-number handling.
🧪 How to verify
  1. Enable the warehouse flag with { "allowed_plans": ["free"] } for a free SaaS organisation and confirm the Warehouse tab is available.
  2. Repeat with the legacy ["free"] value, then remove free and confirm the plan banner returns.
  3. Exercise Utils.featureStateToValue with nested values, false, '', flat strings, and missing int/float fields.
  4. Run cd frontend && npm run test:unit -- common/utils/__tests__/utils.test.ts after adding the coverage.

Automate: Add table-driven utility tests for both configuration shapes and each plan tier.

Product take: This is a solid controlled rollout for experimentation access on free organisations. The converter regression risks unrelated feature-value rendering, so it should be corrected before that rollout lands.

🧭 Assumptions & unverified claims

No unverified assumptions or claims.

Free-tier access deserves a free pass; value conversion does not · reviewed at 94055b1

Comment thread frontend/common/utils/utils.tsx Outdated

@talissoncosta talissoncosta 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.

One question before approving it.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
frontend/common/utils/utils.tsx (2)

64-64: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Make planHierarchy non-nullable.

planHierarchy is typed as Plan[], and Plan includes null. allowedPlans is a string[], so allowedPlans.includes(p) causes a TypeScript error with strict: true.

Use Exclude<Plan, null>[] or define a separate non-null plan type.


24-24: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Use the common/ alias for this import.

This frontend file must not use a relative import. Replace ./featureStateToValue with common/utils/featureStateToValue.

As per coding guidelines, frontend files must use only common/, components/, and project/ import paths.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 16a1a1e5-7bcc-4f03-a7e8-079e3c1022df

📥 Commits

Reviewing files that changed from the base of the PR and between 8162b9c and 53c85b2.

📒 Files selected for processing (1)
  • frontend/common/utils/utils.tsx

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@Zaimwa9
Zaimwa9 requested a review from talissoncosta August 27, 2026 08:43
@Zaimwa9
Zaimwa9 dismissed talissoncosta’s stale review August 27, 2026 08:43

overseeded by gagan

@Zaimwa9
Zaimwa9 merged commit 2be8a90 into main Aug 27, 2026
28 checks passed
@Zaimwa9
Zaimwa9 deleted the feat/experimentation-default-on-fe branch August 27, 2026 08:44
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.

3 participants