Skip to content

Conversation

@kylejuliandev
Copy link
Contributor

This PR

Adds support for Disabled flags in the InMemoryProvider. Also updates the e2e tests to run the tests for disabled flags.

Related Issues

Notes

Follow-up Tasks

How to test

@kylejuliandev kylejuliandev requested a review from a team as a code owner November 10, 2025 20:56
@kylejuliandev kylejuliandev changed the title feat: Add disabled support to InMemoryProvider feat: Add disabled flag support to InMemoryProvider Nov 10, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @kylejuliandev, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant enhancement to the InMemoryProvider by adding explicit support for disabled feature flags. This allows developers to mark flags as inactive, ensuring they consistently resolve to their default values with a 'Reason.Disabled' status. The changes span core flag definitions, JSON parsing for test configurations, and extensive test coverage to guarantee the reliability of this new functionality.

Highlights

  • Disabled Flag Support: The InMemoryProvider now supports a 'disabled' property for feature flags, allowing flags to be explicitly turned off.
  • Default Value Resolution: When a flag is disabled, it will always resolve to its predefined default value, and the resolution reason will be 'Reason.Disabled'.
  • Flag Interface and Class Updates: The IFlag interface now includes a 'Disabled' boolean property, and the Flag class constructor and Evaluate method have been updated to incorporate and respect this new property.
  • E2E Test Enhancements: End-to-end tests have been updated to include scenarios for disabled flags, ensuring proper functionality and removing previous exclusions for 'reason-codes-disabled'.
  • Comprehensive Unit Testing: New unit tests have been added to InMemoryProviderTests to validate the behavior of disabled flags across various data types (boolean, string, integer, double, object).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist
Copy link

Summary of Changes

Hello @kylejuliandev, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the "InMemoryProvider" by introducing explicit support for disabled feature flags. This allows developers to mark flags as inactive, ensuring they consistently resolve to their default values with a "Reason.Disabled", thereby improving clarity and control over feature rollout. The changes span the core "Flag" definition, its evaluation logic, and are thoroughly validated with updated unit and end-to-end tests, alongside a practical example in the sample application.

Highlights

  • Disabled Flag Support: Introduced a "Disabled" property to the "Flag" interface and its "Flag" implementation within the "InMemoryProvider", allowing flags to be explicitly marked as disabled.
  • Flag Evaluation Logic: Modified the "Evaluate" method in "Flag" to immediately return the provided default value with a "Reason.Disabled" if the flag is marked as disabled, bypassing normal variant evaluation.
  • E2E Test Updates: Updated end-to-end tests to parse the "disabled" property from flag definitions and removed the "reason-codes-disabled" exclusion tag, ensuring comprehensive testing of disabled flag scenarios.
  • Unit Test Coverage: Added extensive unit tests in "InMemoryProviderTests" to validate the behavior of disabled flags across various data types (boolean, string, integer, float, object), confirming they correctly resolve to their default values when disabled.
  • Sample Application Integration: Included a new "disabled-flag" example in the "AspNetCore" sample application to demonstrate how to define and use a disabled flag.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.02%. Comparing base (ddd8f22) to head (ab8466d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #632      +/-   ##
==========================================
+ Coverage   89.99%   90.02%   +0.03%     
==========================================
  Files          77       77              
  Lines        3198     3208      +10     
  Branches      368      369       +1     
==========================================
+ Hits         2878     2888      +10     
  Misses        251      251              
  Partials       69       69              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@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 successfully adds support for a disabled flag to the InMemoryProvider, which is a valuable feature. The changes are well-implemented, including updates to the E2E tests to parse and utilize the new disabled property. I have a couple of suggestions to enhance the design and maintain consistency. One is to ensure the immutability of the Disabled property on a flag, and the other is a minor correction in a test file. Overall, this is a solid contribution.

Copy link

@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 adds support for a disabled flag to the InMemoryProvider, which is a great feature. The implementation looks solid, and the new functionality is well-tested. I've made a few suggestions to improve the code:

  • In src/OpenFeature/Providers/Memory/Flag.cs, I've suggested making the Disabled property immutable after creation to prevent potential race conditions and improve predictability.
  • In test/OpenFeature.E2ETests/Utils/FlagDictionaryJsonConverter.cs, I found an obsolete comment that should be removed.
  • In test/OpenFeature.Tests/Providers/Memory/InMemoryProviderTests.cs, I've made several suggestions to improve the new tests, such as correcting a comment and adding assertions to make them more robust.

Overall, these are minor points in an otherwise excellent contribution. Once these are addressed, the PR should be ready to merge.

/// <summary>
/// Indicates if the flag is disabled. When disabled, the flag will resolve to the default value.
/// </summary>
bool Disabled { get; }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@askpt I think the only doubt I have with this change is that it is technically a breaking change. Anyone who may have extended Flag in their projects will have problems upgrading as it won't automatically implement this

Copy link
Member

Choose a reason for hiding this comment

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

In fairness this is not a "shocking" breaking change. Also should we publish this interface? 🤔

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.

3 participants