diff --git a/packages/atlas-service/src/main.ts b/packages/atlas-service/src/main.ts index d8a33cffe04..056596cb8f9 100644 --- a/packages/atlas-service/src/main.ts +++ b/packages/atlas-service/src/main.ts @@ -94,7 +94,8 @@ export async function throwIfNotOk( function throwIfAINotEnabled(atlasService: typeof AtlasService) { if ( - !preferences.getPreferences().cloudFeatureRolloutAccess?.GEN_AI_COMPASS || + (!preferences.getPreferences().cloudFeatureRolloutAccess?.GEN_AI_COMPASS && + !preferences.getPreferences().enableAIWithoutRolloutAccess) || !preferences.getPreferences().enableAIFeatures ) { throw new Error( diff --git a/packages/compass-preferences-model/src/feature-flags.ts b/packages/compass-preferences-model/src/feature-flags.ts index 38a8a382f55..eaad0ff30ba 100644 --- a/packages/compass-preferences-model/src/feature-flags.ts +++ b/packages/compass-preferences-model/src/feature-flags.ts @@ -15,6 +15,7 @@ export type FeatureFlagDefinition = { export type FeatureFlags = { enableAIExperience: boolean; + enableAIWithoutRolloutAccess: boolean; enableLgDarkmode: boolean; enableOidc: boolean; // Not capitalized "OIDC" for spawn arg casing. enableStageWizard: boolean; @@ -38,6 +39,18 @@ export const featureFlags: Required<{ }, }, + /** + * Temporary feature flag for bypassing our incremental rollout for ai access. + * Ticket to remove: COMPASS-7226 + */ + enableAIWithoutRolloutAccess: { + stage: 'development', + description: { + short: 'Enable AI Features Without Rollout Access', + long: 'Bypass the public preview rollout access for the AI features in Compass. Do not use this feature with sensitive data.', + }, + }, + /** * Currently Compass uses `darkreader` to globally change the views of * Compass to a dark theme. Turning on this feature flag stops darkreader diff --git a/packages/compass-preferences-model/src/utils.ts b/packages/compass-preferences-model/src/utils.ts index cd6a8d3cce7..028caed8b32 100644 --- a/packages/compass-preferences-model/src/utils.ts +++ b/packages/compass-preferences-model/src/utils.ts @@ -42,6 +42,10 @@ export function capMaxTimeMSAtPreferenceLimit(value: T): T | number { } export function useIsAIFeatureEnabled(React: ReactHooks) { + const enableAIWithoutRolloutAccess = usePreference( + 'enableAIWithoutRolloutAccess', + React + ); const enableAIExperience = usePreference('enableAIExperience', React); const isAIFeatureEnabled = usePreference( 'cloudFeatureRolloutAccess', @@ -49,5 +53,9 @@ export function useIsAIFeatureEnabled(React: ReactHooks) { )?.GEN_AI_COMPASS; const enableAIFeatures = usePreference('enableAIFeatures', React); - return enableAIExperience && isAIFeatureEnabled && enableAIFeatures; + return ( + enableAIExperience && + (enableAIWithoutRolloutAccess || isAIFeatureEnabled) && + enableAIFeatures + ); } diff --git a/packages/compass-settings/src/components/settings/feature-preview.tsx b/packages/compass-settings/src/components/settings/feature-preview.tsx index c458a916754..0de3cdaa265 100644 --- a/packages/compass-settings/src/components/settings/feature-preview.tsx +++ b/packages/compass-settings/src/components/settings/feature-preview.tsx @@ -41,10 +41,19 @@ export function useShouldShowFeaturePreviewSettings(): boolean { // - we are in a development environment or 'showDevFeatureFlags' is explicitly enabled // - and there are feature flags in 'development' stage. // - AI feature flag is enabled + const enableAIWithoutRolloutAccess = usePreference( + 'enableAIWithoutRolloutAccess', + React + ); const enableAIExperience = usePreference('enableAIExperience', React); const showDevFeatures = useShouldShowDevFeatures(); const showPreviewFeatures = useShouldShowPreviewFeatures(); - return enableAIExperience || showPreviewFeatures || showDevFeatures; + return ( + enableAIWithoutRolloutAccess || + enableAIExperience || + showPreviewFeatures || + showDevFeatures + ); } const atlasSettingsContainerStyles = css({ @@ -89,6 +98,7 @@ export default withPreferences( state: RootState, ownProps: { enableAIExperience?: boolean; + enableAIWithoutRolloutAccess?: boolean; cloudFeatureRolloutAccess?: UserPreferences['cloudFeatureRolloutAccess']; } ) => { @@ -97,10 +107,15 @@ export default withPreferences( state.settings.settings.enableAIExperience || ['authenticated', 'in-progress'].includes(state.atlasLogin.status) || ownProps.enableAIExperience || + ownProps.enableAIWithoutRolloutAccess || ownProps.cloudFeatureRolloutAccess?.GEN_AI_COMPASS, }; } )(FeaturePreviewSettings), - ['enableAIExperience', 'cloudFeatureRolloutAccess'], + [ + 'enableAIExperience', + 'cloudFeatureRolloutAccess', + 'enableAIWithoutRolloutAccess', + ], React );