Problem
When a connection is removed via removeConnection, several surfaces are left in a stale state:
- Playground: UI still shows "connected" status; next execution throws a confusing "No credentials found" error instead of transitioning to the disconnected state
- Interactive Shell: Shell PTY remains open with a stale connection
- Collection View: Open collection views may reference the removed connection
- Document View: Open document views may reference the removed connection
- Running Tasks: Any active tasks (e.g., export, schema scan) on that connection are not canceled
Currently, removeConnection clears CredentialCache and SchemaStore, but does not notify any of these surfaces.
Proposed Solution
Design a unified disconnect experience that:
- Notifies all active views when a connection is removed
- Transitions each surface to an appropriate disconnected state (not silently stale)
- Optionally cancels running tasks on the removed connection
- Considers adding an explicit "Disconnect" command separate from "Remove Connection"
This could be implemented via an event-driven approach (e.g., CredentialCache or a connection manager emitting events) or explicit cleanup calls from removeConnection.
Context
Identified during PR #508 review (Finding H1). The playground specifically has a first-class disconnected state (PlaygroundService.clearConnection()), but it is not called when the connection is removed externally.
Scope
This affects the playground, interactive shell, collection view, document view, and any other surface that holds a reference to a connection.
Problem
When a connection is removed via
removeConnection, several surfaces are left in a stale state:Currently,
removeConnectionclearsCredentialCacheandSchemaStore, but does not notify any of these surfaces.Proposed Solution
Design a unified disconnect experience that:
This could be implemented via an event-driven approach (e.g.,
CredentialCacheor a connection manager emitting events) or explicit cleanup calls fromremoveConnection.Context
Identified during PR #508 review (Finding H1). The playground specifically has a first-class disconnected state (
PlaygroundService.clearConnection()), but it is not called when the connection is removed externally.Scope
This affects the playground, interactive shell, collection view, document view, and any other surface that holds a reference to a connection.