Skip to content

refactor: atlas-admin-api service COMPASS-10893 - #8311

Open
paula-stacho wants to merge 7 commits into
mainfrom
COMPASS-10893
Open

refactor: atlas-admin-api service COMPASS-10893#8311
paula-stacho wants to merge 7 commits into
mainfrom
COMPASS-10893

Conversation

@paula-stacho

@paula-stacho paula-stacho commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Description

Main change: Moves the logic related to Atlas Admin API to a dedicated service (the original code introduced in #8262 - unfortunately the git diff isn't quite clear on what has been just moved 🙈 )

Other notable changes:

  • the connectionString -> cluster & project mapping is expensive to get and immutable - the service adds a cache (cleared when the user logs out from atlas - I wasn't sure if we need that, but it feels cleaner - we can reevaluate later when we have more functionality depending on it)
  • added versioning - this is not very well documented in the atlas admin api docs, some more info is on the public docs - each resource/endpoint can have it's own version, but the one used for default appears to be the closest to a latest "stable"

Note: this is dead code at the moment but I tested the atlas log in + cluster state request with a dummy code.

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)

Copilot AI review requested due to automatic review settings August 3, 2026 10:40

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 a new @mongodb-js/atlas-admin-api package and wires it into Compass (desktop + web) and the assistant plugin via a shared provider/locator pattern, aiming to centralize Atlas Admin API access.

Changes:

  • Added the new @mongodb-js/atlas-admin-api workspace package (service, provider/locator, pagination/types utilities, tests).
  • Wrapped existing Atlas providers with AtlasAdminApiServiceProvider in Compass, Compass Web, and the shared testing-library wrapper.
  • Updated Compass Assistant to consume the new Atlas Admin API service via app-registry injection.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/compass/src/app/components/entrypoint.tsx Adds the admin API provider to the desktop app provider tree.
packages/compass/package.json Adds the new workspace package as a dependency.
packages/compass-web/src/entrypoint.tsx Adds the admin API provider to the web app provider tree.
packages/compass-web/package.json Adds the new workspace package to the web workspace deps list.
packages/compass-assistant/src/compass-assistant-provider.tsx Switches assistant extra-args injection to use the new admin API service.
packages/compass-assistant/package.json Adds the new workspace package as a dependency.
packages/atlas-admin-api/tsconfig.json New package TypeScript config.
packages/atlas-admin-api/tsconfig-build.json New package build TS config.
packages/atlas-admin-api/src/util.ts Adds shared helpers for connection-string matching and 404 detection.
packages/atlas-admin-api/src/provider.tsx Adds the provider + locator for app-registry injection.
packages/atlas-admin-api/src/provider.spec.tsx Tests provider/locator behavior and cache clearing on auth events.
packages/atlas-admin-api/src/pagination.ts Adds pagination helpers and response assertion.
packages/atlas-admin-api/src/index.ts Defines public exports for the new package.
packages/atlas-admin-api/src/cluster-types.ts Adds cluster-related types and runtime assertions.
packages/atlas-admin-api/src/atlas-admin-api-service.ts Refactors/renames service and adds caching for project/cluster lookup.
packages/atlas-admin-api/src/atlas-admin-api-service.spec.ts Expands tests for caching behavior and error semantics.
packages/atlas-admin-api/package.json Adds the new workspace package manifest and exports map.
packages/atlas-admin-api/.mocharc.js Adds mocha config for the new package.
packages/atlas-admin-api/.eslintrc.js Adds eslint config for the new package.
packages/atlas-admin-api/.eslintignore Adds ignores for build/test outputs.
packages/atlas-admin-api/.depcheckrc Adds depcheck config for the new package.
package-lock.json Links the new workspace package into the lockfile.
configs/testing-library-compass/src/index.tsx Wraps test wrapper with the admin API provider and improves auth service stub.
configs/testing-library-compass/.depcheckrc Updates depcheck ignores for the new import.

Comment thread packages/atlas-admin-api/src/cluster-types.ts
@paula-stacho paula-stacho added the feature flagged PRs labeled with this label will not be included in the release notes of the next release label Aug 3, 2026
@paula-stacho
paula-stacho marked this pull request as ready for review August 3, 2026 16:07
@paula-stacho
paula-stacho requested a review from a team as a code owner August 3, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants