Add instance ID prefix orchestration queries - #251
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: abe44a4b-db94-4661-bb3b-2d7dd30b1e78
There was a problem hiding this comment.
Pull request overview
Adds a new public query filter to the core SDK to allow querying orchestrations by an instance ID prefix, wiring it through gRPC request serialization and validating behavior via tests and changelog documentation.
Changes:
- Added
OrchestrationQuery.instance_id_prefixas a public filter option. - Serialized the new filter to
InstanceQuery.instanceIdPrefixinbuild_query_instances_req. - Added tests for serialization and in-memory backend filtering; documented the new API in
CHANGELOG.md.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/durabletask/test_batch_actions.py | Adds orchestration query-by-prefix test and serialization regression test. |
| durabletask/internal/client_helpers.py | Populates InstanceQuery.instanceIdPrefix from OrchestrationQuery.instance_id_prefix. |
| durabletask/client.py | Extends the public OrchestrationQuery dataclass with instance_id_prefix. |
| CHANGELOG.md | Documents the new user-facing query filter under ## Unreleased. |
Suppressed comments (1)
durabletask/client.py:199
OrchestrationQueryis a public dataclass; insertinginstance_id_prefixin the middle changes the positional argument order, which can break callers that instantiateOrchestrationQuerypositionally. To preserve backwards compatibility, append new fields at the end of the dataclass field list.
instance_id_prefix: str | None = None
# Some backends don't respond well with max_instance_count = None, so we use the integer limit for non-paginated
# results instead.
max_instance_count: int | None = (1 << 31) - 1
fetch_inputs_and_outputs: bool = False
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Bernd Verst (berndverst)
left a comment
There was a problem hiding this comment.
Requesting changes for the positional-constructor compatibility regression. The wire mapping and query behavior otherwise look sound.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: abe44a4b-db94-4661-bb3b-2d7dd30b1e78
|
Resolves one half of #222 |
Bernd Verst (berndverst)
left a comment
There was a problem hiding this comment.
Second-pass review complete at c71cec2. The positional constructor and existing class-pattern order are preserved, both provider changelogs now cover the inherited API, and the existing protobuf field is wired through the shared sync/async request path without client-side filtering. Targeted tests, affected-file Flake8, and strict core/Functions Pyright checks pass.
Summary
instance_id_prefixtoOrchestrationQueryand serialize it toInstanceQuery.instanceIdPrefixValidation
python -m pytest tests/durabletask/test_batch_actions.pypython -m flake8 durabletaskpython -m flake8 tests/durabletask