[bug-bash] print maps a missing item's HTTP 404 to exit 1 instead of documented not-found exit 5
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Bắt đầu với PrintCommand.PrintItemAsync và nhánh NotFound của ReadItemStreamAsync, sau đó theo dõi cách ShellExitCode ánh xạ lỗi lệnh sang mã thoát. Kiểm tra quy ước mã thoát được ghi trong tài liệu và các bài kiểm thử gần đó cho thao tác đọc từng mục. Công việc hoàn tất khi mục không tồn tại vẫn hiển thị thông báo lỗi dễ hiểu và trả về mã thoát 5.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment
Windows x64, CosmosDBShell 1.1.291-preview (db49321323).
Verified on a disposable container with partition key /pk, using an authorized
Azure CLI identity and Gateway connection mode.
Repro
The following creates a unique disposable shared-throughput database (400 RU/s)
and an empty container. Supply an authorized Azure NoSQL account using these
environment variables; no real endpoint or identity is included in this report:
# Set COSMOS_ENDPOINT, AZURE_SUBSCRIPTION_ID and COSMOS_RESOURCE_GROUP first.
foreach ($name in @('COSMOS_ENDPOINT', 'AZURE_SUBSCRIPTION_ID', 'COSMOS_RESOURCE_GROUP')) {
if ([string]::IsNullOrWhiteSpace([Environment]::GetEnvironmentVariable($name))) {
throw "Set $name to an authorized test account value before continuing."
}
}
$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
$connection = @(
'--connect', $env:COSMOS_ENDPOINT,
'--connect-azure-cli', '--connect-mode', 'gateway',
'--connect-subscription', $env:AZURE_SUBSCRIPTION_ID,
'--connect-resource-group', $env:COSMOS_RESOURCE_GROUP,
'--output', 'json', '--quiet'
)
$db = 'BugBash_Print_' + [guid]::NewGuid().ToString('N')
& $shell @connection -c "mkdb $db --scale=m --ru=400"
if ($LASTEXITCODE -ne 0) { throw 'Fixture database creation failed; stop.' }
& $shell @connection --database $db -c 'mkcon Items /pk'
if ($LASTEXITCODE -ne 0) { throw 'Fixture container creation failed; stop.' }
# Exact failing command. The new container is empty, so this item cannot exist.
& $shell @connection --database $db --container Items -c 'print absent p1'
$readExit = $LASTEXITCODE
"Observed exit code: $readExit"
Actual: Observed exit code 1. Expected: 5.
Expected
A point read that returns HTTP 404 maps to not-found exit code 5, as documented
in the CLI's exit-code contract.
Actual
The command returns exit code 1, with a JSON stderr error saying the item was
not found and suggesting the partition key be verified.
Observed direct live reproduction:
print absent p1
stderr:
{"status":"error","error":"Item with id 'absent' not found using partition key 'p1'. Verify the partition key value is correct."}
Also reproduced for an item correctly absent after atomic batch rollback, and
after a successful explicit item deletion. This is an exit-code classification
bug, not a batch rollback or item deletion failure.
Cleanup
Delete only the database created by the commands above:
& $shell @connection -c "rmdb $db true"
Investigation lead
PrintCommand.PrintItemAsync uses ReadItemStreamAsync. Its explicit NotFound
branch throws a plain CommandException without preserving the HTTP status or
an SDK exception. ShellExitCode therefore cannot recognize the original 404
and falls back to general failure.
The fix should preserve the useful friendly error message while retaining the
original status classification. No fix has been implemented.
- Ngôn ngữ chính
- C#
- Star
- 4
- Fork
- 7
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 23
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Azure/CosmosDBShell
-
[bug-bash] Sequential script commands leak their result into rm as implicit pipe inputCó thể đã có người làm @mkrueger đã nhận 1 ngày trước. Đang mởbug bug-bash
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 75/100
Azure/CosmosDBShell#281 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[bug-bash] Invalid command arguments return general-failure exit 1 instead of documented usage exit 2Có thể đã có người làm @mkrueger đã nhận 1 ngày trước. Đang mởbug bug-bash
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Azure/CosmosDBShell#280 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[bug-bash] edit and theme failures silently return exit 1 without a machine-readable stderr errorCó thể đã có người làm @mkrueger đã nhận 1 ngày trước. Đang mởbug bug-bash
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
Azure/CosmosDBShell#278 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[bug-bash] Multi-statement -c and piped stdin silently drop intermediate output and file redirectionsCó thể đã có người làm @mkrueger đã nhận 1 ngày trước. Đang mởbug bug-bash
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 75/100
Azure/CosmosDBShell#277 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Connection to mcp failed?Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Azure/CosmosDBShell#274 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Azure/CosmosDBShell
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
Unity-Technologies/unity-agent-plugin#118 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
The Recommended preset turns on Import Uno DSP, which only works with the Material themeCó thể đã có người làm @agneszitte đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
unoplatform/uno.templates#2388 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
eyalgolan/statecraft-israel#2732 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
変換の候補のどれが Zenzai の答えか分からないĐang mở要トリアージ
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
kind/chore status/draft
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Altinn/altinn-events#1158 ·
Maintainer thường phản hồi trong vòng 1 ngày