Make `License.feature_available?` the SSoT for license checks
Problem
The problem is described in Include Registration Features check in SSoT met... (&11311)
Proposal
Transform the License.feature_available?
check into the SSoT check that returns if a feature is available at instance level, whether it's from the purchased license/tier or from the instance admin having enabled Usage Pings (so you get extra features for that).
Cyclical dependency problem
We know that we previously attempted to incorporate usage ping feature check inside License.feature_available?
but we decided not to do that because of some cyclical dependencies:
flowchart LR
Gitlab::CurrentSettings --> ApplicationSetting --> Gitlab::ImportSources --> License.feature_available? --> Gitlab::CurrentSettings
However, these cyclical dependencies are located within ApplicationSetting
when using License.feature_available?
.
We should be able to skip the check for usage ping features due to cyclical dependencies in these few instances of the codebase. This way we have made the problem of cyclical dependencies explicit rather than implicit.
The cyclical dependencies are not wide-spread and they are specifically located within an area of code that deals with initialization. We can deal with cyclical dependencies later if we have a good way to identify them in code. This should not prevent us from using a much more common pattern for license check and making it the SSoT.