Address cyclical dependency of `email_additional_text` feature check with ApplicationSetting
Problem
The feature email_additional_text
is marked as incompatible with Usage Ping because the License.feature_available?
has a cyclical dependency with ApplicationSetting
and a test will fail if we try to move it to Registration Features (a.k.a Usage Ping features).
There is plan to move this feature to Registration Features but currently this feature is blocked by the cyclical dependency.
Reproduction steps
- Remove the feature from the list of blocked features https://gitlab.com/gitlab-org/gitlab/-/blob/0daa71593c64e855845237ac590fe12437906976/ee/app/models/gitlab_subscriptions/features.rb#L322 - this blocklist prevents the cyclical dependency from happening.
- Run
bundle exec spring rspec spec/lib/gitlab/current_settings_spec.rb
- you should see some specs taking very long time due to the cyclical dependency. Eventually the spec examples timeout withSystemStackError
(stack level too deep).
Proposal
Refactor the code (possibly from ApplicationSetting
) not to rely so early in the app setup / startup on License.feature_available?
for the given feature.
Once the refactoring solves the cyclical dependency, remove the feature from FEATURES_NOT_SUPPORTING_USAGE_PING
list.
Edited by Heinrich Lee Yu