Commit 75c3b3e9 authored by Tim Zallmann's avatar Tim Zallmann

Merge branch '208863_remove_epic_aggregate_feature_flag' into 'master'

Remove `unfiltered_epic_aggregates` feature flag

See merge request gitlab-org/gitlab!28070
parents 3af09062 b9ae9d66
......@@ -22,6 +22,10 @@ query epicChildEpics(
webUrl
startDate
dueDate
descendantWeightSum {
closedIssues
openedIssues
}
group {
name
fullName
......
query epicChildEpics(
$fullPath: ID!
$iid: ID!
$state: EpicState
$sort: EpicSort
$startDate: Time
$dueDate: Time
) {
group(fullPath: $fullPath) {
id
name
epic(iid: $iid) {
id
title
children(state: $state, sort: $sort, startDate: $startDate, endDate: $dueDate) {
edges {
node {
id
title
description
state
webUrl
startDate
dueDate
descendantWeightSum {
closedIssues
openedIssues
}
group {
name
fullName
}
}
}
}
}
}
}
......@@ -29,6 +29,10 @@ query groupEpics(
webUrl
startDate
dueDate
descendantWeightSum {
closedIssues
openedIssues
}
group {
name
fullName
......
query groupEpics(
$fullPath: ID!
$state: EpicState
$sort: EpicSort
$startDate: Time
$dueDate: Time
$labelName: [String!] = []
$authorUsername: String = ""
$search: String = ""
) {
group(fullPath: $fullPath) {
id
name
epics(
state: $state
sort: $sort
startDate: $startDate
endDate: $dueDate
labelName: $labelName
authorUsername: $authorUsername
search: $search
) {
edges {
node {
id
title
description
state
webUrl
startDate
dueDate
descendantWeightSum {
closedIssues
openedIssues
}
group {
name
fullName
}
}
}
}
}
}
......@@ -15,8 +15,6 @@ import { EXTEND_AS } from '../constants';
import groupEpics from '../queries/groupEpics.query.graphql';
import epicChildEpics from '../queries/epicChildEpics.query.graphql';
import groupEpicsForUnfilteredEpicAggregatesFeatureFlag from '../queries/groupEpicsForUnfilteredEpicAggregatesFeatureFlag.query.graphql';
import epicChildEpicsForUnfilteredEpicAggregatesFeatureFlag from '../queries/epicChildEpicsForUnfilteredEpicAggregatesFeatureFlag.query.graphql';
import groupMilestones from '../queries/groupMilestones.query.graphql';
import * as types from './mutation_types';
......@@ -46,15 +44,9 @@ export const fetchGroupEpics = (
// and then we don't need to pass `filterParams`.
if (epicIid) {
query = epicChildEpics;
if (gon.features && gon.features.unfilteredEpicAggregates) {
query = epicChildEpicsForUnfilteredEpicAggregatesFeatureFlag;
}
variables.iid = epicIid;
} else {
query = groupEpics;
if (gon.features && gon.features.unfilteredEpicAggregates) {
query = groupEpicsForUnfilteredEpicAggregatesFeatureFlag;
}
variables = {
...variables,
...filterParams,
......
......@@ -18,7 +18,6 @@ class Groups::EpicsController < Groups::ApplicationController
before_action do
push_frontend_feature_flag(:roadmap_graphql, @group, default_enabled: true)
push_frontend_feature_flag(:unfiltered_epic_aggregates, @group, default_enabled: true)
push_frontend_feature_flag(:vue_issuable_epic_sidebar, @group)
end
......
......@@ -11,7 +11,6 @@ module Groups
before_action :persist_roadmap_layout, only: [:show]
before_action do
push_frontend_feature_flag(:roadmap_graphql, @group, default_enabled: true)
push_frontend_feature_flag(:unfiltered_epic_aggregates, @group, default_enabled: true)
push_frontend_feature_flag(:roadmap_buffered_rendering, @group)
push_frontend_feature_flag(:milestones_in_roadmap, @group)
end
......
......@@ -120,22 +120,16 @@ module Types
description: 'A list of issues associated with the epic',
resolver: Resolvers::EpicIssuesResolver
field :descendant_counts, Types::EpicDescendantCountType, null: true, complexity: 10,
field :descendant_counts, Types::EpicDescendantCountType, null: true,
description: 'Number of open and closed descendant epics and issues',
resolve: -> (epic, args, ctx) do
if Feature.enabled?(:unfiltered_epic_aggregates, epic.group, default_enabled: true)
Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate.new(ctx, epic.id, COUNT)
else
Epics::DescendantCountService.new(epic, ctx[:current_user])
end
Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate.new(ctx, epic.id, COUNT)
end
field :descendant_weight_sum, Types::EpicDescendantWeightSumType, null: true, complexity: 10,
field :descendant_weight_sum, Types::EpicDescendantWeightSumType, null: true,
description: "Total weight of open and closed issues in the epic and its descendants",
resolve: -> (epic, args, ctx) do
if Feature.enabled?(:unfiltered_epic_aggregates, epic.group, default_enabled: true)
Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate.new(ctx, epic.id, WEIGHT_SUM)
end
Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate.new(ctx, epic.id, WEIGHT_SUM)
end
field :health_status, Types::EpicHealthStatusType, null: true, complexity: 10,
......@@ -145,16 +139,12 @@ module Types
end
def has_children?
return object.has_children? unless Feature.enabled?(:unfiltered_epic_aggregates, object.group, default_enabled: true)
Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate.new(context, object.id, COUNT) do |node, _aggregate_object|
node.children.any?
end
end
def has_issues?
return object.has_issues? unless Feature.enabled?(:unfiltered_epic_aggregates, object.group, default_enabled: true)
Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate.new(context, object.id, COUNT) do |node, _aggregate_object|
node.has_issues?
end
......
......@@ -132,107 +132,50 @@ describe 'Epic aggregates (count and weight)' do
end
end
context 'with feature flag enabled' do
before do
stub_feature_flags(unfiltered_epic_aggregates: true)
end
it 'uses the LazyEpicAggregate service' do
# one for count, one for weight_sum, even though the share the same tree state as part of the context
expect(Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate).to receive(:new).twice
post_graphql(query, current_user: current_user)
end
it_behaves_like 'counts properly'
it 'returns the weights' do
descendant_weight_result = {
"openedIssues" => 5,
"closedIssues" => 7
}
is_expected.to include(
a_hash_including('descendantWeightSum' => a_hash_including(descendant_weight_result))
)
end
it 'uses the LazyEpicAggregate service' do
# one for count, one for weight_sum, even though the share the same tree state as part of the context
expect(Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate).to receive(:new).twice
context 'when requesting has_issues' do
let(:epic_aggregates_query) do
<<~QUERY
nodes {
hasIssues
}
QUERY
end
post_graphql(query, current_user: current_user)
end
it_behaves_like 'having correct values for', 'hasIssues'
it_behaves_like 'efficient query'
end
it_behaves_like 'counts properly'
context 'when requesting has_children' do
let(:epic_aggregates_query) do
<<~QUERY
nodes {
hasChildren
}
QUERY
end
it 'returns the weights' do
descendant_weight_result = {
"openedIssues" => 5,
"closedIssues" => 7
}
it_behaves_like 'having correct values for', 'hasChildren'
it_behaves_like 'efficient query'
end
is_expected.to include(
a_hash_including('descendantWeightSum' => a_hash_including(descendant_weight_result))
)
end
context 'with feature flag disabled' do
before do
stub_feature_flags(unfiltered_epic_aggregates: false)
context 'when requesting has_issues' do
let(:epic_aggregates_query) do
<<~QUERY
nodes {
hasIssues
}
QUERY
end
it_behaves_like 'having correct values for', 'hasChildren'
it_behaves_like 'having correct values for', 'hasIssues'
it_behaves_like 'efficient query'
end
context 'when requesting counts' do
let(:epic_aggregates_query) do
<<~QUERY
nodes {
descendantCounts {
openedEpics
closedEpics
openedIssues
closedIssues
}
}
QUERY
end
it 'uses the DescendantCountService' do
expect(Epics::DescendantCountService).to receive(:new)
post_graphql(query, current_user: current_user)
end
it_behaves_like 'counts properly'
context 'when requesting has_children' do
let(:epic_aggregates_query) do
<<~QUERY
nodes {
hasChildren
}
QUERY
end
context 'when requesting weights' do
let(:epic_aggregates_query) do
<<~QUERY
nodes {
descendantWeightSum {
openedIssues
closedIssues
}
}
QUERY
end
it 'returns nil' do
post_graphql(query, current_user: current_user)
expect(subject).to include(a_hash_including('descendantWeightSum' => nil))
end
end
it_behaves_like 'having correct values for', 'hasChildren'
it_behaves_like 'efficient query'
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment