Skip to content

feat!: DISABLED is a successful evaluation (still defaults)#1800

Merged
toddbaert merged 6 commits into
mainfrom
feat/disabled-flag-reason
Jun 2, 2026
Merged

feat!: DISABLED is a successful evaluation (still defaults)#1800
toddbaert merged 6 commits into
mainfrom
feat/disabled-flag-reason

Conversation

@jonathannorris

@jonathannorris jonathannorris commented May 25, 2026

Copy link
Copy Markdown
Member
  • Disabled flags now resolve successfully with reason=DISABLED instead of errorCode=FLAG_NOT_FOUND. See the ADR.
  • Breaking, but barely: resolved values are unchanged (the caller-provided default is still surfaced).
  • The break is only observable for consumers that inspect reason / errorCode on disabled-flag evaluations.

Related Issues

Closes #1799
Part of open-feature/flagd#1965

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 updates the behavior of disabled feature flags to return a disabled reason instead of an error code. However, the current implementation returns a null value for disabled flags, which can lead to NullPointerExceptions in client applications. The reviewer suggests returning the user-provided default value instead of null when a flag is disabled, and updating the corresponding unit tests to assert this behavior.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the in-process flagd-core evaluation behavior to treat state: DISABLED as a successful evaluation with reason=DISABLED (instead of returning FLAG_NOT_FOUND), and ensures disabled evaluations include flag metadata.

Changes:

  • FlagdCore: return reason=DISABLED for disabled flags (no errorCode/errorMessage) and include flag metadata.
  • MockEvaluator: align test evaluator behavior with the new disabled-flag semantics.
  • Tests: update assertions in flagd-core and providers/flagd to expect reason=DISABLED with no value/variant.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
tools/flagd-core/src/main/java/dev/openfeature/contrib/tools/flagd/core/FlagdCore.java Changes disabled-flag evaluation to return reason=DISABLED and include metadata.
tools/flagd-core/src/test/java/dev/openfeature/contrib/tools/flagd/core/FlagdCoreTest.java Updates disabled-flag test expectations for FlagdCore.
providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/resolver/process/MockEvaluator.java Updates mock evaluator disabled-flag behavior used by in-process resolver tests.
providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/resolver/process/InProcessResolverTest.java Updates disabled-flag assertions for in-process resolver tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@toddbaert

Copy link
Copy Markdown
Member

Marking as draft for now - we need the flagd and testbed update first.

@toddbaert toddbaert changed the title feat(flagd-core): return reason=DISABLED for disabled flags feat(flagd-core)!: DISABLED is a successful evaluation (still defaults) Jun 1, 2026
@toddbaert toddbaert force-pushed the feat/disabled-flag-reason branch from af8f129 to 309fb2d Compare June 1, 2026 17:18
jonathannorris and others added 4 commits June 1, 2026 13:18
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
…s, add object test

Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
@toddbaert toddbaert force-pushed the feat/disabled-flag-reason branch from 309fb2d to b2969bd Compare June 1, 2026 17:19
@toddbaert toddbaert changed the title feat(flagd-core)!: DISABLED is a successful evaluation (still defaults) feat!: DISABLED is a successful evaluation (still defaults) Jun 1, 2026
@toddbaert toddbaert marked this pull request as ready for review June 1, 2026 17:19
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.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.

feat: flagd-core in-process evaluator returns reason=DISABLED for disabled flags

7 participants