cody: add cody.enabled flag to site-config, simplify others#52919
Conversation
9dc318d to
19ffd1d
Compare
e1c58a4 to
d3587f5
Compare
There was a problem hiding this comment.
Instead of removing this entirely, can we infer cody.enabled = completions.enabled and mark this old configuration as deprecated? This way when we upgrade an instance, Cody won't be momentarily disabled
There was a problem hiding this comment.
This way when we upgrade an instance, Cody won't be momentarily disabled
How many customers are affected by this? And with "momentarily" you mean the time between "upgraded" and "admin added cody.enabled", right?
There was a problem hiding this comment.
And with "momentarily" you mean the time between "upgraded" and "admin added cody.enabled", right?
Yep!
How many customers are affected by this?
This is pretty surprisingly high number for me but we have 32 Cloud customers with Cody enabled that may all be affected by this change:
$ mi2 instance list -expr 'Spec.Application.Cody?.Enabled == true' | jq length
32
There was a problem hiding this comment.
Should this be nested? e.g.
cody {
enabled
restrictUsersFeatureFlag
}
this could be convenient for grouping Cody-related config
There was a problem hiding this comment.
I personally think top-level fields are easier to manage than nested ones and I'm also copying relatively recent additions to site-config like these:
Because the case I want to optimize for is
{
"cody.enabled": true
}That seems much nicer to me (I know: hard arguments here) than:
{
"cody": {
"enabled": true
}
}(If we had a webform instead of a JSON editor and people wouldn't have to edit this manually, that's fine)
There was a problem hiding this comment.
Fair enough, we have precedence for both :)
There was a problem hiding this comment.
Potential downside I've seen is that sometimes customer's don't sort the keys alphabetically so in a large site config, at a glance it's easy to miss that some facet of a particular group of config is set/not set
This adds - `cody.enabled` to site-config flag, default false - `cody.restrictUsersFeatureFlag` to site-config, default false It changes - `cody.IsEnabled` to check `cody.enabled` and *not* `completions.enabled` anymore - feature flag used by `cody.restrictUsersFeatureFlag` from `cody-experimental` to `cody` - completions handler to check whether cody is enabled and only then check config It removes - `experimentalFeatures.CodyRestrictUsersFeatureFlag` in favor of `cody.restrictUsersFeatureFlag` - `completions.enabled` field, in favor of `cody.enabled`
d3587f5 to
d1a8981
Compare
Context: proposal in [Cody feature flag in 5.1](https://docs.google.com/document/d/1syg64zhUapagA1c8YVO7v4_EUI_m583C39UeRNcCJ3k/edit#) Fixes a lot of things on this ticket: https://github.com/sourcegraph/sourcegraph/issues/52980 This adds - `cody.enabled` to site-config flag, default false - `cody.restrictUsersFeatureFlag` to site-config, default false It changes - `cody.IsEnabled()` to check `cody.enabled` and whether `completions` exists, **not** `completions.enabled` anymore - `client.GetCompletionsConfig` to prefer `cody.enabled` over `completions.Enabled` but respect old value - feature flag used by `cody.restrictUsersFeatureFlag` from `cody-experimental` to `cody` - completions handler to check whether cody is enabled and only then check config - ping data to send value of `conf.CodyEnabled()` which checks that Cody is enabled through `cody.enabled == true && completions != nil` It removes - `experimentalFeatures.CodyRestrictUsersFeatureFlag` in favor of `cody.restrictUsersFeatureFlag` It deprecates - `completions.enabled` field, in favor of `cody.enabled` ## Test plan - Manual testing --------- Co-authored-by: Erik Seliger <erikseliger@me.com>
Context: proposal in Cody feature flag in 5.1
Fixes a lot of things on this ticket: https://github.com/sourcegraph/sourcegraph/issues/52980
This adds
cody.enabledto site-config flag, default falsecody.restrictUsersFeatureFlagto site-config, default falseIt changes
cody.IsEnabled()to checkcody.enabledand whethercompletionsexists, notcompletions.enabledanymoreclient.GetCompletionsConfigto prefercody.enabledovercompletions.Enabledbut respect old valuecody.restrictUsersFeatureFlagfromcody-experimentaltocodyconf.CodyEnabled()which checks that Cody is enabled throughcody.enabled == true && completions != nilIt removes
experimentalFeatures.CodyRestrictUsersFeatureFlagin favor ofcody.restrictUsersFeatureFlagIt deprecates
completions.enabledfield, in favor ofcody.enabledTest plan