Skip to content

chore(compass-preferences-model): use optInGenAIFeatures for Compass COMPASS-9593 #7129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: feature/no-auth-ai
Choose a base branch
from

Conversation

gagik
Copy link
Contributor

@gagik gagik commented Jul 21, 2025

This is targetted against a feature branch: https://github.com/mongodb-js/compass/tree/feature/no-auth-ai

Aligns Compass and DE in their opt-in requirements for AI features.

This might need to be merged into a feature flag branch

@gagik gagik force-pushed the gagik/opt-in-ai branch from e8d1aa5 to bed75dd Compare July 25, 2025 11:13
@gagik gagik changed the title WIP chore(compass-preferences-model): use optInGenAIFeatures for Compass WIP chore(compass-preferences-model): use optInGenAIFeatures for Compass COMPASS-9593 Jul 28, 2025
)}`;
}

describe('Atlas Login', function () {
Copy link
Contributor Author

@gagik gagik Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could also skip these if re-introducing is likely enough.
I also assume we're not going to delete stores/atlas-login.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should clean it up, but I don't think you necessarily need to do it in this PR. This plugin was the first attempt at this sort of hight level cross plugin interface and implementation and so contains some patterns that we moved away from, it's probably for the better if we can completely drop it from the codebase

Copy link
Contributor Author

@gagik gagik Jul 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added #7150 to handle the cleanup

@gagik gagik changed the title WIP chore(compass-preferences-model): use optInGenAIFeatures for Compass COMPASS-9593 chore(compass-preferences-model): use optInGenAIFeatures for Compass COMPASS-9593 Jul 28, 2025
@gagik gagik marked this pull request as ready for review July 28, 2025 09:04
@Copilot Copilot AI review requested due to automatic review settings July 28, 2025 09:04
@gagik gagik requested a review from a team as a code owner July 28, 2025 09:04
@gagik gagik force-pushed the gagik/opt-in-ai branch from 1c3bcc3 to 7562746 Compare July 28, 2025 09:04
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR standardizes the naming of the opt-in preference for AI features across Compass and Data Explorer by renaming optInDataExplorerGenAIFeatures to optInGenAIFeatures. This aligns the naming convention between the two products and makes the preference more generic and reusable.

  • Renames preference key from optInDataExplorerGenAIFeatures to optInGenAIFeatures
  • Updates preference description to be more generic
  • Changes default value from true to false
  • Updates all references and tests to use the new preference name

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/compass-web/src/preferences.tsx Updates preference name in default preferences object
packages/compass-web/sandbox/sandbox-atlas-sign-in.tsx Updates type definition and variable assignment for the new preference name
packages/compass-web/sandbox/index.tsx Updates preference name in sandbox configuration
packages/compass-preferences-model/src/preferences-schema.tsx Defines the new preference schema with updated name, description, and default value
packages/compass-preferences-model/src/compass-web-preferences-access.ts Updates editable preferences list with new name
packages/compass-generative-ai/src/store/atlas-optin-reducer.ts Updates preference checks and method calls to use new naming
packages/compass-generative-ai/src/store/atlas-optin-reducer.spec.ts Updates all test cases to use new preference and method names
packages/compass-generative-ai/src/atlas-ai-service.ts Refactors opt-in method and removes unnecessary imports
packages/compass-generative-ai/src/atlas-ai-service.spec.ts Adds comprehensive tests for the new opt-in method
packages/compass-e2e-tests/tests/atlas-login.test.ts Removes entire test file
packages/compass-e2e-tests/tests/atlas-cloud/collection-ai-query.test.ts Updates feature flag references to use new preference name

// Performs a post request to Atlas to set the user opt in preference to true.
await this.atlasService.authenticatedFetch(
this.atlasService.cloudEndpoint(
'settings/optInDataExplorerGenAIFeatures'
Copy link
Preview

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The URL path still references 'optInDataExplorerGenAIFeatures' but the preference has been renamed to 'optInGenAIFeatures'. Consider updating the API endpoint to match the new naming convention for consistency.

Suggested change
'settings/optInDataExplorerGenAIFeatures'
'settings/optInGenAIFeatures'

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how we ensure backwards-compatibility

},
validator: z.boolean().default(true),
validator: z.boolean().default(false),
Copy link
Preview

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the default value from true to false is a breaking change that could affect existing users who had the feature enabled by default. This could disable AI features for users who were previously opted in.

Suggested change
validator: z.boolean().default(false),
validator: z.boolean().default(true),

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was likely an unintentional default which always gets overriden by the 'settings/optInDataExplorerGenAIFeatures' fetch

},
validator: z.boolean().default(true),
validator: z.boolean().default(false),
Copy link
Contributor Author

@gagik gagik Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct me if not so but this change shouldn't have any side effects on DE. The state of this was always being overriden by the API request and we'd likely not have wanted this to be true anyhow.

@gagik gagik force-pushed the gagik/opt-in-ai branch from 7562746 to 3df8f4a Compare July 28, 2025 09:08
@gagik gagik changed the base branch from main to compass-remove-ai-auth July 29, 2025 10:55
@gagik gagik changed the base branch from compass-remove-ai-auth to feature/no-auth-ai July 29, 2025 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants