Skip to content

fix(shell): set database on initial load COMPASS-9204#7927

Open
Anemy wants to merge 1 commit intomainfrom
COMPASS-9204-set-database-on-shell-first-load
Open

fix(shell): set database on initial load COMPASS-9204#7927
Anemy wants to merge 1 commit intomainfrom
COMPASS-9204-set-database-on-shell-first-load

Conversation

@Anemy
Copy link
Copy Markdown
Member

@Anemy Anemy commented Mar 30, 2026

COMPASS-9204

Previously we wouldn't use the database the user's collection it in when they click the shell button. It would only use the database after the first time the shell was rendered. This ensures we use the intended database.

Added a regression e2e test.

Copy link
Copy Markdown
Contributor

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

Fixes COMPASS-9204 by ensuring the Shell tab applies the intended database context on first open (from a collection) by deferring the “initial eval applied” state until mongoshVersion is known, and adds an e2e regression test that opens the shell from the collection header.

Changes:

  • Gate initial-eval “applied” state on mongoshVersion so the first Shell render can correctly apply the use <db> initial eval.
  • Add e2e coverage for opening Shell from a collection header and verifying db/collection context.
  • Refactor e2e shell commands to distinguish opening Shell from the sidebar vs. from a collection header.

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-shell/src/plugin.spec.tsx Tightens unit test to assert the runtime evaluates version() on initial render.
packages/compass-shell/src/components/compass-shell/tab-compass-shell.tsx Adjusts initial-eval gating to wait for mongoshVersion and reorders initialization.
packages/compass-e2e-tests/tests/shell.test.ts Adds regression e2e test for shell opened from collection header and updates existing shell open path.
packages/compass-e2e-tests/helpers/selectors.ts Adds selector for the collection header “open shell” button.
packages/compass-e2e-tests/helpers/mongo-clients.ts Adds dataset helper to create a non-default db/collection for the new e2e.
packages/compass-e2e-tests/helpers/commands/shell-eval.ts Exposes shell output reader and updates shell opening path to sidebar-specific helper.
packages/compass-e2e-tests/helpers/commands/open-shell.ts Splits shell opening into openShellFromSidebar and openShellFromCollectionHeader.
packages/compass-collection/src/components/collection-header-actions/collection-header-actions.tsx Adds data-testid to support e2e opening Shell from the collection header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants