From dbee5314aeb5ef2293b788eea2d385cfd9c54345 Mon Sep 17 00:00:00 2001
From: Alina Mihaila <amihaila@gitlab.com>
Date: Thu, 2 Feb 2023 20:30:47 +0000
Subject: [PATCH] Add custom feature_category platform

  - For features that support developers and
  they are not specific to a product group
---
 .rubocop_todo/rspec/invalid_feature_category.yml        | 1 -
 doc/development/feature_categorization/index.md         | 5 +++++
 rubocop/cop/rspec/invalid_feature_category.rb           | 4 +++-
 spec/lib/gitlab/job_waiter_spec.rb                      | 2 +-
 spec/rubocop/cop/rspec/invalid_feature_category_spec.rb | 1 +
 5 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/.rubocop_todo/rspec/invalid_feature_category.yml b/.rubocop_todo/rspec/invalid_feature_category.yml
index fb5e2299337ee..469c0e2a8a889 100644
--- a/.rubocop_todo/rspec/invalid_feature_category.yml
+++ b/.rubocop_todo/rspec/invalid_feature_category.yml
@@ -88,7 +88,6 @@ RSpec/InvalidFeatureCategory:
     - 'spec/lib/gitlab/graphql/tracers/logger_tracer_spec.rb'
     - 'spec/lib/gitlab/graphql/tracers/metrics_tracer_spec.rb'
     - 'spec/lib/gitlab/import_export/version_checker_spec.rb'
-    - 'spec/lib/gitlab/job_waiter_spec.rb'
     - 'spec/lib/gitlab/metrics/background_transaction_spec.rb'
     - 'spec/lib/gitlab/sidekiq_middleware/worker_context/client_spec.rb'
     - 'spec/lib/gitlab/sidekiq_middleware/worker_context/server_spec.rb'
diff --git a/doc/development/feature_categorization/index.md b/doc/development/feature_categorization/index.md
index 26c2c553d593f..dad94a2aae230 100644
--- a/doc/development/feature_categorization/index.md
+++ b/doc/development/feature_categorization/index.md
@@ -221,3 +221,8 @@ Additionally, we flag the offenses via `RSpec/MissingFeatureCategory` RuboCop ru
 For Engineering Productivity internal tooling we use `feature_category: :tooling`.
 
 For example in [`spec/tooling/danger/specs_spec.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/tooling/danger/specs_spec.rb#L12).
+
+### Shared feature category
+
+For features that support developers and they are not specific to a product group we use `feature_category: :shared`
+For example [`spec/lib/gitlab/job_waiter_spec.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/lib/gitlab/job_waiter_spec.rb)
diff --git a/rubocop/cop/rspec/invalid_feature_category.rb b/rubocop/cop/rspec/invalid_feature_category.rb
index 4d658fdc36f38..be6d802bc92ba 100644
--- a/rubocop/cop/rspec/invalid_feature_category.rb
+++ b/rubocop/cop/rspec/invalid_feature_category.rb
@@ -36,7 +36,9 @@ class InvalidFeatureCategory < RuboCop::Cop::RSpec::Base
         # List of feature categories which are not defined in config/feature_categories.yml
         CUSTOM_FEATURE_CATEGORIES = [
           # https://docs.gitlab.com/ee/development/feature_categorization/#tooling-feature-category
-          :tooling
+          :tooling,
+          # https://docs.gitlab.com/ee/development/feature_categorization/#shared-feature-category
+          :shared
         ].to_set.freeze
 
         # @!method feature_category?(node)
diff --git a/spec/lib/gitlab/job_waiter_spec.rb b/spec/lib/gitlab/job_waiter_spec.rb
index f7a76035203cc..af2da8f20c0e5 100644
--- a/spec/lib/gitlab/job_waiter_spec.rb
+++ b/spec/lib/gitlab/job_waiter_spec.rb
@@ -2,7 +2,7 @@
 
 require 'spec_helper'
 
-RSpec.describe Gitlab::JobWaiter, :redis, feature_category: :not_owned do
+RSpec.describe Gitlab::JobWaiter, :redis, feature_category: :shared do
   describe '.notify' do
     it 'pushes the jid to the named queue' do
       key = described_class.new.key
diff --git a/spec/rubocop/cop/rspec/invalid_feature_category_spec.rb b/spec/rubocop/cop/rspec/invalid_feature_category_spec.rb
index 0514197d6c4bd..e60cbe2d3ca90 100644
--- a/spec/rubocop/cop/rspec/invalid_feature_category_spec.rb
+++ b/spec/rubocop/cop/rspec/invalid_feature_category_spec.rb
@@ -61,6 +61,7 @@
 
   context 'with custom categories' do
     it_behaves_like 'feature category validation', 'tooling'
+    it_behaves_like 'feature category validation', 'shared'
   end
 
   it 'flags invalid feature category for non-symbols' do
-- 
GitLab