Skip to content

Commit 3e92494

Browse files
committed
Update feature flags documentation for new feature behaviour
1 parent 2a25c6a commit 3e92494

File tree

1 file changed

+19
-47
lines changed

1 file changed

+19
-47
lines changed

docs/feature-flags.md

Lines changed: 19 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ clients commit to doing the associated clean up work once a feature stabilises.
3535
When starting work on a feature, we should create a matching feature flag:
3636

3737
1. Add a new
38-
[setting](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.js)
38+
[setting](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.ts)
3939
of the form:
4040
```js
4141
"feature_cats": {
@@ -47,17 +47,9 @@ When starting work on a feature, we should create a matching feature flag:
4747
```
4848
2. Check whether the feature is enabled as appropriate:
4949
```js
50-
SettingsStore.isFeatureEnabled("feature_cats")
50+
SettingsStore.getValue("feature_cats")
5151
```
52-
3. Add the feature to the set of labs on
53-
[develop](https://github.com/vector-im/riot-web/blob/develop/riot.im/develop/config.json)
54-
and [nightly](https://github.com/vector-im/riot-desktop/blob/develop/riot.im/nightly/config.json):
55-
```json
56-
"features": {
57-
"feature_cats": "labs"
58-
},
59-
```
60-
4. Document the feature in the [labs documentation](https://github.com/vector-im/riot-web/blob/develop/docs/labs.md)
52+
3. Document the feature in the [labs documentation](https://github.com/vector-im/riot-web/blob/develop/docs/labs.md)
6153

6254
With these steps completed, the feature is disabled by default, but can be
6355
enabled on develop and nightly by interested users for testing.
@@ -67,69 +59,49 @@ The following lists a few common options.
6759

6860
## Enabling by default on develop and nightly
6961

70-
Set the feature to `enable` in the
62+
Set the feature to `true` in the
7163
[develop](https://github.com/vector-im/riot-web/blob/develop/riot.im/develop/config.json)
7264
and
7365
[nightly](https://github.com/vector-im/riot-desktop/blob/develop/riot.im/nightly/config.json)
7466
configs:
7567

7668
```json
7769
"features": {
78-
"feature_cats": "enable"
70+
"feature_cats": true
7971
},
8072
```
8173

8274
## Enabling by default on staging, app, and release
8375

84-
Set the feature to `enable` in the
76+
Set the feature to `true` in the
8577
[staging / app](https://github.com/vector-im/riot-web/blob/develop/riot.im/app/config.json)
8678
and
8779
[release](https://github.com/vector-im/riot-desktop/blob/develop/riot.im/release/config.json)
8880
configs.
8981

90-
**Warning:** While this does mean the feature is enabled by default for
91-
https://app.element.io and official Element Desktop builds, it will not be enabled by
92-
default for self-hosted installs, custom desktop builds, etc. To cover those
93-
cases as well, the best options at the moment are converting to a regular
94-
setting defaulted on or to remove the flag. Simply enabling the existing flag by
95-
default in `Settings.js`
96-
[does not work currently](https://github.com/vector-im/riot-web/issues/10360).
82+
**Note:** The above will only enable the feature for https://app.element.io and official Element
83+
Desktop builds. It will not be enabled for self-hosted installed, custom desktop builds, etc. To
84+
cover these cases, change the setting's `default` in `Settings.ts` to `true`.
9785

9886
## Feature deployed successfully
9987

100-
Once we're confident that a feature is working well, we should remove the flag:
88+
Once we're confident that a feature is working well, we should remove or convert the flag.
10189

102-
1. Remove the [setting](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.js)
103-
2. Remove all `isFeatureEnabled` lines that test for the feature's setting
90+
If the feature is meant to be turned off/on by the user:
91+
1. Remove `isFeature` from the [setting](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.ts)
92+
2. Change the `default` to `true` (if desired).
10493
3. Remove the feature from the [labs documentation](https://github.com/vector-im/riot-web/blob/develop/docs/labs.md)
105-
4. Remove feature state from
106-
[develop](https://github.com/vector-im/riot-web/blob/develop/riot.im/develop/config.json),
107-
[nightly](https://github.com/vector-im/riot-desktop/blob/develop/riot.im/nightly/config.json),
108-
[staging / app](https://github.com/vector-im/riot-web/blob/develop/riot.im/app/config.json),
109-
and
110-
[release](https://github.com/vector-im/riot-desktop/blob/develop/riot.im/release/config.json)
111-
configs
112-
5. Celebrate! 🥳
94+
4. Celebrate! 🥳
11395

114-
## Convert to a regular setting (optional)
115-
116-
Sometimes we decide a feature should always be user-controllable as a setting
117-
even after it has been fully deployed. In that case, we would craft a new,
118-
regular setting:
119-
120-
1. Remove the feature flag from
121-
[settings](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.js)
122-
and add a regular setting with the appropriate levels for your feature
123-
2. Replace the `isFeatureEnabled` lines with `getValue` or similar calls
124-
according to the [settings
125-
docs](https://github.com/matrix-org/matrix-react-sdk/blob/develop/docs/settings.md)
126-
(checking carefully, as we may want a different mix of code paths when the
127-
feature is always present but gated by a setting)
96+
If the feature is meant to be forced on (non-configurable):
97+
1. Remove the [setting](https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/settings/Settings.ts)
98+
2. Remove all `getValue` lines that test for the feature.
12899
3. Remove the feature from the [labs documentation](https://github.com/vector-im/riot-web/blob/develop/docs/labs.md)
129-
4. Remove feature state from
100+
4. If applicable, remove the feature state from
130101
[develop](https://github.com/vector-im/riot-web/blob/develop/riot.im/develop/config.json),
131102
[nightly](https://github.com/vector-im/riot-desktop/blob/develop/riot.im/nightly/config.json),
132103
[staging / app](https://github.com/vector-im/riot-web/blob/develop/riot.im/app/config.json),
133104
and
134105
[release](https://github.com/vector-im/riot-desktop/blob/develop/riot.im/release/config.json)
135106
configs
107+
5. Celebrate! 🥳

0 commit comments

Comments
 (0)