Skip to content

Add experimental feature toggle system#6719

Open
mdegat01 wants to merge 1 commit intomainfrom
feature-toggles
Open

Add experimental feature toggle system#6719
mdegat01 wants to merge 1 commit intomainfrom
feature-toggles

Conversation

@mdegat01
Copy link
Copy Markdown
Contributor

@mdegat01 mdegat01 commented Apr 9, 2026

Summary

Adds a feature toggle system to Supervisor to gate experimental features during development, preventing users from depending on in-flux APIs.

The first toggle is supervisor_v2_api which will gate the upcoming V2 API.

API Changes

POST /supervisor/options

Accepts a feature_flags dict. Only keys present are changed — absent keys leave the current state unchanged, consistent with Supervisor's existing partial-update pattern.

{"feature_flags": {"supervisor_v2_api": true}}

Unknown feature flag names are rejected with a 400 error.

GET /supervisor/info

Always returns all known feature flags and their current state for discoverability:

{"feature_flags": {"supervisor_v2_api": false}}

Implementation

  • ExperimentalFeature StrEnum in supervisor/const.py — add new toggles here as an enum value
  • feature_flags stored in config.json as a dict, defaults to False for any flag not yet set
  • Voluptuous schema validates keys against ExperimentalFeature enum values

Introduces an ExperimentalFeature enum and feature_flags config to allow
toggling experimental features via the supervisor options API. The first
feature flag is 'supervisor_v2_api' to gate the upcoming V2 API.

Absent keys in options request = no change (partial update, consistent
with existing options APIs). The info endpoint always returns all known
feature flags and their current state for discoverability.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mdegat01 mdegat01 added the new-feature A new feature label Apr 9, 2026
@mdegat01
Copy link
Copy Markdown
Contributor Author

mdegat01 commented Apr 9, 2026

So first thing I realized with the v2 API is I want us to be able to iterate on it for a bit. And I don't want to block Supervisor releases until its ready to ship to make changing what we have a breaking change. So I thought a feature toggle setup would be a good idea. Then we can continue to ship versions of Supervisor as normal while freely changing V2 until its ready without worrying about breaking others.

@mdegat01 mdegat01 requested a review from agners April 9, 2026 04:23
Copy link
Copy Markdown
Member

@agners agners left a comment

Choose a reason for hiding this comment

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

Other than the naming nit, I think this is a good idea. In a way it mirrors a bit the lab approach we have in Core. The incremental development approach works much better for us, and having the feature behind a flag helps us avoid features being used while they are work-in-progress. Nice 👍 !

vol.Optional(ATTR_DETECT_BLOCKING_IO): vol.Coerce(DetectBlockingIO),
vol.Optional(ATTR_COUNTRY): str,
vol.Optional(ATTR_FEATURE_FLAGS): vol.Schema(
{vol.Coerce(ExperimentalFeature): vol.Boolean()}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The flag is named feature_flags, the enum ExperimentalFeature. I'd prefer if we have either experimental in both of them or none of them.

I guess the later would potentially be misunderstood, or rather change the scope of this feature flag 🤔 .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. I think I'll just go with the industry standard feature flag term rather then impose a use case on them with experimental

@mdegat01 mdegat01 added missing-documentation Added to pull requests that needs a docs, but none is linked needs-cli Pull requests needs CLI changes but none is linked needs-client-library Pull requests needs client library changes but none is linked labels Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed missing-documentation Added to pull requests that needs a docs, but none is linked needs-cli Pull requests needs CLI changes but none is linked needs-client-library Pull requests needs client library changes but none is linked new-feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants