From 85114f4ede7d1cdfde83f0d9876bfc222e0c4bf7 Mon Sep 17 00:00:00 2001 From: Ryan Albrecht Date: Tue, 16 Jun 2026 15:19:54 -0700 Subject: [PATCH] chore(seer): Cleanup ununsed bulkAutofixAutomationSettingsInfiniteOptions() --- .../hooks/useBulkAutofixAutomationSettings.ts | 35 ------------------- .../hooks/useUpdateProjectSeerPreferences.ts | 10 ------ .../app/utils/seer/useMutateAutofixProject.ts | 18 ++++------ .../seerAutomation/seerAutomation.spec.tsx | 5 --- 4 files changed, 7 insertions(+), 61 deletions(-) delete mode 100644 static/app/components/events/autofix/preferences/hooks/useBulkAutofixAutomationSettings.ts diff --git a/static/app/components/events/autofix/preferences/hooks/useBulkAutofixAutomationSettings.ts b/static/app/components/events/autofix/preferences/hooks/useBulkAutofixAutomationSettings.ts deleted file mode 100644 index 82b1625461ea7b..00000000000000 --- a/static/app/components/events/autofix/preferences/hooks/useBulkAutofixAutomationSettings.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type {ProjectSeerPreferences} from 'sentry/components/events/autofix/types'; -import type {Organization} from 'sentry/types/organization'; -import {apiOptions} from 'sentry/utils/api/apiOptions'; - -type AutofixAutomationTuning = - | 'off' - | 'super_low' // deprecated - | 'low' // deprecated - | 'medium' - | 'high' // deprecated - | 'always' // deprecated - | null; // deprecated - -type AutofixAutomationSettings = { - autofixAutomationTuning: AutofixAutomationTuning; - automatedRunStoppingPoint: ProjectSeerPreferences['automated_run_stopping_point']; - automationHandoff: ProjectSeerPreferences['automation_handoff']; - projectId: string | number; // Ideally this is a string, but in reality it can be a number. - reposCount: number; -}; - -export function bulkAutofixAutomationSettingsInfiniteOptions({ - organization, -}: { - organization: Organization; -}) { - return apiOptions.asInfinite()( - '/organizations/$organizationIdOrSlug/autofix/automation-settings/', - { - path: {organizationIdOrSlug: organization.slug}, - query: {per_page: 100}, - staleTime: 0, - } - ); -} diff --git a/static/app/components/events/autofix/preferences/hooks/useUpdateProjectSeerPreferences.ts b/static/app/components/events/autofix/preferences/hooks/useUpdateProjectSeerPreferences.ts index 668daec1af6384..ae7f22a5227252 100644 --- a/static/app/components/events/autofix/preferences/hooks/useUpdateProjectSeerPreferences.ts +++ b/static/app/components/events/autofix/preferences/hooks/useUpdateProjectSeerPreferences.ts @@ -6,8 +6,6 @@ import type {Project} from 'sentry/types/project'; import {fetchMutation} from 'sentry/utils/queryClient'; import {useOrganization} from 'sentry/utils/useOrganization'; -import {bulkAutofixAutomationSettingsInfiniteOptions} from './useBulkAutofixAutomationSettings'; - export function useUpdateProjectSeerPreferences(project: Project) { const organization = useOrganization(); const queryClient = useQueryClient(); @@ -48,14 +46,6 @@ export function useUpdateProjectSeerPreferences(project: Project) { }, onSettled: () => { queryClient.invalidateQueries({queryKey}); - - const bulkAutofixAutomationSettingsQueryOptions = - bulkAutofixAutomationSettingsInfiniteOptions({ - organization, - }); - queryClient.invalidateQueries({ - queryKey: bulkAutofixAutomationSettingsQueryOptions.queryKey, - }); }, }); } diff --git a/static/app/utils/seer/useMutateAutofixProject.ts b/static/app/utils/seer/useMutateAutofixProject.ts index acf7c73470e807..f69e9769a1ba0d 100644 --- a/static/app/utils/seer/useMutateAutofixProject.ts +++ b/static/app/utils/seer/useMutateAutofixProject.ts @@ -1,10 +1,8 @@ import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'; -import {bulkAutofixAutomationSettingsInfiniteOptions} from 'sentry/components/events/autofix/preferences/hooks/useBulkAutofixAutomationSettings'; import {projectSeerPreferencesApiOptions} from 'sentry/components/events/autofix/preferences/hooks/useProjectSeerPreferences'; import {ProjectsStore} from 'sentry/stores/projectsStore'; import type {Project} from 'sentry/types/project'; -import {getApiUrl} from 'sentry/utils/api/getApiUrl'; import {makeDetailedProjectQueryKey} from 'sentry/utils/project/useDetailedProject'; import {fetchMutation} from 'sentry/utils/queryClient'; import { @@ -12,6 +10,7 @@ import { knownAgentIntegrationsQueryOptions, parseAgentOption, } from 'sentry/utils/seer/preferredAgent'; +import {getSeerProjectReposInfiniteQueryOptions} from 'sentry/utils/seer/seerProjectRepos'; import { getInfiniteSeerProjectsSettingsQueryOptions, getSeerProjectSettingsQueryOptions, @@ -99,14 +98,14 @@ export function useMutateAutofixProject() { // provider/owner/name matching cannot. Its replace-all is transactional, // so if this request fails we abort before touching settings and // nothing is persisted. + const reposQueryOptions = getSeerProjectReposInfiniteQueryOptions({ + organization, + project, + }); + const [reposUrl] = reposQueryOptions.queryKey; await fetchMutation({ method: 'PUT', - url: getApiUrl('/projects/$organizationIdOrSlug/$projectIdOrSlug/seer/repos/', { - path: { - organizationIdOrSlug: organization.slug, - projectIdOrSlug: project.slug, - }, - }), + url: reposUrl, data: {repos}, }); @@ -151,9 +150,6 @@ export function useMutateAutofixProject() { queryKey: projectSeerPreferencesApiOptions(organization.slug, project.slug) .queryKey, }); - queryClient.invalidateQueries({ - queryKey: bulkAutofixAutomationSettingsInfiniteOptions({organization}).queryKey, - }); queryClient.invalidateQueries({ queryKey: getSeerProjectSettingsQueryOptions({ organization, diff --git a/static/gsApp/views/seerAutomation/seerAutomation.spec.tsx b/static/gsApp/views/seerAutomation/seerAutomation.spec.tsx index 0dab19cf8b3c40..af65282367eb4f 100644 --- a/static/gsApp/views/seerAutomation/seerAutomation.spec.tsx +++ b/static/gsApp/views/seerAutomation/seerAutomation.spec.tsx @@ -31,11 +31,6 @@ describe('SeerAutomation', () => { method: 'GET', body: [], }); - MockApiClient.addMockResponse({ - url: '/organizations/org-slug/autofix/automation-settings/', - method: 'GET', - body: [], - }); }); it('does not show legacy banner for orgs without legacy or beta Seer features', () => {