Recommend and install/update the Azure Cosmos DB Shell - #3204
Draft
Mike Krüger (mkrueger) wants to merge 1 commit into
Draft
Recommend and install/update the Azure Cosmos DB Shell#3204Mike Krüger (mkrueger) wants to merge 1 commit into
Mike Krüger (mkrueger) wants to merge 1 commit into
Conversation
Add an engagement-gated recommendation to install the Cosmos DB Shell, plus an Install/Update entry point surfaced from settings and the command palette. Reuses the existing dotnet-tool install/launch pipeline, masks all sensitive launch context, and adds an opt-out setting.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a proactive, engagement-gated recommendation to install Azure Cosmos DB Shell and introduces an explicit “Install or Update Azure Cosmos DB Shell” command (plus a settings link), while reusing the existing dotnet tool pipeline and strengthening masking to avoid leaking sensitive launch context.
Changes:
- Records Cosmos DB “engagement” (open document / run query) and conditionally shows a non-modal, rate-limited Shell recommendation with telemetry.
- Adds an explicit install-or-update entry point that updates via
dotnet tool updatewhen the Shell is already installed and no custom Shell path is configured. - Improves privacy hygiene by reducing sensitive output and expanding
valuesToMaskfor Shell launch/connect flows.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/panels/trpc/routers/queryEditorRouter.ts | Records “runQuery” engagement to gate the proactive Shell recommendation. |
| src/cosmosDBShell/recommendation/shellRecommendation.ts | Implements the recommendation gating/state machine + shown/clicked telemetry. |
| src/cosmosDBShell/recommendation/shellRecommendation.test.ts | Adds unit tests covering gating, suppression/cooldown, de-dupe, and telemetry behavior. |
| src/cosmosDBShell/install/installPrompts.ts | Extends install pipeline to support update flow and adds an explicit install/update entry point. |
| src/cosmosDBShell/CosmosDBShellExtension.ts | Registers the new command and expands masking while reducing sensitive output logging. |
| src/cosmosDBShell/constants.ts | Adds command/setting IDs and persisted globalState keys for recommendation state. |
| src/commands/openDocument/openDocument.ts | Records “openDocument” engagement to gate the proactive Shell recommendation. |
| package.nls.json | Adds localized command title, settings markdown link, and new recommendation setting description. |
| package.json | Contributes the new command and adds the new setting; switches Shell path to markdownDescription. |
| l10n/bundle.l10n.json | Updates extracted localization strings for new prompts/actions. |
Comment on lines
50
to
54
| telemetryContext.errorHandling.suppressDisplay = true; | ||
| telemetryContext.errorHandling.rethrow = false; | ||
| telemetryContext.telemetry.properties.verb = verb; | ||
| telemetryContext.telemetry.properties.dotnetPathProvided = String(!!dotnetPath); | ||
| const startedAt = Date.now(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the PRD "Recommend Azure Cosmos DB Shell from the VS Code Extension." It adds:
cosmosDB.shell.pathsetting description.Both paths reuse the existing
dotnet toolinstall/launch pipeline rather than introducing a new multi-OS install matrix. The recommendation is opt-out via a new setting, is capped so it can't nag, and never emits PII/EUII.Requirements met
Functional
recordCosmosShellEngagementAndMaybeRecommend('openDocument' | 'runQuery')isCosmosDBShellInstalled()wasShownInSession+ persisted impression countRECOMMENDATION_STATE_LATER_UNTILcooldownl10n.t()/package.nls.jsonCOMMAND_LAUNCH_COSMOS_DB_SHELLcontext.valuesToMaskfor endpoint, DB/container ids, credentials, tenant/MI ids, custom pathcosmosDB.shell.recommendation.enabled(defaulttrue)ms-azuretools.vscode-cosmosdb.shellRecommendation"scope": "application"(globally managed via user settings). A true namedextensionConfigurationPolicylives in VS Codeproduct.jsonand isn't available to a third-party extension.recommendation.shown,recommendation.clicked, plus install/update tool + prompt eventsSecurity / Privacy (SR1–SR5)
context.valuesToMask(non-empty guards).dotnet toolcommand already used by the extension; the resolved binary path is not echoed.Accessibility (AX1–AX2)
How install / update works now (user scenarios)
Scenario A — Shell not installed, user is exploring Cosmos DB
dotnet tool install --global CosmosDBShell --prereleasepipeline (with .NET SDK-missing fallback prompts), then launches the Shell.Scenario B — Explicit "Install or Update Azure Cosmos DB Shell" (Command Palette, or the button in the
cosmosDB.shell.pathsetting)dotnet tool update --global CosmosDBShell --prereleaseand refreshes install detection.cosmosDB.shell.pathconfigured → informs the user that automatic updates are unavailable for a custom path and offers a Settings shortcut (it won't touch the user-managed binary).refreshCosmosDBShellSupport()invalidates the support cache and updates thevscodeDatabases.cosmosDBShellSupportEnabledcontext so the UI reflects the new state immediately.Scenario C — Launch Shell command
Tests
src/cosmosDBShell/recommendation/shellRecommendation.test.tscovering the engagement threshold, installed/disabled gating, suppression + cooldown, lifetime-cap auto-suppress, concurrent de-dup, Later cooldown + impression reset, and dismissal.npm run build,npm run lint,npm run prettier-fix, andnpm run l10nall pass.Open item