From c54585488ccd84b2e0a738e41fea5c69a7068f5c Mon Sep 17 00:00:00 2001
From: Miguel Rincon <mrincon@gitlab.com>
Date: Tue, 20 Feb 2024 16:03:37 +0100
Subject: [PATCH] Remove enable_new_sentry_clientside_integration

This change removes enable_new_sentry_clientside_integration in favor of
enable_new_sentry_integration to have a single feature flag that
defined the sentry compatibility state.

Changelog: other
---
 app/views/admin/application_settings/_sentry.html.haml    | 4 ++--
 app/views/layouts/_head.html.haml                         | 2 +-
 .../enable_new_sentry_clientside_integration.yml          | 8 --------
 lib/gitlab/gon_helper.rb                                  | 5 ++---
 locale/gitlab.pot                                         | 2 +-
 spec/features/sentry_js_spec.rb                           | 8 ++++----
 spec/lib/gitlab/gon_helper_spec.rb                        | 4 ++--
 7 files changed, 12 insertions(+), 21 deletions(-)
 delete mode 100644 config/feature_flags/development/enable_new_sentry_clientside_integration.yml

diff --git a/app/views/admin/application_settings/_sentry.html.haml b/app/views/admin/application_settings/_sentry.html.haml
index 962672376771..5079f374c84e 100644
--- a/app/views/admin/application_settings/_sentry.html.haml
+++ b/app/views/admin/application_settings/_sentry.html.haml
@@ -1,9 +1,9 @@
 = gitlab_ui_form_for @application_setting, url: metrics_and_profiling_admin_application_settings_path(anchor: 'js-sentry-settings'), html: { class: 'fieldset-form', id: 'sentry-settings' } do |f|
   = form_errors(@application_setting)
 
-  - if Feature.disabled?(:enable_new_sentry_integration) || Feature.disabled?(:enable_new_sentry_clientside_integration, current_user)
+  - if Feature.disabled?(:enable_new_sentry_integration)
     %fieldset.gl-text-secondary
-      = safe_format(s_('AdminSettings|GitLab uses the %{bold_start}Rails%{bold_end} and %{bold_start}Browser JavaScript%{bold_end} Sentry SDKs to send events to Sentry. For changes to Rails integration settings to take effect, enable the %{code_start}enable_new_sentry_integration%{code_end} and %{code_start}enable_new_sentry_clientside_integration%{code_end} feature flags and restart GitLab.'), tag_pair(tag.b, :bold_start, :bold_end), tag_pair(tag.code, :code_start, :code_end))
+      = safe_format(s_('AdminSettings|GitLab uses the %{bold_start}Rails%{bold_end} and %{bold_start}Browser JavaScript%{bold_end} Sentry SDKs to send events to Sentry. For changes to Rails integration settings to take effect, enable the %{code_start}enable_new_sentry_integration%{code_end} feature flag and restart GitLab.'), tag_pair(tag.b, :bold_start, :bold_end), tag_pair(tag.code, :code_start, :code_end))
   - else
     %fieldset.gl-text-secondary
       = safe_format(s_('AdminSettings|GitLab uses the %{bold_start}Rails%{bold_end} and %{bold_start}Browser JavaScript%{bold_end} Sentry SDKs to send events to Sentry. For changes to Rails integration settings to take effect, restart GitLab.'), tag_pair(tag.b, :bold_start, :bold_end))
diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml
index 54985651cc79..ecf9556978c7 100644
--- a/app/views/layouts/_head.html.haml
+++ b/app/views/layouts/_head.html.haml
@@ -48,7 +48,7 @@
   = render 'layouts/loading_hints'
 
   = render_if_exists 'layouts/header/translations'
-  - if Feature.enabled?(:enable_new_sentry_clientside_integration, current_user) && Gitlab::CurrentSettings.sentry_enabled
+  - if Feature.enabled?(:enable_new_sentry_integration) && Gitlab::CurrentSettings.sentry_enabled
     = webpack_bundle_tag 'sentry'
   - elsif Gitlab.config.sentry.enabled
     = webpack_bundle_tag 'legacy_sentry'
diff --git a/config/feature_flags/development/enable_new_sentry_clientside_integration.yml b/config/feature_flags/development/enable_new_sentry_clientside_integration.yml
deleted file mode 100644
index 46835315f2f1..000000000000
--- a/config/feature_flags/development/enable_new_sentry_clientside_integration.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: enable_new_sentry_clientside_integration
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/102650
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/382570
-milestone: '15.6'
-type: development
-group: group::runner
-default_enabled: false
diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb
index f50a6747497e..6fdbfd833fad 100644
--- a/lib/gitlab/gon_helper.rb
+++ b/lib/gitlab/gon_helper.rb
@@ -25,10 +25,9 @@ def add_gon_variables
         gon.sentry_environment = Gitlab.config.sentry.environment
       end
 
-      # Support for Sentry setup via configuration files will be removed in 16.0
+      # Support for Sentry setup via configuration files will be removed in 17.0
       # in favor of Gitlab::CurrentSettings.
-      if Feature.enabled?(:enable_new_sentry_clientside_integration,
-                          current_user) && Gitlab::CurrentSettings.sentry_enabled
+      if Feature.enabled?(:enable_new_sentry_integration) && Gitlab::CurrentSettings.sentry_enabled
         gon.sentry_dsn           = Gitlab::CurrentSettings.sentry_clientside_dsn
         gon.sentry_environment   = Gitlab::CurrentSettings.sentry_environment
         gon.sentry_clientside_traces_sample_rate = Gitlab::CurrentSettings.sentry_clientside_traces_sample_rate
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index d5ab5389916f..a622aff16e28 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -3529,7 +3529,7 @@ msgstr ""
 msgid "AdminSettings|Git abuse rate limit"
 msgstr ""
 
-msgid "AdminSettings|GitLab uses the %{bold_start}Rails%{bold_end} and %{bold_start}Browser JavaScript%{bold_end} Sentry SDKs to send events to Sentry. For changes to Rails integration settings to take effect, enable the %{code_start}enable_new_sentry_integration%{code_end} and %{code_start}enable_new_sentry_clientside_integration%{code_end} feature flags and restart GitLab."
+msgid "AdminSettings|GitLab uses the %{bold_start}Rails%{bold_end} and %{bold_start}Browser JavaScript%{bold_end} Sentry SDKs to send events to Sentry. For changes to Rails integration settings to take effect, enable the %{code_start}enable_new_sentry_integration%{code_end} feature flag and restart GitLab."
 msgstr ""
 
 msgid "AdminSettings|GitLab uses the %{bold_start}Rails%{bold_end} and %{bold_start}Browser JavaScript%{bold_end} Sentry SDKs to send events to Sentry. For changes to Rails integration settings to take effect, restart GitLab."
diff --git a/spec/features/sentry_js_spec.rb b/spec/features/sentry_js_spec.rb
index 0cf32864b1e3..583dcba62208 100644
--- a/spec/features/sentry_js_spec.rb
+++ b/spec/features/sentry_js_spec.rb
@@ -3,9 +3,9 @@
 require 'spec_helper'
 
 RSpec.describe 'Sentry', feature_category: :error_tracking do
-  context 'when enable_new_sentry_clientside_integration is disabled' do
+  context 'when enable_new_sentry_integration is disabled' do
     before do
-      stub_feature_flags(enable_new_sentry_clientside_integration: false)
+      stub_feature_flags(enable_new_sentry_integration: false)
     end
 
     it 'does not load sentry if sentry is disabled' do
@@ -26,9 +26,9 @@
     end
   end
 
-  context 'when enable_new_sentry_clientside_integration is enabled' do
+  context 'when enable_new_sentry_integration is enabled' do
     before do
-      stub_feature_flags(enable_new_sentry_clientside_integration: true)
+      stub_feature_flags(enable_new_sentry_integration: true)
     end
 
     it 'does not load sentry if sentry settings are disabled' do
diff --git a/spec/lib/gitlab/gon_helper_spec.rb b/spec/lib/gitlab/gon_helper_spec.rb
index 068f3cd092ca..e95623a01e11 100644
--- a/spec/lib/gitlab/gon_helper_spec.rb
+++ b/spec/lib/gitlab/gon_helper_spec.rb
@@ -89,9 +89,9 @@
           helper.add_gon_variables
         end
 
-        context 'when enable_new_sentry_clientside_integration is disabled' do
+        context 'when enable_new_sentry_integration is disabled' do
           before do
-            stub_feature_flags(enable_new_sentry_clientside_integration: false)
+            stub_feature_flags(enable_new_sentry_integration: false)
           end
 
           it 'does not set sentry dsn and environment from config' do
-- 
GitLab