Skip to content

fix: honor disabled in-memory flags - #690

Open
shashank231 wants to merge 2 commits into
open-feature:mainfrom
shashank231:fix/in-memory-disabled-flags
Open

shashank231 wants to merge 2 commits into
open-feature:mainfrom
shashank231:fix/in-memory-disabled-flags

Conversation

@shashank231

@shashank231 shashank231 commented Nov 29, 2026 •

Copy link
Copy Markdown

This PR

Disabled in-memory flags currently resolve as though they were enabled. Return the caller’s default with Reason.DISABLED, no variant, and no error, and skip the context evaluator when the flag is disabled. For example, a disabled boolean flag configured as True returns False when the caller passes False as the default.

The shared resolution path checks for an unknown flag first, then a disabled flag, before evaluating enabled flags normally.

Regression coverage includes all five flag types (both mappings and lists for objects), with and without a context evaluator, through both sync and async methods.

Related Issues

Relates to #627. This proposes the behavior discussed there for maintainer review.

How to test

Validated locally on Python 3.13:

  • .venv\Scripts\python.exe -m pytest -q tests — 227 passed.
  • .venv\Scripts\prek.exe run --all-files — all hooks passed, including Ruff and mypy.

@shashank231
shashank231 requested review from a team as code owners November 29, 2026 17:37
@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The in-memory provider now returns the supplied default with Reason.DISABLED when a flag is disabled. Tests cover synchronous and asynchronous resolution across six value types and verify that the context evaluator is not called.

Changes: Disabled Flag Resolution

Layer / File(s) Summary
Disabled flag handling and validation
openfeature/provider/in_memory_provider.py, tests/provider/test_in_memory_provider.py
_resolve returns the supplied default with Reason.DISABLED for disabled flags. Tests check the result type and details across six value types and confirm the context evaluator is not called.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • open-feature/python-sdk#627 — The issue describes disabled in-memory flags resolving as enabled. This change makes the provider honor the disabled state by returning the supplied default.

Suggested reviewers: gruebel, federicobond

Merge Risk: Minimal · up to 3125d

Disabled in-memory flags now return the caller's default with a DISABLED reason instead of being evaluated as enabled. The change is small and tested, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: disabled in-memory flags now return the caller's default. It uses the fix prefix and names the affected component, so it matches the changeset.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description states the problem (disabled in-memory flags resolve as enabled) and the fix (return the caller's default with Reason.DISABLED, no variant or error, and skip the context evaluator). It…
Full details: Description check

Explanation

The description states the problem (disabled in-memory flags resolve as enabled) and the fix (return the caller's default with Reason.DISABLED, no variant or error, and skip the context evaluator). It also lists regression coverage across all five flag types through sync and async methods, and the local test runs. It matches the raw summary and objectives, so it is related to the changeset.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c938f6a3-43c2-4907-b2d4-f8b49732f8d6
Commits

Reviewing files that changed from the base of the PR and between 2b46703 and 3125dbb.

Files selected for processing: 1

  • tests/provider/test_in_memory_provider.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Signed-off-by: Shashank Kaushik <kaushikshashank1998@gmail.com>
@shashank231
shashank231 force-pushed the fix/in-memory-disabled-flags branch from 6c1510d to 2b46703 Compare November 29, 2026 17:45
Signed-off-by: Shashank Kaushik <kaushikshashank1998@gmail.com>

This branch has not been deployed

No deployments
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