Skip to content

Commit 960c20c

Browse files
authored
feat(ai-consent): Skip consent screen for issue summary (#102687)
1 parent affaa25 commit 960c20c

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

static/app/views/issueDetails/streamline/sidebar/seerSection.spec.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,44 @@ describe('SeerSection', () => {
133133
expect(screen.getByRole('button', {name: 'Fix with Seer'})).toBeInTheDocument();
134134
});
135135

136+
it('shows issue summary and "Fix with Seer" when consent flow is removed and there is no autofix quota', async () => {
137+
const orgWithConsentFlowRemoved = OrganizationFixture({
138+
hideAiFeatures: false,
139+
features: ['gen-ai-features', 'gen-ai-consent-flow-removal'],
140+
});
141+
142+
MockApiClient.addMockResponse({
143+
url: `/organizations/${mockProject.organization.slug}/issues/${mockGroup.id}/autofix/setup/`,
144+
body: AutofixSetupFixture({
145+
setupAcknowledgement: {
146+
orgHasAcknowledged: true,
147+
userHasAcknowledged: true,
148+
},
149+
integration: {ok: true, reason: null},
150+
githubWriteIntegration: {ok: true, repos: []},
151+
billing: {hasAutofixQuota: false},
152+
}),
153+
});
154+
MockApiClient.addMockResponse({
155+
url: `/organizations/${mockProject.organization.slug}/issues/${mockGroup.id}/summarize/`,
156+
method: 'POST',
157+
body: {whatsWrong: 'Test summary', possibleCause: 'You did it wrong'},
158+
});
159+
160+
render(<SeerSection event={mockEvent} group={mockGroup} project={mockProject} />, {
161+
organization: orgWithConsentFlowRemoved,
162+
});
163+
164+
await waitFor(() => {
165+
expect(screen.queryByTestId('loading-placeholder')).not.toBeInTheDocument();
166+
});
167+
168+
expect(screen.getByText(/initial guess/i)).toBeInTheDocument();
169+
// Should show issue summary
170+
expect(await screen.findByText('You did it wrong')).toBeInTheDocument();
171+
expect(screen.getByRole('button', {name: 'Fix with Seer'})).toBeInTheDocument();
172+
});
173+
136174
it('shows "Find Root Cause" even when autofix needs setup', async () => {
137175
MockApiClient.addMockResponse({
138176
url: `/organizations/${mockProject.organization.slug}/issues/${mockGroup.id}/autofix/setup/`,

static/app/views/issueDetails/streamline/sidebar/seerSection.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type {Event} from 'sentry/types/event';
1616
import type {Group} from 'sentry/types/group';
1717
import type {Project} from 'sentry/types/project';
1818
import {getConfigForIssueType} from 'sentry/utils/issueTypeConfig';
19+
import useOrganization from 'sentry/utils/useOrganization';
1920
import {SectionKey} from 'sentry/views/issueDetails/streamline/context';
2021
import {SidebarFoldSection} from 'sentry/views/issueDetails/streamline/foldSection';
2122
import {useAiConfig} from 'sentry/views/issueDetails/streamline/hooks/useAiConfig';
@@ -105,6 +106,9 @@ export default function SeerSection({
105106
const issueTypeDoesntHaveSeer =
106107
!issueTypeConfig.autofix && !issueTypeConfig.issueSummary;
107108

109+
const organization = useOrganization();
110+
const removeConsentFlow = organization.features.includes('gen-ai-consent-flow-removal');
111+
108112
if (
109113
(!aiConfig.areAiFeaturesAllowed || issueTypeDoesntHaveSeer) &&
110114
!aiConfig.hasResources
@@ -140,7 +144,8 @@ export default function SeerSection({
140144
preventCollapse={!hasStreamlinedUI}
141145
>
142146
<SeerSectionContainer>
143-
{(aiConfig.orgNeedsGenAiAcknowledgement || !aiConfig.hasAutofixQuota) &&
147+
{(aiConfig.orgNeedsGenAiAcknowledgement ||
148+
(!removeConsentFlow && !aiConfig.hasAutofixQuota)) &&
144149
!aiConfig.isAutofixSetupLoading ? (
145150
<SeerWelcomeEntrypoint />
146151
) : aiConfig.hasAutofix || aiConfig.hasSummary ? (

0 commit comments

Comments
 (0)