Skip to content

feat: extract flagd evaluator into api, core, and testkit packages#377

Draft
aepfli wants to merge 1 commit intomainfrom
feat/extract-flagd-evaluator-api-core-testkit
Draft

feat: extract flagd evaluator into api, core, and testkit packages#377
aepfli wants to merge 1 commit intomainfrom
feat/extract-flagd-evaluator-api-core-testkit

Conversation

@aepfli
Copy link
Copy Markdown
Member

@aepfli aepfli commented Apr 8, 2026

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/): Evaluator Protocol defining the contract for flag evaluation, so others can implement their own evaluator
  • openfeature-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-harness evaluator/ directory, with pytest-bdd step definitions

Provider refactoring

  • InProcessResolver now delegates evaluation to FlagdCore via an adapter pattern
  • Old modules (flags.py, targeting.py, custom_ops.py) are thin re-exports from core for backward compatibility
  • Connectors (FileWatcher, GrpcWatcher) remain unchanged

Other changes

  • Updated test-harness submodule from v2.11.1 to v3.5.0 (adds evaluator/ directory)
  • Added tools/* to UV workspace members
  • Added release-please config for the 3 new packages

Test plan

  • openfeature-flagd-api unit tests: 10 passed
  • openfeature-flagd-core unit tests: 58 passed
  • openfeature-flagd-core testkit compliance: 79/100 passed (21 failures are pre-existing Python limitations: fractional v2 algorithm + nested expressions)
  • Provider unit tests: 175 passed (no regressions)
  • Provider file e2e tests: 113 passed, 27 failed (fractional v2/nested + legacy no-default-variant scenarios from test-harness update)
  • Provider in-process e2e tests: 161 passed, 35 failed (same categories + 1 container-dependent test)

Known limitations (pre-existing, not introduced by this PR)

  • Python uses fractional v1 hashing algorithm (abs(hash) / i32_max * 100), v2 tests fail
  • panzi-json-logic doesn't support nested expressions in fractional operator arguments

🤖 Generated with Claude Code

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>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist 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

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.

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