colcon / colcon-core

Command line tool to build sets of software packages
http://colcon.readthedocs.io
Apache License 2.0
99 stars 44 forks source link

Add central interface for defining feature flags #640

Closed cottsay closed 1 month ago

cottsay commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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).

codecov[bot] commented 2 months ago

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 :warning:
Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.