-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[tool] Support FeatureFlags.isEnabled in google3 #171797
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
Conversation
| } | ||
|
|
||
| /// All Flutter feature flags that are enabled. | ||
| // This member is overriden in google3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally my plan was to override this in google3 with something like:
@override
Iterable<Feature> get allEnabledFeatures {
return <Feature>[
if (isWebEnabled) flutterWebFeature,
if (isLinuxEnabled) flutterLinuxDesktopFeature,
...
];
}However, I reconsidered as this would be brittle: when we add a few flag, we'd need to remember to update google3's FeatureFlags.allEnabledFeatures implementation. With this new approach, google3's FeatureFlags.isEnabled and FeatureFlags.allEnabledFeatures will just work without any overrides.
| /// | ||
| /// This default implementation is used by google3 to facilitate rolls. | ||
| /// In Flutter, this is overriden by [FlutterFeatureFlags.isEnabled]. | ||
| bool isEnabled(Feature feature) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand why we are doing this, but it's unfortunate because it further increases the cost of new feature flags.
Could you explain why => false isn't a good enough default implementation, or why we need a default implementation at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we went with => false approach, here's the process we'd need to do to add a new feature flag:
- Add feature flag to the tool
- Wait until this rolls to google3
- Update google3 to also add the feature flag to the tool (see this)
We'd be very likely to forget that third step.
With the approach in this PR, all of the work to add a feature flag is centralized in the Flutter tool. google3 wouldn't need any updates to add the new feature flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you expand on that - why isn't the default of false ok? I think it's going to be pretty rare that, for something that deserves to be flagged, we don't want to explicitly (and separately) turn it on in google3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we make Feature an enum and drop the default case in this switch? That would cause FRoB to fail without a G3Fix since this switch wouldn't be exhaustive if we add a new value to Feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's assuming that we move this implementation of isEnabled into google3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A feature flag is very likely to require additional work in google3. Even if we make the flutter_tools believe that a certain feature flag is enabled, it might not actually work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we went with the default of false here, it would allow us to be in weird middle states. For example:
- I add
fooFeatureandFeatureFlags.isFooEnabledto the Flutter tool and make it on by default. - This rolls into google3. At this point, google3's
FeatureFlags.isFooEnabledistruebutFeatureFlags.allEnabledFeaturesexcludesfooFeature.
To fix this, I have to remember to update google3's FeatureFlags.allEnabledFeatures override to do the right thing:
@override
Iterable<Feature> get allEnabledFeatures {
return <Feature>[
if (isWebEnabled) flutterWebFeature,
if (isLinuxEnabled) flutterLinuxDesktopFeature,
...
+ if (isFooEnabled), fooFeature,
];
}IMO, this is error-prone. Folks will forget to update google3's feature flags, which will cause weird behaviors in google3.
This problem is avoided by this PR's approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, this is error-prone. Folks will forget to update google3's feature flags, which will cause weird behaviors in google3.
They won't forget if Feature is an enum and it breaks compilation when we no longer exhaustively check each value 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, I didn't mean to ignore folks' comments in this thread. Y'all replied after I opened the tab, I didn't see your replies until I refreshed the page 😅
Couldn't we make
Featurean enum and drop the default case in thisswitch? That would cause FRoB to fail without a G3Fix since thisswitchwouldn't be exhaustive if we add a new value toFeature.
I think this alternative solution would work too, but personally I'd prefer a solution that avoids g3fixes. That said, I'm happy to switch to that approach if everyone else prefers it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem! GitHub is being weird and not refreshing comments automatically for me.
When it comes to experiments in google3, it's probably worth forcing whoever is creating a new feature to add the G3Fix so it can be deliberately enabled or disabled for google3. I'd also rather keep things simpler in open-source land and let google3 handle its own special cases in general, but that's just my gut feeling... 😃
| /// | ||
| /// This default implementation is used by google3 to facilitate rolls. | ||
| /// In Flutter, this is overriden by [FlutterFeatureFlags.isEnabled]. | ||
| bool isEnabled(Feature feature) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A feature flag is very likely to require additional work in google3. Even if we make the flutter_tools believe that a certain feature flag is enabled, it might not actually work.
| /// In Flutter, this is overriden by [FlutterFeatureFlags.isEnabled]. | ||
| bool isEnabled(Feature feature) { | ||
| return switch (feature) { | ||
| flutterWebFeature => isWebEnabled, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/flutter_features.dart#L24, isWebEnabled is implemented by calling isEnabled. I think it would be better to consistently treat isEnabled as the more lower-level API than is*Enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's two layers here:
FeatureFlags- This is basically justisFooEnabledproperties with static defaults. This is what google3 uses, effectively.FlutterFeatureFlags- This adds runtime configuration (from env variables and more). This is what the Flutter tool uses.FlutterFeatureFlagsreplacesFeatureFlags's logic entirely, it just usesFeatureFlagsas an interface.
At the FlutterFeatureFlags layer, isEnabled's logic is completely replaced. isEnabled remains the lower-level API than isFooEnabled.
At this FeatureFlags layer, you're right that isEnabled is now a higher-level API than isFooEnabled. However, IMO that's perfectly acceptable: FeatureFlags is just an interface from FlutterFeatureFlags's perspective, it doesn't matter which API is higher or lower level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I have no doubt that the code will function correctly. But it's still better to be consistent to help the future maintainers to build a better mental model. It's also more error prone.
I could imagine someone being confused, like I did, when they are reading this and wondering how this could work. Especially that there are some amount of code that only exists in google3.
That's why I think we should be consistent in both layers.
This concern exists today. If you want to control feature flags separately in Flutter versus google3, you'll need to do the same thing before and after this PR: you'll need to update google3 to override |
|
@bkonyi @matanlurey I chatted with @chingjun offline. What would y'all think of making google3 implement |
I think that sounds reasonable! |
I just don't understand why we'd want to add work for something that is going to happen very rarely (wanting to enable a flag specifically for google3 at the exact same time we add it, ostensibly disabled by default, for the external tool). That being said, this is easy to change. Let's just make a decision, document what it is, and move on. |
chingjun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just don't understand why we'd want to add work for something that is going to happen very rarely (wanting to enable a flag specifically for google3 at the exact same time we add it, ostensibly disabled by default, for the external tool).
The "additional work" is incurred when they add a new feature flag. When someone is adding a new feature flag, we want them to know that the flag doesn't work in google3 as is and probably require additional work.
And the reason we are making this change, is because we intend to make it easier to add new feature flags in the flutter tools, especially runtime feature flags. These do require additional work in google3. It's better to know ahead of time so that they could plan around it.
| /// In Flutter, this is overriden by [FlutterFeatureFlags.isEnabled]. | ||
| bool isEnabled(Feature feature) { | ||
| return switch (feature) { | ||
| flutterWebFeature => isWebEnabled, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I have no doubt that the code will function correctly. But it's still better to be consistent to help the future maintainers to build a better mental model. It's also more error prone.
I could imagine someone being confused, like I did, when they are reading this and wondering how this could work. Especially that there are some amount of code that only exists in google3.
That's why I think we should be consistent in both layers.
_⚠️ Landing this is blocked until: 1) https://critique.corp.google.com/cl/781275353 lands and 2) google3 is updated to add the new feature flag introduced in #171903 Currently, google3's `Google3Features` extends `FeatureFlags`. As a result, google3 automatically gets the same feature flag values as in Flutter. This makes Flutter's feature flag values abstract, thereby requiring that google3's `Google3Features` must explicitly set each feature flag's value. Discussion that motivated this change: #171797 Internal CL: https://critique.corp.google.com/cl/781275353 Part of: #167668 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
_⚠️ Landing this is blocked until: 1) https://critique.corp.google.com/cl/781275353 lands and 2) google3 is updated to add the new feature flag introduced in flutter#171903 Currently, google3's `Google3Features` extends `FeatureFlags`. As a result, google3 automatically gets the same feature flag values as in Flutter. This makes Flutter's feature flag values abstract, thereby requiring that google3's `Google3Features` must explicitly set each feature flag's value. Discussion that motivated this change: flutter#171797 Internal CL: https://critique.corp.google.com/cl/781275353 Part of: flutter#167668 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
_⚠️ Landing this is blocked until: 1) https://critique.corp.google.com/cl/781275353 lands and 2) google3 is updated to add the new feature flag introduced in flutter#171903 Currently, google3's `Google3Features` extends `FeatureFlags`. As a result, google3 automatically gets the same feature flag values as in Flutter. This makes Flutter's feature flag values abstract, thereby requiring that google3's `Google3Features` must explicitly set each feature flag's value. Discussion that motivated this change: flutter#171797 Internal CL: https://critique.corp.google.com/cl/781275353 Part of: flutter#167668 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
_⚠️ Landing this is blocked until: 1) https://critique.corp.google.com/cl/781275353 lands and 2) google3 is updated to add the new feature flag introduced in flutter#171903 Currently, google3's `Google3Features` extends `FeatureFlags`. As a result, google3 automatically gets the same feature flag values as in Flutter. This makes Flutter's feature flag values abstract, thereby requiring that google3's `Google3Features` must explicitly set each feature flag's value. Discussion that motivated this change: flutter#171797 Internal CL: https://critique.corp.google.com/cl/781275353 Part of: flutter#167668 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
_⚠️ Landing this is blocked until: 1) https://critique.corp.google.com/cl/781275353 lands and 2) google3 is updated to add the new feature flag introduced in flutter#171903 Currently, google3's `Google3Features` extends `FeatureFlags`. As a result, google3 automatically gets the same feature flag values as in Flutter. This makes Flutter's feature flag values abstract, thereby requiring that google3's `Google3Features` must explicitly set each feature flag's value. Discussion that motivated this change: flutter#171797 Internal CL: https://critique.corp.google.com/cl/781275353 Part of: flutter#167668 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
_⚠️ Landing this is blocked until: 1) https://critique.corp.google.com/cl/781275353 lands and 2) google3 is updated to add the new feature flag introduced in flutter#171903 Currently, google3's `Google3Features` extends `FeatureFlags`. As a result, google3 automatically gets the same feature flag values as in Flutter. This makes Flutter's feature flag values abstract, thereby requiring that google3's `Google3Features` must explicitly set each feature flag's value. Discussion that motivated this change: flutter#171797 Internal CL: https://critique.corp.google.com/cl/781275353 Part of: flutter#167668 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Currently, google3's implementation of
FeatureFlags.isEnabledthrows. Instead, you have to callFeatureFlags.isFooEnabled, which in google3 returns hardcoded values (google3 does not allow for features to be enabled through configs).This provides an implementation of
FeatureFlags.isEnabledthat returns the hardcoded values.Part of #167668
Alternatives considered
Since this implementation is used by google3, I considered downstreaming this logic to google3. However, this would be brittle: whenever we add a new feature flag, we would need to remember to update google3's
FeatureFlags.isEnabledimplementation. And since we need to roll the new flag to google3 before we can update google3'sFeatureFlags.isEnabledimplementation, we can't write a google3 test that verifies that all flags are supported by google3'sFeatureFlags.isEnabled.Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.