Introduce Feature Flag for Imports Context
Background
As part of Code Suggestions' focus area to improve code suggestions quality, we are working with groupeditor extensions to add imports as an additional context to code suggestions requests.
An "import context provider" will be introduced in Imports Context Provider - (previously DaVinci ... (gitlab-org/editor-extensions&58 - closed). We will then use this provider to get the imported files in the current active document in an IDE workspace.
Similar to Duo Chat additional contexts, we want to introduce the imports context behind a Feature Flag to allow for a graceful rollout. This would also tie-in with an existing framework in the Language Server that allows users to opt out of selected features.
On the Rails side, the value of this Feature Flag per user should be exposed in the GraphQL currentUser
query. We should be able to query the code suggestions available features like so:
query {
currentUser {
duoCodeSuggestionsAvailableFeatures
}
}
And get this result:
{
"data": {
"currentUser": {
"duoCodeSuggestionsAvailableFeatures": [
"include_imports_context",
]
}
}
}
References and Resources
- GraphQL
currentUser
API reference - GraphQL
CurrentUserType
definition -
UserAvailableFeaturesResolver
- this is a resolver specifically for the User's available Duo Chat features.
Proposal
Update the GraphQL CurrentUserType
to include a new field: duo_code_suggestions_available_features
. As with duo_chat_available_features
, this should be an array of features available to that user.
Note: duo_chat_available_features
is resolved in the Ai::UserAvailableFeaturesResolver
. The resolver has a generic name, but it is only specific to duo chat features. You can choose to introduce a new resolver specific to Code Suggestions features, or modify the Ai::UserAvailableFeaturesResolver
to return Code Suggestions OR Duo Chat available features according to a given parameter.
Actual Implementation
Instead of a duoCodeSuggestionsAvailableFeatures
field to match the duoChatAvailableFeatures
, we are instead introducing a codeSuggestionsContexts
.
duoChatAvailableFeatures
refers to features that are defined in the Duo Chat unit primitives, the access of which is tied to subscription and licensing.
We need to properly reflect this difference by precisely naming the new field (which is controlled by Feature Flags) codeSuggestionsContexts
.