From 46a09039cad879967c9f9b27438af9fead3b3e64 Mon Sep 17 00:00:00 2001
From: Kos Palchyk <kpalchyk@gitlab.com>
Date: Tue, 27 Jun 2023 19:56:53 +0300
Subject: [PATCH] Updates Container Registry estimation flag name

Renames `registry_size_estimated` GraphQL field to
`container_registry_size_is_estimated`, and deprecates
proper name.

Changelog: deprecated
---
 .../types/root_storage_statistics_type.rb        |  7 ++++++-
 ...6-2-registry-size-estimated-graphql-field.yml | 11 +++++++++++
 doc/api/graphql/reference/index.md               |  3 ++-
 doc/update/deprecations.md                       | 16 ++++++++++++++++
 .../types/root_storage_statistics_type_spec.rb   |  2 +-
 5 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 data/deprecations/16-2-registry-size-estimated-graphql-field.yml

diff --git a/app/graphql/types/root_storage_statistics_type.rb b/app/graphql/types/root_storage_statistics_type.rb
index f7d0782366707..45473fadff003 100644
--- a/app/graphql/types/root_storage_statistics_type.rb
+++ b/app/graphql/types/root_storage_statistics_type.rb
@@ -8,12 +8,17 @@ class RootStorageStatisticsType < BaseObject
 
     field :build_artifacts_size, GraphQL::Types::Float, null: false, description: 'CI artifacts size in bytes.'
     field :container_registry_size, GraphQL::Types::Float, null: false, description: 'Container Registry size in bytes.'
+    field :container_registry_size_is_estimated, GraphQL::Types::Boolean, method: :registry_size_estimated, null: false,
+      description: 'Indicates whether the deduplicated Container Registry size for ' \
+                   'the namespace is an estimated value or not.'
     field :dependency_proxy_size, GraphQL::Types::Float, null: false, description: 'Dependency Proxy sizes in bytes.'
     field :lfs_objects_size, GraphQL::Types::Float, null: false, description: 'LFS objects size in bytes.'
     field :packages_size, GraphQL::Types::Float, null: false, description: 'Packages size in bytes.'
     field :pipeline_artifacts_size, GraphQL::Types::Float, null: false,
       description: 'CI pipeline artifacts size in bytes.'
-    field :registry_size_estimated, GraphQL::Types::Boolean, null: false,
+    field :registry_size_estimated, GraphQL::Types::Boolean,
+      null: false,
+      deprecated: { reason: 'Use `container_registry_size_is_estimated`', milestone: '16.2' },
       description: 'Indicates whether the deduplicated Container Registry size for ' \
                    'the namespace is an estimated value or not.'
     field :repository_size, GraphQL::Types::Float, null: false, description: 'Git repository size in bytes.'
diff --git a/data/deprecations/16-2-registry-size-estimated-graphql-field.yml b/data/deprecations/16-2-registry-size-estimated-graphql-field.yml
new file mode 100644
index 0000000000000..a0251040203b3
--- /dev/null
+++ b/data/deprecations/16-2-registry-size-estimated-graphql-field.yml
@@ -0,0 +1,11 @@
+- title: "GraphQL field `registrySizeEstimated` has been deprecated"  # (required) Actionable title. e.g., The `confidential` field for a `Note` is deprecated. Use `internal` instead.
+  announcement_milestone: "16.2"  # (required) The milestone when this feature was first announced as deprecated.
+  removal_milestone: "17.0"  # (required) The milestone when this feature is planned to be removed
+  breaking_change: true  # (required) If this deprecation is a breaking change, set this value to true
+  reporter: kpalchyk  # (required) GitLab username of the person reporting the deprecation
+  stage: Package  # (required) String value of the stage that the feature was created in. e.g., Growth
+  issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/416509  # (required) Link to the deprecation issue in GitLab
+  body: |  # (required) Do not modify this line, instead modify the lines below.
+    For clarity, the GraphQL field `registrySizeEstimated` was renamed to `containerRegistrySizeIsEstimated`, to match its counterpart.
+    `registrySizeEstimated` was deprecated in GitLab 16.2 and will be removed in GitLab 17.0.
+    Use `containerRegistrySizeIsEstimated` introduced in GitLab 16.2 instead.
diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md
index a3a600084d6b8..231b648d1259d 100644
--- a/doc/api/graphql/reference/index.md
+++ b/doc/api/graphql/reference/index.md
@@ -22228,11 +22228,12 @@ Counts of requirements by their state.
 | ---- | ---- | ----------- |
 | <a id="rootstoragestatisticsbuildartifactssize"></a>`buildArtifactsSize` | [`Float!`](#float) | CI artifacts size in bytes. |
 | <a id="rootstoragestatisticscontainerregistrysize"></a>`containerRegistrySize` | [`Float!`](#float) | Container Registry size in bytes. |
+| <a id="rootstoragestatisticscontainerregistrysizeisestimated"></a>`containerRegistrySizeIsEstimated` | [`Boolean!`](#boolean) | Indicates whether the deduplicated Container Registry size for the namespace is an estimated value or not. |
 | <a id="rootstoragestatisticsdependencyproxysize"></a>`dependencyProxySize` | [`Float!`](#float) | Dependency Proxy sizes in bytes. |
 | <a id="rootstoragestatisticslfsobjectssize"></a>`lfsObjectsSize` | [`Float!`](#float) | LFS objects size in bytes. |
 | <a id="rootstoragestatisticspackagessize"></a>`packagesSize` | [`Float!`](#float) | Packages size in bytes. |
 | <a id="rootstoragestatisticspipelineartifactssize"></a>`pipelineArtifactsSize` | [`Float!`](#float) | CI pipeline artifacts size in bytes. |
-| <a id="rootstoragestatisticsregistrysizeestimated"></a>`registrySizeEstimated` | [`Boolean!`](#boolean) | Indicates whether the deduplicated Container Registry size for the namespace is an estimated value or not. |
+| <a id="rootstoragestatisticsregistrysizeestimated"></a>`registrySizeEstimated` **{warning-solid}** | [`Boolean!`](#boolean) | **Deprecated** in 16.2. Use `container_registry_size_is_estimated`. |
 | <a id="rootstoragestatisticsrepositorysize"></a>`repositorySize` | [`Float!`](#float) | Git repository size in bytes. |
 | <a id="rootstoragestatisticssnippetssize"></a>`snippetsSize` | [`Float!`](#float) | Snippets size in bytes. |
 | <a id="rootstoragestatisticsstoragesize"></a>`storageSize` | [`Float!`](#float) | Total storage in bytes. |
diff --git a/doc/update/deprecations.md b/doc/update/deprecations.md
index 703d946562191..2cd02884f561e 100644
--- a/doc/update/deprecations.md
+++ b/doc/update/deprecations.md
@@ -308,6 +308,22 @@ Use `dependencyProxyTotalSizeBytes` instead, introduced in GitLab 16.1.
 
 <div class="deprecation breaking-change" data-milestone="17.0">
 
+### GraphQL field `registrySizeEstimated` has been deprecated
+
+<div class="deprecation-notes">
+- Announced in: GitLab <span class="milestone">16.2</span>
+- This is a [breaking change](https://docs.gitlab.com/ee/update/terminology.html#breaking-change).
+- To discuss this change or learn more, see the [deprecation issue](https://gitlab.com/gitlab-org/gitlab/-/issues/416509).
+</div>
+
+For clarity, the GraphQL field `registrySizeEstimated` was renamed to `containerRegistrySizeIsEstimated`, to match its counterpart.
+`registrySizeEstimated` was deprecated in GitLab 16.2 and will be removed in GitLab 17.0.
+Use `containerRegistrySizeIsEstimated` introduced in GitLab 16.2 instead.
+
+</div>
+
+<div class="deprecation breaking-change" data-milestone="17.0">
+
 ### GraphQL type, `RunnerMembershipFilter` renamed to `CiRunnerMembershipFilter`
 
 <div class="deprecation-notes">
diff --git a/spec/graphql/types/root_storage_statistics_type_spec.rb b/spec/graphql/types/root_storage_statistics_type_spec.rb
index 56f58825db0e0..094eb9a851596 100644
--- a/spec/graphql/types/root_storage_statistics_type_spec.rb
+++ b/spec/graphql/types/root_storage_statistics_type_spec.rb
@@ -9,7 +9,7 @@
     expect(described_class).to have_graphql_fields(:storage_size, :repository_size, :lfs_objects_size,
       :build_artifacts_size, :packages_size, :wiki_size, :snippets_size,
       :pipeline_artifacts_size, :uploads_size, :dependency_proxy_size,
-      :container_registry_size, :registry_size_estimated)
+      :container_registry_size, :container_registry_size_is_estimated, :registry_size_estimated)
   end
 
   specify { expect(described_class).to require_graphql_authorizations(:read_statistics) }
-- 
GitLab