feat: extract flagd evaluator into api, core, and testkit packages#377
Draft
feat: extract flagd evaluator into api, core, and testkit packages#377
Conversation
Split the flagd evaluation logic from the provider into three independent packages under tools/, mirroring the Java SDK contrib architecture (PRs #1696 and #1742): - openfeature-flagd-api: Evaluator Protocol defining the contract for flag evaluation implementations - openfeature-flagd-core: Reference implementation with FlagdCore class, targeting engine, and custom operators (fractional, sem_ver, starts_with, ends_with) - openfeature-flagd-api-testkit: Compliance test suite bundling gherkin feature files from the test-harness evaluator directory The provider's InProcessResolver now delegates to FlagdCore via an adapter pattern, keeping connector code (FileWatcher, GrpcWatcher) unchanged. Old provider modules (flags.py, targeting.py, custom_ops.py) are thin re-exports from the core package for backward compatibility. Also updates the test-harness submodule from v2.11.1 to v3.5.0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a modular architecture for the flagd provider by extracting core evaluation logic and API definitions into separate tools packages. It replaces the internal FlagStore with a new FlagdCore implementation and adds a testkit for compliance testing. I have no feedback to provide on the changes.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Mirrors the Java SDK contrib architecture (PR #1696, PR #1742) by extracting the flagd evaluation logic into three independent packages:
openfeature-flagd-api(tools/openfeature-flagd-api/):EvaluatorProtocol defining the contract for flag evaluation, so others can implement their own evaluatoropenfeature-flagd-core(tools/openfeature-flagd-core/): Reference implementation (FlagdCore) with targeting engine and custom operators (fractional, sem_ver, starts_with, ends_with)openfeature-flagd-api-testkit(tools/openfeature-flagd-api-testkit/): Compliance test suite bundling gherkin feature files from the test-harnessevaluator/directory, with pytest-bdd step definitionsProvider refactoring
InProcessResolvernow delegates evaluation toFlagdCorevia an adapter patternflags.py,targeting.py,custom_ops.py) are thin re-exports from core for backward compatibilityFileWatcher,GrpcWatcher) remain unchangedOther changes
evaluator/directory)tools/*to UV workspace membersTest plan
openfeature-flagd-apiunit tests: 10 passedopenfeature-flagd-coreunit tests: 58 passedopenfeature-flagd-coretestkit compliance: 79/100 passed (21 failures are pre-existing Python limitations: fractional v2 algorithm + nested expressions)Known limitations (pre-existing, not introduced by this PR)
abs(hash) / i32_max * 100), v2 tests failpanzi-json-logicdoesn't support nested expressions in fractional operator arguments🤖 Generated with Claude Code