Support undefined partition keys (PartitionKey.None) across item commands
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 15/100
調査の方向性
Start with the shared partition-key conversion that the typed parser uses, and with how mkitem and create item currently infer keys from item content. Before changing anything, reproduce the missing-key case against the emulator and check how print and patch behave. The issue leaves the shell syntax for requesting None open, so agree on that with maintainers first. Done means the acceptance criteria hold, including the warning rules and the tests that use same-id items in the None, Null, and string partitions.
索引モデルが issue の本文から書いたものです。
説明
Summary
Cosmos DB supports items whose configured partition-key property is absent. The .NET SDK represents this value with PartitionKey.None, distinct from explicit JSON null, represented by PartitionKey.Null.
Cosmos DB Shell can create and enumerate missing-key items, but no command can explicitly address their logical partition. Consequently, such items cannot be point-read, patched, replaced, transactionally updated, or reliably deleted.
This gap also applies to missing components in hierarchical partition keys. The SDK exposes PartitionKeyBuilder.AddNoneType() for this case.
Current command behavior
| Commands | Current behavior |
|---|---|
mkitem, create item |
Implicitly support create/upsert because the partition key is omitted from CreateItemAsync/UpsertItemAsync and extracted from the document. |
import |
Implicitly supports insert/upsert for the same reason. |
query |
Can discover missing-key items with NOT IS_DEFINED(c.<path>), but cannot use None as an explicit routing value. |
ls, export |
Can enumerate missing-key items through scans/queries. |
watch |
An unscoped feed can observe them; --partition-key cannot select None. |
print |
Cannot point-read an item using PartitionKey.None. PR #248 adds typed scalar and hierarchical keys but no undefined-key representation. |
patch |
Its shared typed parser has no syntax for PartitionKey.None. |
batch |
Cannot open a transactional batch for the None logical partition. |
sproc exec |
Cannot execute a stored procedure against the None logical partition. |
rm |
--partition-key cannot express None; scan-based removal skips items when a configured key path is absent. |
replace |
Rejects an item when any configured partition-key path is absent. |
No shell command currently provides explicit PartitionKey.None support.
SDK and documentation evidence
The SDK documentation defines:
PartitionKey.None: “allows creating and accessing items without a value for partition key.”PartitionKey.Null: creates and accesses items with an explicit null partition-key value.PartitionKeyBuilder.AddNoneType(): adds aNonecomponent to a hierarchical partition key.CreateItemAsyncandUpsertItemAsyncextract the partition key from the item when it is not supplied.IS_DEFINEDdistinguishes a missing property from an explicitly null property.
Microsoft's partitioning guidance recommends a stable, high-cardinality property with a value on every item. Supporting None is therefore primarily needed for legacy, transitional, and exceptional data, not as a recommended data model: partition-key guidance.
Proposed behavior
When a configured partition-key path is absent, treat it as the valid Cosmos DB value PartitionKey.None instead of rejecting or skipping the item.
Define an unambiguous shell representation for explicitly requesting None. It must remain distinct from:
- explicit JSON
null; - the strings
"none"and"undefined"; - an accidentally omitted required argument.
Warning behavior
Warning: Creating or modifying an item with an implicitly inferred
PartitionKey.Nonemust always produce a visible warning.
- Reads using
Noneare valid and must not warn. - Mutations using explicitly requested
Nonemust not warn. - Mutations using implicitly inferred
Nonemust always warn. - Bulk operations must emit one bounded summary warning with the affected item count.
Extend shared partition-key conversion to produce:
PartitionKey.Nonefor a scalar undefined key;PartitionKeyBuilder.AddNoneType()for undefined HPK components.
Commands that derive keys from item content, including mkitem, create item, import, replace, and scan-based rm, should infer None for absent paths. They must warn before or while performing mutations unless the caller explicitly acknowledged None.
Commands with explicit partition targeting, including print, patch, batch, sproc, rm, and partition-scoped watch, should accept the new explicit representation. Because these requests are intentional, they should not warn.
Acceptance criteria
- Missing scalar and hierarchical key components are converted to the SDK's
Nonerepresentation instead of being rejected or skipped. - Reads using inferred or explicit
Nonedo not warn. - Every mutation using implicitly inferred
Noneemits a warning. - Mutations using explicitly requested
Nonedo not warn. - Bulk mutations produce one bounded summary warning with an accurate item count.
- Create fixtures with the same
idin theNone,Null, and string logical partitions and prove each command addresses only the intended item. - Cover scalar and hierarchical keys with one or more missing components.
- Point-read, patch, replace, delete, batch, stored-procedure, and scoped-watch operations use the SDK's
Nonerepresentation. - Preserve literal strings resembling the chosen
Nonesentinel. - Keep omitted required arguments distinct from an explicit
Nonevalue. - Add shell parser, command, MCP schema/call, warning, and emulator integration coverage.
- Document the syntax, warning behavior, distinction from
null, and Microsoft's recommendation to use a present, stable, high-cardinality partition-key value. - Coordinate the
printimplementation with #248.
- 主要言語
- C#
- スター
- 4
- フォーク
- 7
- 平均マージ
- 2日 13分
- マージ済み PR(30日)
- 30
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Azure/CosmosDBShell のほかの issue
-
MCP session disposal throws ObjectDisposedException by accessing an expired HttpContext対応中かも @mkrueger が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
Azure/CosmosDBShell#249 ·
メンテナーはふだん 2 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
Azure/CosmosDBShell#240 ·
メンテナーはふだん 2 日以内に返信
-
automation P1
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
Azure/CosmosDBShell#178 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Lightweight headless CI distribution (no MCP, LSP, interactive UI)再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンautomation P1
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
Azure/CosmosDBShell#175 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
agentic enhancement P0
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
Azure/CosmosDBShell#153 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
Azure/CosmosDBShell の issue をすべて見る
似ている issue
-
area-signalr
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
dotnet/aspnetcore#69842 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 2 日以内に返信
-
bug needs-triage
難易度 2/5 1時間未満 初心者へのやさしさ 78/100
microsoft/microsoft-ui-reactor#1373 ·
メンテナーはふだん 1 日以内に返信
-
Client customer-reported KeyVault needs-team-attention question Service Attention
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Azure/azure-sdk-for-net#63861 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
:watch: Not Triaged dotnet-csharp/svc fundamentals/subsvc
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信