Repository navigation
PR6: Disconnect clusters without stranding open views - #1130
Tomasz Naumowicz (tnaum-ms) merged 24 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Check the connection latch before admitting new work and include import/export leases in the existing task-conflict queries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Check task and dirty-view conflicts, fence work before closing resources, and offer Connect without changing tree identity. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fence the confirmed targets before deleting, and let a surviving connection reconnect if its storage deletion fails. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Retire only older view generations after storage changes, including password-only and partial writes. Keep the edit fence retryable until a change is confirmed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…(WI-8) Treat closed clients and terminal auth as unavailable, keep partial samples for unsupported commands, and resume one poll loop only after Retry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the import lease through cleanup and the bound import interruption handling from PR5. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Regenerate localization, apply repository formatting, keep Disconnect type narrowing explicit, and update the Atlas fixture for connected-state detection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ CI passed: standard tier (ready PR)Commit
Full run: add the Code quality
Build sizeNo size data for Artifacts: VSIX | Bundle-reports-45613596633 | L1-manifest-report-45613596633 All graphs (exact bytes)
Packaged bytes. Shared chunks count in every graph that loads them, so rows do not add up. Updated in place on every run. |
Use Reconnect for an explicit disconnect, keep Fluent layout defaults, and verify teardown rejects active import and export leases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reuse Retry for the auto-opened panel only after a same-identity reconnect. Record OP-5 evidence without claiming a live transfer test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical issues can execute queued shell commands under newly saved credentials and discard document edits without confirmation during multi-connection teardown.
10 open issues
Validate all affected views before asynchronous removal · New Discard queued shell input and guard completion on disconnect · New Scope Disconnect to DocumentDB cluster nodes · New Clear cached provider errors before refreshing disconnected rows · New Treat removed evaluators as cancellation during teardown · New Clear the credential-rejection hold after successful recovery · New Propagate cancellation from connection removal prompts · New Update retained views to offer retry after failed deletion · New Reset the shell input buffer when rejecting disconnected commands · New Treat evaluation failures after disconnect as intentional cancellation · New
What changed in this PR
Adds explicit Disconnect to the DocumentDB extension and shares teardown with connection removal and folder deletion, addressing stale sessions and stranded views.
Changes:
- Protects active tasks and transfers, with choices to close tabs or retain their contents disabled.
- Locks old views after saved connection edits and supports same-identity Dashboard recovery after reconnect.
- Adds commands, settings, localization, and focused lifecycle coverage.
| File | Description |
|---|---|
src/webviews/documentdb/documentView/documentView.tsx |
Reports dirty-state transitions to the host. |
src/webviews/documentdb/documentView/documentView.test.tsx |
Tests dirty-state reporting. |
src/webviews/documentdb/documentView/documentsViewRouter.ts |
Adds the dirty-state reporting procedure. |
src/webviews/documentdb/documentView/documentsViewRouter.test.ts |
Tests panel dirty-state updates. |
src/webviews/documentdb/documentView/documentsViewController.ts |
Tracks each panel’s unsaved changes. |
src/webviews/documentdb/documentView/documentsViewController.test.ts |
Tests per-panel dirty tracking. |
src/webviews/documentdb/clusterDashboard/clusterDashboardRouter.test.ts |
Covers health-poll failure classification. |
src/webviews/documentdb/clusterDashboard/clusterDashboardController.ts |
Requests recovery after same-identity reconnect. |
src/webviews/documentdb/clusterDashboard/clusterDashboardController.test.ts |
Tests Dashboard reconnect eligibility. |
src/webviews/documentdb/clusterDashboard/ClusterDashboard.tsx |
Pauses unavailable polling and handles reconnect. |
src/webviews/documentdb/boundViewOperations.ts |
Rejects retired bindings and maps closed clients. |
src/webviews/components/DisconnectedOverlay.tsx |
Uses standard dialog layout and instant backdrop. |
src/webviews/components/DisconnectedOverlay.test.tsx |
Updates dialog action selectors. |
src/webviews/components/DisconnectedOverlay.scss |
Removes custom dialog layout overrides. |
src/webviews/_integration/describeUnavailableConnection.ts |
Adds reconnect and settings-update guidance. |
src/webviews/_integration/connectionUnavailable.ts |
Adds the update-in-progress reason. |
src/tree/documentdb/ClusterItemBase.ts |
Adds Reconnect children and connected context. |
src/tree/documentdb/ClusterItemBase.test.ts |
Tests disconnected expansion and stable identity. |
src/tree/connections-view/LocalQuickStart/LocalQuickStartItem.ts |
Honors disconnect before Quick Start preparation. |
src/tree/connections-view/DocumentDBClusterItem.ts |
Uses connection-aware tree context. |
src/settingsKeys.ts |
Defines the open-tabs teardown setting. |
src/services/taskService/taskService.ts |
Adds resource leases and admission guards. |
src/services/taskService/taskService.test.ts |
Tests lease conflicts and blocked admission. |
src/plugins/service-atlas-mongodb/discovery-tree/AtlasClusterItem.ts |
Uses connection-aware Atlas tree context. |
src/plugins/service-atlas-mongodb/discovery-tree/AtlasClusterItem.test.ts |
Updates client-state mocks. |
src/documentdb/shell/ShellTerminalLinkProvider.ts |
Registers shell disconnect callbacks. |
src/documentdb/shell/ShellSessionManager.ts |
Blocks worker use while connections are latched. |
src/documentdb/shell/ShellSessionManager.test.ts |
Tests disconnected worker admission. |
src/documentdb/shell/DocumentDBShellPty.ts |
Stops workers while retaining terminal contents. |
src/documentdb/ConnectionUnavailableError.ts |
Adds the update-in-progress reason. |
src/documentdb/connectionTeardown.ts |
Centralizes confirmation, fencing, and cleanup. |
src/documentdb/connectionTeardown.test.ts |
Covers teardown choices, conflicts, and failures. |
src/documentdb/connectionBindingRetirement.ts |
Tracks permanently retired view generations. |
src/documentdb/ClustersExtension.ts |
Registers Disconnect and Reconnect commands. |
src/documentdb/ClusterSession.ts |
Prevents retired sessions from operating. |
src/documentdb/ClustersClient.ts |
Enforces retirement and supports fenced cleanup. |
src/documentdb/ClustersClient.test.ts |
Tests retirement and identity-preserving teardown. |
src/commands/updateCredentials/updateCredentials.ts |
Routes credential saves through the edit fence. |
src/commands/updateCredentials/updateCredentials.test.ts |
Covers saved-edit retirement and shell choices. |
src/commands/updateConnectionString/updateConnectionString.ts |
Retires old views after connection-string edits. |
src/commands/updateConnectionString/updateConnectionString.test.ts |
Tests the revised saved-edit lifecycle. |
src/commands/saveConnectionEdit.ts |
Fences persistence and retires changed settings. |
src/commands/removeConnection/removeConnection.ts |
Reuses shared teardown before storage deletion. |
src/commands/playground/executePlaygroundCode.ts |
Adds teardown-aware evaluator stopping and guards. |
src/commands/openInteractiveShell/openInteractiveShell.ts |
Wires terminal disconnect callbacks. |
src/commands/openClusterDashboard/openClusterDashboard.ts |
Passes automatic-open reconnect context. |
src/commands/importDocuments/importDocuments.ts |
Holds a lease throughout database import work. |
src/commands/importDocuments/importDocuments.test.ts |
Tests transfer lease lifetime and teardown blocking. |
src/commands/exportDocuments/exportDocuments.ts |
Holds a lease through export completion. |
src/commands/disconnect/disconnect.ts |
Implements explicit Disconnect and Reconnect. |
src/commands/dashboardBoundCommands.test.ts |
Updates connection-latch mocks. |
src/commands/connections-view/deleteFolder/ExecuteStep.ts |
Tears down descendants before deleting storage. |
src/commands/connections-view/deleteFolder/deleteFolder.test.ts |
Adapts tests to shared removal. |
package.nls.json |
Adds the localized Disconnect command title. |
package.json |
Contributes Disconnect, tab settings, and version update. |
package-lock.json |
Synchronizes the prerelease version. |
l10n/bundle.l10n.json |
Updates lifecycle messages. |
docs/ai-and-plans/features/connection-lifecycle/README.md |
Documents retained Dashboard reconnect behavior. |
docs/ai-and-plans/features/connection-lifecycle/iterations/01-implementation-plan.md |
Updates disconnect acceptance scenarios. |
docs/ai-and-plans/features/connection-lifecycle/iterations/01-dev-plan.md |
Records teardown design and validation progress. |
build/verification/browser/scenarios.ts |
Exercises stale polling and Dashboard recovery. |
Review effort: Max
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
390cbec
into
feature/connection-lifecycle


Adds explicit Disconnect and uses the same teardown for Remove and folder deletion. Users can close affected views or keep their contents open and disabled. Active transfers and tasks protect the connection from teardown; the tree offers Connect after an explicit disconnect without changing the node ID.
CP-4: teardown order
sequenceDiagram actor User participant Command participant Tasks as Tasks and transfer leases participant Client as Connection lifecycle participant Views as Views and workers participant Tree User->>Command: Disconnect or Remove Command->>Tasks: Check conflicts before prompting Command->>User: Choose what happens to tabs; confirm unsaved changes if closing Command->>Tasks: Recheck the whole target set synchronously Command->>Client: Latch and advance the epoch before any await Command->>Views: Disable or close views; stop affected workers Command->>Client: Close client; clear caches as appropriate Command->>Tree: Refresh; offer Connect after DisconnectA5 leases span client resolution through transfer cleanup. Connect clears only the explicit Disconnect hold; the tree reconnects using the retained identity. Remove drops cached credentials. The approved saved-edit lock (decision 0018) uses the same pre-save fence but always keep old tabs open and copyable, with no tab-choice prompt.
Draft scope and validation
PR6 targets
feature/connection-lifecycleand includes merged PR4 (#1117) and PR5 (#1121).OP-5 cleared: on the CI-built
1.1.1-alpha.4VSIX at71c646b67, the operator validated Keep open, Close all, Remove, and the saved-edit lock. Disconnect during import/export was verified by automated tests against the teardown preflight, not in a live transfer.Follow-up at
762f49e6f: the tree says Reconnect; the auto-opened Dashboard resumes after a same-identity reconnect without replaying work. The recovery dialog uses the default Fluent layout and an unanimated full-webview backdrop.Local Case 2 passed: localization generation and check, formatting, lint, build, strict workspace test type-check, full Vitest (9,901 passed, one skipped), and VSIX packaging. Browser checks also passed for the dialog layout and Dashboard reconnect. AI pre-review remains before handoff for operator review.
Part of #1102. Related: #1059, #566. See the WI-7 plan.
Post-merge description review
The 1.2.0 behavior supersedes the Dashboard-resume and saved-edit notes above. Disconnect, Delete Connection, and Disconnect and update for a live connection use the guarded teardown: active transfers keep running and block teardown; otherwise, open tabs can be closed or kept for inspection and copying. Reconnect starts a new session and cannot revive an old tab, including Cluster Dashboard. A blocked or canceled disconnect does not open the credential or connection-string editor.