Skip to content

Add OpenFeature server provider#255

Draft
msiebert wants to merge 4 commits intomasterfrom
msiebert-openfeature-provider
Draft

Add OpenFeature server provider#255
msiebert wants to merge 4 commits intomasterfrom
msiebert-openfeature-provider

Conversation

@msiebert
Copy link
Copy Markdown

Summary

  • Adds openfeature-server-provider/ package implementing OpenFeature server provider
  • Wraps local or remote flags provider, Symbol sentinel for flag detection
  • 32 tests, all passing

Design

  • targetingKey not special, STATIC reason, three error codes, onClose no-op

🤖 Generated with Claude Code

Implement an OpenFeature provider for the Mixpanel Node SDK as a
separate package in openfeature-server-provider/. Wraps either
LocalFeatureFlagsProvider or RemoteFeatureFlagsProvider via the shared
getVariant() API.

Key design decisions:
- Uses Symbol sentinel for fallback detection (flag-not-found)
- Context set globally via initialize(), per-evaluation context ignored
- targetingKey has no special meaning
- Handles both sync (local) and async (remote) providers via await
- Reason codes: STATIC for success, ERROR for failures
- Error codes: PROVIDER_NOT_READY, FLAG_NOT_FOUND, TYPE_MISMATCH
- onClose() is a no-op
- Returns default value on all errors

Includes 32 tests covering all flag types, error cases, async
providers, context handling, and edge cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@msiebert msiebert self-assigned this Mar 19, 2026
msiebert and others added 3 commits March 20, 2026 11:05
Adds PROVIDER_NOT_READY tests for string, number, and object types
(boolean was already covered), and SDK exception handling tests
verifying that getVariant failures return defaults with error codes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge per-evaluation context on top of init context so callers can
override or extend context at each flag evaluation, matching the
OpenFeature specification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- shutdown() now delegates to underlying flags provider
- Add areFlagsReady() to LocalFlagsProvider, check before evaluation
- Return ErrorCode.GENERAL (not PROVIDER_NOT_READY) for exceptions
- Add context value unwrapping with whole-number float→int conversion
- Update tests for new error codes and add shutdown/readiness tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant