Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add central interface for defining feature flags #640

Merged
merged 8 commits into from
May 31, 2024

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented Apr 17, 2024

The intended use for colcon feature flags is to ship pre-production and prototype features in a disabled state, which can be enabled by specifying a particular environment variable value. By using an environment variable, these possibly dangerous or unstable features are hidden from common users but are enabled in a way which can be audited.

Current examples of possible uses:

@cottsay cottsay added the enhancement New feature or request label Apr 17, 2024
@cottsay cottsay self-assigned this Apr 17, 2024
The intended use for colcon feature flags is to ship pre-production and
prototype features in a disabled state, which can be enabled by
specifying a particular environment variable value. By using an
environment variable, these possibly dangerous or unstable features are
hidden from common users but are enabled in a way which can be audited.
Copy link
Contributor

@nuclearsandwich nuclearsandwich left a comment

Choose a reason for hiding this comment

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

I think this is handy for introducing changes in an otherwise "stable" CLI. I've left an implementation comment.

colcon_core/feature_flags.py Outdated Show resolved Hide resolved
@cottsay
Copy link
Member Author

cottsay commented Apr 19, 2024

Also discussed offline:
The is_feature_flag_set now logs a warning the first time an enabled feature is queried. It will look like this on the console:

[0.208s] colcon.colcon_core.feature_flags WARNING Enabling feature: foobar

I'd rather not directly write to stdout or stderr, and INFO level log messages are not printed to the console by default, so this seemed like the best move. A warning also highlights the possible instability of the feature's use.

@nuclearsandwich
Copy link
Contributor

I'd rather not directly write to stdout or stderr, and INFO level log messages are not printed to the console by default, so this seemed like the best move. A warning also highlights the possible instability of the feature's use.

I think warning is appropriate since feature flags are used to change default behavior in inherently unstable and under-tested ways (i.e. we will never test with the complete cartesian product of feature flag values).

Copy link

codecov bot commented May 22, 2024

Codecov Report

Attention: Patch coverage is 96.29630% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 83.33%. Comparing base (485f500) to head (6edd2b5).
Report is 1 commits behind head on master.

Files Patch % Lines
colcon_core/feature_flags.py 96.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #640      +/-   ##
==========================================
+ Coverage   83.24%   83.33%   +0.09%     
==========================================
  Files          66       67       +1     
  Lines        3850     3877      +27     
  Branches      760      766       +6     
==========================================
+ Hits         3205     3231      +26     
  Misses        556      556              
- Partials       89       90       +1     

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

@cottsay cottsay merged commit 857ea3f into master May 31, 2024
36 checks passed
@delete-merged-branch delete-merged-branch bot deleted the cottsay/feature-flags branch May 31, 2024 23:19
@cottsay cottsay added this to the 0.16.2 milestone Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

None yet

2 participants