Repository navigation
Add --dry-run preview to throughput write subcommands - #166
Merged
Merged
Conversation
throughput set/manual/autoscale now accept --dry-run to preview the current vs. planned mode and RU/s without applying the change or prompting for confirmation. Structured JSON (current/planned) plus an interactive table. First slice of dry-run mode (G1).
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a --dry-run preview mode to the throughput write subcommands so automation and users can see the current vs. intended throughput configuration before making a billable change. This fits the CosmosDBShell CLI’s pattern of providing structured JSON results (for MCP/automation) while keeping interactive output human-friendly.
Changes:
- Adds
--dry-runhandling tothroughput set|manual|autoscaleto compute and return a “current vs. planned” preview without performing writes or prompting. - Extends localization strings and command documentation to describe the new option and its output.
- Adds unit tests ensuring
--dry-runstill enforces RU validation and fails cleanly when disconnected.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| docs/commands.md | Documents --dry-run for throughput write subcommands and adds an example. |
| CosmosDBShell/lang/en.ftl | Adds localized option/help text and labels for the dry-run preview table. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.Commands/ThroughputCommand.cs | Implements --dry-run plan generation and interactive preview output for throughput writes. |
| CosmosDBShell.Tests/CommandTests/ThroughputCommandTests.cs | Adds coverage for dry-run RU validation and disconnected behavior. |
| CHANGELOG.md | Adds an Unreleased entry describing the new --dry-run feature. |
Code Coverage OverviewLanguages: C# C# / code-coverage/dotnetThe overall coverage in the Show a code coverage summary of the most impacted files.
Updated |
Dmitrii Shilov (bk201-)
approved these changes
Jul 9, 2026
Mike Krüger (mkrueger)
added a commit
that referenced
this pull request
Jul 9, 2026
…, delete) (#167) ## Summary Adds `--dry-run` preview support to the destructive delete commands, extending the dry-run pattern already used by `import` (and, in #166, `throughput`). This is a scoped slice of the broader dry-run work tracked in #156. When `--dry-run` is supplied, the command reports what it *would* delete and makes no changes: - **`rm --dry-run`** — runs the same pattern match/pipe evaluation but issues no `DeleteItemAsync` calls, then reports how many items matched. - **`rmcon --dry-run`** — locates the target container and reports it without confirming or deleting. - **`rmdb --dry-run`** — locates the target database and reports it without confirming or deleting. - **`delete <type> ... --dry-run`** — forwards the flag to the routed `rm` / `rmcon` / `rmdb` command. No confirmation prompt is shown in dry-run mode and no writes occur. ## Changes - `RmCommand`, `RmContainerCommand`, `RmDbCommand`, `DeleteCommand`: new `--dry-run` option and preview branches (`delete` forwards the flag). - `lang/en.ftl`: new `command-*-description-dry-run` and `command-*-dry-run-plan` strings (the `rm` plan honours the existing `{ $count }` plural form). - `docs/commands.md`: documented `--dry-run` for `rm`, `rmcon`, `rmdb`, and `delete`. - `CHANGELOG.md`: added an Unreleased entry. - Tests: offline dry-run tests for `rm`, `rmdb`, and `delete` (validation still applies, disconnected still throws, dry-run localization keys resolve). ## Validation - `dotnet build` — both projects build clean. - `dotnet test` — 38 affected tests pass (RmCommand, RmDbCommand, DeleteCommand, HelpCommandVerification, LocalizationKeyAudit). ## Notes - Cost-delta ($) estimation is out of scope; deletes have no throughput contract to preview. - Relates to #156. Companion to #166 (throughput `--dry-run`).
…ut-dry-run # Conflicts: # CHANGELOG.md
Dmitrii Shilov (bk201-)
approved these changes
Jul 9, 2026
This was referenced Jul 9, 2026
Closed
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.
What
Adds a
--dry-runoption to thethroughputwrite subcommands (set/manual/autoscale). With--dry-run, the command reads the current provisioned throughput and reports the current vs. planned mode and RU/s — then stops, performing no write and requiring no confirmation.This is a first, contained slice of dry-run mode (item G1, #156), scoped to
throughput. It also addresses the "preview before a billable change" gap called out in C1 (#164).Part of #156
Part of #164
Why
Throughput changes are billable. Today the only safety net is an interactive confirmation prompt, which is skipped in non-interactive contexts (MCP, scripts, piped input).
--dry-runlets agents and automation preview the exact effect of a scaling change before committing to it.Behavior
dryRun: truepluscurrentandplannedblocks (mode, throughput, autoscaleMaxThroughput, minThroughput).... --dry-run > out.json) likethroughput show.Scope / non-goals
throughputfor now — full global--dry-runacross all mutating commands remains tracked in G1. Dry-run mode #156.Tests
ThroughputCommandTestscovering:--dry-runstill enforces missing-RU and below-minimum validation acrossset/manual/autoscale, and dry-run on a disconnected shell throwsNotConnectedException.Docs
docs/commands.md— documents the--dry-runoption, behavior, and an example.CHANGELOG.md— Unreleased entry.Validation
dotnet build CosmosDBShell/CosmosDBShell.csproj✅dotnet build CosmosDBShell.Tests/CosmosDBShell.Tests.csproj✅