From 55e2056dbb7227f87a90f838de7f2ac19b642148 Mon Sep 17 00:00:00 2001
From: Marc Shaw <mshaw@gitlab.com>
Date: Tue, 18 Jul 2023 11:08:23 +0200
Subject: [PATCH] Remove the summarize_diff quick action

MR: gitlab.com/gitlab-org/gitlab/-/merge_requests/126827

Changelog: other
---
 .../quick_actions/interpret_service.rb        |  3 +-
 .../summarize_diff_quick_action.yml           |  8 ---
 .../quick_actions/merge_request_actions.rb    | 19 ------
 .../quick_actions/interpret_service_spec.rb   | 60 -------------------
 locale/gitlab.pot                             |  9 ---
 5 files changed, 1 insertion(+), 98 deletions(-)
 delete mode 100644 config/feature_flags/development/summarize_diff_quick_action.yml

diff --git a/app/services/quick_actions/interpret_service.rb b/app/services/quick_actions/interpret_service.rb
index d1798ce6fc022..b5f6bff756b36 100644
--- a/app/services/quick_actions/interpret_service.rb
+++ b/app/services/quick_actions/interpret_service.rb
@@ -188,8 +188,7 @@ def extract_updates(commands)
         next unless definition
 
         definition.execute(self, arg)
-        # summarize_diff will be removed https://gitlab.com/gitlab-org/gitlab/-/issues/407258#note_1385269274
-        usage_ping_tracking(definition.name, arg) unless definition.name == :summarize_diff
+        usage_ping_tracking(definition.name, arg)
       end
     end
 
diff --git a/config/feature_flags/development/summarize_diff_quick_action.yml b/config/feature_flags/development/summarize_diff_quick_action.yml
deleted file mode 100644
index ebbfaba2dbaa5..0000000000000
--- a/config/feature_flags/development/summarize_diff_quick_action.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: summarize_diff_quick_action
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/117458
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/407256
-milestone: '15.11'
-type: development
-group: group::code review
-default_enabled: false
diff --git a/ee/lib/ee/gitlab/quick_actions/merge_request_actions.rb b/ee/lib/ee/gitlab/quick_actions/merge_request_actions.rb
index c6416dfdc2d1a..854a220b6f265 100644
--- a/ee/lib/ee/gitlab/quick_actions/merge_request_actions.rb
+++ b/ee/lib/ee/gitlab/quick_actions/merge_request_actions.rb
@@ -21,25 +21,6 @@ module MergeRequestActions
           command :reassign_reviewer do |reassign_param|
             @updates[:reviewer_ids] = extract_users(reassign_param).map(&:id)
           end
-
-          desc { _('Create LLM-generated summary from diff(s)') }
-          explanation { _('Creates a LLM-generated summary from diff(s).') }
-          execution_message { _('Request for summary queued.') }
-          types MergeRequest
-          condition do
-            ::Feature.enabled?(:summarize_diff_quick_action, current_user) &&
-              ::Llm::MergeRequests::SummarizeDiffService.enabled?(
-                group: quick_action_target.project.root_ancestor,
-                user: current_user
-              )
-          end
-          command :summarize_diff do
-            ::MergeRequests::Llm::SummarizeMergeRequestWorker.new.perform(
-              current_user.id,
-              { 'type' => ::MergeRequests::Llm::SummarizeMergeRequestWorker::SUMMARIZE_QUICK_ACTION,
-                'merge_request_id' => quick_action_target.id }
-            )
-          end
         end
       end
     end
diff --git a/ee/spec/services/quick_actions/interpret_service_spec.rb b/ee/spec/services/quick_actions/interpret_service_spec.rb
index 7c0f25ccf3e48..1a612b845209d 100644
--- a/ee/spec/services/quick_actions/interpret_service_spec.rb
+++ b/ee/spec/services/quick_actions/interpret_service_spec.rb
@@ -450,66 +450,6 @@
       end
     end
 
-    context "summarize_diff command" do
-      let(:content) { "/summarize_diff" }
-      let(:summarize_flag) { true }
-      let(:summarize_diff_enabled) { true }
-
-      before do
-        stub_feature_flags(summarize_diff_quick_action: summarize_flag)
-
-        allow(::Llm::MergeRequests::SummarizeDiffService).to receive(:enabled?).and_return(summarize_diff_enabled)
-      end
-
-      context "when the checks are enabled" do
-        context 'when summarize_diff_vertex is enabled' do
-          before do
-            allow_next_instance_of(Gitlab::Llm::VertexAi::Client) do |llm_client|
-              allow(llm_client).to receive(:text)
-            end
-          end
-
-          it "applies /summarize_diff" do
-            _, _, msg = service.execute(content, merge_request)
-
-            expect(msg).to include("Request for summary queued")
-          end
-        end
-
-        context 'when summarize_diff_vertex is disabled' do
-          before do
-            stub_feature_flags(summarize_diff_vertex: false)
-          end
-
-          it "applies /summarize_diff" do
-            _, _, msg = service.execute(content, merge_request)
-
-            expect(msg).to include("Request for summary queued")
-          end
-        end
-      end
-
-      context "when :summarize_diff_quick_action feature flag is disabled" do
-        let(:summarize_flag) { false }
-
-        it "doesn't apply /summarize_diff" do
-          _, _, msg = service.execute(content, merge_request)
-
-          expect(msg).to include("Could not apply summarize_diff command")
-        end
-      end
-
-      context "when SummarizeDiffService is disabled" do
-        let(:summarize_diff_enabled) { false }
-
-        it "doesn't apply /summarize_diff" do
-          _, _, msg = service.execute(content, merge_request)
-
-          expect(msg).to include("Could not apply summarize_diff command")
-        end
-      end
-    end
-
     context 'iteration command' do
       let_it_be(:iteration) { create(:iteration, iterations_cadence: create(:iterations_cadence, group: group)) }
 
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index ca22bcb59fb14..41b1413676c36 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -13069,9 +13069,6 @@ msgstr ""
 msgid "Create AI-generated commit message"
 msgstr ""
 
-msgid "Create LLM-generated summary from diff(s)"
-msgstr ""
-
 msgid "Create New Directory"
 msgstr ""
 
@@ -13522,9 +13519,6 @@ msgstr ""
 msgid "Created on:"
 msgstr ""
 
-msgid "Creates a LLM-generated summary from diff(s)."
-msgstr ""
-
 msgid "Creates a branch and a merge request to resolve this issue."
 msgstr ""
 
@@ -39010,9 +39004,6 @@ msgstr ""
 msgid "Request details"
 msgstr ""
 
-msgid "Request for summary queued."
-msgstr ""
-
 msgid "Request parameter %{param} is missing."
 msgstr ""
 
-- 
GitLab