feat: add method to validate feature toggles - #284
Open
NicoleMGomes wants to merge 6 commits into
Open
Conversation
NicoleMGomes
marked this pull request as ready for review
August 25, 2026 18:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds feature toggle support to the runtime context module.
DWCContextProvidernow reads thedwc-stage-configurationrequest header — a base64-encoded JSON payload listing feature flags with their enabled state — and exposes the names of all enabled toggles as the newFEATURE_TOGGLEScontext key (ContextKey[List[str]]). A new top-level helperis_feature_enabled(name)checks whether a named toggle is active for the current request, returningFalsewhen the header is absent, malformed, or the toggle is not enabled.Related Issue
Closes #
Type of Change
How to Test
bootstrap(app)(usesDWCContextProviderby default).dwc-stage-configuration: <base64-encoded JSON>where the JSON has the shape{"features":[{"name":"MY_FEATURE","enabled":true}]}.is_feature_enabled("my-feature")— expectTrue.is_feature_enabled("absent-feature")— expectFalse.False.pytest tests/core/unit/runtime_context/ -v— all 45 tests pass.Checklist
Additional Notes
FEATURE_TOGGLESis exported fromsap_cloud_sdk.core.runtime_contextalongside the existing DWC keys.is_feature_enabledis also exported at the same level for ergonomic use in request handlers.