diff --git a/packages/compass-e2e-tests/tests/atlas-login.test.ts b/packages/compass-e2e-tests/tests/atlas-login.test.ts index 31ca02171a7..dad8d294903 100644 --- a/packages/compass-e2e-tests/tests/atlas-login.test.ts +++ b/packages/compass-e2e-tests/tests/atlas-login.test.ts @@ -12,6 +12,7 @@ import path from 'path'; import { expect } from 'chai'; import { createNumbersCollection } from '../helpers/insert-data'; import { AcceptTOSToggle } from '../helpers/selectors'; +import { startMockAtlasServiceServer } from '../helpers/atlas-service'; const DEFAULT_TOKEN_PAYLOAD = { expires_in: 3600, @@ -37,11 +38,17 @@ describe('Atlas Login', function () { let oidcMockProvider: OIDCMockProvider; let originalDisableKeychainUsage: string | undefined; let getTokenPayload: OIDCMockProviderConfig['getTokenPayload']; + let stopMockAtlasServer: () => Promise; before(async function () { originalDisableKeychainUsage = process.env.COMPASS_E2E_DISABLE_KEYCHAIN_USAGE; + // Start a mock server to pass an ai response. + const { endpoint, stop } = await startMockAtlasServiceServer(); + stopMockAtlasServer = stop; + process.env.COMPASS_ATLAS_SERVICE_UNAUTH_BASE_URL_OVERRIDE = endpoint; + function isAuthorised(req: { headers: { authorization?: string } }) { const [, token] = req.headers.authorization?.split(' ') ?? []; // We can't check that the issued token is the one received by oidc-plugin @@ -108,12 +115,10 @@ describe('Atlas Login', function () { 'browserCommandForOIDCAuth', getTestBrowserShellCommand() ); - await browser.setFeature('enableAIWithoutRolloutAccess', true); }); afterEach(async function () { await browser.setFeature('browserCommandForOIDCAuth', undefined); - await browser.setFeature('enableAIWithoutRolloutAccess', false); await afterTest(compass, this.currentTest); await afterTests(compass, this.currentTest); }); @@ -125,6 +130,9 @@ describe('Atlas Login', function () { delete process.env.COMPASS_ATLAS_AUTH_PORTAL_URL_OVERRIDE; process.env.COMPASS_E2E_DISABLE_KEYCHAIN_USAGE = originalDisableKeychainUsage; + + await stopMockAtlasServer(); + delete process.env.COMPASS_ATLAS_SERVICE_UNAUTH_BASE_URL_OVERRIDE; }); describe('in settings', function () { diff --git a/packages/compass-preferences-model/src/feature-flags.ts b/packages/compass-preferences-model/src/feature-flags.ts index 55bfb5aa895..2d10e08391a 100644 --- a/packages/compass-preferences-model/src/feature-flags.ts +++ b/packages/compass-preferences-model/src/feature-flags.ts @@ -15,7 +15,6 @@ export type FeatureFlagDefinition = { export type FeatureFlags = { enableGenAIExperience: boolean; - enableAIWithoutRolloutAccess: boolean; enableLgDarkmode: boolean; enableOidc: boolean; // Not capitalized "OIDC" for spawn arg casing. enableStageWizard: boolean; @@ -41,18 +40,6 @@ 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 c0f938193bc..66b76721532 100644 --- a/packages/compass-preferences-model/src/utils.ts +++ b/packages/compass-preferences-model/src/utils.ts @@ -46,8 +46,7 @@ export function capMaxTimeMSAtPreferenceLimit(value: T): T | number { * feature is considered enabled if: * - AI feature flag is enabled * - config preference that controls AI is enabled - * - either mms backend rollout enabled feature for the compass user or special - * option to bypass the check is passed + * - mms backend rollout enabled feature for the compass user */ export function isAIFeatureEnabled( preferences: Pick< @@ -55,7 +54,6 @@ export function isAIFeatureEnabled( | 'enableGenAIFeatures' | 'enableGenAIExperience' | 'cloudFeatureRolloutAccess' - | 'enableAIWithoutRolloutAccess' > = preferencesAccess.getPreferences() ) { const { @@ -66,14 +64,11 @@ export function isAIFeatureEnabled( enableGenAIExperience, // based on mms backend rollout response cloudFeatureRolloutAccess, - // feature flag to bypass rollout access check - enableAIWithoutRolloutAccess, } = preferences; return ( enableGenAIFeatures && enableGenAIExperience && - (!!cloudFeatureRolloutAccess?.GEN_AI_COMPASS || - enableAIWithoutRolloutAccess) + !!cloudFeatureRolloutAccess?.GEN_AI_COMPASS ); } @@ -84,15 +79,10 @@ export function useIsAIFeatureEnabled(React: ReactHooks) { 'cloudFeatureRolloutAccess', React ); - const enableAIWithoutRolloutAccess = usePreference( - 'enableAIWithoutRolloutAccess', - React - ); return isAIFeatureEnabled({ enableGenAIFeatures, enableGenAIExperience, cloudFeatureRolloutAccess, - enableAIWithoutRolloutAccess, }); }