fix(cosmos): enforce partition isolation for point reads and deletes - #296
Open
thomhurst wants to merge 3 commits into
Open
fix(cosmos): enforce partition isolation for point reads and deletes#296thomhurst wants to merge 3 commits into
thomhurst wants to merge 3 commits into
Conversation
|
| Filename | Overview |
|---|---|
| src/main/java/io/floci/az/services/cosmos/CosmosHandler.java | Constrains partition-scoped point lookups to documents matching both the requested logical partition and complete document ID. |
| src/test/java/io/floci/az/services/cosmos/CosmosPointPartitionTest.java | Adds focused regressions for cross-partition access, typed partition values, numeric equivalence, and delimiter-related ID suffixes. |
| compatibility-tests/sdk-test-dotnet/CosmosPointPartitionCompatibilityTests.cs | Verifies partition-isolated reads and deletes through the real .NET Cosmos SDK. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Point read or delete] --> B{Partition header present?}
B -- No --> C[Legacy unscoped lookup]
B -- Yes --> D[Parse logical partition]
D --> E[Exact storage-key lookup]
E --> F{ID and logical partition match?}
F -- Yes --> G[Return or delete document]
F -- No --> H[Scan container candidates]
H --> I{Whole ID and partition match?}
I -- Yes --> G
I -- No --> J[Return 404]
Reviews (3): Last reviewed commit: "fix(cosmos): require complete document I..." | Re-trigger Greptile
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.
Point reads and deletes can return or delete a same-ID document from another partition after an exact storage-key miss. The storage key also stringifies partition values, so null and an empty string, or numbers and strings, can cross-match even on an exact-key hit.
Make explicit partition headers authoritative by validating candidate documents with the existing logical partition predicate. Keep the exact-key fast path, and constrain any fallback to matching partition values. Equivalent numeric representations such as 42 and 42.0 continue to match. Headerless requests retain their existing unscoped behavior.
Validation:
The pre-existing string-based storage key encoding still needs separate work to support creating the same ID simultaneously under colliding typed partition values. This PR protects point-operation scope without redesigning persisted keys.