Skip to content

feat(multiprovider): add ComparisonStrategy - #2003

Draft
jonathannorris wants to merge 1 commit into
mainfrom
feat/multiprovider-comparison-strategy
Draft

feat(multiprovider): add ComparisonStrategy#2003
jonathannorris wants to merge 1 commit into
mainfrom
feat/multiprovider-comparison-strategy

Conversation

@jonathannorris

@jonathannorris jonathannorris commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds ComparisonStrategy, which evaluates every configured provider in parallel and compares the results.
  • When all providers agree, the fallback provider's evaluation is returned. On mismatch, an optional callback receives the flag key and each provider's evaluation in registration order, and the fallback result is still returned.
  • Provider errors, timeouts, and null evaluations are surfaced as structured ProviderError entries on the returned evaluation.

Usage

Strategy strategy = new ComparisonStrategy("primary", (flagKey, results) ->
        log.warn("providers disagree on {}: {}", flagKey, results));
FeatureProvider provider = new MultiProvider(List.of(primary, candidate), strategy);

Notes

Default timeout is 30s; a constructor overload accepts a caller-supplied ExecutorService and timeout.

Related PRs

This is one of three independent PRs that together close the multi-provider gaps identified in #1882. They branch off main separately and can be reviewed and merged in any order. Together they replace #1897.

Relates to #1882

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d7c4340d-8183-4931-90ae-1efb758fc977

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@sonarqubecloud

sonarqubecloud Bot commented Aug 6, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.91%. Comparing base (a8e6644) to head (62b831a).

Files with missing lines Patch % Lines
...nfeature/sdk/multiprovider/ComparisonStrategy.java 89.47% 7 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2003      +/-   ##
============================================
+ Coverage     92.52%   92.91%   +0.38%     
- Complexity      728      756      +28     
============================================
  Files            60       61       +1     
  Lines          1739     1834      +95     
  Branches        202      220      +18     
============================================
+ Hits           1609     1704      +95     
+ Misses           80       79       -1     
- Partials         50       51       +1     
Flag Coverage Δ
unittests 92.91% <89.47%> (+0.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

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