Skip to content

feat(api): auto-connect Flagsmith warehouse for new orgs via experimental_flags value - #8377

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

feat(api): auto-connect Flagsmith warehouse for new orgs via experimental_flags value#8377
Zaimwa9 merged 8 commits into
mainfrom
feat/experimentation-default-on

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

Adds auto-provisioning of Flagsmith hosted warehouse connections, controlled by the experimental_flags flag value.

  • get_experiment_flag_config() reads and parses the experimental_flags JSON value (only when the flag is enabled for the org).
  • ensure_flagsmith_warehouse_connection() auto-creates a Flagsmith warehouse connection on first access if auto_connect_warehouse is true and no connection exists. Race-safe via the existing unique constraint.
  • Wired into the warehouse connection list endpoint for lazy provisioning.

Companion frontend PR: #8378

Flag configuration

Set the experimental_flags segment override value to:

{"auto_connect_warehouse": true}

Revert by setting auto_connect_warehouse to false or removing the value — no code deploy needed.

How did you test this code?

  • ensure_flagsmith_warehouse_connection is a no-op when auto_connect_warehouse is absent/false or a connection already exists.
  • Race condition handled by IntegrityError catch on the existing unique_active_warehouse_per_env constraint.
  • Compile checks pass.

@Zaimwa9
Zaimwa9 requested review from a team as code owners August 26, 2026 08:23
@Zaimwa9
Zaimwa9 requested review from matthewelwell and talissoncosta and removed request for a team August 26, 2026 08:23
@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

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

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Aug 26, 2026 12:46pm
flagsmith-frontend-preview Ignored Ignored Preview Aug 26, 2026 12:46pm
flagsmith-frontend-staging Ignored Ignored Preview Aug 26, 2026 12:46pm

Request Review

@github-actions github-actions Bot added front-end Issue related to the React Front End Dashboard api Issue related to the REST API labels Aug 26, 2026
@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-e2e:pr-8377 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-8377 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-8377 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-8377 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-8377 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-8377 Finished ✅ Results

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

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The service parses experiment flag configuration and creates an active Flagsmith warehouse connection when enabled. Warehouse connection listing invokes this setup before querying connections. Unit and view tests cover configuration parsing, connection creation, existing connections, integrity conflicts, and disabled settings. The event catalogue now references the relocated source lines.

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

Merge Risk: 🔵 Low · up to eae03

The change is otherwise mergeable, but one unit test needs a database-access marker because its fixture creates database records; add that marker before merging so the test can run successfully.


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.

@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: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9c21f051-8fb8-4336-b794-dfb408193bd7

📥 Commits

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

📒 Files selected for processing (3)
  • api/experimentation/services.py
  • api/experimentation/views.py
  • frontend/common/utils/utils.tsx

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

Comment thread api/experimentation/services.py
Comment thread api/experimentation/services.py Outdated
@github-actions

github-actions Bot commented Aug 26, 2026

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

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  45.5 seconds
commit  a9754b5
info  🔄 Run: #19844 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  34.1 seconds
commit  a9754b5
info  🔄 Run: #19844 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  45.4 seconds
commit  a9754b5
info  🔄 Run: #19844 (attempt 1)

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

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

passed  16 passed
skipped  1 skipped

Details

stats  17 tests across 11 suites
duration  1 minute, 5 seconds
commit  a9754b5
info  🔄 Run: #19844 (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 #19842 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  38.4 seconds
commit  1037f7c
info  🔄 Run: #19842 (attempt 1)

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

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  54.9 seconds
commit  1037f7c
info  🔄 Run: #19842 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  42.7 seconds
commit  1037f7c
info  🔄 Run: #19842 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  47.4 seconds
commit  1037f7c
info  🔄 Run: #19842 (attempt 1)

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

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  6.5 seconds
commit  eae03e5
info  🔄 Run: #19815 (attempt 1)

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

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  31.9 seconds
commit  eae03e5
info  🔄 Run: #19815 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  44 seconds
commit  eae03e5
info  🔄 Run: #19815 (attempt 1)

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

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  33.5 seconds
commit  eae03e5
info  🔄 Run: #19815 (attempt 1)

@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Aug 26, 2026
@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

@flagsmith-engineering
flagsmith-engineering Bot requested a review from a team as a code owner August 26, 2026 08:30
@github-actions github-actions Bot added the docs Documentation updates label Aug 26, 2026
@Zaimwa9
Zaimwa9 force-pushed the feat/experimentation-default-on branch from 619277d to 1d68bc3 Compare August 26, 2026 08:31
@Zaimwa9 Zaimwa9 changed the title feat: enable experimentation for all new organisations via flag-driven gating feat(api): auto-connect Flagsmith warehouse for new orgs via experimental_flags value Aug 26, 2026
@github-actions github-actions Bot removed the feature New feature or request label Aug 26, 2026
@github-actions github-actions Bot added feature New feature or request and removed docs Documentation updates labels Aug 26, 2026
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request docs Documentation updates labels 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: bf8bf849-c337-4470-90fd-ad91cf47dac9

📥 Commits

Reviewing files that changed from the base of the PR and between 5020eb6 and 55a63e1.

📒 Files selected for processing (3)
  • api/experimentation/services.py
  • api/tests/unit/experimentation/test_services.py
  • api/tests/unit/experimentation/test_views.py

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

Comment thread api/tests/unit/experimentation/test_services.py Outdated
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request docs Documentation updates labels 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: 394e1e96-bb20-4f01-9f45-8a4965490b61

📥 Commits

Reviewing files that changed from the base of the PR and between 5eb0cea and eae03e5.

📒 Files selected for processing (1)
  • api/tests/unit/experimentation/test_services.py

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

Comment thread api/tests/unit/experimentation/test_services.py
Comment thread api/experimentation/views.py Outdated
@github-actions github-actions Bot added docs Documentation updates feature New feature or request and removed feature New feature or request docs Documentation updates labels Aug 26, 2026
Comment thread api/experimentation/signals.py Outdated
@github-actions github-actions Bot added docs Documentation updates feature New feature or request and removed feature New feature or request docs Documentation updates labels Aug 26, 2026
@Zaimwa9
Zaimwa9 merged commit 27dbc25 into main Aug 27, 2026
35 checks passed
@Zaimwa9
Zaimwa9 deleted the feat/experimentation-default-on branch August 27, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API 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