diff --git a/ee/app/assets/javascripts/security_dashboard/components/pipeline/vulnerability_finding_modal.vue b/ee/app/assets/javascripts/security_dashboard/components/pipeline/vulnerability_finding_modal.vue index 15f97396f2eb9bf347c12ecf4252a2908485b01e..ce2fc710036858649e9bbf03d0deca19ae6554ff 100644 --- a/ee/app/assets/javascripts/security_dashboard/components/pipeline/vulnerability_finding_modal.vue +++ b/ee/app/assets/javascripts/security_dashboard/components/pipeline/vulnerability_finding_modal.vue @@ -35,7 +35,6 @@ import { VULNERABILITY_MODAL_ID } from 'ee/vue_shared/security_reports/component import VulnerabilityCodeFlow from 'ee/vulnerabilities/components/vulnerability_code_flow.vue'; import { getRefFromBlobPath } from 'ee/vulnerabilities/helpers'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import glAbilitiesMixin from '~/vue_shared/mixins/gl_abilities_mixin'; import { VULNERABILITY_DETAIL_CODE_FLOWS } from 'ee/security_dashboard/constants'; import VulnerabilityDismissalReason from './vulnerability_dismissal_reason.vue'; import VulnerabilityFindingModalDetails from './vulnerability_finding_modal_details.vue'; @@ -80,7 +79,7 @@ export default { directives: { GlTooltip: GlTooltipDirective, }, - mixins: [glAbilitiesMixin(), glFeatureFlagMixin()], + mixins: [glFeatureFlagMixin()], props: { findingUuid: { type: String, @@ -346,14 +345,6 @@ export default { codeFlowData() { return this.finding.details.find((detail) => detail.type === VULNERABILITY_DETAIL_CODE_FLOWS); }, - isFindingAIResolvable() { - return ( - // controlled by the parent, so the AI features can be disabled if needed (e.g. feature flag, pipeline security report) - this.showAiResolution && - this.glAbilities.resolveVulnerabilityWithAi && - this.finding?.vulnerability?.aiResolutionEnabled - ); - }, }, methods: { handleCommentEsc() { @@ -716,7 +707,7 @@ export default { @create-jira-issue="createJiraIssue" /> <gl-button - v-if="isFindingAIResolvable" + v-if="showAiResolution" v-gl-tooltip.hover variant="confirm" icon="tanuki-ai" diff --git a/ee/app/assets/javascripts/security_dashboard/graphql/queries/security_report_finding.query.graphql b/ee/app/assets/javascripts/security_dashboard/graphql/queries/security_report_finding.query.graphql index 7c2bd7419d0b65a68ba2f06b5023cd3a4a36c537..0b71669da721dcc93137ce957f558b6983fe1eae 100644 --- a/ee/app/assets/javascripts/security_dashboard/graphql/queries/security_report_finding.query.graphql +++ b/ee/app/assets/javascripts/security_dashboard/graphql/queries/security_report_finding.query.graphql @@ -157,7 +157,6 @@ query getSecurityReportFinding($projectFullPath: ID!, $pipelineIid: ID!, $findin stateComment vulnerability { id - aiResolutionEnabled externalIssueLinks { nodes { id diff --git a/ee/app/controllers/ee/projects/merge_requests_controller.rb b/ee/app/controllers/ee/projects/merge_requests_controller.rb index c4e7d9366944aa2fe43060cc63b619a4cb454983..647ec364e791fbe2b7ee9b81d8797fc5778224b1 100644 --- a/ee/app/controllers/ee/projects/merge_requests_controller.rb +++ b/ee/app/controllers/ee/projects/merge_requests_controller.rb @@ -12,7 +12,6 @@ module MergeRequestsController before_action only: [:show] do push_frontend_feature_flag(:merge_trains_skip_train, @project) push_frontend_feature_flag(:resolve_vulnerability_in_mr, @project) - push_frontend_ability(ability: :resolve_vulnerability_with_ai, resource: @project, user: current_user) end before_action :authorize_read_pipeline!, only: [:metrics_reports] diff --git a/ee/spec/frontend/security_dashboard/components/pipeline/mock_data.js b/ee/spec/frontend/security_dashboard/components/pipeline/mock_data.js index ebb2a6377b2a84dfb44c0176b1cb371500d4fa00..847cce76e8f17f901945d5ad272c1de509fa388b 100644 --- a/ee/spec/frontend/security_dashboard/components/pipeline/mock_data.js +++ b/ee/spec/frontend/security_dashboard/components/pipeline/mock_data.js @@ -580,7 +580,6 @@ export const pipelineSecurityReportFinding = { stateComment: null, vulnerability: { id: '1', - aiResolutionEnabled: true, externalIssueLinks: { nodes: [], }, diff --git a/ee/spec/frontend/security_dashboard/components/pipeline/vulnerability_finding_modal_spec.js b/ee/spec/frontend/security_dashboard/components/pipeline/vulnerability_finding_modal_spec.js index 6282ffc7f25c5a7cf0afcaaef24baaa542c7985e..2a3fc0fe9d06a7c7ec10b0075d40d5fc16f2df96 100644 --- a/ee/spec/frontend/security_dashboard/components/pipeline/vulnerability_finding_modal_spec.js +++ b/ee/spec/frontend/security_dashboard/components/pipeline/vulnerability_finding_modal_spec.js @@ -123,7 +123,6 @@ describe('ee/security_dashboard/components/pipeline/vulnerability_finding_modal. responseHandlers, propsData, glFeatures: { vulnerabilityCodeFlow = false, pipelineVulnerabilityCodeFlow = false } = {}, - glAbilities: { resolveVulnerabilityWithAi = true } = {}, ...options } = {}) => { modalMockMethods = { @@ -152,7 +151,6 @@ describe('ee/security_dashboard/components/pipeline/vulnerability_finding_modal. }), provide: { glFeatures: { vulnerabilityCodeFlow, pipelineVulnerabilityCodeFlow }, - glAbilities: { resolveVulnerabilityWithAi }, }, ...options, }); @@ -1624,34 +1622,23 @@ describe('ee/security_dashboard/components/pipeline/vulnerability_finding_modal. describe('resolve with AI', () => { const findResolveWithAIButton = () => wrapper.findByTestId('resolve-with-ai'); - it.each` - propsData | glAbilities | graphQLVulnerability | shouldShowResolveWithAIButton - ${{ showAiResolution: true }} | ${{ resolveVulnerabilityWithAi: true }} | ${{ aiResolutionEnabled: true }} | ${true} - ${{ showAiResolution: false }} | ${{ resolveVulnerabilityWithAi: true }} | ${{ aiResolutionEnabled: true }} | ${false} - ${{ showAiResolution: true }} | ${{ resolveVulnerabilityWithAi: false }} | ${{ aiResolutionEnabled: true }} | ${false} - ${{ showAiResolution: true }} | ${{ resolveVulnerabilityWithAi: true }} | ${{ aiResolutionEnabled: false }} | ${false} - `( - 'shows the "Resolve with AI" button: "$shouldShowResolveWithAIButton"', - async ({ propsData, glAbilities, graphQLVulnerability, shouldShowResolveWithAIButton }) => { + it.each([true, false])( + 'shows the "Resolve with AI" button: "%s', + async (showAiResolution) => { createWrapper({ responseHandlers: { - securityReportFindingQuery: jest.fn().mockResolvedValue( - getPipelineSecurityReportFindingResponse({ - overrides: { - vulnerability: graphQLVulnerability, - }, - }), - ), + securityReportFindingQuery: jest + .fn() + .mockResolvedValue(getPipelineSecurityReportFindingResponse()), }, - propsData, - provide: { - glAbilities, + propsData: { + showAiResolution, }, }); await waitForPromises(); - expect(findResolveWithAIButton().exists()).toBe(shouldShowResolveWithAIButton); + expect(findResolveWithAIButton().exists()).toBe(showAiResolution); }, ); @@ -1665,7 +1652,6 @@ describe('ee/security_dashboard/components/pipeline/vulnerability_finding_modal. }, provide: { glFeatures: { resolveVulnerabilityInMr: true }, - glAbilities: { resolveVulnerabilityWithAi: true }, }, propsData: { showAiResolution: true, diff --git a/ee/spec/requests/projects/merge_requests_controller_spec.rb b/ee/spec/requests/projects/merge_requests_controller_spec.rb index 1bc87ba6f70ec9d269c1803a0f1c184631f84841..5c463cdb0ff03b61215fccbe8dd6f8eb98388e76 100644 --- a/ee/spec/requests/projects/merge_requests_controller_spec.rb +++ b/ee/spec/requests/projects/merge_requests_controller_spec.rb @@ -13,38 +13,6 @@ login_as(user) end - describe 'GET #show' do - def get_show - get project_merge_request_path(project, merge_request) - end - - context "when resolveVulnerabilityWithAi ability is allowed" do - before do - allow(Ability).to receive(:allowed?).and_call_original - allow(Ability).to receive(:allowed?).with(user, :resolve_vulnerability_with_ai, project).and_return(true) - - get_show - end - - it 'sets the frontend ability to true when allowed' do - expect(response.body).to have_pushed_frontend_ability(resolveVulnerabilityWithAi: true) - end - end - - context "when resolveVulnerabilityWithAi ability is not allowed" do - before do - allow(Ability).to receive(:allowed?).and_call_original - allow(Ability).to receive(:allowed?).with(user, :resolve_vulnerability_with_ai, project).and_return(false) - - get_show - end - - it 'sets the frontend ability to false not allowed' do - expect(response.body).to have_pushed_frontend_ability(resolveVulnerabilityWithAi: false) - end - end - end - describe 'GET #edit' do def get_edit get edit_project_merge_request_path(project, merge_request)