Skip to content

PR4: Classify connection failures and add explicit recovery - #1117

Merged
Tomasz Naumowicz (tnaum-ms) merged 30 commits into
feature/connection-lifecyclefrom
dev/tnaum/connection-lifecycle-recovery
Nov 24, 2026
Merged

Tomasz Naumowicz (tnaum-ms) merged 30 commits into
feature/connection-lifecyclefrom
dev/tnaum/connection-lifecycle-recovery

Conversation

@tnaum-ms

@tnaum-ms Tomasz Naumowicz (tnaum-ms) commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

Connection failures now distinguish a lost Entra session, rejected credentials, a closed client, and a temporary network outage. Recovery does not replay the failed operation. The tree offers Retry sign-in instead of Retry when interactive Entra sign-in is needed. A rejected verified Entra connection keeps its in-memory settings but cannot silently reopen.

Show Connection Stats reports sanitized client state and the last Entra token's declared expiry and time remaining. Shell and Playground no longer import VS Code UI code from the Node worker.

Validation and scope

OP-3 passed on the earlier CI VSIX: real sign-out, no unsolicited prompt, explicit prompt dismissal, and successful sign-in on a later click. The operator also confirmed that both Shell and Playground work on the CI-built 1.1.1-alpha.1 VSIX.

Final local Case 2 passed: localization, formatting, lint, build, strict workspace test type-check, 9,796 runtime tests (one skipped), and VSIX packaging. Full CI passed at code head d422d065b; ed21d7c16 only records the operator's smoke confirmation. See the signed-off pre-review.

WI-6 webview recovery is not included; it is being developed in stacked PR5 (#1121). Part of #1102. The delivery plan records the remaining work.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…n-in

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…WI-5)

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>
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added the ci:full-requested Requests a full run of CI checks. label Nov 23, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added ci:full-requested Requests a full run of CI checks. and removed ci:full-requested Requests a full run of CI checks. labels Nov 23, 2026
Base automatically changed from dev/tnaum/connection-lifecycle-client-identity to feature/connection-lifecycle November 23, 2026 16:05
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added ci:full-requested Requests a full run of CI checks. and removed ci:full-requested Requests a full run of CI checks. labels Nov 23, 2026
@github-actions github-actions Bot removed the ci:full-requested Requests a full run of CI checks. label Nov 23, 2026
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ CI passed: standard tier (ready PR)

Commit b9099d8, workflow run.

Layer Result Ran or skipped because
Static checks ✅ passed every push
Unit tests ✅ passed every push
npm packages: verify tarballs ✅ passed packages/**, package-lock.json or the CI workflow changed
VSIX: inspect contents ✅ passed ready PR
VSIX: self-test of the checks ✅ passed build/verification/**, build/vite/**, the Vite configs, package-lock.json or the CI workflow changed
VSIX: activate in VS Code ✅ passed ready PR
VSIX: self-test of the activation check ✅ passed build/verification/**, build/vite/**, the Vite configs, package-lock.json or the CI workflow changed
Webview host in unbundled extensions ✅ passed packages/vscode-ext-webview/**, package-lock.json or the CI workflow changed
E2E ⏭️ not available yet arrives with the E2E iteration (full tier)

Full run: add the ci:full-requested label to run every layer once on the current commit.
Last full run: ✅ passed on d422d06, requested by Tomasz Naumowicz (@tnaum-ms), run.

Code quality

Check Status How to fix
Localization (l10n) ✅ Passed Nothing to fix
ESLint ✅ Passed Nothing to fix
Prettier formatting ✅ Passed Nothing to fix

Build size

No size data for feature/connection-lifecycle yet; sizes only. VSIX: 8.8 MiB.

Artifacts: VSIX | Bundle-reports-45382994173 | L1-manifest-report-45382994173

All graphs (exact bytes)
Graph PR bytes
Collection View page (collectionView) 6,039,541
Document View page (documentView) 4,810,445
Local Quick Start page (localQuickStart) 1,581,517
Atlas Credentials page (atlasCredentials) 1,510,179
Cluster Dashboard page (clusterDashboard) 1,553,664
Diagnose Connection page (connectionDiagnostics) 1,533,091
Activation (mainStartup) 3,182,735
Extension host (main) 9,759,327
Playground worker (playgroundWorker) 5,415,042
VSIX (vsix) 9,245,124
playgroundTsPlugin 6,175
viewsEntry 1,457,617
viewsAssets 80,340
editorWorker 259,570
jsonWorker 389,427

Packaged bytes. Shared chunks count in every graph that loads them, so rows do not add up.

Updated in place on every run.

Repair the lifecycle test fixtures and type-only import, then update the generated localization and formatting reported by CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added the ci:full-requested Requests a full run of CI checks. label Nov 23, 2026
@github-actions github-actions Bot removed the ci:full-requested Requests a full run of CI checks. label Nov 23, 2026
Record the partial OP-3 evidence and track prompt sign-out handling in #1119 without changing the existing gate.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Separate the shared auth IDs from host-only UI metadata so workers can load OIDC options in Node.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Expose a read-only snapshot for operators without changing the existing OP-3 candidate.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Show the declared expiry of the last token supplied to the driver without retaining the token or changing renewal.

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>
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added the ci:full-requested Requests a full run of CI checks. label Nov 23, 2026
@github-actions github-actions Bot removed the ci:full-requested Requests a full run of CI checks. label Nov 23, 2026
Record the OP-3 pass and use Retry sign-in as the primary Entra recovery action without changing its command or position.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Hold current verified Entra replacement rejections and leave a healthy replacement alone when an old Retry action is clicked.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Drop listings from a different identity, keep actionable repairs, and detect failures without mistaking a database name for a recovery row.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added the ci:full-requested Requests a full run of CI checks. label Nov 24, 2026
@github-actions github-actions Bot removed the ci:full-requested Requests a full run of CI checks. label Nov 24, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added this to the 1.2.0 milestone Nov 24, 2026
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) marked this pull request as ready for review November 24, 2026 06:52
@tnaum-ms

Copy link
Copy Markdown
Collaborator Author

Ready for operator review — ed21d7c16 records the successful live Shell and Playground smoke on the CI-built 1.1.1-alpha.1 VSIX. OP-3 passed previously. Final local Case 2 passed on the unchanged code (9,796 tests passed, one skipped, and VSIX packaged); full CI passed on code head d422d065b. The signed-off pre-review is linked in the description. This PR targets feature/connection-lifecycle; PR5 (#1121) remains stacked on it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Authentication recovery gaps can leave connections blocked without usable repair actions or repeatedly reopening clients with rejected credentials.

9 open issues
What changed in this PR

This PR adds the host and tree recovery layer for #1102: classify connection failures and require explicit recovery where needed, without replaying failed operations. Open-view recovery remains in stacked PR5 (#1121).

Changes:

  • Classifies sign-in, credential, closed-client and network failures, with safeguards against stale recovery.
  • Adds Retry sign-in and credential/key recovery paths while retaining verified Entra settings.
  • Adds sanitized connection statistics, worker-safe authentication identifiers, regression tests and updated design records.
File Description
src/​tree/​documentdb/​ClusterItemBase.ts Classifies expansion failures and selects recovery actions.
src/​tree/​documentdb/​ClusterItemBase.test.ts Tests recovery actions and stale identity results.
src/​tree/​connections-view/​LocalQuickStart/​LocalQuickStartItem.ts Forwards client-reuse tracking through Quick Start.
src/​tree/​connections-view/​LocalQuickStart/​LocalQuickStartItem.credentials.test.ts Updates lifecycle mocks.
src/​tree/​connections-view/​DocumentDBClusterItem.ts Applies classified startup cleanup and epoch checks.
src/​tree/​connections-view/​DocumentDBClusterItem.test.ts Tests credential retention after transient failure.
src/​tree/​BaseExtendedTreeDataProvider.ts Captures established-client telemetry before expansion.
src/​tree/​azure-resources-view/​mongo-ru/​RUCoreResourceItem.ts Exposes key refresh and shared failure cleanup.
src/​tree/​azure-resources-view/​documentdb/​VCoreResourceItem.ts Uses shared startup-failure handling.
src/​tree/​azure-resources-view/​documentdb/​azureResourceAuthentication.test.ts Updates authentication lifecycle mocks.
src/​plugins/​service-kubernetes/​discovery-tree/​documentdb/​KubernetesResourceItem.ts Uses epoch-aware startup cleanup.
src/​plugins/​service-kubernetes/​discovery-tree/​documentdb/​KubernetesResourceItem.test.ts Updates lifecycle mocks.
src/​plugins/​service-azure-vm/​discovery-tree/​vm/​AzureVMResourceItem.ts Uses shared startup-failure handling.
src/​plugins/​service-azure-mongo-vcore/​discovery-tree/​documentdb/​DocumentDBResourceItem.ts Applies classified startup cleanup.
src/​plugins/​service-azure-mongo-ru/​discovery-tree/​documentdb/​MongoRUResourceItem.ts Exposes replacement-key reads and shared cleanup.
src/​plugins/​service-atlas-mongodb/​discovery-tree/​AtlasClusterItem.ts Uses shared startup-failure handling.
src/​plugins/​service-atlas-mongodb/​discovery-tree/​AtlasClusterItem.test.ts Updates lifecycle mocks.
src/​documentdb/​runWithClient.ts Adds a bound operation wrapper without replay.
src/​documentdb/​connectionFailures.ts Defines bounded, typed failure classification.
src/​documentdb/​connectionFailures.test.ts Tests classification, mixed evidence and cancellation.
src/​documentdb/​ClustersExtension.ts Registers sign-in recovery and connection statistics.
src/​documentdb/​ClustersClient.ts Adds failure reporting, recovery holds and diagnostics.
src/​documentdb/​ClustersClient.test.ts Tests replacement, rejection, diagnostics and recovery races.
src/​documentdb/​auth/​oidcClientOptions.ts Wraps token callback failures for classification.
src/​documentdb/​auth/​oidcClientOptions.test.ts Guards against VS Code imports in workers.
src/​documentdb/​auth/​MicrosoftEntraIDAuthHandler.ts Supports explicit recovery-session acquisition.
src/​documentdb/​auth/​ManagedIdentityAuthHandler.ts Identifies Managed Identity callback failures.
src/​documentdb/​auth/​ManagedIdentityAuthHandler.test.ts Tests wrapped callback failures and explanations.
src/​documentdb/​auth/​entraErrors/​entraCallbackErrors.ts Adds worker-safe, auth-specific callback errors.
src/​documentdb/​auth/​driverOidcContract.test.ts Tests final authentication rejection behavior.
src/​documentdb/​auth/​AuthMethodId.ts Extracts authentication identifiers from UI code.
src/​documentdb/​auth/​AuthMethod.ts Re-exports the extracted identifiers.
src/​commands/​updateCredentials/​UpdateCredentialsWizardContext.ts Tracks recovery validity and completed saves.
src/​commands/​updateCredentials/​updateCredentials.ts Checks recovery epochs and clears matching rejection holds.
src/​commands/​updateCredentials/​updateCredentials.test.ts Tests ordinary saves across epoch changes.
src/​commands/​updateCredentials/​ExecuteStep.ts Checks recovery validity around credential persistence.
src/​commands/​updateConnectionString/​UpdateCSWizardContext.ts Adds recovery-validity tracking.
src/​commands/​updateConnectionString/​updateConnectionString.ts Supports rejection recovery with epoch checks.
src/​commands/​updateConnectionString/​updateConnectionString.test.ts Tests ordinary edits across epoch changes.
src/​commands/​updateConnectionString/​ExecuteStep.ts Checks recovery validity around connection-string saves.
src/​commands/​signInAgain/​signInAgain.ts Implements explicit, identity-aware sign-in recovery.
src/​commands/​signInAgain/​signInAgain.test.ts Tests account selection, dismissal and stale recovery.
src/​commands/​showConnectionStats/​showConnectionStats.ts Prints sanitized client state and token expiry.
src/​commands/​showConnectionStats/​showConnectionStats.test.ts Tests expiry and remaining-time formatting.
src/​commands/​retryAuthentication/​retryAuthentication.ts Adds source-specific credential and key recovery.
src/​commands/​retryAuthentication/​retryAuthentication.test.ts Tests key refresh, rejection holds and stale Retry.
src/​commands/​diagnoseConnection/​diagnoseConnection.test.ts Updates lifecycle mocks.
package.nls.json Adds the connection-statistics command title.
package.json Contributes the command and advances the alpha version.
package-lock.json Synchronizes root package version metadata.
l10n/​bundle.l10n.json Regenerates recovery messages and removes obsolete strings.
docs/​ai-and-plans/​features/​connection-lifecycle/​README.md Summarizes recovery decisions and follow-up scope.
docs/​ai-and-plans/​features/​connection-lifecycle/​iterations/​01-pr4-connection-recovery-review.md Records pre-review dispositions and validation.
docs/​ai-and-plans/​features/​connection-lifecycle/​iterations/​01-implementation-plan.md Documents verified Entra rejection recovery.
docs/​ai-and-plans/​features/​connection-lifecycle/​iterations/​01-dev-plan.md Updates delivery scope and verification progress.
docs/​ai-and-plans/​features/​connection-lifecycle/​decisions.md Records settings retention and rejection-hold decisions.

Review effort: Max

Comment thread src/commands/signInAgain/signInAgain.ts Resolved
Comment thread src/documentdb/ClustersClient.ts Resolved
Comment thread src/documentdb/ClustersClient.ts Resolved
Comment thread src/tree/documentdb/ClusterItemBase.ts Resolved
Comment thread src/tree/documentdb/ClusterItemBase.ts Resolved
Comment thread src/tree/documentdb/ClusterItemBase.ts Resolved
Comment thread src/tree/documentdb/ClusterItemBase.ts Resolved
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>
@tnaum-ms

Copy link
Copy Markdown
Collaborator Author

#sign-off

@tnaum-ms
Tomasz Naumowicz (tnaum-ms) merged commit 779efc9 into feature/connection-lifecycle Nov 24, 2026
12 checks passed
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) deleted the dev/tnaum/connection-lifecycle-recovery branch November 24, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants