Skip to content

Implement v1 show_history status compatibility - #245

Merged
berndverst merged 6 commits into
mainfrom
andystaples-fix-v1-show-history
Jul 30, 2026
Merged

Implement v1 show_history status compatibility#245
berndverst merged 6 commits into
mainfrom
andystaples-fix-v1-show-history

Conversation

@andystaples

@andystaples andystaples commented Jul 29, 2026

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
  • document that the shared gRPC history protocol exposes structured FailureDetails, but not the independent v1-only Reason and Details fields

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.

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 30, 2026 16:05
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a28a3fa8-303a-4a74-8fbc-8e062e39d97f

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 10 out of 10 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/durable_orchestration_status.py:156

  • The history property docstring says history is populated only when show_history=True is passed to get_status, but from_json() can also populate history when historyEvents / legacy history is present. This makes the doc misleading for callers who reconstruct a status from JSON.
    def history(self) -> Optional[list[Any]]:
        """Get the execution history.

        The history is populated only when requested by passing
        ``show_history=True`` to the client's compatibility ``get_status`` API.
        """

Copilot AI review requested due to automatic review settings July 30, 2026 16:10

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 10 out of 10 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

CHANGELOG.md:45

  • Wrapped changelog bullet lines should not be indented; this entry is inconsistent with other wrapped bullets in this file (e.g., the next item continues at column 1).
- Failed task and sub-orchestration history events now retain the host-provided
  failure `reason` and redacted `details` alongside structured failure details.

azure-functions-durable/CHANGELOG.md:37

  • Wrapped changelog bullet lines should not be indented; most wrapped bullets in this changelog continue at column 1 (for example, the next item’s continuation line starts with header.).
- The v1-compatible `get_status()` API now supports `show_history` and
  `show_history_output`, including compacted `historyEvents` output without an
  additional history request when history is not requested.

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 30, 2026 16:40

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/durable_orchestration_status.py:156

  • The history property docstring is now inaccurate: history can also be populated when reconstructing a status via from_json() (it reads historyEvents/legacy history), not only via get_status(show_history=True). This can mislead callers relying on JSON round-trips.
        """Get the execution history.

        The history is populated only when requested by passing
        ``show_history=True`` to the client's compatibility ``get_status`` API.
        """

Copilot AI review requested due to automatic review settings July 30, 2026 17:15

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

  • When compacting sub-orchestration events, the scheduled SubOrchestrationInstanceCreatedEvent entry is removed and its instance_id is not copied onto the corresponding *Completed/*Failed event. This drops InstanceId from the projected v1 historyEvents, making sub-orchestration entries harder to correlate with child instances and diverging from the v1 history shape (which includes the child instance id on these events).
    scheduled_index, scheduled_event = scheduled
    item["ScheduledTime"] = _format_datetime(scheduled_event.timestamp)
    item["FunctionName"] = scheduled_event.name
    if show_input and scheduled_event.input is not None:
        item["Input"] = scheduled_event.input
    removed_indexes.add(scheduled_index)

@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.

The unsafe failure-field synthesis has been removed, the shared gRPC protocol boundary is now explicitly documented and tested, and no actionable issues remain at this head.

@berndverst
berndverst merged commit 61f672c into main Jul 30, 2026
25 checks passed
@berndverst
berndverst deleted the andystaples-fix-v1-show-history branch July 30, 2026 20:21
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