[bug-bash] Invalid command arguments return general-failure exit 1 instead of documented usage exit 2
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by reading docs/ci.md and docs/navigation.md to confirm the exit-code contract, then trace how command argument validation errors are mapped to exit codes; the issue points to ArgumentException, JsonException, CommandNotFoundException, and plain CommandException paths. Reproduce the three commands in PowerShell without a database connection. Done when missing or invalid arguments return 2 while runtime failures retain their documented classification.
由索引模型根据 Issue 内容生成。
描述
Environment
Windows x64, CosmosDBShell 1.1.291-preview (db49321323).
No database connection is required.
Repro (PowerShell)
$package = "$env:USERPROFILE\.dotnet\tools\.store\cosmosdbshell\1.1.291-preview"
$shell = Join-Path $package 'cosmosdbshell.win-x64\1.1.291-preview\tools\net10.0\win-x64\CosmosDBShell.exe'
& $shell --version
$work = Join-Path ([IO.Path]::GetTempPath()) ("cosmos-usage-" + [guid]::NewGuid().ToString("N"))
New-Item -ItemType Directory -Path $work | Out-Null
Set-Location $work
& $shell --output json -c 'echo [1] | filter'
"Exit code: $LASTEXITCODE"
Actual stderr:
{"status":"error","error":"Missing required parameter: ExpressionText"}
Actual exit code: 1.
Another example:
'[{"id":"a","pk":"a"}]' | Set-Content .\sample.json
& $shell --output json -c 'import sample.json --dry-run --concurrency 0'
"Exit code: $LASTEXITCODE"
Actual stderr:
{"status":"error","error":"Concurrency must be a positive integer."}
Actual exit code: 1.
Third exact command:
& $shell --output json -c 'echo [{"id":"a"}] | ftab --format invalid'
"Exit code: $LASTEXITCODE"
Actual stderr:
{"status":"error","error":"The -format option must be one of: default, markdown, html."}
Actual exit code: 1.
Expected
The documented exit-code contract in docs/ci.md
and docs/navigation.md assigns
code 2 to usage errors, invalid/bad arguments, and unknown options. Code 1 is
for failures that do not fit a more specific category. A missing required
parameter and an invalid concurrency argument should therefore classify as 2.
Working control
An unknown command or unknown app-level option correctly returns exit code 2.
Impact
CI wrappers cannot consistently distinguish incorrect invocation from a runtime
failure using the published exit-code contract.
Investigation lead
The current source maps ArgumentException, JsonException, and
CommandNotFoundException to usage errors. Several argument-validation paths
instead create a plain CommandException without a classified inner exception,
which falls through to general failure. This is a candidate root cause,
not a verified fix.
Reproduced against the installed release.
- 主要语言
- C#
- 星标
- 4
- 派生
- 7
- 平均合并
- 2 天 2 小时
- 30 天内合并 PR
- 24
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Azure/CosmosDBShell 的其他 Issue
-
[bug-bash] print maps a missing item's HTTP 404 to exit 1 instead of documented not-found exit 5未关闭bug bug-bash
难度 2/5 1-3 小时 新手友好度 78/100
Azure/CosmosDBShell#279 ·
维护者通常 1 天内回复
-
bug bug-bash
难度 3/5 1-2 天 新手友好度 75/100
Azure/CosmosDBShell#281 ·
维护者通常 1 天内回复
-
[bug-bash] edit and theme failures silently return exit 1 without a machine-readable stderr error未关闭bug bug-bash
难度 3/5 1-2 天 新手友好度 62/100
Azure/CosmosDBShell#278 ·
维护者通常 1 天内回复
-
bug bug-bash
难度 3/5 1-2 天 新手友好度 75/100
Azure/CosmosDBShell#277 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 35/100
Azure/CosmosDBShell#274 · 1 条评论 ·
维护者通常 1 天内回复
查看 Azure/CosmosDBShell 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
sebastienros/jint#4449 ·
维护者通常 1 天内回复
-
needs triage
难度 2/5 1-3 小时 新手友好度 63/100
spectreconsole/spectre.console#2242 ·
维护者通常 11 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
KnifeLemon/Filee#1118 ·
维护者通常 1 天内回复
-
[fullscreen]未关闭has-image has-license has-readme new-tool ready-to-approve repo-verified
难度 1/5 1 小时以内 新手友好度 68/100
shanselman/TinyToolTown#893 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100