Skip to content

search: add Features type

Administrator requested to merge k/features into main

Created by: keegancsmith

We mint a new Features type which is part of the top level SearchParameters. The purpose of this type will be to calculate the feature flags once per search and then have a way to access them everywhere in a type safe manor.

We hook up this type similarly to how we access UserSettings. At the time of creating search inputs we query Sourcegraph specific stores to set these fields. The intention of this pattern is to only create the Feature struct once and never mutate it. Then every other access is a read. This helps localize all changes for Features which will hopefully become more frequently used tool by our team.

As a demonstration this commit also uses the new Feature type to disable content based language queries. We are running into corner cases in that feature and do not feel confident in releasing it to all customers yet. This will allow us to continue testing it within the sourcegraph org on sourcegraph.com as well as allow admins to enable it.

Merge request reports

Loading