diff --git a/packages/compass-e2e-tests/tests/atlas-login.test.ts b/packages/compass-e2e-tests/tests/atlas-login.test.ts index 0983a993503..f1cef57eb37 100644 --- a/packages/compass-e2e-tests/tests/atlas-login.test.ts +++ b/packages/compass-e2e-tests/tests/atlas-login.test.ts @@ -36,7 +36,8 @@ function getTestBrowserShellCommand() { )}`; } -describe('Atlas Login', function () { +// TODO: remove these when we remove atlas login +describe.skip('Atlas Login', function () { let compass: Compass; let browser: CompassBrowser; let oidcMockProvider: OIDCMockProvider; @@ -281,7 +282,8 @@ describe('Atlas Login', function () { ); }); - it('should not show AI input if sign in flow was not finished', async function () { + // TODO: remove once we remove atlas login + it.skip('should not show AI input if sign in flow was not finished', async function () { getTokenPayload = () => { return new Promise(() => {}); }; @@ -314,7 +316,8 @@ describe('Atlas Login', function () { ); }); - it('should not show AI input if sign in flow was not finished', async function () { + // TODO: remove once we remove atlas login + it.skip('should not show AI input if sign in flow was not finished', async function () { getTokenPayload = () => { return new Promise(() => {}); }; diff --git a/packages/compass-generative-ai/src/atlas-ai-service.spec.ts b/packages/compass-generative-ai/src/atlas-ai-service.spec.ts index 5d86731562f..0c9f6aa2684 100644 --- a/packages/compass-generative-ai/src/atlas-ai-service.spec.ts +++ b/packages/compass-generative-ai/src/atlas-ai-service.spec.ts @@ -86,8 +86,8 @@ describe('AtlasAiService', function () { { apiURLPreset: 'admin-api', expectedEndpoints: { - 'mql-aggregation': `http://example.com/ai/api/v1/mql-aggregation?request_id=abc`, - 'mql-query': `http://example.com/ai/api/v1/mql-query?request_id=abc`, + 'mql-aggregation': `http://example.com/unauth/ai/api/v1/mql-aggregation?request_id=abc`, + 'mql-query': `http://example.com/unauth/ai/api/v1/mql-query?request_id=abc`, }, }, { @@ -333,13 +333,6 @@ describe('AtlasAiService', function () { // Reset preferences await preferences.savePreferences({ optInGenAIFeatures: false, - enableUnauthenticatedGenAI: true, - }); - }); - - afterEach(async function () { - await preferences.savePreferences({ - enableUnauthenticatedGenAI: false, }); }); diff --git a/packages/compass-generative-ai/src/atlas-ai-service.ts b/packages/compass-generative-ai/src/atlas-ai-service.ts index 9cb4c23b803..d77e0b1dbdf 100644 --- a/packages/compass-generative-ai/src/atlas-ai-service.ts +++ b/packages/compass-generative-ai/src/atlas-ai-service.ts @@ -12,12 +12,10 @@ import { EJSON } from 'bson'; import { z } from 'zod'; import { getStore } from './store/atlas-ai-store'; import { optIntoGenAIWithModalPrompt } from './store/atlas-optin-reducer'; -import { signIntoAtlasWithModalPrompt } from './store/atlas-signin-reducer'; import { AtlasAiServiceInvalidInputError, AtlasAiServiceApiResponseParseError, } from './atlas-ai-errors'; -import { mongoLogId } from '@mongodb-js/compass-logging/provider'; type GenerativeAiInput = { userInput: string; @@ -203,9 +201,11 @@ const aiURLConfig = { // There are two different sets of endpoints we use for our requests. // Down the line we'd like to only use the admin api, however, // we cannot currently call that from the Atlas UI. Pending CLOUDP-251201 + // NOTE: The unauthenticated endpoints are also rate limited by IP address + // rather than by logged in user. 'admin-api': { - aggregation: 'ai/api/v1/mql-aggregation', - query: 'ai/api/v1/mql-query', + aggregation: 'unauth/ai/api/v1/mql-aggregation', + query: 'unauth/ai/api/v1/mql-query', }, cloud: { aggregation: (groupId: string) => `ai/v1/groups/${groupId}/mql-aggregation`, @@ -341,17 +341,7 @@ export class AtlasAiService { } async ensureAiFeatureAccess({ signal }: { signal?: AbortSignal } = {}) { - if (this.preferences.getPreferences().enableUnauthenticatedGenAI) { - return getStore().dispatch(optIntoGenAIWithModalPrompt({ signal })); - } - - // When the ai feature is attempted to be opened we make sure - // the user is signed into Atlas and opted in. - - if (this.apiURLPreset === 'cloud') { - return getStore().dispatch(optIntoGenAIWithModalPrompt({ signal })); - } - return getStore().dispatch(signIntoAtlasWithModalPrompt({ signal })); + return getStore().dispatch(optIntoGenAIWithModalPrompt({ signal })); } private getQueryOrAggregationFromUserInput = async ( @@ -498,7 +488,7 @@ export class AtlasAiService { } catch (err) { const errorMessage = err instanceof Error ? err.stack : String(err); this.logger.log.error( - mongoLogId(1_001_000_311), + this.logger.mongoLogId(1_001_000_311), 'AtlasAiService', 'Failed to parse mock data schema response with expected schema', { diff --git a/packages/compass-preferences-model/src/feature-flags.ts b/packages/compass-preferences-model/src/feature-flags.ts index 216d9518b76..6f5a4aea9d4 100644 --- a/packages/compass-preferences-model/src/feature-flags.ts +++ b/packages/compass-preferences-model/src/feature-flags.ts @@ -153,7 +153,7 @@ export const featureFlags: Required<{ }, enableUnauthenticatedGenAI: { - stage: 'development', + stage: 'released', description: { short: 'Enable GenAI for unauthenticated users', },