Skip to content

wip - #8302

Draft
esvm wants to merge 2 commits into
mainfrom
feat/index-management
Draft

wip#8302
esvm wants to merge 2 commits into
mainfrom
feat/index-management

Conversation

@esvm

@esvm esvm commented Jul 30, 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)

Copilot AI review requested due to automatic review settings July 30, 2026 17:36

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 an Atlas-role-derived enableIndexesManagement preference intended to allow “Index Manager” users to manage regular indexes in Compass-Web even when broader write/admin UI is restricted via readOnly / readWrite. The approach is generally cohesive (plumbed through selectors and covered by tests), but there are a couple of permission-default and UI-gating issues that should be addressed before merge.

Changes:

  • Add enableIndexesManagement preference derived from Atlas roles in Compass-Web and model it in the preferences schema.
  • Allow regular index write actions when enableIndexesManagement is true, while keeping search-index write access unchanged.
  • Extend unit/integration tests around the new permission behavior.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/compass-web/src/preferences.tsx Derives enableIndexesManagement from Atlas roles when building cloud preferences.
packages/compass-web/src/preferences.spec.tsx Adds coverage for index-management permission derivation scenarios.
packages/compass-preferences-model/src/preferences-schema.tsx Introduces enableIndexesManagement into the preferences schema/types.
packages/compass-indexes/src/utils/indexes-read-write-access.ts Updates access selector to allow regular index writes when index-management is enabled.
packages/compass-indexes/src/utils/indexes-read-write-access.spec.ts Adds test cases for index-management behavior.
packages/compass-indexes/src/modules/search-indexes.ts Threads new preference through selector usage.
packages/compass-indexes/src/modules/regular-indexes.ts Threads new preference through selector usage.
packages/compass-indexes/src/components/search-indexes-table/search-indexes-table.tsx Passes enableIndexesManagement into access selector.
packages/compass-indexes/src/components/search-indexes-table/search-indexes-drawer-table.tsx Passes enableIndexesManagement into access selector.
packages/compass-indexes/src/components/regular-indexes-table/regular-indexes-table.tsx Passes enableIndexesManagement into access selector for regular indexes.
packages/compass-indexes/src/components/regular-indexes-table/regular-indexes-table.spec.tsx Adds UI coverage for action visibility with index-management enabled/disabled.
packages/compass-indexes/src/components/regular-indexes-table/regular-indexes-drawer-table.tsx Passes enableIndexesManagement into access selector for drawer view.
packages/compass-indexes/src/components/indexes/indexes.tsx Passes enableIndexesManagement into access selector for overall indexes view gating.
packages/compass-indexes/src/components/indexes-toolbar/indexes-toolbar.tsx Updates create-index button gating to consider index-management permission.
packages/compass-indexes/src/components/indexes-toolbar/indexes-toolbar.spec.tsx Adds coverage for create-index button visibility when index-management is enabled.
packages/compass-indexes/src/components/drawer-views/indexes-list-drawer-view.tsx Passes enableIndexesManagement into access selector.
packages/compass-indexes/src/components/drawer-views/edit-search-index-drawer-view.tsx Passes enableIndexesManagement into access selector.
packages/compass-indexes/src/components/drawer-views/create-search-index-drawer-view.tsx Passes enableIndexesManagement into access selector.

Comment on lines +28 to 30
const enableIndexesManagement =
preferences.enableIndexesManagement ?? true;
const enableAtlasSearchIndexes =
Comment thread packages/compass-preferences-model/src/preferences-schema.tsx Outdated
Comment on lines 134 to +138
(!isReadonlyView ||
VIEW_PIPELINE_UTILS.isVersionSearchCompatibleForViewsCompass(
serverVersion
)) &&
!preferencesReadWrite &&
(!preferencesReadWrite || enableIndexesManagement) &&
Comment on lines +36 to +39
// `enableIndexesManagement` allows creating / dropping / hiding indexes even
// when the user lacks general write access (`readOnly`) or admin-level
// access (`readWrite`). This matches the Atlas "Index Manager" role, where
// MongoDB itself authorizes `createIndex` / `dropIndex` for these users.
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