Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution][Detection Engine] removes feature flag for AI assistant on rule create form #189040

Merged
merged 2 commits into from
Jul 25, 2024
Merged
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 @@ -158,11 +158,6 @@ export const allowedExperimentalValues = Object.freeze({
*/
protectionUpdatesEnabled: true,

/**
* Enables AI assistant on rule creation form when query has error
*/
AIAssistantOnRuleCreationFormEnabled: false,

/**
* Disables the timeline save tour.
* This flag is used to disable the tour in cypress tests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
createIndexPatternField,
getSelectToggleButtonForName,
} from '../../../rule_creation/components/required_fields/required_fields.test';
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';

// Mocks integrations
jest.mock('../../../fleet_integrations/api');
Expand All @@ -49,11 +48,6 @@ jest.mock('../ai_assistant', () => {
};
});

jest.mock('../../../../common/hooks/use_experimental_features', () => ({
useIsExperimentalFeatureEnabled: jest.fn(),
}));

const useIsExperimentalFeatureEnabledMock = useIsExperimentalFeatureEnabled as jest.Mock;
const mockRedirectLegacyUrl = jest.fn();
const mockGetLegacyUrlConflict = jest.fn();
jest.mock('../../../../common/lib/kibana', () => {
Expand Down Expand Up @@ -631,9 +625,6 @@ describe('StepDefineRule', () => {
});

describe('AI assistant', () => {
beforeEach(() => {
useIsExperimentalFeatureEnabledMock.mockReturnValue(true);
});
it('renders assistant when query is not valid', () => {
render(<TestForm formProps={{ isQueryBarValid: false, ruleType: 'query' }} />, {
wrapper: TestProviders,
Expand All @@ -642,16 +633,6 @@ describe('StepDefineRule', () => {
expect(screen.getByTestId('ai-assistant')).toBeInTheDocument();
});

it('does not render assistant when feature flag is disabled', () => {
useIsExperimentalFeatureEnabledMock.mockReturnValue(false);

render(<TestForm formProps={{ isQueryBarValid: false, ruleType: 'query' }} />, {
wrapper: TestProviders,
});

expect(screen.queryByTestId('ai-assistant')).toBe(null);
});

it('does not render assistant when query is valid', () => {
render(<TestForm formProps={{ isQueryBarValid: true, ruleType: 'query' }} />, {
wrapper: TestProviders,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import { MlJobSelect } from '../../../rule_creation/components/ml_job_select';
import { PickTimeline } from '../../../rule_creation/components/pick_timeline';
import { StepContentWrapper } from '../../../rule_creation/components/step_content_wrapper';
import { ThresholdInput } from '../threshold_input';
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
import { SuppressionInfoIcon } from '../suppression_info_icon';
import { EsqlInfoIcon } from '../../../rule_creation/components/esql_info_icon';
import {
Expand Down Expand Up @@ -216,10 +215,6 @@ const StepDefineRuleComponent: FC<StepDefineRuleProps> = ({

const isThresholdRule = getIsThresholdRule(ruleType);
const alertSuppressionUpsellingMessage = useUpsellingMessage('alert_suppression_rule_form');

const isAIAssistantEnabled = useIsExperimentalFeatureEnabled(
'AIAssistantOnRuleCreationFormEnabled'
);
const { getFields, reset, setFieldValue } = form;

const setRuleTypeCallback = useSetFieldValueWithCallback({
Expand Down Expand Up @@ -938,7 +933,7 @@ const StepDefineRuleComponent: FC<StepDefineRuleProps> = ({
</>
</RuleTypeEuiFormRow>

{isAIAssistantEnabled && !isMlRule(ruleType) && !isQueryBarValid && (
{!isMlRule(ruleType) && !isQueryBarValid && (
<AiAssistant getFields={form.getFields} language={queryBar?.query?.language} />
)}

Expand Down