Skip to content

docs: ADR for updated disabled flag behaviour#1919

Open
suthar26 wants to merge 2 commits intoopen-feature:mainfrom
suthar26:docs/adr-disabled-flag-evaluation
Open

docs: ADR for updated disabled flag behaviour#1919
suthar26 wants to merge 2 commits intoopen-feature:mainfrom
suthar26:docs/adr-disabled-flag-evaluation

Conversation

@suthar26
Copy link
Copy Markdown

@suthar26 suthar26 commented Apr 1, 2026

This PR

  • adds ADR for disabled flag behavior updates

Related Issues

Fixes #1918

Notes

Follow-up Tasks

How to test

@suthar26 suthar26 requested review from a team as code owners April 1, 2026 04:17
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 1, 2026

Deploy Preview for polite-licorice-3db33c ready!

Name Link
🔨 Latest commit 7b4902b
🔍 Latest deploy log https://app.netlify.com/projects/polite-licorice-3db33c/deploys/69ea6ef3072c82000853f1a7
😎 Deploy Preview https://deploy-preview-1919--polite-licorice-3db33c.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 1, 2026
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 an Architecture Decision Record (ADR) to change flagd's handling of disabled flags. Instead of returning an error, disabled flags will now return a successful evaluation with a reason of DISABLED and the defaultVariant value, aligning with the OpenFeature specification. Feedback on the ADR highlights several technical implementation details that need to be addressed: the logic in evaluateVariant should be simplified, and the resolve[T] function must be updated to handle DISABLED reasons for empty variants to avoid type mismatch errors. Additionally, the proposal needs to account for gRPC v1 compatibility in bulk evaluations and include specific implementation steps in the timeline for the gRPC and OFREP service layers.

Comment thread docs/architecture-decisions/disabled-flag-evaluation.md
Comment thread docs/architecture-decisions/disabled-flag-evaluation.md
Comment thread docs/architecture-decisions/disabled-flag-evaluation.md Outdated
@suthar26 suthar26 force-pushed the docs/adr-disabled-flag-evaluation branch 5 times, most recently from 73a3398 to c5259ee Compare April 8, 2026 04:34
Comment thread docs/architecture-decisions/disabled-flag-evaluation.md Outdated
@suthar26 suthar26 force-pushed the docs/adr-disabled-flag-evaluation branch from c5259ee to 31200d1 Compare April 8, 2026 15:31
@toddbaert toddbaert changed the title docs: add disabled flag behaviour docs: ADR for updated disabled flag behaviour Apr 9, 2026
---
# Treat Disabled Flag Evaluation as Successful with Reason DISABLED

This ADR proposes changing flagd's handling of disabled flags from returning an error (`reason=ERROR`, `errorCode=FLAG_DISABLED`) to returning a successful evaluation with `reason=DISABLED` and the flag's `defaultVariant` value. A flag that does not exist in a flag set should remain a `FLAG_NOT_FOUND` error.
Copy link
Copy Markdown
Member

@toddbaert toddbaert Apr 10, 2026

Choose a reason for hiding this comment

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

I'm not sure about this.

I would expect the behavior to be return the code-default in all cases when the flags is disabled. Otherwise I'm not really sure what the point is. If we use the defaultVariant, we are still delegating the evaluation do the flag management system, which contradicts the DISABLED idea to me.

I think we just just immediately return the code default.

Am I not thinking about this correctly? Maybe you had a different concept in mind.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i agree, it should use the code_default/fallback - the barriers in flagd are blurry, because if there is no default_variant on the flag, we also use the code_default. but in the case of a disabled flag, it should be the code_default

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

no you are totally right, thats what we should be doing

Copy link
Copy Markdown
Member

@toddbaert toddbaert left a comment

Choose a reason for hiding this comment

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

Review focusing on in-process provider coverage, OFREP spec alignment details, and format.

Comment thread docs/architecture-decisions/disabled-flag-evaluation.md
Comment thread docs/architecture-decisions/disabled-flag-evaluation.md
Comment thread docs/architecture-decisions/disabled-flag-evaluation.md
Comment thread docs/architecture-decisions/disabled-flag-evaluation.md
@toddbaert toddbaert self-requested a review April 10, 2026 17:31
Copy link
Copy Markdown
Member

@toddbaert toddbaert left a comment

Choose a reason for hiding this comment

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

I think this is a bit of a blocker for me; it seems a bit incoherent. Maybe I'm missing something though or not thinking about it correctly. I think if this was changed this would be an easy approval for me. Please help me understand if I'm off-base 😅

@suthar26 suthar26 force-pushed the docs/adr-disabled-flag-evaluation branch 3 times, most recently from 9dcffbd to a4f89fb Compare April 15, 2026 18:55
@suthar26 suthar26 requested a review from toddbaert April 23, 2026 05:33
Signed-off-by: Parth Suthar <parth.suthar@dynatrace.com>
Signed-off-by: Parth Suthar <parth.suthar@dynatrace.com>
@suthar26 suthar26 force-pushed the docs/adr-disabled-flag-evaluation branch from a4f89fb to 7b4902b Compare April 23, 2026 19:11
@sonarqubecloud
Copy link
Copy Markdown

The response has the following properties:

- **value**: Omitted (signals code-default deferral). The SDK/provider uses the application's code-defined default value.
- **variant**: Omitted (empty string).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why an empty string? I'd expect this to be completely omitted in supported languages.

Comment on lines +244 to +255
### Timeline

1. Update `evaluateVariant` in `core/pkg/evaluator/json.go` to return `reason=DISABLED` with an empty variant (code-default deferral) instead of an error
2. Update `resolve[T]` in `core/pkg/evaluator/json.go` to handle `DisabledReason` with empty variants (avoids `TYPE_MISMATCH`)
3. Remove the disabled-flag skip in `ResolveAllValues` and update the `default` branch of the type switch to include disabled flags for gRPC v1 requests
4. Update `SuccessResponseFrom` in `core/pkg/service/ofrep/models.go` to preserve `reason=DISABLED` (with field omission) for disabled flags deferring to code defaults
5. Remove `FlagDisabledErrorCode` handling from `errFormat`, `errFormatV2`, and `EvaluationErrorResponseFrom`
6. Update gRPC v1 service layer (`flag_evaluator_v1.go`) to handle nil values in `ResolveAll` responses for disabled flags deferring to code defaults
7. Update each language SDK's in-process provider evaluator to return `reason=DISABLED` with code-default deferral instead of raising an error when encountering a disabled flag
8. Update flagd-testbed with test cases for disabled flag evaluation across all surfaces
9. Update OpenFeature providers to recognize `DISABLED` as a non-error, non-cacheable reason
10. Update provider documentation and migration guides
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This isn't really a timeline.

### Open questions

- Should bulk evaluation include an option to exclude disabled flags for clients that prefer the current behavior (smaller payloads)?
- How should existing dashboards and alerts that key on `FLAG_DISABLED` errors be migrated? Should we provide a deprecation period where both behaviors are available?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is something we can do. We just need to make it clear that's in the release notes that we're making the behavior change.


- Should bulk evaluation include an option to exclude disabled flags for clients that prefer the current behavior (smaller payloads)?
- How should existing dashboards and alerts that key on `FLAG_DISABLED` errors be migrated? Should we provide a deprecation period where both behaviors are available?
- Does this change require a new flagd major version, or can it be introduced in a minor version with appropriate documentation given the spec alignment argument?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It should be marked as a behavior-breaking change, which will update the minor version since we're sub-1.0.

- Should bulk evaluation include an option to exclude disabled flags for clients that prefer the current behavior (smaller payloads)?
- How should existing dashboards and alerts that key on `FLAG_DISABLED` errors be migrated? Should we provide a deprecation period where both behaviors are available?
- Does this change require a new flagd major version, or can it be introduced in a minor version with appropriate documentation given the spec alignment argument?
- Should the `FlagDisabledErrorCode` constant be retained (but unused) for a deprecation period, or removed immediately?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How would we retain this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Treat disabled flag evaluation as success with reason=DISABLED

4 participants