Skip to content

feat(experimentation): add the one-click Flagsmith database warehouse for self-hosted - #8863

Merged
Zaimwa9 merged 5 commits into
mainfrom
feat/postgres-warehouse-flagsmith-database-ui
Nov 4, 2026
Merged

Zaimwa9 merged 5 commits into
mainfrom
feat/postgres-warehouse-flagsmith-database-ui

Conversation

@Zaimwa9

@Zaimwa9 Zaimwa9 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

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

Depends on #8857.

Self-hosted installations can enable Flagsmith's own Postgres database as the experimentation warehouse in one click from the Warehouse tab, with no connection details.

  • New "Flagsmith database" card on self-hosted, creating a postgres connection with {"source": "flagsmith_database"}.
  • Connection card, event name picker and metrics page handle the new mode.

How did you test this code?

Unit tests for the warehouse types; manually enabled it on a local self-hosted instance against #8857 and checked events appear in the card stats and the metric event picker.

@vercel

vercel Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Ready Ready Preview Nov 4, 2026 8:39am UTC
flagsmith-frontend-preview Ready Ready Preview Nov 4, 2026 8:39am UTC
flagsmith-frontend-staging Ready Ready Preview Nov 4, 2026 8:39am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The warehouse settings add a Flagsmith database option that uses a PostgreSQL connection and a distinct configuration source. The setup flow creates the connection and reports success or failure. PostgreSQL connections can be tested and receive a type label. Flagsmith database connections cannot be edited. PostgreSQL is also included in event-list eligibility and the metrics warehouse labels. The event-help component and test-event flow use API events URLs for Flagsmith database connections.

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

Merge Risk: Low · up to fd03e

The supported PostgreSQL workflow has no established blocking defect. Other self-hosted installations can see an option they cannot enable; merging requires awareness of this bounded limitation.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions github-actions Bot added front-end Issue related to the React Front End Dashboard feature New feature or request labels Nov 2, 2026
@Zaimwa9

Zaimwa9 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@themis-blindfold review

@themis-blindfold

Copy link
Copy Markdown
Contributor

⚖️ Themis review: 🟠 Fix before merge

The new self-hosted flow cannot succeed against this merge target because its API contract has not landed yet, and it is advertised to self-hosted MySQL and Oracle installations that the feature does not support. The existing unit, lint, security, and preview checks passed, but they do not exercise the enable flow.

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

🟠 Majors

  • frontend/web/components/pages/environment-settings/tabs/warehouse-tab/index.tsx:121 — the enable request is rejected on the merge target.
  • frontend/web/components/pages/environment-settings/tabs/warehouse-tab/warehouseTypes.ts:26 — unsupported self-hosted database engines are offered the PostgreSQL mode.
  • frontend/web/components/pages/environment-settings/tabs/warehouse-tab/index.tsx:120 — the new enable workflow has no regression coverage.
📝 Walkthrough
  • warehouse type selection - adds a self-hosted Flagsmith-database choice and hides the SaaS-managed option outside SaaS.
  • connection creation - posts a PostgreSQL connection identified by the flagsmith_database config source.
  • connection presentation - labels the new mode, enables event listing, test actions, and metric warehouse labels.
  • coverage - adds unit tests for warehouse-type availability and connection identification.
🧪 How to verify
  1. Rebase with the backend support for config.source: "flagsmith_database", then enable the card on a self-hosted PostgreSQL instance and confirm the POST returns 201.
  2. Run the same Warehouse tab on self-hosted MySQL and Oracle installations; the PostgreSQL-only card must not be offered.
  3. After enabling, confirm the connection card shows its event stats and the metric event picker lists database events.
  4. Run cd frontend && npm run test:unit -- web/components/pages/environment-settings/tabs/warehouse-tab/__tests__/warehouseTypes.test.ts --runInBand.
    Automate: Add a WarehouseTab test that covers the self-hosted create payload and the PostgreSQL-only availability gate.

Product take: This is a useful low-friction option for PostgreSQL self-hosting, but its current availability and missing backend dependency turn a one-click setup into an error for affected users.

🧭 Assumptions & unverified claims
  • The referenced backend change is expected to add support for the flagsmith_database config source; that implementation is not present on this branch.

The button has the right ambition; it just needs its database half beside it · reviewed at 754f2d3

@Zaimwa9
Zaimwa9 marked this pull request as ready for review November 4, 2026 08:46
@Zaimwa9
Zaimwa9 requested a review from a team as a code owner November 4, 2026 08:46
@Zaimwa9
Zaimwa9 requested review from kyle-ssg and removed request for a team November 4, 2026 08:46
@github-actions github-actions Bot removed the feature New feature or request label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Docker builds report

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

@github-actions github-actions Bot added the feature New feature or request label Nov 4, 2026
@Zaimwa9
Zaimwa9 removed the request for review from kyle-ssg November 4, 2026 08:47
@github-actions

github-actions Bot commented Nov 4, 2026 •

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

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

passed  4 passed

Details

stats  4 tests across 4 suites
duration  1 minute, 4 seconds
commit  fd03e16
info  🔄 Run: #22844 (attempt 1)

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

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

passed  4 passed

Details

stats  4 tests across 4 suites
duration  33 seconds
commit  fd03e16
info  🔄 Run: #22844 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  32.3 seconds
commit  fd03e16
info  🔄 Run: #22844 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  4.1 seconds
commit  fd03e16
info  🔄 Run: #22844 (attempt 1)

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

Nitpick comments: 1
frontend/web/components/pages/environment-settings/tabs/warehouse-tab/index.tsx: 1

238-243: Trivial · Functional Correctness · Quick win

Add a caller-level test for the connection-specific events URL.

handleSendTestEvent passes the API events URL only for Flagsmith database connections. No existing test imports the component that contains this branch, and the helper tests call sendWarehouseTestEvent without a second argument. Removing the argument would therefore leave the test suite unchanged. The test event would then use the default flagsmithClientEventsAPI endpoint.

Add a test that mocks sendWarehouseTestEvent and asserts its second argument for both connection types:

  • For a Flagsmith database connection, the argument equals getApiEventsUrl(Project.api).
  • For any other connection type, the argument is undefined.

Keep the existing helper tests unchanged.

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 4d4b8d49-cb6c-42cd-bbf3-e3797487a08f
Commits

Reviewing files that changed from the base of the PR and between ada5267 and fd03e16.

Files selected for processing: 7
  • frontend/web/components/pages/environment-settings/tabs/warehouse-tab/WarehouseConnectionCard.tsx
  • frontend/web/components/pages/environment-settings/tabs/warehouse-tab/WarehouseEventCodeHelp.tsx
  • frontend/web/components/pages/environment-settings/tabs/warehouse-tab/WarehouseSetup.tsx
  • frontend/web/components/pages/environment-settings/tabs/warehouse-tab/__tests__/warehouseEventSnippets.test.ts
  • frontend/web/components/pages/environment-settings/tabs/warehouse-tab/index.tsx
  • frontend/web/components/pages/environment-settings/tabs/warehouse-tab/sendWarehouseTestEvent.ts
  • frontend/web/components/pages/environment-settings/tabs/warehouse-tab/warehouseEventSnippets.ts

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

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

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

@Zaimwa9
Zaimwa9 merged commit 51bcfc2 into main Nov 4, 2026
45 checks passed
@Zaimwa9
Zaimwa9 deleted the feat/postgres-warehouse-flagsmith-database-ui branch November 4, 2026 13:55

This branch was successfully deployed

3 active deployments
Preview – flagsmith-frontend-staging — fd03e164 Deployed Nov 4, 2026 by vercel[bot]
Preview – flagsmith-frontend-preview — fd03e164 Deployed Nov 4, 2026 by vercel[bot]
Preview – docs — fd03e164 Deployed Nov 4, 2026 by vercel[bot]
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