Implement v1 show_history status compatibility - #245
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a28a3fa8-303a-4a74-8fbc-8e062e39d97f
There was a problem hiding this comment.
Pull request overview
Implements full v1-compatible get_status(show_history=...) behavior in the Azure Functions Durable provider by conditionally fetching Durable Task history and projecting it into the v1 historyEvents shape, while preserving the existing fast path when history isn’t requested or isn’t available.
Changes:
- Updated compatibility
get_status()to fetch history only whenshow_history=Trueand project it into v1historyEvents, honoringshow_inputandshow_history_output. - Extended
DurableOrchestrationStatusto round-triphistoryEvents(and accept legacyhistory) throughfrom_json()/to_json(). - Updated docs/changelog to remove the “ignored show_history flags” limitation and note the new support.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/azure-functions-durable/test_durable_orchestration_status_compat.py | Adds JSON round-trip tests for historyEvents and legacy history acceptance. |
| tests/azure-functions-durable/test_client_compat.py | Adds async tests validating history fetch gating, projection, and output/input suppression behavior. |
| azure-functions-durable/MIGRATION_GUIDE.md | Removes the prior limitation note about ignored show_history flags. |
| azure-functions-durable/CHANGELOG.md | Documents the new v1 get_status() history support and removes the known-limitation entry. |
| azure-functions-durable/azure/durable_functions/internal/compat/history_projection.py | Introduces the Durable Task → v1 historyEvents projection logic. |
| azure-functions-durable/azure/durable_functions/internal/compat/durable_orchestration_status.py | Adds history storage/serialization support to the status wrapper. |
| azure-functions-durable/azure/durable_functions/client.py | Wires show_history into get_status() with conditional history retrieval and projection. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a28a3fa8-303a-4a74-8fbc-8e062e39d97f
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
azure-functions-durable/azure/durable_functions/internal/compat/history_projection.py:101
TaskScheduledEventandSubOrchestrationInstanceCreatedEventare projected with aNamefield (from thenamedataclass field), while other projected events use the v1FunctionNamekey (e.g.,ExecutionStarted) and merged completion events also emitFunctionName. If an orchestration is still running and has scheduled-but-not-yet-completed work, these scheduled events will surface withName, which is inconsistent with the rest of the v1 history shape and makes consumers handle two keys for the same concept.
if isinstance(
event,
(history.TaskScheduledEvent,
history.SubOrchestrationInstanceCreatedEvent)):
item.pop("Version", None)
berndverst
left a comment
There was a problem hiding this comment.
One blocking v1 compatibility issue remains in failed activity and sub-orchestration history projection.
| def _serialize(value: Any) -> Any: | ||
| if isinstance(value, datetime): | ||
| return _format_datetime(value) | ||
| if isinstance(value, task.FailureDetails): |
There was a problem hiding this comment.
Compatibility: For TaskFailedEvent and SubOrchestrationInstanceFailedEvent, this emits only nested FailureDetails, while the v1 history contract exposes top-level Reason and Details. A migrated status viewer reading those established keys will fail exactly when an activity or child orchestration fails. Preserve the legacy fields through the history protocol/model (without bypassing the host's details-redaction behavior), emit them here alongside structured details, and add failed-event parity tests.
Fixes #230
Summary
get_status(show_history=True)requests ithistoryEventsshapeshow_inputandshow_history_output, including current continued-as-new historyTesting
python -m pytest tests/azure-functions-durable -m "not dts and not azurite and not functions_e2e" -qpython -m flake8 azure-functions-durablepython -m flake8 tests/azure-functions-durablepython -m pyright azure-functions-durable/azure/durable_functions/internal/compat/durable_orchestration_status.py azure-functions-durable/azure/durable_functions/internal/compat/history_projection.pypython -m pymarkdown -c .pymarkdown.json scan azure-functions-durable/MIGRATION_GUIDE.md