Skip to content

Commit 1fdef7b

Browse files
authored
chore(compass-assistant): hide the performance insight entrypoints behind its own feature flag COMPASS-9794 (#7281)
1 parent 115830e commit 1fdef7b

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

packages/compass-assistant/src/compass-assistant-provider.spec.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,24 @@ describe('useAssistantActions', function () {
182182
},
183183
});
184184

185+
expect(Object.keys(result.current)).to.have.length.greaterThan(0);
186+
expect(result.current.interpretExplainPlan).to.be.a('function');
187+
expect(result.current.interpretConnectionError).to.be.a('function');
188+
expect(result.current.tellMoreAboutInsight).to.be.undefined;
189+
});
190+
191+
it('returns actions when both AI features and assistant flag AND enablePerformanceInsightsEntrypoints are enabled', function () {
192+
const { result } = renderHook(() => useAssistantActions(), {
193+
wrapper: createWrapper(createMockChat({ messages: [] })),
194+
preferences: {
195+
enableAIAssistant: true,
196+
enablePerformanceInsightsEntrypoints: true,
197+
enableGenAIFeatures: true,
198+
enableGenAIFeaturesAtlasOrg: true,
199+
cloudFeatureRolloutAccess: { GEN_AI_COMPASS: true },
200+
},
201+
});
202+
185203
expect(Object.keys(result.current)).to.have.length.greaterThan(0);
186204
expect(result.current.interpretExplainPlan).to.be.a('function');
187205
expect(result.current.interpretConnectionError).to.be.a('function');

packages/compass-assistant/src/compass-assistant-provider.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ export function useAssistantActions(): AssistantActionsType {
9696
const actions = useContext(AssistantActionsContext);
9797
const isAIFeatureEnabled = useIsAIFeatureEnabled();
9898
const isAssistantFlagEnabled = usePreference('enableAIAssistant');
99+
const isPerformanceInsightEntrypointsEnabled = usePreference(
100+
'enablePerformanceInsightsEntrypoints'
101+
);
102+
99103
if (!isAIFeatureEnabled || !isAssistantFlagEnabled) {
100104
return {
101105
getIsAssistantEnabled: () => false,
@@ -111,7 +115,9 @@ export function useAssistantActions(): AssistantActionsType {
111115
return {
112116
interpretExplainPlan,
113117
interpretConnectionError,
114-
tellMoreAboutInsight,
118+
tellMoreAboutInsight: isPerformanceInsightEntrypointsEnabled
119+
? tellMoreAboutInsight
120+
: undefined,
115121
getIsAssistantEnabled: () => true,
116122
};
117123
}

packages/compass-preferences-model/src/feature-flags.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export type FeatureFlags = {
3030
enableSearchActivationProgramP1: boolean;
3131
enableUnauthenticatedGenAI: boolean;
3232
enableAIAssistant: boolean;
33+
enablePerformanceInsightsEntrypoints: boolean;
3334
};
3435

3536
export const featureFlags: Required<{
@@ -178,4 +179,14 @@ export const featureFlags: Required<{
178179
short: 'Enable AI Assistant',
179180
},
180181
},
182+
183+
/*
184+
* Feature flag for AI Assistant's performance insight entrypoints.
185+
*/
186+
enablePerformanceInsightsEntrypoints: {
187+
stage: 'development',
188+
description: {
189+
short: 'Enable the performance insights AI Assistant entrypoints',
190+
},
191+
},
181192
};

0 commit comments

Comments
 (0)