[bug-bash] print maps a missing item's HTTP 404 to exit 1 instead of documented not-found exit 5
Maintainer antworten meist innerhalb von 1 Tag
Ein zugehöriger Pull Request wurde bereits gemerged.
- #288 von @mkrueger — gemerged
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 78/100
Rechercherichtung
Beginne mit PrintCommand.PrintItemAsync und seinem ReadItemStreamAsync-NotFound-Zweig und verfolge dann, wie ShellExitCode Befehlsfehler Exitcodes zuordnet. Prüfe den dokumentierten Exitcode-Vertrag und die benachbarten Tests für einzelne Lesezugriffe. Fertig ist es, wenn bei einem fehlenden Element weiterhin die verständliche Fehlermeldung ausgegeben und Exitcode 5 zurückgegeben wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- C#
- Sterne
- 4
- Forks
- 7
- Ø Merge
- 1 T. 15 Std.
- Gemergte PRs (30 T.)
- 33
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus Azure/CosmosDBShell
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
Azure/CosmosDBShell#274 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
Azure/CosmosDBShell#265 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
Azure/CosmosDBShell#240 ·
Maintainer antworten meist innerhalb von 1 Tag
-
automation P1
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 45/100
Azure/CosmosDBShell#178 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Lightweight headless CI distribution (no MCP, LSP, interactive UI)Evtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offenautomation P1
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
Azure/CosmosDBShell#175 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in Azure/CosmosDBShell
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
NethermindEth/nethermind#15684 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area/ai-assistant squad/flyt
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
Altinn/altinn-studio#21798 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
arastella625/DAORework#181 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
BEagle1984/silverback#280 ·
-
bug P1
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
endercodezz/BYDLO#417 ·
Maintainer antworten meist innerhalb von 1 Tag