Skip to content

Implement v1 show_history status compatibility - #245

Open
andystaples wants to merge 2 commits into
mainfrom
andystaples-fix-v1-show-history
Open

Implement v1 show_history status compatibility#245
andystaples wants to merge 2 commits into
mainfrom
andystaples-fix-v1-show-history

Conversation

@andystaples

Copy link
Copy Markdown
Contributor

Fixes #230

Summary

  • fetch orchestration history only when get_status(show_history=True) requests it
  • project Durable Task history into the compacted v1 historyEvents shape
  • honor show_input and show_history_output, including current continued-as-new history
  • preserve the no-history fast path for missing, pending, and default status queries
  • remove the completed compatibility limitation from the migration guide and changelog

Testing

  • python -m pytest tests/azure-functions-durable -m "not dts and not azurite and not functions_e2e" -q
  • python -m flake8 azure-functions-durable
  • python -m flake8 tests/azure-functions-durable
  • python -m pyright azure-functions-durable/azure/durable_functions/internal/compat/durable_orchestration_status.py azure-functions-durable/azure/durable_functions/internal/compat/history_projection.py
  • python -m pymarkdown -c .pymarkdown.json scan azure-functions-durable/MIGRATION_GUIDE.md

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a28a3fa8-303a-4a74-8fbc-8e062e39d97f
Copilot AI review requested due to automatic review settings July 29, 2026 20:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 when show_history=True and project it into v1 historyEvents, honoring show_input and show_history_output.
  • Extended DurableOrchestrationStatus to round-trip historyEvents (and accept legacy history) through from_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
Copilot AI review requested due to automatic review settings July 29, 2026 20:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • TaskScheduledEvent and SubOrchestrationInstanceCreatedEvent are projected with a Name field (from the name dataclass field), while other projected events use the v1 FunctionName key (e.g., ExecutionStarted) and merged completion events also emit FunctionName. If an orchestration is still running and has scheduled-but-not-yet-completed work, these scheduled events will surface with Name, 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 berndverst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement v1 show_history status query compatibility

3 participants