From aef9280a78c29ae79d589382e895768cd3ff00bb Mon Sep 17 00:00:00 2001 From: Stanislav Lashmanov Date: Wed, 3 Sep 2025 18:13:59 +0400 Subject: [PATCH 1/5] Remove rapid_diffs_on_compare_show feature flag Changelog: added --- .../projects/compare_controller.rb | 3 +- .../beta/rapid_diffs_on_compare_show.yml | 9 --- .../projects/compare_controller_spec.rb | 4 -- spec/features/projects/compare_spec.rb | 72 ------------------- spec/features/projects/view_on_env_spec.rb | 34 --------- 5 files changed, 1 insertion(+), 121 deletions(-) delete mode 100644 config/feature_flags/beta/rapid_diffs_on_compare_show.yml diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index 3c2c8e4570dce5..d397166be74252 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -238,8 +238,7 @@ def rapid_diffs_force_disabled? end def rapid_diffs_enabled? - ::Feature.enabled?(:rapid_diffs_on_compare_show, current_user, type: :beta) && - !rapid_diffs_force_disabled? && + !rapid_diffs_force_disabled? && params.permit(:format)[:format].blank? end end diff --git a/config/feature_flags/beta/rapid_diffs_on_compare_show.yml b/config/feature_flags/beta/rapid_diffs_on_compare_show.yml deleted file mode 100644 index 034f741fcf1da0..00000000000000 --- a/config/feature_flags/beta/rapid_diffs_on_compare_show.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -name: rapid_diffs_on_compare_show -feature_issue_url: https://gitlab.com/groups/gitlab-org/-/epics/11559 -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/187955 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/539580 -milestone: '18.0' -group: group::code review -type: beta -default_enabled: true diff --git a/spec/controllers/projects/compare_controller_spec.rb b/spec/controllers/projects/compare_controller_spec.rb index 447eae785a5d21..024b79a9eda7e5 100644 --- a/spec/controllers/projects/compare_controller_spec.rb +++ b/spec/controllers/projects/compare_controller_spec.rb @@ -76,10 +76,6 @@ let(:straight) { nil } let(:page) { nil } - before do - stub_feature_flags(rapid_diffs_on_compare_show: false) - end - context 'when the refs exist in the same project' do context 'when we set the white space param' do let(:from_project_id) { nil } diff --git a/spec/features/projects/compare_spec.rb b/spec/features/projects/compare_spec.rb index 6ac2fd388003c1..bd134ccdfe710d 100644 --- a/spec/features/projects/compare_spec.rb +++ b/spec/features/projects/compare_spec.rb @@ -93,78 +93,6 @@ expect(find(".js-compare-from-dropdown .gl-new-dropdown-contents")).to have_selector('li.gl-new-dropdown-item', count: 1) end - context 'with legacy diffs' do - before do - stub_feature_flags(rapid_diffs_on_compare_show: false) - end - - it 'renders additions info when click unfold diff' do - visit project_compare_index_path(project) - - select_using_dropdown('from', RepoHelpers.sample_commit.parent_id, commit: true) - select_using_dropdown('to', RepoHelpers.sample_commit.id, commit: true) - - click_button 'Compare' - expect(page).to have_content 'Commits on Source 1' - expect(page).to have_content "Showing 2 changed files" - - diff = first('.js-unfold') - diff.click - wait_for_requests - - page.within diff.query_scope do - expect(first('.new_line').text).not_to have_content "..." - end - end - - context 'when commit has overflow', :js do - it 'displays warning' do - visit project_compare_index_path(project, from: "feature", to: "master") - - allow(Commit).to receive(:max_diff_options).and_return(max_files: 3) - allow_next_instance_of(DiffHelper) do |instance| - allow(instance).to receive(:render_overflow_warning?).and_return(true) - end - - click_button('Compare') - - within_testid('too-many-changes-alert') do - expect(page).to have_text("Some changes are not shown. For a faster browsing experience, only 3 of 3+ files are shown.") - expect(page).not_to have_link("Plain diff") - expect(page).not_to have_link("Patches") - end - end - end - - context "pagination" do - before do - stub_const("Projects::CompareController::COMMIT_DIFFS_PER_PAGE", 1) - end - - it "shows an adjusted count for changed files on this page" do - visit project_compare_index_path(project, from: "feature", to: "master") - - click_button('Compare') - - expect(page).to have_content("Showing 1 changed file") - end - - it "shows commits list only on the first page" do - visit project_compare_index_path(project, from: "feature", to: "master") - click_button('Compare') - - expect(page).to have_content 'Commits on Source 29' - - # go to the second page - within(".files .gl-pagination") do - click_on("2") - end - - expect(page).not_to have_content 'Commits on Source 29' - end - end - end - context 'when displayed with rapid_diffs' do let(:from) { RepoHelpers.sample_commit.parent_id } let(:to) { RepoHelpers.sample_commit.id } diff --git a/spec/features/projects/view_on_env_spec.rb b/spec/features/projects/view_on_env_spec.rb index a790a64ee8c5e8..9352328fe2c32f 100644 --- a/spec/features/projects/view_on_env_spec.rb +++ b/spec/features/projects/view_on_env_spec.rb @@ -48,40 +48,6 @@ let(:environment) { create(:environment, project: project, name: 'review/feature', external_url: 'http://feature.review.example.com') } let!(:deployment) { create(:deployment, :success, environment: environment, ref: branch_name, sha: sha) } - context 'with legacy diffs' do - before do - stub_feature_flags(rapid_diffs_on_compare_show: false) - end - - context 'when visiting a comparison for the branch' do - before do - sign_in(user) - - visit project_compare_path(project, from: 'master', to: branch_name) - - wait_for_requests - end - - it 'has a "View on env" button' do - expect(page).to have_link('View on feature.review.example.com', href: 'http://feature.review.example.com/ruby/feature') - end - end - - context 'when visiting a comparison for the commit' do - before do - sign_in(user) - - visit project_compare_path(project, from: 'master', to: sha) - - wait_for_requests - end - - it 'has a "View on env" button' do - expect(page).to have_link('View on feature.review.example.com', href: 'http://feature.review.example.com/ruby/feature') - end - end - end - context 'when visiting a blob on the branch' do before do sign_in(user) -- GitLab From 881e160825ff946a7f72f86f5638037d10960769 Mon Sep 17 00:00:00 2001 From: Stanislav Lashmanov Date: Wed, 3 Sep 2025 18:36:54 +0400 Subject: [PATCH 2/5] Remove legacy code --- .../projects/compare/rapid_diffs/index.js | 7 ---- .../pages/projects/compare/show/index.js | 12 ++---- .../projects/compare_controller.rb | 37 +++++------------- .../projects/compare/rapid_diffs.html.haml | 35 ----------------- app/views/projects/compare/show.html.haml | 38 +++++++++---------- .../projects/compare_controller_spec.rb | 4 +- 6 files changed, 33 insertions(+), 100 deletions(-) delete mode 100644 app/assets/javascripts/pages/projects/compare/rapid_diffs/index.js delete mode 100644 app/views/projects/compare/rapid_diffs.html.haml diff --git a/app/assets/javascripts/pages/projects/compare/rapid_diffs/index.js b/app/assets/javascripts/pages/projects/compare/rapid_diffs/index.js deleted file mode 100644 index dc0b9e8d22727e..00000000000000 --- a/app/assets/javascripts/pages/projects/compare/rapid_diffs/index.js +++ /dev/null @@ -1,7 +0,0 @@ -import initCompareSelector from '~/projects/compare'; -import { createRapidDiffsApp } from '~/rapid_diffs'; - -initCompareSelector(); - -const app = createRapidDiffsApp(); -app.init(); diff --git a/app/assets/javascripts/pages/projects/compare/show/index.js b/app/assets/javascripts/pages/projects/compare/show/index.js index 328b5596e1a9fc..dc0b9e8d22727e 100644 --- a/app/assets/javascripts/pages/projects/compare/show/index.js +++ b/app/assets/javascripts/pages/projects/compare/show/index.js @@ -1,13 +1,7 @@ -import Diff from '~/diff'; -import GpgBadges from '~/gpg_badges'; -import { initDiffStatsDropdown } from '~/init_diff_stats_dropdown'; import initCompareSelector from '~/projects/compare'; -import syntaxHighlight from '~/syntax_highlight'; +import { createRapidDiffsApp } from '~/rapid_diffs'; initCompareSelector(); -new Diff(); // eslint-disable-line no-new -initDiffStatsDropdown(); -GpgBadges.fetch(); - -syntaxHighlight([document.querySelector('.files')]); +const app = createRapidDiffsApp(); +app.init(); diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index d397166be74252..cc80c98f64dcfd 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -13,7 +13,7 @@ class Projects::CompareController < Projects::ApplicationController before_action :require_non_empty_project before_action :authorize_read_code! # Defining ivars - before_action :define_diffs, only: [:show, :diff_for_path] + before_action :define_diffs, only: [:diff_for_path] before_action :define_environment, only: [:show] before_action :define_diff_notes_disabled, only: [:show, :diff_for_path] before_action :define_commits, only: [:show, :diff_for_path, :signatures] @@ -33,29 +33,24 @@ def index end def show - apply_diff_view_cookie! - - if rapid_diffs_enabled? - @js_action_name = 'rapid_diffs' - @rapid_diffs_presenter = ::RapidDiffs::ComparePresenter.new( - compare, - diff_view, - diff_options, - compare_params - ) - return render action: :rapid_diffs - end - respond_to do |format| format.html do - render locals: { pagination_params: params.permit(:page) } + apply_diff_view_cookie! + @rapid_diffs_presenter = ::RapidDiffs::ComparePresenter.new( + compare, + diff_view, + diff_options, + compare_params + ) end format.patch do + define_diffs compare ? send_git_patch(source_project.repository, compare.diff_refs) : render_404 end format.diff do + define_diffs compare ? send_git_diff(source_project.repository, compare.diff_refs) : render_404 end end @@ -191,8 +186,6 @@ def define_commits end def define_diffs - return if rapid_diffs_enabled? - @diffs = compare.present? ? compare.diffs(diff_options) : [] end @@ -231,14 +224,4 @@ def compare_params def diffs_resource(options = {}) compare&.diffs(diff_options.merge(options)) end - - def rapid_diffs_force_disabled? - ::Feature.enabled?(:rapid_diffs_debug, current_user, type: :ops) && - params.permit(:rapid_diffs_disabled)[:rapid_diffs_disabled] == 'true' - end - - def rapid_diffs_enabled? - !rapid_diffs_force_disabled? && - params.permit(:format)[:format].blank? - end end diff --git a/app/views/projects/compare/rapid_diffs.html.haml b/app/views/projects/compare/rapid_diffs.html.haml deleted file mode 100644 index b1589dfdeb8309..00000000000000 --- a/app/views/projects/compare/rapid_diffs.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -- @no_container = true -- container_class = fluid_layout ? '' : 'container-limited' -- add_to_breadcrumbs s_("CompareRevisions|Compare revisions"), project_compare_index_path(@project) -- page_title "#{params[:from]} to #{params[:to]}" --# Only show commit list in the first page -- hide_commit_list = params[:page].present? && params[:page] != '1' -- add_page_specific_style 'page_bundles/merge_requests' -- add_page_specific_style 'page_bundles/compare_rapid_diffs' - -.container-fluid{ class: [container_class] } - .gl-border-b-0.gl-mb-0.gl-pt-4 - .js-signature-container{ data: { 'signatures-path' => signatures_namespace_project_compare_index_path } } - #js-compare-selector{ data: project_compare_selector_data(@project, @merge_request, params) } - -- if @commits.present? - .container-fluid{ class: [container_class] } - = render "projects/commits/commit_list" unless hide_commit_list - .container-fluid - = render ::RapidDiffs::AppComponent.new(@rapid_diffs_presenter) -- else - .container-fluid - = render Pajamas::CardComponent.new(card_options: { class: "gl-bg-subtle" }) do |c| - - c.with_body do - = render Pajamas::EmptyStateComponent.new(svg_path: 'illustrations/empty-state/empty-commit-md.svg', - title: s_("CompareRevisions|There isn't anything to compare")) do |c| - - - c.with_description do - - if params[:to] == params[:from] - - source_branch = capture do - %span.ref-name= params[:from] - - target_branch = capture do - %span.ref-name= params[:to] - = (s_("CompareRevisions|%{source_branch} and %{target_branch} are the same.") % { source_branch: source_branch, target_branch: target_branch }).html_safe - - else - = _("To get a valid comparison, select two different branches.") diff --git a/app/views/projects/compare/show.html.haml b/app/views/projects/compare/show.html.haml index 62e77067d5c0ca..b1589dfdeb8309 100644 --- a/app/views/projects/compare/show.html.haml +++ b/app/views/projects/compare/show.html.haml @@ -2,36 +2,34 @@ - container_class = fluid_layout ? '' : 'container-limited' - add_to_breadcrumbs s_("CompareRevisions|Compare revisions"), project_compare_index_path(@project) - page_title "#{params[:from]} to #{params[:to]}" -- has_diff = @commits.present? || @diffs.present? && @diffs.diff_files.present? -# Only show commit list in the first page - hide_commit_list = params[:page].present? && params[:page] != '1' +- add_page_specific_style 'page_bundles/merge_requests' +- add_page_specific_style 'page_bundles/compare_rapid_diffs' .container-fluid{ class: [container_class] } .gl-border-b-0.gl-mb-0.gl-pt-4 .js-signature-container{ data: { 'signatures-path' => signatures_namespace_project_compare_index_path } } #js-compare-selector{ data: project_compare_selector_data(@project, @merge_request, params) } -- if has_diff +- if @commits.present? .container-fluid{ class: [container_class] } = render "projects/commits/commit_list" unless hide_commit_list .container-fluid - = render "projects/diffs/diffs", - diffs: @diffs, - environment: @environment, - diff_page_context: "is-compare", - page: pagination_params[:page], - paginate_diffs: true, - paginate_diffs_per_page: Projects::CompareController::COMMIT_DIFFS_PER_PAGE + = render ::RapidDiffs::AppComponent.new(@rapid_diffs_presenter) - else .container-fluid - = render Pajamas::EmptyStateComponent.new(svg_path: 'illustrations/empty-state/empty-commit-md.svg', - title: s_("CompareRevisions|There isn't anything to compare")) do |c| - - c.with_description do - - if params[:to] == params[:from] - - source_branch = capture do - %span.ref-name= params[:from] - - target_branch = capture do - %span.ref-name= params[:to] - = (s_("CompareRevisions|%{source_branch} and %{target_branch} are the same.") % { source_branch: source_branch, target_branch: target_branch }).html_safe - - else - = _("To get a valid comparison, select two different branches.") + = render Pajamas::CardComponent.new(card_options: { class: "gl-bg-subtle" }) do |c| + - c.with_body do + = render Pajamas::EmptyStateComponent.new(svg_path: 'illustrations/empty-state/empty-commit-md.svg', + title: s_("CompareRevisions|There isn't anything to compare")) do |c| + + - c.with_description do + - if params[:to] == params[:from] + - source_branch = capture do + %span.ref-name= params[:from] + - target_branch = capture do + %span.ref-name= params[:to] + = (s_("CompareRevisions|%{source_branch} and %{target_branch} are the same.") % { source_branch: source_branch, target_branch: target_branch }).html_safe + - else + = _("To get a valid comparison, select two different branches.") diff --git a/spec/controllers/projects/compare_controller_spec.rb b/spec/controllers/projects/compare_controller_spec.rb index 024b79a9eda7e5..641a69ec00b0c1 100644 --- a/spec/controllers/projects/compare_controller_spec.rb +++ b/spec/controllers/projects/compare_controller_spec.rb @@ -877,10 +877,10 @@ } end - it 'renders rapid_diffs template' do + it 'renders show template' do send_request - expect(response).to render_template(:rapid_diffs) + expect(response).to render_template(:show) end describe 'Get #diff_files_metadata' do -- GitLab From 25c4c364d7f942265d052730d56347c2c5e6ab28 Mon Sep 17 00:00:00 2001 From: Stanislav Lashmanov Date: Fri, 5 Sep 2025 16:30:30 +0400 Subject: [PATCH 3/5] Fix the spec, update outdated and missing code --- .../pages/projects/compare/show/index.js | 2 + .../projects/compare_controller.rb | 6 +- .../projects/compare_controller_spec.rb | 78 ++++--------------- 3 files changed, 17 insertions(+), 69 deletions(-) diff --git a/app/assets/javascripts/pages/projects/compare/show/index.js b/app/assets/javascripts/pages/projects/compare/show/index.js index dc0b9e8d22727e..89bb533f28cf50 100644 --- a/app/assets/javascripts/pages/projects/compare/show/index.js +++ b/app/assets/javascripts/pages/projects/compare/show/index.js @@ -1,7 +1,9 @@ import initCompareSelector from '~/projects/compare'; +import GpgBadges from '~/gpg_badges'; import { createRapidDiffsApp } from '~/rapid_diffs'; initCompareSelector(); +GpgBadges.fetch(); const app = createRapidDiffsApp(); app.init(); diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index cc80c98f64dcfd..83c79bce0bce65 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -14,7 +14,6 @@ class Projects::CompareController < Projects::ApplicationController before_action :authorize_read_code! # Defining ivars before_action :define_diffs, only: [:diff_for_path] - before_action :define_environment, only: [:show] before_action :define_diff_notes_disabled, only: [:show, :diff_for_path] before_action :define_commits, only: [:show, :diff_for_path, :signatures] before_action :merge_request, only: [:index, :show] @@ -24,10 +23,6 @@ class Projects::CompareController < Projects::ApplicationController feature_category :source_code_management urgency :low, [:show, :create, :signatures] - # Diffs may be pretty chunky, the less is better in this endpoint. - # Pagination design guides: https://design.gitlab.com/components/pagination/#behavior - COMMIT_DIFFS_PER_PAGE = 20 - def index compare_params end @@ -189,6 +184,7 @@ def define_diffs @diffs = compare.present? ? compare.diffs(diff_options) : [] end + # TODO: support 'view on environment' in Rapid Diffs def define_environment if compare environment_params = if source_project.repository.branch_exists?(head_ref) diff --git a/spec/controllers/projects/compare_controller_spec.rb b/spec/controllers/projects/compare_controller_spec.rb index 641a69ec00b0c1..08e1b5e25dfeb1 100644 --- a/spec/controllers/projects/compare_controller_spec.rb +++ b/spec/controllers/projects/compare_controller_spec.rb @@ -77,40 +77,15 @@ let(:page) { nil } context 'when the refs exist in the same project' do - context 'when we set the white space param' do - let(:from_project_id) { nil } - let(:from_ref) { '08f22f25' } - let(:to_ref) { '66eceea0' } - let(:whitespace) { 1 } - - it 'shows some diffs with ignore whitespace change option' do - allow(controller.current_user).to receive(:show_whitespace_in_diffs).and_return(false) - - show_request - - expect(response).to be_successful - diff_file = assigns(:diffs).diff_files.first - expect(diff_file).not_to be_nil - expect(assigns(:commits).length).to be >= 1 - # without whitespace option, there are more than 2 diff_splits - diff_splits = diff_file.diff.diff.split("\n") - expect(diff_splits.length).to be <= 2 - end - end - - context 'when we do not set the white space param' do - let(:from_project_id) { nil } - let(:from_ref) { 'improve%2Fawesome' } - let(:to_ref) { 'feature' } - let(:whitespace) { nil } + let(:from_project_id) { nil } + let(:from_ref) { 'improve%2Fawesome' } + let(:to_ref) { 'feature' } - it 'sets the diffs and commits ivars' do - show_request + it 'sets the commits ivar' do + show_request - expect(response).to be_successful - expect(assigns(:diffs).diff_files.first).not_to be_nil - expect(assigns(:commits).length).to be >= 1 - end + expect(response).to be_successful + expect(assigns(:commits).length).to be >= 1 end end @@ -169,11 +144,10 @@ let(:to_ref) { 'feature' } let(:whitespace) { nil } - it 'shows the diff' do + it 'shows commits' do show_request expect(response).to be_successful - expect(assigns(:diffs).diff_files.first).not_to be_nil expect(assigns(:commits).length).to be >= 1 end end @@ -194,8 +168,6 @@ expect(response).to be_successful expect(assigns(:commits).length).to be >= 2 - expect(assigns(:diffs).raw_diff_files.size).to be >= 2 - expect(assigns(:diffs).diff_files.first).to be_present end end @@ -205,12 +177,11 @@ let(:straight) { "true" } - it 'the commits are empty, but the removed lines are visible as diffs' do + it 'the commits are empty' do show_request expect(response).to be_successful expect(assigns(:commits).length).to eq 0 - expect(assigns(:diffs).diff_files.size).to be >= 4 end end @@ -220,12 +191,11 @@ let(:straight) { "false" } - it 'the additional commits are not visible in diffs and commits' do + it 'the additional commits are not visible' do show_request expect(response).to be_successful expect(assigns(:commits).length).to eq 0 - expect(assigns(:diffs).diff_files.size).to eq 0 end end end @@ -240,7 +210,6 @@ show_request expect(response).to be_successful - expect(assigns(:diffs)).to be_empty expect(assigns(:commits)).to be_empty end end @@ -263,14 +232,13 @@ } end - it 'does not show the diff' do + it 'does not show commits' do allow(controller).to receive(:source_project).and_return(project) expect(project).to receive(:default_merge_request_target).and_return(private_fork) show_request expect(response).to be_successful - expect(assigns(:diffs)).to be_empty expect(assigns(:commits)).to be_empty end end @@ -280,11 +248,10 @@ let(:from_ref) { 'non-existent-source-ref' } let(:to_ref) { 'feature' } - it 'sets empty diff and commit ivars' do + it 'sets empty commit ivar' do show_request expect(response).to be_successful - expect(assigns(:diffs)).to eq([]) expect(assigns(:commits)).to eq([]) end end @@ -294,11 +261,10 @@ let(:from_ref) { 'improve%2Fawesome' } let(:to_ref) { 'non-existent-target-ref' } - it 'sets empty diff and commit ivars' do + it 'sets empty commit ivar' do show_request expect(response).to be_successful - expect(assigns(:diffs)).to eq([]) expect(assigns(:commits)).to eq([]) end end @@ -426,32 +392,16 @@ let(:page) { 1 } shared_examples 'valid compare page' do - it 'shows the diff' do + it 'shows commits' do show_request expect(response).to be_successful - expect(assigns(:diffs).diff_files.first).to be_present expect(assigns(:commits).length).to be >= 1 end end it_behaves_like 'valid compare page' - it 'only loads blobs in the current page' do - stub_const('Projects::CompareController::COMMIT_DIFFS_PER_PAGE', 1) - - expect_next_instance_of(Repository) do |repository| - # This comparison contains 4 changed files but we expect only the blobs for the first one to be loaded - expect(repository).to receive(:blobs_at).with( - contain_exactly([from_ref, '.gitmodules'], [to_ref, '.gitmodules']), anything - ).and_call_original - end - - show_request - - expect(response).to be_successful - end - context 'when from_ref is HEAD ref' do let(:from_ref) { 'HEAD' } let(:to_ref) { 'feature' } # Need to change to_ref too so there's something to compare with HEAD -- GitLab From 78be162d864cb9b17aac63ac8f2e1ffbecc11ffb Mon Sep 17 00:00:00 2001 From: Stanislav Lashmanov Date: Fri, 5 Sep 2025 16:48:03 +0400 Subject: [PATCH 4/5] Put diff blobs behind a debug feature flag --- app/controllers/concerns/rapid_diffs/streaming_resource.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/concerns/rapid_diffs/streaming_resource.rb b/app/controllers/concerns/rapid_diffs/streaming_resource.rb index 9018e2970c0d8a..b7337f8d08aad8 100644 --- a/app/controllers/concerns/rapid_diffs/streaming_resource.rb +++ b/app/controllers/concerns/rapid_diffs/streaming_resource.rb @@ -56,7 +56,8 @@ def stream_diff_files(options, view_context) return unless resource # NOTE: This is a temporary flag to test out the new diff_blobs - if !!ActiveModel::Type::Boolean.new.cast(params.permit(:diff_blobs)[:diff_blobs]) + use_new_gitaly_rpc = ActiveModel::Type::Boolean.new.cast(params.permit(:diff_blobs)[:diff_blobs]) + if use_new_gitaly_rpc && Feature.enabled?(:rapid_diffs_debug, current_user) stream_diff_blobs(options, view_context) else stream_diff_collection(options, view_context) -- GitLab From ae8916aa9748cbf8e5e5ba6b36075d186a668e62 Mon Sep 17 00:00:00 2001 From: Stanislav Lashmanov Date: Mon, 8 Sep 2025 17:21:41 +0400 Subject: [PATCH 5/5] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: Hordur Freyr Yngvason --- app/controllers/projects/compare_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index 83c79bce0bce65..faab511027e7b9 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -185,6 +185,7 @@ def define_diffs end # TODO: support 'view on environment' in Rapid Diffs + # See https://gitlab.com/gitlab-org/gitlab/-/issues/554718 def define_environment if compare environment_params = if source_project.repository.branch_exists?(head_ref) -- GitLab