Skip to content

fix(extensions): prompt connection picker for extension commands when target is ambiguous #892

Description

@ZhuchkaTriplesix

Summary

In lib/core/extensions/extension_driver_session.dart, targetForExtension resolves which live session should execute a command triggered from Command Palette (Ctrl+P):

ExtensionCommandTarget targetForExtension(
  String extensionId, {
  int? preferredConnectionId,
}) {
  return resolveExtensionCommandTarget(
    extensionId: extensionId,
    liveConnectionIds: [
      for (final entry in _bridges.entries)
        if (entry.value.isStarted) entry.key,
    ],
    extensionIdFor: (id) => _manifests[id]?.id,
    preferredConnectionId: preferredConnectionId,
  );
}

If a user has multiple active connections of the same extension driver (e.g. "ClickHouse Dev" and "ClickHouse Prod") and triggers an extension command (e.g. "Optimize Partition" or "Inspect Storage") while focused on a neutral tab, resolveExtensionCommandTarget arbitrarily picks the first live connection ID.

This can result in executing maintenance or mutation commands on the wrong server (e.g. inadvertently running against production).

Scope

• When multiple live connections for the same extension exist and neither is active in the current workspace tab, do not silently pick the first connection ID.
• Prompt the user with a quick picker modal / bottom sheet to select the target connection before executing the command.
• Add test cases for multi-session command targeting.

Out of scope

• Built-in SQL workspace connection switching.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmarketplaceExtensions marketplace, ExtensionManifeststabilityTheme parser epic label: stabilityuxUser experience, keyboard shortcuts and interactions

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions