Skip to content

Keep database connections usable across expiry and idle drops - #1136

Merged
Tomasz Naumowicz (tnaum-ms) merged 408 commits into
mainfrom
feature/connection-lifecycle
Dec 3, 2026
Merged

Tomasz Naumowicz (tnaum-ms) merged 408 commits into
mainfrom
feature/connection-lifecycle

Conversation

@tnaum-ms

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

Copy link
Copy Markdown
Collaborator

Release notes: keep working after sign-in expires or a connection drops

The DocumentDB extension for Visual Studio Code can recover from routine Microsoft Entra token expiry and idle connection drops without restarting VS Code.

  • Keep your place. Collection View, Document View and Cluster Dashboard keep your query, results or draft through a recoverable failure. The extension silently renews sign-in for the same account and tenant when possible, including in the Interactive Shell and Query Playground. If repair is needed, use Retry sign-in in the tree or Sign in again in Shell or Playground, then run the interrupted operation yourself. The extension does not replay a failed write, command or script.
  • Disconnect without losing work. Close the affected tabs or keep their contents to inspect and copy. Closing a dirty document requires confirmation. Shell scrollback and Playground file text remain, but their workers stop. Reconnect starts a new session: kept tabs cannot read or write to it, even with the same account. Open a fresh tab from the tree. Editing credentials or a connection string uses the same disconnect checks; an active transfer is left running rather than interrupted.
  • Understand what went wrong. Recovery actions distinguish a sign-in problem from rejected credentials or a connection that needs retrying. Failed tree connections offer Diagnose connection and a separate Open shell without authentication action that does not reuse saved credentials. Show Connection Stats prints a local snapshot for troubleshooting. Azure Discovery renews its management credentials and, when one account or tenant cannot be listed, shows the subscriptions it could load with a warning and Show Output.

Stability and validation

A delayed failure from an old client cannot evict its replacement. A pending action from an ended session (including a confirmed-later delete) cannot reach the reconnected database. A temporary outage does not permanently disable a live tab; a deliberate disconnect does. Rejected credentials are not silently retried.

  • Standard CI on 1e12d20 passed, including unit tests, static checks, package verification, VSIX inspection and activation. The full local verification on #1169 recorded 11,011 passing tests and one skipped. At c50dd2a9b, the full local review checks passed: formatting, localization verification, lint, build, test type-check, Vitest (11,016 passed, one skipped), and VSIX packaging.
  • Still to verify before release: real Entra expiry and idle/sleep–wake recovery in the packaged extension; retaining, copying and reconnecting a dirty tab without reviving it; and a Retry/sign-in overtaken by Disconnect. CI activation is not evidence for those interactions or for telemetry ingestion. See the candidate runbook.

Telemetry: what we can measure

Startup events give per-attempt stages, timing and outcomes. Established-client tree events can add age, generation and failure kind. Post-startup Entra lookups report surface, lookup outcome and token lifetime when available. Instrumented webview calls distinguish thrown failures (causeType) from blocked operations (unavailableReason, including sessionEnded). Disconnect records tab choice, affected views/workers and task conflicts; Azure Discovery records skipped-account/tenant counts and ARM challenge outcomes. These lifecycle dimensions do not need tokens, connection strings or account identifiers.

  • Explicit Reconnect: Count connect.startup events with startupTrigger=explicitReconnect, grouped by startupOutcome (succeeded, failed, canceled). An accepted click reserves the startup ID; a click without an observed startup is not a failed connection. These are extension-client startups, not driver socket reconnects.
  • Entra renewal: renewalOutcome now distinguishes providerChanged from noSession in the extension, Shell and Playground. A token returned by the host is not proof of database acceptance.
  • Did work resume? First-page Collection View Find/Refresh calls reuse the tab ID: count affected tabs with a later successful read, another attempt but no success, or no observed follow-up. A blocked RPC can report SDK Succeeded; exclude it using unavailableReason.

Use these for within-version diagnosis, not a before/after failure-rate claim. Telemetry queries and definitions. Candidate-matched prerelease ingestion (CP-5) remains to be verified.

Scope and history

Original stages: #1107, #1108, #1111, #1113, #1117, #1121, #1130, #1133, #1135. Subsequent hardening and review: #1137, #1138, #1139, #1146, #1149, #1154, #1169, #1170. Feature design and decisions.

Not included: broader network/Kubernetes tunnel recovery (#1105), stale-result indicators (#1106), or proactive sign-out handling (#1119).

Fixes #1102
Fixes #990
Fixes #1059

Part of #566 and #1091. Related to #626.

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

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…s (PR5 R4)

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>
Reuse the existing import count translation and tidy the document regression fixture.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the delete callback typed without altering when the bound or tree client is resolved.

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>
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>
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>
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>

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.

Comment thread src/documentdb/connectionSurfaces.ts Resolved
A dirty report can lag behind the editor. Authorize disposal only for the editable tabs covered by the discard confirmation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Return the current AI request to idle without losing static insights, and fence stale stream callbacks before they affect state or notifications.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Align error translation guidance with the typed session-ended reason and the current webview recovery flow.

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

Keep the session reports available in installed builds, gate schema tools with the survey commands, and remove the demo task.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Lead with counts and separate each connection, Shell, or Playground session with a state heading and bulleted details.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Apply the Case 2 formatter output without rewriting the existing commits.

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) merged commit 38c563c into main Dec 3, 2026
16 checks passed
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) deleted the feature/connection-lifecycle branch December 3, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

4 participants