Skip to content

feat: add OpenFeature Python server provider - #1

Merged
dsun0720 merged 9 commits into
featbit:mainfrom
WuJiayi0307:feat/openfeature-provider
Aug 7, 2026
Merged

dsun0720 merged 9 commits into
featbit:mainfrom
WuJiayi0307:feat/openfeature-provider

Conversation

@WuJiayi0307

@WuJiayi0307 WuJiayi0307 commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add the standalone FeatBit OpenFeature Python server provider as a thin wrapper around the existing FeatBit Python Server SDK.

  • implement the OpenFeature FeatureProvider and all typed resolution methods
  • convert OpenFeature evaluation contexts to FeatBit users
  • convert FeatBit evaluation details, including stable variation IDs, to OpenFeature resolution details
  • bridge FeatBit SDK data-update states to OpenFeature provider status and lifecycle events
  • support tracking and configuration-change events
  • isolate evaluation, tracking, listener, and shutdown failures from application code
  • add packaging metadata, type information, documentation, CI, and offline integration coverage

Status mapping

  • FeatBit OK → OpenFeature READY
  • FeatBit INTERRUPTED → OpenFeature STALE
  • FeatBit OFF → OpenFeature FATAL
  • provider shutdown → OpenFeature NOT_READY

Dependencies

  • fb-python-sdk>=1.1.8,<2
  • openfeature-sdk>=0.10,<1
  • Python 3.10–3.12

The required variation-ID and thread-safe status-listener capabilities are proposed in featbit/featbit-python-sdk#14.

Validation

  • 53 passed
  • Apache-2.0 package metadata matches the repository license
  • Flake8 passed
  • wheel and source distribution built successfully
  • isolated installation smoke test passed
  • offline end-to-end evaluation verified: OpenFeature Client → Provider → real FeatBit evaluator, returning value v2, variant variation-v2, and provider status READY

Summary by CodeRabbit

  • New Features

    • Added a Python OpenFeature provider for evaluating FeatBit feature flags with typed results, resolution details, targeting context, tracking, and configuration-change events.
    • Added provider lifecycle handling, including readiness, error, and shutdown states.
    • Added inline typing support for improved development tooling.
  • Documentation

    • Added comprehensive installation, configuration, supported mappings, development, and publishing documentation.
  • Packaging

    • Added Python package metadata and automated build and release publishing workflows.
  • Quality

    • Added automated testing and continuous integration across supported Python versions.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@WuJiayi0307, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fa2f2e23-cc6b-4c64-8c82-7642e011945d

📥 Commits

Reviewing files that changed from the base of the PR and between 68864cc and 153e7fa.

📒 Files selected for processing (2)
  • featbit_openfeature/provider.py
  • tests/test_provider.py
📝 Walkthrough

Walkthrough

This change adds a packaged FeatBit OpenFeature provider with context and resolution converters, typed flag evaluation, lifecycle and status handling, tracking, packaging automation, documentation, and unit plus offline integration tests.

Changes

FeatBit OpenFeature provider

Layer / File(s) Summary
Package and release surface
.flake8, .github/workflows/*, .gitignore, MANIFEST.in, pyproject.toml, featbit_openfeature/__init__.py, featbit_openfeature/impl/__init__.py, featbit_openfeature/py.typed, README.md
Defines package metadata, public exports, type-checker support, distribution contents, lint and release automation, CI execution, and provider documentation.
Evaluation context and resolution conversion
featbit_openfeature/impl/context_converter.py, featbit_openfeature/impl/details_converter.py
Converts evaluation contexts into FeatBit users, serializes supported attributes, validates targeting keys, and maps FeatBit evaluation details to OpenFeature resolution details.
Provider evaluation and lifecycle
featbit_openfeature/provider.py
Implements typed resolution, type validation, tracking, initialization, shutdown, listener registration, configuration-change events, and FeatBit status mapping.
Provider validation and offline integration
tests/impl/*, tests/test_provider.py, tests/test_offline_integration.py, tests/test_packaging_metadata.py, tests/fixtures/bootstrap.json
Tests conversion, resolution errors, lifecycle behavior, status transitions, tracking, concurrency, packaging metadata, and offline evaluation against bootstrap data.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OpenFeatureClient
  participant FeatBitProvider
  participant EvaluationContextConverter
  participant FBClient
  participant OpenFeatureEvents
  OpenFeatureClient->>FeatBitProvider: resolve typed flag
  FeatBitProvider->>EvaluationContextConverter: convert evaluation context
  EvaluationContextConverter-->>FeatBitProvider: FeatBit user
  FeatBitProvider->>FBClient: variation_detail
  FBClient-->>FeatBitProvider: EvalDetail and variation
  FeatBitProvider-->>OpenFeatureClient: FlagResolutionDetails
  FBClient->>FeatBitProvider: status or flag-change notification
  FeatBitProvider->>OpenFeatureEvents: emit provider event
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 1.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding an OpenFeature Python server provider.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Line 20: Update the actions/checkout@v4 step to set persist-credentials to
false, ensuring the workflow does not retain the GitHub token in local Git
configuration; leave the remaining checkout behavior unchanged.
- Around line 28-29: The CI dependency installation should not use the moving
`refs/pull/14/head` override. Update the `fb-python-sdk` install command in the
workflow to honor the `pyproject.toml` constraint `>=1.1.8,<2`, or replace it
with an immutable full commit pin and document the temporary override.

In `@featbit_openfeature/provider.py`:
- Around line 74-86: Register the status listeners in initialize
unconditionally, including when wait_for_OKState times out or state is OFF.
Ensure _register_listeners() executes before propagating ProviderFatalError or
ProviderNotReadyError, while preserving the existing error classification and
successful initialization behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a9e9f0cf-2f49-4ce4-b487-a53d642e563c

📥 Commits

Reviewing files that changed from the base of the PR and between 6574599 and b9396b5.

📒 Files selected for processing (17)
  • .flake8
  • .github/workflows/ci.yml
  • .gitignore
  • MANIFEST.in
  • README.md
  • featbit_openfeature/__init__.py
  • featbit_openfeature/impl/__init__.py
  • featbit_openfeature/impl/context_converter.py
  • featbit_openfeature/impl/details_converter.py
  • featbit_openfeature/provider.py
  • featbit_openfeature/py.typed
  • pyproject.toml
  • tests/fixtures/bootstrap.json
  • tests/impl/test_context_converter.py
  • tests/impl/test_details_converter.py
  • tests/test_offline_integration.py
  • tests/test_provider.py

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml Outdated
Comment thread featbit_openfeature/provider.py
@deleteLater

Copy link
Copy Markdown
Contributor

@greptileai

Comment thread featbit_openfeature/provider.py
Comment thread featbit_openfeature/provider.py
Comment thread featbit_openfeature/py.typed
Comment thread .github/workflows/ci.yml

@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

🧹 Nitpick comments (1)
.github/workflows/release.yml (1)

14-14: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Pin release actions to immutable commits.

The workflow uses mutable action references. A changed action could alter the build artifact or the publish step. The publish job has id-token: write, so this could affect PyPI Trusted Publishing. Pin each action to a full commit SHA and keep the upstream version in a comment for maintainable updates.

Also applies to: 17-17, 26-26, 42-42, 47-47

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml at line 14, Update every action reference in
the release workflow, including checkout and the actions at the other indicated
steps, to use a full immutable commit SHA instead of a mutable tag. Add a
comment alongside each SHA identifying its upstream version so future updates
remain maintainable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@featbit_openfeature/provider.py`:
- Around line 115-120: Update the provider lifecycle synchronization around
shutdown(), _register_listeners(), and status emission: set a shutdown state
while holding _lifecycle_lock, then make listener registration and status
emission no-ops once shutdown has begun. Ensure shutdown snapshots and removes
only valid pre-shutdown listeners, preventing initialize() from adding callbacks
after the snapshot.

---

Nitpick comments:
In @.github/workflows/release.yml:
- Line 14: Update every action reference in the release workflow, including
checkout and the actions at the other indicated steps, to use a full immutable
commit SHA instead of a mutable tag. Add a comment alongside each SHA
identifying its upstream version so future updates remain maintainable.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 76903af5-2f19-4dfe-be67-9268e6215ba5

📥 Commits

Reviewing files that changed from the base of the PR and between b9396b5 and 6a89dc1.

📒 Files selected for processing (8)
  • .github/workflows/ci.yml
  • .github/workflows/release.yml
  • README.md
  • featbit_openfeature/provider.py
  • pyproject.toml
  • tests/test_offline_integration.py
  • tests/test_packaging_metadata.py
  • tests/test_provider.py
💤 Files with no reviewable changes (1)
  • tests/test_offline_integration.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/ci.yml
  • pyproject.toml

Comment thread featbit_openfeature/provider.py
Comment thread featbit_openfeature/provider.py Outdated
Comment thread featbit_openfeature/provider.py
@dsun0720
dsun0720 merged commit 8f86d71 into featbit:main Aug 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants