Skip to content

feat(flagd-core): add terminal resolve operator - #486

Draft
marcozabel wants to merge 3 commits into
open-feature:mainfrom
marcozabel:feat/resolve-operator
Draft

marcozabel wants to merge 3 commits into
open-feature:mainfrom
marcozabel:feat/resolve-operator

Conversation

@marcozabel

@marcozabel marcozabel commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Closes #460. Part of open-feature/flagd#2090.

Adds {"resolve": ["variant", "reason"?, [["key", value], ...]?]}, matching open-feature/flagd#2127 and open-feature/java-sdk-contrib#1979. It can be the whole rule, an if result or a fractional bucket variant. Rule metadata takes precedence over flag metadata, which takes precedence over flag-set metadata; flagSetId and version are never overridden. Malformed computed arguments fall back to the default variant.

Also makes / by zero return ±Inf/NaN like the other cores, instead of raising.

Before merge: move the test-harness pin from open-feature/flagd-testbed#448 to a release, then re-enable @resolve for in-process and RPC.

The json_logic builtin raises ZeroDivisionError, which fails the whole
evaluation. JavaScript, and the Go and Java flagd cores, return Infinity
or NaN instead.

Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
{"resolve": ["variant", "reason"?, [["key", value], ...]?]} selects a
variant, optionally overrides the reason and adds rule metadata over
flag and flag set metadata. It works as the whole rule, an if result or
a fractional bucket variant. Malformed computed arguments fall back to
the default variant, and rule metadata can't override the reserved
flagSetId and version keys.

Refs: open-feature#460
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
Pin the test harness to flagd-testbed#448 (unreleased) for the @resolve
scenarios. The released testbed image has no resolve launchpad config,
so file mode reads the harness flag file directly, and RPC and
in-process skip @resolve until a testbed release ships it.
"the resolved metadata should contain" now checks only the listed keys,
since resolve flags also carry flag set metadata.

Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.83721% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.07%. Comparing base (2ff2bae) to head (a7e99b1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...openfeature/contrib/tools/flagd/core/flagd_core.py 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #486      +/-   ##
==========================================
- Coverage   96.16%   92.07%   -4.10%     
==========================================
  Files          47       17      -30     
  Lines        1798      555    -1243     
==========================================
- Hits         1729      511    -1218     
+ Misses         69       44      -25     

☔ View full report in Codecov by Harness.
📢 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.

This branch has not been deployed

No deployments
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.

feat(flagd): implement resolve operator

3 participants