Is InMemoryFlag.state intended to be honoured? DISABLED is never read
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 38/100
Línea de trabajo
Comienza en openfeature/provider/in_memory_provider.py, en InMemoryFlag.state y resolve(), y compara después el comportamiento documentado entre lenguajes para los flags deshabilitados que se describe en el issue. Confirma si Python debe respetar DISABLED o conservar el campo únicamente por compatibilidad. El trabajo estará terminado cuando se haya decidido y registrado el comportamiento previsto, y se haya actualizado el comportamiento relevante del proveedor en memoria o las pruebas si los maintainers deciden hacer un cambio.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
InMemoryFlag declares a state field with an ENABLED/DISABLED enum, and as far as I can tell nothing ever reads it. Asking because "the field is there for API compatibility and honouring it was never promised" is a perfectly good answer, and I would rather have it recorded than assume a bug.
What I see
openfeature/provider/in_memory_provider.py:
class InMemoryFlag(typing.Generic[T_co]):
class State(StrEnum):
ENABLED = "ENABLED"
DISABLED = "DISABLED"
default_variant: str
variants: dict[str, T_co]
flag_metadata: FlagMetadata = field(default_factory=dict)
state: State = State.ENABLED # line 47
...
def resolve(self, evaluation_context):
if self.context_evaluator:
return self.context_evaluator(self, evaluation_context or EvaluationContext())
return FlagResolutionDetails(
value=self.variants[self.default_variant],
reason=Reason.STATIC,
variant=self.default_variant,
flag_metadata=self.flag_metadata,
)
grep -n state in_memory_provider.py returns exactly one line — the declaration above. State.DISABLED does not appear anywhere else in the package.
So a flag constructed with state=State.DISABLED resolves to its own defaultVariant with reason STATIC, as though it were enabled.
Why I think it may be worth changing
For comparison, across the other in-memory reference providers:
| SDK | field | behaviour on a disabled flag |
|---|---|---|
| JavaScript | disabled: boolean |
caller's default, reason: DISABLED, no error code |
| Java | disabled (isDisabled) |
caller's default, reason: DISABLED, no error code |
| Go | State enum |
caller's default + reason: DISABLED, but also a GENERAL error — reported as go-sdk#552, fixed by #574 |
| Python | state enum |
resolves as if enabled |
Two of the four substitute the caller's default with reason: DISABLED and no error; Go agreed that was the right answer when it was raised. That is convention rather than specification — I could find no numbered requirement saying what a provider owes a disabled flag — so this is not a conformance claim, just a consistency observation.
Also worth noting the two shapes in the ecosystem: state: ENABLED|DISABLED in Go, Python and flagd's flag format, versus disabled: boolean in JavaScript, Java and Appendix B's test-flags.json. Not something to fix here, but it is why the field probably exists in this shape.
Questions
- Is
stateintended to be honoured byresolve(), or is it carried for configuration compatibility only? - If it should be honoured — is the intended behaviour the caller's default with
reason: DISABLEDand no error code, matching JavaScript and Java? - Would you rather the field were removed than implemented, if honouring it is not wanted? A declared field that is never read seems the more surprising of the two states.
Context
Found while building the cross-language provider conformance suite proposed in open-feature/spec#417. A new gated @disabled-flags capability is left undeclared for the Python in-memory suites on the strength of this, and the four scenarios skip rather than fail — so nothing is blocked. Recording the question so the reason for that gate is not just in my head.
- Lenguaje dominante
- Python
- Estrellas
- 113
- Forks
- 48
- Merge medio
- 23 h 52 min
- PR fusionados (30 d)
- 20
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de open-feature/python-sdk
-
[BUG] before hooks do not receive the evaluation context returned by earlier before hooksPosiblemente ocupada @Ritinpaul la tomó hace 52 días. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 78/100
open-feature/python-sdk#628 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Spec v0.9.0 complianceAbiertov0.9.0
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
open-feature/python-sdk#618 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Supply the bound domain to provider initializationPosiblemente ocupada @jonathannorris la tomó hace 148 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
open-feature/python-sdk#615 ·
Los mantenedores suelen responder en 1 día
-
Support isolated API instancesPosiblemente ocupada @marcozabel la tomó hace 219 días. Abierto
open-feature/python-sdk#584 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[Multi-provider] Gaps identified relative to js-sdk reference implementationPosiblemente ocupada @jonathannorris la tomó hace 256 días. Abiertomulti-provider
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
open-feature/python-sdk#568 ·
Los mantenedores suelen responder en 1 día
Todos los issues de open-feature/python-sdk
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
documentation good first issue help wanted
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
documentation good first issue help wanted
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
-
documentation good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100