From 988e2f57f9635ed9cc3896b15965b608fce54756 Mon Sep 17 00:00:00 2001
From: Mikolaj Wawrzyniak <mwawrzyniak@gitlab.com>
Date: Wed, 29 Nov 2023 14:21:43 +0100
Subject: [PATCH] Remove code_suggestions_completion_api feature

Remove feautre flag that controlled decision between 2 different
code suggestions API. Use GitLab Rails proxied one now onwards

Changelog: other
EE: true
---
 doc/api/code_suggestions.md                            |  1 +
 doc/development/code_suggestions/index.md              |  4 ++--
 .../development/code_suggestions_completion_api.yml    |  8 --------
 ee/lib/api/code_suggestions.rb                         |  2 --
 ee/spec/requests/api/code_suggestions_spec.rb          | 10 ----------
 5 files changed, 3 insertions(+), 22 deletions(-)
 delete mode 100644 ee/config/feature_flags/development/code_suggestions_completion_api.yml

diff --git a/doc/api/code_suggestions.md b/doc/api/code_suggestions.md
index 2cf1c9cfa9518..ef324b71e95ba 100644
--- a/doc/api/code_suggestions.md
+++ b/doc/api/code_suggestions.md
@@ -36,6 +36,7 @@ Example response:
 
 > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/415581) in GitLab 16.2 [with a flag](../administration/feature_flags.md) named `code_suggestions_completion_api`. Disabled by default. This feature is an Experiment.
 > - Requirement to generate a JWT before calling this endpoint was [removed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127863) in GitLab 16.3.
+> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/416371) in GitLab 16.8. [Feature flag `code_suggestions_completion_api`](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138174) removed.
 
 FLAG:
 On self-managed GitLab, by default this feature is not available. To make it available, an administrator can [enable the feature flag](../administration/feature_flags.md) named `code_suggestions_completion_api`.
diff --git a/doc/development/code_suggestions/index.md b/doc/development/code_suggestions/index.md
index bdf3bcdd52081..409efc41fc27b 100644
--- a/doc/development/code_suggestions/index.md
+++ b/doc/development/code_suggestions/index.md
@@ -24,10 +24,10 @@ This should enable everyone to see locally any change in an IDE being sent to th
       1. Open the extension settings by clicking a small cog icon and select "Extension Settings" option
       1. Check a "GitLab: Debug" checkbox.
 1. Main Application
-   1. Enable Feature Flags ```code_suggestions_completion_api``` and ```code_suggestions_tokens_api```
+   1. Enable Feature Flag ```code_suggestions_tokens_api```
       1. In your terminal, navigate to a `gitlab` inside your `gitlab-development-kit` directory
       1. Run `bundle exec rails c` to start a Rails console
-      1. Call `Feature.enable(:code_suggestions_completion_api)` and `Feature.enable(:code_suggestions_tokens_api)` from the console
+      1. Call `Feature.enable(:code_suggestions_tokens_api)` from the console
    1. Run the GDK with ```export CODE_SUGGESTIONS_BASE_URL=http://localhost:5052```
 1. [Setup Model Gateway](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#how-to-run-the-server-locally)
     1. Build tree sitter libraries ```poetry run scripts/build-tree-sitter-lib.py```
diff --git a/ee/config/feature_flags/development/code_suggestions_completion_api.yml b/ee/config/feature_flags/development/code_suggestions_completion_api.yml
deleted file mode 100644
index b7344076b9ae5..0000000000000
--- a/ee/config/feature_flags/development/code_suggestions_completion_api.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: code_suggestions_completion_api
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/125401
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/416371
-milestone: '16.2'
-type: development
-group: group::ai framework
-default_enabled: false
diff --git a/ee/lib/api/code_suggestions.rb b/ee/lib/api/code_suggestions.rb
index 8f6e39f9970b8..100b7b9051abc 100644
--- a/ee/lib/api/code_suggestions.rb
+++ b/ee/lib/api/code_suggestions.rb
@@ -122,8 +122,6 @@ def gitlab_realm
         end
         post do
           if Gitlab.org_or_com?
-            forbidden! unless ::Feature.enabled?(:code_suggestions_completion_api, current_user)
-
             if ::Feature.enabled?(:purchase_code_suggestions)
               not_found! unless current_user.code_suggestions_add_on_available? # rubocop: disable Style/SoleNestedConditional -- Feature Flag shouldn't be checked in the same condition.
             end
diff --git a/ee/spec/requests/api/code_suggestions_spec.rb b/ee/spec/requests/api/code_suggestions_spec.rb
index e0b4d8fd1291d..db2a24700234d 100644
--- a/ee/spec/requests/api/code_suggestions_spec.rb
+++ b/ee/spec/requests/api/code_suggestions_spec.rb
@@ -646,16 +646,6 @@ def is_even(n: int) ->
         end
       end
 
-      context 'when code_suggestions_completion_api feature flag is disabled' do
-        let(:current_user) { authorized_user }
-
-        before do
-          stub_feature_flags(code_suggestions_completion_api: false)
-        end
-
-        include_examples 'a forbidden response'
-      end
-
       context 'when purchase_code_suggestions feature flag is disabled' do
         let(:current_user) { authorized_user }
 
-- 
GitLab