Skip to content

feat!: evaluate feature flags through the v4 endpoints - #53

Open
lourens-octopus wants to merge 2 commits into
mainfrom
lourens/bmbb-753
Open

feat!: evaluate feature flags through the v4 endpoints#53
lourens-octopus wants to merge 2 commits into
mainfrom
lourens/bmbb-753

Conversation

@lourens-octopus

@lourens-octopus lourens-octopus commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Resolves BMBB-753 and BMBB-749. Java counterpart of openfeature-provider-dotnet#96, brought up to date with .NET's current code.

Stacked on #51 — review that first; this branch targets it.

What

The provider now evaluates through the v4 feature-flag endpoints, using the rules-based evaluation from #51 instead of v3's segment and rollout matching.

  • api/feature-flags/check/v4/ and api/feature-flags/evaluations/v4/
  • EvaluationResponse replaces FeatureToggles; getServerSideEvaluations() replaces getFeatureToggleEvaluationManifest()
  • evaluate(slug, context) drops defaultValue and resolves a ServerSideEvaluation, so value and reason come from the server or from the rules it deferred, and a malformed response reports the problem it found
  • an unrecognised slug throws FlagNotFoundError with the message the other providers use, warned once per slug rather than on every evaluation
  • specification submodule ef8450967890d8

BREAKING CHANGE: is on the commit so release-please cuts the major; cutting the release is BMBB-772.

Two commits

refactor: flatten the v4 package into the provider package — a pure move, green on its own.

The switch needs the evaluator, in the provider package, to call ServerSideEvaluation.evaluate(). Package access is not hierarchical, so a v4 sub-package would mean making that type and EvaluationResponse public — permanently, since OctopusProvider keeps its fully-qualified name and so the parent→v4 call outlives BMBB-780. With v4 now the only contract, the sub-package has served its purpose. Everything stays package-private, the public API is unchanged, and #51's duplicated rollout hash collapses back to one implementation.

feat!: evaluate feature flags through the v4 endpoints — the switch.

Scope

BMBB-749 is here because it cannot be split off: the specification bump replaces its fixtures (10 added, 4 deleted, 2 renamed) and a submodule has one pointer, so bumping first leaves v4 fixtures against a v3 provider — 80 failures, which I hit while separating the commits — and switching first leaves v4 code against deleted fixtures. .NET adopted the fixtures inside its own switch PR for the same reason.

Left to the tickets that own them, mirroring .NET's #96#99:

  • BMBB-780FeatureToggles, FeatureToggleEvaluation and Segment remain, unused, marked TODO(BMBB-780). Their evaluation logic is gone, since replacing it is the switch, so OctopusContextTests drops from 291 lines to 108.
  • BMBB-755 — .NET's #97 renames (OctopusContextFeatureFlagEvaluator, and so on). BMBB-715 looks like a duplicate of it.

Tests

452 pass, 0 failures, including all 83 specification tests (up from 41 — the v4 fixture set is larger). New OctopusClientTests cases pin both endpoint paths against WireMock, as .NET's do. Public API confirmed unchanged via javap.

🤖 Generated with Claude Code

@lourens-octopus
lourens-octopus requested a review from a team as a code owner August 11, 2026 02:28
Base automatically changed from lourens/bmbb-751 to main August 11, 2026 21:00
lourens-octopus and others added 2 commits August 12, 2026 09:01
The switch to v4 needs the evaluator, which lives in the provider
package, to call ServerSideEvaluation.evaluate(). Java package access is
not hierarchical, so keeping the v4 types in a sub-package would mean
making them public — permanently, since nothing later removes the split.

With v4 becoming the only contract, the sub-package has served its
purpose: it kept an unreleased contract out of the way while v3 was live.
Everything stays package-private in one package, and the public API is
unchanged.

A pure move: no behaviour changes, and the two test-only shims that only
existed to cross the package boundary are gone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Switches the provider from the v3 toggle endpoints to the v4 feature-flag
endpoints, and from v3's segment and rollout matching to the rules-based
evaluation added earlier.

- GET api/feature-flags/check/v4/ and api/feature-flags/evaluations/v4/
- EvaluationResponse replaces FeatureToggles
- evaluate(slug, context) resolves a ServerSideEvaluation, so the value
  and reason come from the server or from the client-side rules it
  deferred, and a malformed response reports the problem it found
- an unrecognised slug throws FlagNotFoundError with the message the
  other provider libraries use
- specification fixtures move to the v4 evaluations set

v3's types remain, unused, for BMBB-780.

BREAKING CHANGE: the provider now calls the v4 feature-flag endpoints and
evaluates rules-based flags. A server that only serves the v3 toggle
endpoints is no longer supported.

Co-Authored-By: Claude Opus 5 (1M context) <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