Skip to content

feat(compass-web): persist compass web preferences using mms endpoints COMPASS-10869 - #8293

Open
dkwncho wants to merge 6 commits into
mainfrom
COMPASS-10869-persist-web-app-preferences
Open

feat(compass-web): persist compass web preferences using mms endpoints COMPASS-10869#8293
dkwncho wants to merge 6 commits into
mainfrom
COMPASS-10869-persist-web-app-preferences

Conversation

@dkwncho

@dkwncho dkwncho commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Description

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • If this change could impact the load on the MongoDB cluster, please describe the expected and worst case impact
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@dkwncho
dkwncho requested a review from a team as a code owner July 27, 2026 21:48
@dkwncho
dkwncho requested review from Copilot and ivandevp and removed request for Copilot July 27, 2026 21:48
@github-actions github-actions Bot added the feat label Jul 27, 2026
@dkwncho
dkwncho removed the request for review from ivandevp July 27, 2026 21:48
@dkwncho

dkwncho commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

TODO: Remove the gating of collection creation in csfle.mts such that the AppPreferences collection will be created as desired. We got away with keeping it gated in prod just cause the collections already existed for the 4 og user data types. If we don't do this, turning on feature flag in prod will break things

Backport COMPASS-10868 before merging this PR

@dkwncho dkwncho added the feature flagged PRs labeled with this label will not be included in the release notes of the next release label Jul 27, 2026
Copilot AI review requested due to automatic review settings July 27, 2026 22:04
@dkwncho
dkwncho force-pushed the COMPASS-10869-persist-web-app-preferences branch from c3ab10e to 3a23631 Compare July 27, 2026 22:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces Atlas-backed persistence for Compass Web preferences by leveraging the Atlas “userData” (MMS) endpoints, while keeping cloud-provided preference/feature-flag values authoritative.

Changes:

  • Add a new AtlasPreferencesStorage implementation (and loader) to persist preferences via Atlas userData endpoints.
  • Wire Compass Web preference loading to optionally use Atlas persistence when enableCompassWebSettings is enabled.
  • Add/extend unit tests around persisted preference loading/saving and the new storage integration.

Reviewed changes

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

Show a summary per file
File Description
packages/compass-web/src/preferences.tsx Integrates Atlas userData-backed storage into Compass Web preference loading.
packages/compass-web/src/preferences.spec.tsx Adds tests for loading/saving Compass Web preferences via the MMS userData endpoint.
packages/compass-preferences-model/src/provider.ts Re-exports new Atlas preferences storage APIs from the preferences model provider entrypoint.
packages/compass-preferences-model/src/preferences-atlas-storage.ts Implements Atlas userData GET/PUT persistence and merge behavior for preferences.
packages/compass-preferences-model/src/preferences-atlas-storage.spec.ts Adds unit tests for load and persistence semantics (merging, overrides, failure modes).
packages/compass-preferences-model/src/compass-web-preferences-access.ts Allows injecting a PreferencesStorage into Compass Web preferences access.
packages/compass-preferences-model/src/compass-web-preferences-access.spec.ts Tests injected storage behavior and sandbox semantics.
packages/atlas-service/src/provider.tsx Exposes getAtlasConfig via the atlas-service provider for Compass Web usage.

Comment thread packages/compass-web/src/preferences.tsx
Comment thread packages/compass-web/src/preferences.spec.tsx
@dkwncho
dkwncho force-pushed the COMPASS-10869-persist-web-app-preferences branch from 45c8d84 to 84d7f7e Compare July 28, 2026 14:43
@dkwncho
dkwncho requested a review from nbbeeken July 28, 2026 18:06

@nbbeeken nbbeeken left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

in packages/compass-generative-ai/src/atlas-ai-service.ts we check if AI features are enabled for the project, do the new user-settings override the project level settings?

Comment thread packages/compass-preferences-model/src/preferences-atlas-storage.ts
Comment on lines +189 to +194
authenticatedFetch: (url, init) =>
fetch(url, {
...init,
headers: { ...defaultHeaders, ...init?.headers },
credentials: 'include',
}),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If I'm not mistaken AtlasServiceLike was made so we could feed a stubbed implementation into user-data in a previous PR (or am I remembering a different x-Like type we made?) We need the real thing here, is it somehow not available?

@nbbeeken
nbbeeken requested a review from mabaasit July 29, 2026 21:27
@dkwncho
dkwncho force-pushed the COMPASS-10869-persist-web-app-preferences branch from 60aba5b to a5a56af Compare July 30, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat feature flagged PRs labeled with this label will not be included in the release notes of the next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants