You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(experimentation): add the one-click Flagsmith database warehouse for self-hosted - #8863
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.
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.
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.
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
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.
Run the same Warehouse tab on self-hosted MySQL and Oracle installations; the PostgreSQL-only card must not be offered.
After enabling, confirm the connection card shows its event stats and the metric event picker lists database events.
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
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.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
featureNew feature or requestfront-endIssue related to the React Front End Dashboard
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.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.
postgresconnection with{"source": "flagsmith_database"}.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.