Skip to content

Fix FailureDetails JSON serialization and cut v1.7.2#172

Merged
berndverst merged 1 commit into
microsoft:mainfrom
andystaples:andystaples/fix-failure-details-serialization
Jul 9, 2026
Merged

Fix FailureDetails JSON serialization and cut v1.7.2#172
berndverst merged 1 commit into
microsoft:mainfrom
andystaples:andystaples/fix-failure-details-serialization

Conversation

@andystaples

Copy link
Copy Markdown
Contributor

Summary

Fixes a bug where history_export fails for any orchestration that completes with an error, and cuts release v1.7.2.

task.FailureDetails was a plain class (not a dataclass), so HistoryEvent.to_dict() (asdict + _to_serializable) left it as a raw object and json.dumps raised:

TypeError: Object of type FailureDetails is not JSON serializable

This broke durabletask.extensions.history_export for four event types that carry failure information:

  • ExecutionCompletedEvent
  • TaskFailedEvent
  • SubOrchestrationInstanceFailedEvent
  • EntityOperationFailedEvent

Fix

Converted FailureDetails to a @dataclass(frozen=True). This is a root-cause fix rather than a per-call-site workaround:

  • Preserves the exact public API — same positional constructor and read-only message / error_type / stack_trace attributes.
  • asdict now recurses into it automatically, so all four events serialize to { "message", "error_type", "stack_trace" }.
  • Adds value equality/hashing as a bonus.

FailureDetails was the only non-dataclass, non-primitive nested type in history events; every other nested type (OrchestrationInstance, ParentInstanceInfo, TraceContext) is already a dataclass, so this single change covers the general case.

Release v1.7.2

  • Bumped durabletask and durabletask.azuremanaged to 1.7.2 (and updated azuremanaged dependency floors).
  • Updated both changelogs.

Tests

  • Added test_failure_details_is_json_safe in test_serialization.py.
  • Full core suite (733 passed) and history_export suite (78 passed) green; flake8 clean.

Convert task.FailureDetails to a frozen dataclass so failed orchestrations serialize cleanly through the history_export module. Previously FailureDetails was a plain class, so HistoryEvent.to_dict() left it as a raw object and json.dumps raised TypeError for ExecutionCompleted, TaskFailed, SubOrchestrationInstanceFailed, and EntityOperationFailed events.

Bump both packages to v1.7.2 and update changelogs.
Copilot AI review requested due to automatic review settings July 9, 2026 18:38

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

This pull request fixes a JSON-serialization bug in history export for orchestrations that complete with failure, and prepares the repo for the v1.7.2 release by bumping package versions and updating changelogs.

Changes:

  • Converted task.FailureDetails into a frozen dataclass so asdict() recurses correctly and history_export output is JSON-serializable.
  • Added a regression test ensuring failure-bearing events serialize to JSON-safe dictionaries and the full exported document can be json.loads-parsed.
  • Bumped durabletask and durabletask.azuremanaged to 1.7.2, updated azuremanaged dependency floors, and updated both changelogs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
durabletask/task.py Makes FailureDetails a frozen dataclass to ensure nested history event serialization is JSON-safe.
tests/durabletask/extensions/history_export/test_serialization.py Adds a regression test validating FailureDetails serialization and end-to-end JSON export validity.
pyproject.toml Bumps core package version to 1.7.2.
durabletask-azuremanaged/pyproject.toml Bumps azuremanaged version to 1.7.2 and raises dependency minimums to durabletask>=1.7.2.
CHANGELOG.md Documents the v1.7.2 fix for history export JSON serialization.
durabletask-azuremanaged/CHANGELOG.md Documents the v1.7.2 dependency update.

@berndverst berndverst merged commit 7e95535 into microsoft:main Jul 9, 2026
17 checks passed
@andystaples andystaples deleted the andystaples/fix-failure-details-serialization branch July 9, 2026 21:10
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.

3 participants