feat(compass-connections-navigation): add configurable hidden namespaces display COMPASS-10954 - #8329
feat(compass-connections-navigation): add configurable hidden namespaces display COMPASS-10954#8329nbbeeken wants to merge 1 commit into
Conversation
c222ad9 to
e01e32c
Compare
e01e32c to
4b338f8
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a new user preference to control whether “hidden” MongoDB namespaces (internal/system/admin-local-config) are shown in the connections navigation sidebar, and shifts namespace hiding logic into the navigation layer.
Changes:
- Adds a
showHiddenNamespacespreference and exposes it in General settings. - Updates the connections navigation tree to optionally filter hidden databases/collections and visually distinguish hidden items when shown.
- Removes internal/system namespace filtering from the database/collection model fetch layers.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/database-model/test/index.test.js | Updates database-model fetch test expectations around internal DBs |
| packages/database-model/package.json | Removes mongodb-ns dependency from database-model |
| packages/database-model/lib/model.js | Stops filtering internal DBs at the model layer |
| packages/compass-settings/src/components/settings/general.tsx | Adds showHiddenNamespaces to General settings fields |
| packages/compass-preferences-model/src/preferences-schema.tsx | Defines and documents the showHiddenNamespaces preference |
| packages/compass-connections-navigation/src/tree-data.ts | Adds hidden-namespace classification + visibility selector for sidebar tree data |
| packages/compass-connections-navigation/src/styled-navigation-item.tsx | Applies distinct styling to hidden namespaces when displayed |
| packages/compass-connections-navigation/src/navigation-item-icon.tsx | Adds hidden-namespace tooltip/icon behavior for some item types |
| packages/compass-connections-navigation/src/connections-navigation-tree.tsx | Wires showHiddenNamespaces into tree rendering via selector |
| packages/compass-connections-navigation/src/base-navigation-item.tsx | Adds CSS variable support for italic styling of hidden items |
| packages/compass-connections-navigation/package.json | Adds mongodb-ns dependency |
| packages/collection-model/test/index.test.js | Updates collection-model fetch test expectations around system collections |
| packages/collection-model/lib/model.js | Stops filtering system collections at the model layer |
| package-lock.json | Lockfile updates for dependency changes |
Suppressed comments (2)
packages/compass-connections-navigation/src/tree-data.ts:450
selectVisibleDatabase()currently filters out allsystem.*collections. This will also hidesystem.profile, which historically is treated as a visible collection (and is explicitly excluded from system filtering elsewhere in the codebase).
const collections: Collection[] = [];
for (const collection of database.collections) {
if (!toNS(collection._id).system) {
collections.push(collection);
}
}
packages/compass-connections-navigation/src/navigation-item-icon.tsx:64
- The hidden-namespace tooltip/icon treatment was added for
databaseandcollection, butviewandtimeseriesitems can also be hidden viaisHiddenTreeItem(). Currently those item types won't show the warning tooltip even when they are hidden, leading to inconsistent UI feedback.
if (item.type === 'collection') {
if (isHiddenTreeItem(item)) {
return (
<IconWithTooltip text={HIDDEN_NAMESPACE_TEXT} glyph="EmptyFolder" />
);
}
if (item.inferredFromPrivileges) {
return (
<IconWithTooltip
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
9f6bacc to
315a04d
Compare
315a04d to
4f00801
Compare
4f00801 to
896f010
Compare
896f010 to
851e6d8
Compare
| _id, | ||
| name, | ||
| inferred_from_privileges, | ||
| })) |
There was a problem hiding this comment.
I like this change but it comes at the risk of us adding a new feature and forgetting to follow the showHiddenNamespaces setting. It's additional context for working with collections that folks have to now consider (I think they'll forget it lol).
I'm not sure if it will end up costing us more than the benefit of removing this logic from here. To ensure folks can get these collections and also have the showHiddenNamespaces setting applied everywhere, and abstracted from the consumer, so they only get the collections they need I feel having it on the model does make sense in the end.
With shouldFetchDbAndCollStats in instance model there are more patterns of preferences applied at that level that then cause the model to change and push it's updated out.
Some of the other places besides connections-navigation-tree that we would have to do the same filtering if we went with this approach:
- Collections and databases plugin:
- Data modeling plugin:
- Saved queries:
(Also left this comment on the first pr) Where mongodb-ns sets internal we could add this atlas one https://github.com/mongodb-js/devtools-shared/blob/3663d65ab1e49bd53557dba41fcb7c1298878b52/packages/mongodb-ns/src/index.ts#L53-L54
There was a problem hiding this comment.
I'm walking a thin line between having the model own their "type" (as-in, the collection model now owns isSpecialish or db models own isInternal) and going as far as to tell the UI straight up "shouldHide". Telling the UI parts of the code from the model code how to display rather than providing the information and letting it decide how to display seems like the right call but with the setting being another thing to consult it does get convoluted and can lead to inconsistencies across the app.
I can do better here though, I have an idea of how I can consolidate and simplify the logic further and then it will be easier to apply in places that don't yet filter at all
44f7213 to
6ef317b
Compare
6ef317b to
784e5cb
Compare

Description
Make hiding namespaces a setting in Compass
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes