[FEATURE REQUEST] Expose read consistency in DaprClient.get_state
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 76/100
Research direction
Start with synchronous request construction in dapr/clients/grpc/client.py around line 703 and the asynchronous path in dapr/aio/clients/grpc/client.py around line 641. Compare the GetStateRequest fields with the existing state-consistency handling, then verify both public get_state() paths preserve existing defaults and encode the selected consistency in the dedicated protobuf field.
Written by the indexing model from the issue text.
Description
Describe the feature
Please expose an optional read-consistency argument on both synchronous and asynchronous DaprClient.get_state(), preserving existing defaults and positional arguments.
I encountered this while investigating DaprSession in the OpenAI Agents SDK. Selecting strong consistency passes state_metadata={"consistency": "strong"} to the Dapr client, but that only populates request metadata. It does not set the dedicated GetStateRequest.consistency field.
Current behavior
With dapr==1.16.0, both public methods have the arguments store_name, key, state_metadata, and metadata (gRPC call metadata). The same limitation remains in the inspected current source at e4ad1818079c5089814e4d1610b585286d28b98f:
Both construct the request as:
req = api_v1.GetStateRequest(store_name=store_name, key=key, metadata=state_metadata)
Reproduction evidence
Using the installed asynchronous Dapr client and a local grpc.aio capture server implementing DaprServicer.GetState and SaveState, I exercised public DaprSession.get_items() and add_items() with consistency=DAPR_CONSISTENCY_STRONG. The client HTTP readiness check was disabled only for this isolated mock-server test; protobuf serialization and gRPC transport used the actual Dapr client.
The captured read request was:
{
"store_name": "statestore",
"key": "session-strong:messages",
"consistency_enum_value": 0,
"consistency_name": "CONSISTENCY_UNSPECIFIED",
"metadata": {"consistency": "strong"}
}
The corresponding write request correctly carried options.consistency = CONSISTENCY_STRONG. This establishes the request-encoding difference; it does not demonstrate stale reads against a real state store. The wire capture exercised the async path; the sync-path observation is from source inspection.
Expected behavior and scope
Allow callers to request Consistency.strong or Consistency.eventual through the public get_state() API and serialize that choice into the dedicated protobuf field. Omitting the new argument should preserve CONSISTENCY_UNSPECIFIED. Actual guarantees remain dependent on state-store support.
This request is limited to get_state(): the inspected GetBulkStateRequest does not have a corresponding consistency field.
Release Note
RELEASE NOTE: ADD Optional read-consistency selection for synchronous and asynchronous DaprClient.get_state().
- Dominant language
- Python
- Stars
- 272
- Forks
- 152
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dapr/python-sdk
-
dapr-ext-workflow good first issue kind/enhancement P2
Difficulty 2/5 1-2 days Newbie friendliness 72/100
dapr/python-sdk#853 · 4 comments ·
-
feature-request
Difficulty 3/5 1-2 days Newbie friendliness 76/100
dapr/python-sdk#1214 ·
-
dapr-ext-workflow kind/enhancement
Difficulty 3/5 1-2 days Newbie friendliness 78/100
dapr/python-sdk#1213 ·
-
dapr-ext-workflow kind/enhancement
Difficulty 3/5 1-2 days Newbie friendliness 58/100
dapr/python-sdk#1188 ·
-
dapr-ext-workflow kind/enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
dapr/python-sdk#1181 · 1 assignee ·
Similar issues
-
essnmx good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
[Feature] 奇物选择添加优先级 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Giskard-AI/giskard-oss#2840 · 1 comment ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Openarea: repo bug perceived difficulty: 2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yeti-platform/yeti#1380 ·