Skip to content

Commit

Permalink
[Security Solution][Detection Engine] removes feature flag for AI ass…
Browse files Browse the repository at this point in the history
…istant on rule create form (#189040)

## Summary

- removes feature flag AIAssistantOnRuleCreationFormEnabled
  • Loading branch information
vitaliidm authored Jul 25, 2024
1 parent fb34fc7 commit a8e19ee
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 30 deletions.
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

0 comments on commit a8e19ee

Please sign in to comment.