Skip to content

feat(Dogfooding): Add OpenFeature SDK for server-side Flagsmith-on-Flagsmith#7008

Open
khvn26 wants to merge 1 commit intomainfrom
feat/openfeature-sdk-migration
Open

feat(Dogfooding): Add OpenFeature SDK for server-side Flagsmith-on-Flagsmith#7008
khvn26 wants to merge 1 commit intomainfrom
feat/openfeature-sdk-migration

Conversation

@khvn26
Copy link
Member

@khvn26 khvn26 commented Mar 20, 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

Migrate Flagsmith-on-Flagsmith feature evaluation from the native Flagsmith Python SDK to the vendor-neutral OpenFeature SDK with the Flagsmith provider.

What changed

  • Dependencies: Added openfeature-sdk and openfeature-provider-flagsmith (from danjuv's fork until PR #28 merges — bumps provider constraint to support flagsmith SDK v5).
  • Client module (integrations/flagsmith/client.py): Replaced get_client() with get_openfeature_client() using OpenFeature's provider registry with a named domain (flagsmith-api). Lazy initialisation via ProviderStatus check.
  • Organisation model: Replaced flagsmith_identifier + flagsmith_on_flagsmith_api_traits with a single openfeature_evaluation_context property returning an EvaluationContext.
  • 5 call-sites migrated from client.get_identity_flags(...).is_feature_enabled("x") to client.get_boolean_value("x", default_value=False, evaluation_context=...).
  • Test fixture (conftest.py): enable_features now uses OpenFeature's InMemoryProvider instead of mocking Flagsmith internals.
  • Org tasks tests: Migrated 22 tests from manual get_openfeature_client mocks to the enable_features fixture.
  • Mypy config: Added openfeature_flagsmith.* to ignore_missing_imports overrides (package lacks py.typed).

How did you test this code?

Made sure existing tests pass.

Migrate Flagsmith-on-Flagsmith feature evaluation from the native
Flagsmith Python SDK to the vendor-neutral OpenFeature SDK with the
Flagsmith provider, dogfooding our own OpenFeature integration.
@khvn26 khvn26 requested a review from a team as a code owner March 20, 2026 18:59
@khvn26 khvn26 requested review from gagantrivedi and removed request for a team March 20, 2026 18:59
Copy link

@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 in Settings → Usage.

Once credits are available, reopen this pull request to trigger a review.

@vercel
Copy link

vercel bot commented Mar 20, 2026

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

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Mar 20, 2026 6:59pm
flagsmith-frontend-preview Ignored Ignored Mar 20, 2026 6:59pm
flagsmith-frontend-staging Ignored Ignored Mar 20, 2026 6:59pm

Request Review

@github-actions github-actions bot added api Issue related to the REST API feature New feature or request labels Mar 20, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

Docker builds report

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

Comment on lines +1293 to +1294
variants={"enabled": True},
default_variant="enabled",
Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this is how to create an enabled by default in-memory flag for OF. No, there is no shorter way to do this.

Comment on lines +97 to +99
[[tool.mypy.overrides]]
module = ["openfeature_flagsmith.*"]
ignore_missing_imports = true
Copy link
Member Author

Choose a reason for hiding this comment

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

@khvn26 khvn26 changed the title feat(API): Add OpenFeature SDK for server-side Flagsmith-on-Flagsmith feat: Add OpenFeature SDK for server-side Flagsmith-on-Flagsmith Mar 20, 2026
@khvn26 khvn26 changed the title feat: Add OpenFeature SDK for server-side Flagsmith-on-Flagsmith feat(Dogfooding): Add OpenFeature SDK for server-side Flagsmith-on-Flagsmith Mar 20, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

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

passed  10 passed

Details

stats  10 tests across 7 suites
duration  43 seconds
commit  11c6b4b
info  🔄 Run: #15405 (attempt 1)

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

passed  10 passed

Details

stats  10 tests across 7 suites
duration  29.2 seconds
commit  11c6b4b
info  🔄 Run: #15405 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  46.1 seconds
commit  11c6b4b
info  🔄 Run: #15405 (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, 12 seconds
commit  11c6b4b
info  🔄 Run: #15405 (attempt 1)

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.32%. Comparing base (7c8e69d) to head (11c6b4b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7008      +/-   ##
==========================================
- Coverage   98.32%   98.32%   -0.01%     
==========================================
  Files        1335     1335              
  Lines       49876    49835      -41     
==========================================
- Hits        49039    48998      -41     
  Misses        837      837              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant