Skip to content

[OFREP] Should the provider handle codeDefaultFlag responses? Disabled flags surface FLAG_NOT_FOUND #1850

Open

Description

@aepfli

Asking rather than reporting, because I may be misreading either the schema or the intent — and if the answer is "deliberate, for now", that is a useful thing to have written down.

What I observed

disabled-boolean-flag from flagd-testbed:v3.8.0, over OFREP:

$ curl -s -X POST localhost:8016/ofrep/v1/evaluate/flags/disabled-boolean-flag -d '{"context":{}}'
{"key":"disabled-boolean-flag","reason":"DISABLED","metadata":{}}     HTTP 200

The application receives the code default value with errorCode = FLAG_NOT_FOUND.

Why I think it might be unintended

evaluationSuccess in open-feature/protocol's service/openapi.yaml requires only key and reason. value is not required, because one member of its oneOf is codeDefaultFlag:

Note: This schema has no value property. The provider must use the code default value when processing this response.

DISABLED is in that schema's reason enum, so the response above looks well-formed to me: a successful evaluation that defers to the code default.

In Resolver.java (~174-181), handleResolved appears to take its responseValue == null branch and return the code default with FLAG_NOT_FOUND, discarding the reason parsed a few lines earlier. If that reading is right, the effect is not limited to disabled flags — any codeDefaultFlag response would reach the application as a failure error code on an evaluation that succeeded.

Questions

  1. Is codeDefaultFlag support intended for this provider, or knowingly out of scope for now? code default flag support landed in the protocol in protocol#49 (2025-08-21) as a breaking change, and I could not find any issue in the org tracking provider-side adoption of it — so "nobody has got to it yet" seems at least as likely as "this is a bug".
  2. If it is in scope: is FLAG_NOT_FOUND deliberate here? I would have expected no error code at all, with the reason from the response passed through.
  3. Is there a reading of the schema under which the current behaviour is correct and I have this backwards?

How I ran into it

Building the cross-language provider conformance suite proposed in open-feature/spec#417. A new gated @disabled-flags capability asserts that a flag disabled in the management system resolves to the code default. Four scenarios fail here, all on the error-code assertion — the value assertion passes, because the provider does fall back to the default on error, so the value looks right while the error code says the evaluation failed.

For calibration, the same scenarios pass against the Go and JavaScript OFREP providers, which is what made me think this is worth asking about rather than a limitation of OFREP itself. I am not attached to any particular answer here.

Since filing (2026-10-20)

  • A second backend reproduces it. The GO Feature Flag relay proxy answers a disabled flag the same way, {"reason":"DISABLED"} with no value. The Java GO Feature Flag provider's remote mode delegates to this provider and fails the same 5 scenarios (test(go-feature-flag): adopt the OpenFeature Provider TCK #1947). Its in-process mode passes them, against the same backend.
  • Question 3 has an answer. OFREP's ADR-0006 says that when a response uses codeDefaultFlag, providers MUST use the code default value, with key, reason, variant and metadata unchanged. So an error code here is not a permitted reading.
  • Go passes only partly by design. Its resolvers check reason == DISABLED rather than a missing value, so a value-less success with any other reason would still fail there.

Activity

  1. added
    question
    on Sep 12, 2026
  2. ajtaylor commented on Dec 5, 2026

    @ajtaylor

    Thanks @aepfli, and sorry for jumping ahead with #1997. Here's the thinking behind it, as a starter for discussion.

    How I came to it. I'm building on flagd and hit the same thing from the application side: a flag that's disabled in flagd reaches the application through this provider with reason ERROR and FLAG_NOT_FOUND. To someone reading logs or metrics, that looks like a misspelt key, not a flag that was switched off on purpose.

    The idea. Treat a 200 response with no value as codeDefaultFlag, as ADR-0006 describes: return the caller's default, pass the response's reason, variant and metadata through unchanged, and set no error code or message. Responses with a value, type mismatches and error responses would behave as they do now.

    Following the JavaScript providers. This is how the JS OFREP providers already do it, since open-feature/js-sdk-contrib#1396: the shared resolver checks whether value is defined, not what the reason is, and returns the default with the response's reason. The schema and the ADR tie the code default to the absence of value, not to a particular reason, so this covers DISABLED and any other reason a backend sends with a code default, and leaves a response that does carry a value alone, whatever its reason. The ADR's own example of a code default response uses "reason": "DEFAULT" with a variant, not DISABLED. As you noted, Go checks reason == DISABLED instead, so a value-less response with another reason still fails there.

    Points I'd value views on:

    1. Missing value or reason? @lukas-reining, as you implemented feat: implement OFREP code default js-sdk-contrib#1396, could you confirm that keying on the missing value was the intended reading of the ADR? If so, I'd suggest Java follows JS, and Go's check might move to the same rule.
    2. Explicit "value": null. Here Java and JS would differ. JS checks only for undefined, so an explicit null isn't a code default there. In Java, OfrepResponse.value is a plain Object, so Jackson gives null for both a missing field and an explicit null, and fix(ofrep): use the code default without an error when a response has no value #1997 treats both as a code default. The schema doesn't make value nullable, so I don't think it matters much in practice, but matching JS exactly would mean recording whether the field was present. Is that worth doing?
    3. Consistency across providers. For transparency: I've proposed the same change for the Python (fix(ofrep): don't require variant in a success response python-sdk-contrib#494) and Ruby (fix(ofrep): use the code default when a success response has no value or variant ruby-sdk-contrib#358) providers, and would bring them into line with whatever's agreed here.

    #1997. I'm happy to make it a draft, change it, or close it, whichever you prefer. Its two tests (flagd's disabled-flag response as raw JSON, and a STATIC response with a variant but no value) might be useful whichever approach we settle on.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions