Skip to content

Add connection diagnostics with step-by-step checks and reports - #1066

Merged
Guanzhou Song (guanzhousongmicrosoft) merged 101 commits into
mainfrom
dev/tnaum/connectivity-troubleshooter
Nov 9, 2026
Merged

Guanzhou Song (guanzhousongmicrosoft) merged 101 commits into
mainfrom
dev/tnaum/connectivity-troubleshooter

Conversation

@tnaum-ms

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

Copy link
Copy Markdown
Collaborator

What changed

Add Diagnose connection so users can see which part of a connection fails, what was observed, and what to try next, rather than relying on a single driver error.

  • Open Connection Diagnostics from a connection's context menu, failed-connection recovery actions, or the command palette.
  • Show a fixed eight-step progress list covering diagnosis setup, connection settings, DNS, TCP, TLS, the server greeting, authentication, and database access, with per-step durations and expandable evidence.
  • Use a reusable, VS Code-independent @documentdb-js/connection-diagnostics package for network checks, and the extension's real authentication path for non-interactive authentication and read-only server checks.
  • Support cancellation, reruns, explicit longer/no-diagnostic-timeout retries, and readable Markdown/JSON reports. Keep secrets out of reports and offer identifier hiding and confirmation before sharing identifiers.
  • Include Entra ID/cloud diagnostics, Kubernetes preparation, recovery actions, telemetry, user documentation, and browser scenarios.
  • Rename the existing error-translation layer from ConnectionDiagnosticsService to ErrorExplanationService (providers become *ErrorExplainer) so it no longer shares a name with this feature. Its telemetry follows: connectionDiagnostics.explained becomes errorExplanation.explained, with explanationProviderId and explanationSource (decision 0051; the old data was not yet evaluated). The feature's own events are diagnoseConnection.run and diagnoseConnection.runStarted.

Why

A connection failure can come from several layers, while a generic timeout or driver error rarely identifies which one. Ordered checks and a shareable evidence report help users and support engineers narrow down the cause. Successful connections can also be diagnosed.

Scope

This diagnoses one saved connection without changing its configuration or prompting for credentials/sign-in. It is not a configuration or permissions audit. Cloud-specific firewall configuration helpers and a standalone CLI are outside this PR.

Validation / remaining work

Case 2 handover (2026-11-06), run with gpt-5.6-terra after the review fixes:

  • Passed npm run l10n, npm run prettier-fix, npm run l10n:check, npm run lint, and npm run build.
  • Passed the exact strict workspace test check: npm run typecheck:tests.
  • Passed full npx vitest run: 379 files and 7,406 tests passed; one test skipped.
  • Passed npm run package: 8.61 MB VSIX.
  • Committed the AI pre-review, author decisions and fix references in iteration 04. Accepted F1-F4 fixes are implemented; K1 retains its documented deferral.
  • Previously validated L2-dev browser scenarios: all 28 Connection Diagnostics scenarios in dark, light and high-contrast (84 routes) passed with no errors; not rerun in this handover.
  • No new live-service or installed-extension verification in this handover. Manual coverage should include working/failing connections, password/Entra ID authentication, Kubernetes preparation, cancellation and timeout retries, and report preview/copy/save with identifiers shown/hidden.
  • Sovereign-cloud end-to-end verification remains subject to the service-side preauthorization limits recorded in the feature documentation.

UX review round (2026-11-06), iteration 05:

  • Implemented UX-1 to UX-9: sign-in cloud wording (the panel and connect error no longer claim a sign-in that was not observed), method-aware managed identity guidance, location-neutral loopback and clock text, success titles that count checks, sign-in and cluster clouds in the expanded Authentication Details (decision 0052), and no repeated provider paragraphs on the card. UX-10 closed as a false alarm.
  • Implemented the message consistency proposal (appendix F): one rerun phrase, Next steps that start with the action, hedged titles, and the same terms in collapsed lines and Details. The diagnostic report no longer uses em dashes.
  • Case 2 re-run on 02923c9f: l10n, prettier-fix, l10n:check, lint, build, typecheck:tests, package passed; full npx vitest run passed 7,478 tests (379 files, 1 skipped). Browser scenario unit tests (24) passed; the 84 L2-dev routes were not re-run in a browser.
  • Not covered by the AI pre-review in iteration 04: this round's wording changes, which were reviewed in iteration 05 instead.

Kubernetes port forward follow-up (2026-11-09), from manual testing of the #1069 fixes: the panel did not make clear that the check used a Kubernetes port forward, why, or what it forwarded to.

  • The Connection settings summary now says "Using port forward" (was "Port forward ready").
  • The prepare.sharedTunnel info finding is now titled "Kubernetes port forward stays open". It says whether this check started the port forward or reused an open one, why it is needed, and that it is shared and stays open; Next step: "It closes when you close or reload the VS Code window." (verified: extension disposal stops all tunnels). The externalAssumed outcome uses cautious wording ("may be in use", not verified) and has no next step.
  • Connection settings Details now show the Kubernetes context, namespace, service:port, local port, whether the port forward was started or reused, and "Ready pod found at check time" (the ready-pod check runs before any start or reuse). Host is marked as the local end of the port forward.
  • Report redaction: new identifier kind kubeContext (placeholder context-N) in @documentdb-js/connection-diagnostics, because context names can embed account IDs (for example EKS ARNs); namespace and service were already redacted. Tests confirm no identifiers reach telemetry or the Output trace.
  • Known limitation (pre-existing, unchanged): a reused port forward is matched by source, context, namespace, service and local port, not by service port.
  • Commits: 3d5e18e6, ba52502f, 6df3937f, 13753953.
  • Case 1 checks only: npm run build, npm run l10n:check, and focused Vitest (75 files, 2,312 tests) passed. The full Case 2 suite has not been re-run since these commits.

Links

Closes #100.

Feature overview, design, decisions, and implementation history

…nd the shell on every connection failure

Co-authored-by: Copilot <[email protected]>
…n documents and shared version helpers

Co-authored-by: Copilot <[email protected]>
Follow the renamed hostnameSuffix setting in diagnostics and fixtures, and consume the updated Azure host-cloud result without misclassifying conflicting hosts. Regenerate localization after resolving the rebase conflict.

Co-authored-by: Copilot <[email protected]>
…(WI-29)

Adds the dns.mixedHostDomains warning to the Server address (DNS) step,
for Microsoft Entra ID and managed identity connections only. It
classifies the hosts the driver contacts (seeds, the SRV name and its
resolved targets) with getAzureHostSuffix and the trusted
documentDB.customEnvironment.hostnameSuffix, and warns when they span
two built-in clouds, or one built-in cloud plus unrecognized names
(IP literals included). Hosts that are all unrecognized do not warn.

The package DNS check is wrapped, and the finding is attached once, to
the first host DNS resolves. It only turns a pass into a warning, so
blocking, the headline and later checks are unchanged. Finding data and
telemetry carry counts and cloud enums only, and the panel shows the
finding without a host.

Reason: #1050 review finding E2. The resolver itself is unchanged.

Co-authored-by: Copilot <[email protected]>
- `StatusListItem` gains an optional `aside`: a short value, such as a
  duration badge, at the end of the label line. It keeps its line while
  the label wraps and does not make the row taller.
- `StatusList` gains `highlightRowsOnHover`: the row under the pointer,
  and the row whose control has keyboard focus, is shaded with the
  subtle `colorNeutralBackground2`, with an outline in high contrast.
  The layout does not move. Off by default.
- README sections, changelog (folded into the unreleased 1.3.0) and tests.

Co-authored-by: Copilot <[email protected]>
- srv-resolver: the new `SRV_FALLBACK_ELIGIBLE_ERROR_CODES` export is a
  feature, so the unreleased version is 1.1.0 rather than 1.0.1. The
  changelog names the export and the README lists it.
- connectivity-troubleshooter: depends on srv-resolver ^1.1.0; its
  changelog describes the package as it is, not yet published.

Co-authored-by: Copilot <[email protected]>
… Details (WI-30, WI-31, WI-33)

- Every settled row that ran shows its real duration in a squared outline
  badge at the end of its label line, with no rating and no total; the
  list shades the row under the pointer so the badge stays tied to it.
  A row's duration is the wall-clock span of its checks, never a sum.
- Details give each host's time ("Took ...") only when a row has two or
  more hosts, and each TCP address's connect time ("... in 31 ms",
  "... after 2 ms") only when a host made two or more attempts.
- The Authentication line names the password mechanism
  ("Username and password · SCRAM-SHA-256 · user"); the Secure
  connection line names no TLS version, Details show "TLS 1.3".
- The ping and durations are formatted for the locale.
- A Copy summary share item was built and reverted (WI-32).
- Decision 0050, design, README and implementation log updated.

Co-authored-by: Copilot <[email protected]>
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

✅ CI passed: standard tier (ready PR)

Commit 0086095, 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.
No full run yet.

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

Sizes that changed by 5% or 50 KiB or more against main (warning only):

Graph PR Base Delta Delta %
Activation (mainStartup) 3.6 MiB 3.3 MiB ⚠️ ⬆️ +218.7 KiB +6.4%
Extension host (main) 9.8 MiB 9.6 MiB ⚠️ ⬆️ +219.4 KiB +2.2%
VSIX (vsix) 8.6 MiB 8.5 MiB ⚠️ ⬆️ +78.5 KiB +0.9%
  • Activation (mainStartup), biggest package changes (approx., before minification): src/connectionDiagnostics 191.7 KiB (entered top 60), packages/documentdb-js-connection-diagnostics 104.4 KiB (entered top 60), src/webviews +23.6 KiB
  • Extension host (main), biggest package changes (approx., before minification): src/connectionDiagnostics 191.7 KiB (entered top 60), packages/documentdb-js-connection-diagnostics 104.4 KiB (entered top 60), src/webviews +23.6 KiB

Only each graph's 60 largest packages are tracked; the rest are counted as (other), so "entered/left top 60" can mean a package crossed that line, not that it was added or removed.

To find out why, compare the chunks (bytes, moduleIds) in host.json and views.json from Bundle-reports-42645745434 with the same reports from a main build.

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

All graphs (exact bytes)
Graph PR bytes Base bytes Delta bytes Delta %
Collection View page (collectionView) 6,037,190 6,036,286 ⬆️ +904 +0.0%
Document View page (documentView) 4,809,693 4,808,762 ⬆️ +931 +0.0%
Local Quick Start page (localQuickStart) 1,556,884 1,551,408 ⬆️ +5,476 +0.4%
Atlas Credentials page (atlasCredentials) 1,510,086 1,504,612 ⬆️ +5,474 +0.4%
Cluster Dashboard page (clusterDashboard) 1,551,798 1,550,863 ⬆️ +935 +0.1%
Diagnose Connection page (connectionDiagnostics) 1,532,497 n/a n/a n/a
Activation (mainStartup) 3,727,270 3,503,336 ⬆️ +223,934 +6.4%
Extension host (main) 10,254,777 10,030,062 ⬆️ +224,715 +2.2%
Playground worker (playgroundWorker) 5,397,038 5,397,017 ⬆️ +21 +0.0%
VSIX (vsix) 9,041,146 8,960,758 ⬆️ +80,388 +0.9%
playgroundTsPlugin 6,175 6,175 ✅ 0 0.0%
viewsEntry 1,457,524 1,456,593 ⬆️ +931 +0.1%
viewsAssets 80,340 80,340 ✅ 0 0.0%
editorWorker 259,528 259,528 ✅ 0 0.0%
jsonWorker 389,389 389,389 ✅ 0 0.0%

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

Updated in place on every run.

…planation (RN-1)

ConnectionDiagnosticsService and its providers become ErrorExplanationService
and *ErrorExplainer, so the layer no longer shares a name with the connection
diagnostics feature. Telemetry follows: errorExplanation.explained with
explanationProviderId and explanationSource.

Co-authored-by: Copilot <[email protected]>
…nostics (RN-2)

Moves the package to packages/documentdb-js-connection-diagnostics
(@documentdb-js/connection-diagnostics), src/troubleshooter to
src/connectionDiagnostics, the webview to
src/webviews/documentdb/connectionDiagnostics and the command to
src/commands/diagnoseConnection. Paths and the package name only;
identifiers, IDs and prose follow in later items.

Co-authored-by: Copilot <[email protected]>
…(RN-3)

runTroubleshooter becomes runDiagnostics and the Troubleshooter* types and
errors become Diagnostics*. Consumers in the extension follow, including
the error-name allowlist in the output trace.

Co-authored-by: Copilot <[email protected]>
…ection diagnostics (RN-4)

Renames the extension's own troubleshooter identifiers, comments, JSDoc
and test titles (for example runConnectionDiagnostics,
openConnectionDiagnostics, DiagnosticsOutputTrace, diagnoseConnection).
Wire and persisted IDs are unchanged here.

Co-authored-by: Copilot <[email protected]>
…agnostics (RN-5)

Telemetry events become diagnoseConnection.run and
diagnoseConnection.runStarted with diagnosticsSessionId and
diagnosticsRunCorrelationId; the webview, router, panel view type,
survey activation source, SRV surface and error-explanation source become
connectionDiagnostics. The L2-dev harness, scenarios and fixtures follow.

Co-authored-by: Copilot <[email protected]>
…pied port (F4)

A diagnosis joining an interactive start that chose "Use existing" now
fails with LocalPortInUseError instead of inheriting externalAssumed.
Adds a TDD contract test for the mixed-policy join.

Co-authored-by: Copilot <[email protected]>
Regenerate the localization bundle and apply repository formatting so the diagnostics PR passes the static CI gate.

Co-authored-by: Copilot <[email protected]>
…ings

Name Kubernetes port-forward outcomes and update the ready-state summary in Connection settings.
Refs #1069

Co-authored-by: Copilot <[email protected]>
…be context

Report Kubernetes forwarding details in diagnostics and redact kube context identifiers.
Refs #1069

Co-authored-by: Copilot <[email protected]>
Document Kubernetes port-forward reporting and the related connection settings details.
Refs #1069

Co-authored-by: Copilot <[email protected]>
Sync localized diagnostics strings for Kubernetes port-forward reporting.
Refs #1069

Co-authored-by: Copilot <[email protected]>
@guanzhousongmicrosoft
Guanzhou Song (guanzhousongmicrosoft) merged commit 733f90f into main Nov 9, 2026
14 checks passed
@guanzhousongmicrosoft
Guanzhou Song (guanzhousongmicrosoft) deleted the dev/tnaum/connectivity-troubleshooter branch November 9, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

3 participants