From 4ce21ea128456805fc76f42aa79846c563a15b78 Mon Sep 17 00:00:00 2001 From: gagik Date: Tue, 16 Sep 2025 15:20:18 +0200 Subject: [PATCH 1/2] chore(compass-assistant): hide connection error entry point --- .../components/connection-status-notifications.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/compass-connections/src/components/connection-status-notifications.tsx b/packages/compass-connections/src/components/connection-status-notifications.tsx index e40dc0cebc8..e94765e8dd2 100644 --- a/packages/compass-connections/src/components/connection-status-notifications.tsx +++ b/packages/compass-connections/src/components/connection-status-notifications.tsx @@ -207,10 +207,14 @@ const openConnectionFailedToast = ({ } : undefined } - onDebug={() => { - closeToast(`connection-status--${failedToastId}`); - onDebugClick?.(); - }} + onDebug={ + onDebugClick + ? () => { + closeToast(`connection-status--${failedToastId}`); + onDebugClick(); + } + : undefined + } /> ), variant: 'warning', From 956a644a0c1fbb5ce4be1e8f138744d4b3a2513b Mon Sep 17 00:00:00 2001 From: gagik Date: Tue, 16 Sep 2025 15:27:44 +0200 Subject: [PATCH 2/2] chore: add test --- .../stores/connections-store-redux.spec.tsx | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/compass-connections/src/stores/connections-store-redux.spec.tsx b/packages/compass-connections/src/stores/connections-store-redux.spec.tsx index e0e9eba8cc6..076549b70f6 100644 --- a/packages/compass-connections/src/stores/connections-store-redux.spec.tsx +++ b/packages/compass-connections/src/stores/connections-store-redux.spec.tsx @@ -176,6 +176,32 @@ describe('CompassConnections store', function () { }); }); + it('should not show debug action when assistant is disabled', async function () { + const { connectionsStore } = renderCompassConnections({ + preferences: { + enableAIAssistant: false, + enableGenAIFeatures: false, + enableGenAIFeaturesAtlasOrg: false, + cloudFeatureRolloutAccess: { GEN_AI_COMPASS: false }, + }, + connectFn: sinon + .stub() + .rejects(new Error('Failed to connect to cluster')), + }); + + const connectionInfo = createDefaultConnectionInfo(); + + void connectionsStore.actions.connect(connectionInfo); + + await waitFor(() => { + expect(screen.getByText('Failed to connect to cluster')).to.exist; + }); + + // The debug button should not be present when assistant is disabled + expect(screen.queryByText('Debug for me')).to.not.exist; + expect(screen.queryByTestId('connection-error-debug')).to.not.exist; + }); + it('should show non-genuine modal at the end of connection if non genuine mongodb detected', async function () { const { connectionsStore } = renderCompassConnections({});