Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ describe('OrganizationSettingsForm', () => {
{
organization: {
...organization,
features: ['gen-ai-features'],
features: ['gen-ai-features', 'seer-added'],
},
}
);
Expand Down Expand Up @@ -356,7 +356,7 @@ describe('OrganizationSettingsForm', () => {
{
organization: {
...organization,
features: ['gen-ai-features'],
features: ['gen-ai-features', 'seer-added'],
},
}
);
Expand All @@ -379,7 +379,7 @@ describe('OrganizationSettingsForm', () => {
{
organization: {
...organization,
features: ['gen-ai-features'],
features: ['gen-ai-features', 'seer-added'],
},
}
);
Expand Down Expand Up @@ -421,7 +421,7 @@ describe('OrganizationSettingsForm', () => {
{
organization: {
...organization,
features: ['gen-ai-features'],
features: ['gen-ai-features', 'seer-added'],
},
}
);
Expand All @@ -436,7 +436,7 @@ describe('OrganizationSettingsForm', () => {
expect(screen.queryByTestId('prevent-ai-disabled-tag')).not.toBeInTheDocument();
});

it('is disabled when feature flag is off', async () => {
it('is hidden when seer-added or code-review-beta feature flag is off', async () => {
jest.mocked(RegionUtils.getRegionDataFromOrganization).mockReturnValue({
name: 'us',
displayName: 'United States of America (US)',
Expand All @@ -459,13 +459,11 @@ describe('OrganizationSettingsForm', () => {

await waitFor(() => expect(membersRequest).toHaveBeenCalled());

const preventAiField = screen.getByRole('checkbox', {
name: /Enable AI Code Review/i,
});
expect(preventAiField).toBeInTheDocument();
expect(preventAiField).toBeEnabled();

expect(screen.queryByTestId('prevent-ai-disabled-tag')).not.toBeInTheDocument();
expect(
screen.queryByRole('checkbox', {
name: /Enable AI Code Review/i,
})
).not.toBeInTheDocument();
});

it('is enabled when EU region', async () => {
Expand All @@ -484,7 +482,7 @@ describe('OrganizationSettingsForm', () => {
{
organization: {
...organization,
features: ['gen-ai-features'],
features: ['gen-ai-features', 'seer-added'],
},
}
);
Expand Down Expand Up @@ -518,7 +516,7 @@ describe('OrganizationSettingsForm', () => {
organization: {
...organization,
access: ['org:write'],
features: ['gen-ai-features'],
features: ['gen-ai-features', 'seer-added'],
},
}
);
Expand Down Expand Up @@ -552,7 +550,7 @@ describe('OrganizationSettingsForm', () => {
organization: {
...organization,
access: ['org:read'],
features: ['gen-ai-features'],
features: ['gen-ai-features', 'seer-added'],
},
}
);
Expand Down Expand Up @@ -580,7 +578,7 @@ describe('OrganizationSettingsForm', () => {
organization: {
...organization,
access: ['org:write'],
features: ['gen-ai-features'],
features: ['gen-ai-features', 'seer-added'],
},
}
);
Expand All @@ -599,5 +597,35 @@ describe('OrganizationSettingsForm', () => {
await screen.findByText('This feature is not available for self-hosted instances')
).toBeInTheDocument();
});

it('is hidden when seat-based-seer-enabled feature is on', async () => {
jest.mocked(RegionUtils.getRegionDataFromOrganization).mockReturnValue({
name: 'us',
displayName: 'United States of America (US)',
url: 'https://sentry.example.com',
});

render(
<OrganizationSettingsForm
{...routerProps}
initialData={OrganizationFixture({hideAiFeatures: true})}
onSave={onSave}
/>,
{
organization: {
...organization,
features: ['gen-ai-features', 'seer-added', 'seat-based-seer-enabled'],
},
}
);

await waitFor(() => expect(membersRequest).toHaveBeenCalled());

expect(
screen.queryByRole('checkbox', {
name: /Enable AI Code Review/i,
})
).not.toBeInTheDocument();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {IconLock} from 'sentry/icons';
import {t, tct} from 'sentry/locale';
import ConfigStore from 'sentry/stores/configStore';
import type {Organization} from 'sentry/types/organization';
import showNewSeer from 'sentry/utils/seer/showNewSeer';

export const makePreventAiField = (organization: Organization): FieldObject => {
const isSelfHosted = ConfigStore.get('isSelfHosted');
Expand Down Expand Up @@ -45,13 +44,19 @@ export const makePreventAiField = (organization: Organization): FieldObject => {
),
}),
visible: ({model}) => {
if (showNewSeer(organization)) {
Copy link
Member

@ryan953 ryan953 Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This showNewSeer() call should already be handling the case

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see showNewSeer() handling those in code-review-beta cohort (whether on old seer plan, new seer plan, or neither)

Copy link
Member

@ryan953 ryan953 Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a comment in there that it should be handled... but it's not.
We should add a check for the flag inside that function, to match the comment. that'll also mean the other places that call showNewSeer() will be aligned as well.

Copy link
Member

@ryan953 ryan953 Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

following up with #106425

if (organization.features.includes('seat-based-seer-enabled')) {
return false;
}

// Show field when AI features are enabled (hideAiFeatures is false)
const hideAiFeatures = model.getValue('hideAiFeatures');
return hideAiFeatures;
if (
organization.features.includes('seer-added') ||
organization.features.includes('code-review-beta')
) {
// This looks flipped but it's just a weirdly named field
return model.getValue('hideAiFeatures');
}

return false;
},
disabled: ({access}) => isDisabled || !access.has('org:write'),
};
Expand Down
Loading