durable-workflow 2.17.2__tar.gz → 2.19.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. {durable_workflow-2.17.2/src/durable_workflow.egg-info → durable_workflow-2.19.0}/PKG-INFO +2 -1
  2. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/README.md +1 -0
  3. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/pyproject.toml +3 -3
  4. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/__init__.py +8 -0
  5. durable_workflow-2.19.0/src/durable_workflow/_activity_checkpoint.py +131 -0
  6. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/activity.py +31 -1
  7. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/client.py +31 -14
  8. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/errors.py +110 -8
  9. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/worker.py +25 -5
  10. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/workflow.py +248 -7
  11. {durable_workflow-2.17.2 → durable_workflow-2.19.0/src/durable_workflow.egg-info}/PKG-INFO +2 -1
  12. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow.egg-info/SOURCES.txt +24 -0
  13. durable_workflow-2.19.0/tests/test_activity_acceptance_authority.py +122 -0
  14. durable_workflow-2.19.0/tests/test_activity_acceptance_consumer.py +174 -0
  15. durable_workflow-2.19.0/tests/test_activity_acceptance_entry.py +121 -0
  16. durable_workflow-2.19.0/tests/test_activity_checkpoint.py +249 -0
  17. durable_workflow-2.19.0/tests/test_activity_exponential_retry.py +133 -0
  18. durable_workflow-2.19.0/tests/test_activity_install_inventory.py +152 -0
  19. durable_workflow-2.19.0/tests/test_activity_retry_cap_cell.py +125 -0
  20. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_business_replay_clock_parallel.py +2 -2
  21. durable_workflow-2.19.0/tests/test_checkpointed_batch_example.py +174 -0
  22. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_child_workflow_policies.py +1 -4
  23. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_client.py +58 -0
  24. durable_workflow-2.19.0/tests/test_command_keys_acceptance.py +168 -0
  25. durable_workflow-2.19.0/tests/test_command_keys_captured_inputs.py +181 -0
  26. durable_workflow-2.19.0/tests/test_command_keys_container_ownership.py +108 -0
  27. durable_workflow-2.19.0/tests/test_command_keys_workspace.py +245 -0
  28. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_completion_size_limit.py +86 -1
  29. durable_workflow-2.19.0/tests/test_local_activity_backoff.py +99 -0
  30. durable_workflow-2.19.0/tests/test_native_timer_redrive_cell.py +345 -0
  31. durable_workflow-2.19.0/tests/test_native_timer_redrive_clock.py +144 -0
  32. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_parallel_group_policy.py +9 -4
  33. durable_workflow-2.19.0/tests/test_parallel_member_failure_open_siblings.py +346 -0
  34. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_parallel_saga_authoring.py +3 -5
  35. durable_workflow-2.19.0/tests/test_physical_command_key_readback.py +206 -0
  36. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_portal_source_split.py +114 -0
  37. durable_workflow-2.19.0/tests/test_published_activity_acceptance.py +708 -0
  38. durable_workflow-2.19.0/tests/test_published_pagination_evidence.py +167 -0
  39. durable_workflow-2.19.0/tests/test_quiesced_snapshot.py +154 -0
  40. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_replay.py +3 -3
  41. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_replay_regression_corpus.py +76 -8
  42. durable_workflow-2.19.0/tests/test_retry_cap_download.py +71 -0
  43. durable_workflow-2.19.0/tests/test_retry_cap_workflow.py +51 -0
  44. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_run_closed_settlement_replay.py +10 -7
  45. durable_workflow-2.19.0/tests/test_schedule_origin.py +167 -0
  46. durable_workflow-2.19.0/tests/test_synthetic_command_key_readback.py +171 -0
  47. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_worker.py +4 -0
  48. durable_workflow-2.17.2/tests/test_local_activity_backoff.py +0 -49
  49. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/LICENSE +0 -0
  50. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/setup.cfg +0 -0
  51. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_activity_lease.py +0 -0
  52. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_activity_process.py +0 -0
  53. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_avro.py +0 -0
  54. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_cancellation_scope.py +0 -0
  55. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_cancellation_scope_history.py +0 -0
  56. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_condition_fingerprint.py +0 -0
  57. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_cooperative_cancellation.py +0 -0
  58. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_failure_reporting.py +0 -0
  59. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_metric_routes.py +0 -0
  60. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_poll_transport.py +0 -0
  61. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_prepared_local_activity.py +0 -0
  62. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_query_task_authority.py +0 -0
  63. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_sticky_workflow_cache.py +0 -0
  64. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/_typed_values.py +0 -0
  65. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/auth_composition.py +0 -0
  66. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/cancellation.py +0 -0
  67. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/external_storage.py +0 -0
  68. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/external_task_input.py +0 -0
  69. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/external_task_result.py +0 -0
  70. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/history_bundle_verify.py +0 -0
  71. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/interceptors.py +0 -0
  72. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/invocable.py +0 -0
  73. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/metrics.py +0 -0
  74. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/nexus.py +0 -0
  75. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/py.typed +0 -0
  76. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/python_conformance.py +0 -0
  77. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/replay_clock.py +0 -0
  78. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/replay_clock_math.py +0 -0
  79. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/replay_conformance.py +0 -0
  80. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/replay_verify.py +0 -0
  81. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/retry_policy.py +0 -0
  82. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/serializer.py +0 -0
  83. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/server_compatibility.json +0 -0
  84. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/sync.py +0 -0
  85. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/telemetry.py +0 -0
  86. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/telemetry_carrier.py +0 -0
  87. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/testing.py +0 -0
  88. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/worker_session.py +0 -0
  89. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/worker_status.py +0 -0
  90. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow/workflow_updates_conformance.py +0 -0
  91. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow.egg-info/dependency_links.txt +0 -0
  92. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow.egg-info/entry_points.txt +0 -0
  93. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow.egg-info/requires.txt +0 -0
  94. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/src/durable_workflow.egg-info/top_level.txt +0 -0
  95. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_activity_cancellation_policies.py +0 -0
  96. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_activity_context.py +0 -0
  97. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_activity_heartbeat_authority.py +0 -0
  98. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_activity_identity.py +0 -0
  99. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_activity_lease_authority.py +0 -0
  100. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_activity_lease_renewal.py +0 -0
  101. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_activity_lease_worker.py +0 -0
  102. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_activity_process.py +0 -0
  103. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_activity_retry_info.py +0 -0
  104. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_activity_run_closed_refusal.py +0 -0
  105. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_auth_composition.py +0 -0
  106. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_avro_value_benchmark.py +0 -0
  107. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_avro_value_protocol.py +0 -0
  108. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_business_replay_clock.py +0 -0
  109. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_business_replay_clock_child.py +0 -0
  110. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_business_replay_clock_redrive.py +0 -0
  111. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_business_replay_clock_sequence_claims.py +0 -0
  112. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_cancellation_cause.py +0 -0
  113. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_cancellation_context.py +0 -0
  114. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_cancellation_remaining_time.py +0 -0
  115. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_cancellation_scope_admission.py +0 -0
  116. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_cancellation_scope_authoring.py +0 -0
  117. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_cancellation_scope_boundary.py +0 -0
  118. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_cancellation_scope_opening.py +0 -0
  119. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_ci_checkout.py +0 -0
  120. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_ci_integration_endpoint.py +0 -0
  121. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_client_iterators.py +0 -0
  122. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_client_telemetry.py +0 -0
  123. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_client_timeouts.py +0 -0
  124. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_codec_regression_corpus.py +0 -0
  125. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_committed_cancellation_scope_descendants.py +0 -0
  126. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_committed_cancellation_scope_groups.py +0 -0
  127. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_committed_cancellation_scope_history.py +0 -0
  128. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_committed_cancellation_scope_replay.py +0 -0
  129. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_condition_fingerprint.py +0 -0
  130. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_condition_occurrence_id.py +0 -0
  131. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_condition_replay_drift.py +0 -0
  132. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_control_plane_parity_fixtures.py +0 -0
  133. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_cooperative_cancellation.py +0 -0
  134. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_cooperative_cancellation_client.py +0 -0
  135. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_cooperative_cancellation_worker.py +0 -0
  136. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_cooperative_remote_worker.py +0 -0
  137. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_docs_release_channel.py +0 -0
  138. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_docstring_cross_references.py +0 -0
  139. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_durable_selection.py +0 -0
  140. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_empty_callback_failure.py +0 -0
  141. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_errors.py +0 -0
  142. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_external_storage.py +0 -0
  143. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_external_task_input.py +0 -0
  144. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_external_task_result.py +0 -0
  145. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_failure_reporting.py +0 -0
  146. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_generator_lifecycle.py +0 -0
  147. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_golden_history_replay.py +0 -0
  148. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_history_bundle_pruned.py +0 -0
  149. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_history_bundle_schema2.py +0 -0
  150. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_history_bundle_verify.py +0 -0
  151. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_history_event_contract.py +0 -0
  152. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_invocable.py +0 -0
  153. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_local_failure_reporting.py +0 -0
  154. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_message_streams.py +0 -0
  155. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_metric_routes.py +0 -0
  156. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_metrics.py +0 -0
  157. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_nexus_durable_wait.py +0 -0
  158. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_nexus_namespace.py +0 -0
  159. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_nexus_wire.py +0 -0
  160. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_order_processing_example.py +0 -0
  161. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_parallel_completion_order_replay.py +0 -0
  162. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_patch_history.py +0 -0
  163. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_pending_operation_replay.py +0 -0
  164. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_poll_failure_backoff.py +0 -0
  165. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_poll_transport.py +0 -0
  166. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_prepared_local_activity_client.py +0 -0
  167. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_prepared_local_activity_groups.py +0 -0
  168. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_prepared_local_activity_policies.py +0 -0
  169. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_prepared_local_activity_worker.py +0 -0
  170. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_public_boundary_scanner.py +0 -0
  171. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_publish_workflow_isolation.py +0 -0
  172. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_pypi_project_surface.py +0 -0
  173. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_python_conformance.py +0 -0
  174. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_queries.py +0 -0
  175. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_query_task_authority.py +0 -0
  176. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_query_timeout_retry.py +0 -0
  177. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_readme_quickstart.py +0 -0
  178. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_redrive_call_ledger.py +0 -0
  179. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_redrive_replay.py +0 -0
  180. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_redrive_successor_evidence.py +0 -0
  181. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_registration_ambiguity.py +0 -0
  182. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_release_metadata.py +0 -0
  183. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_release_promotion.py +0 -0
  184. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_replay_clock.py +0 -0
  185. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_replay_conformance.py +0 -0
  186. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_replay_verify.py +0 -0
  187. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_retry_policy.py +0 -0
  188. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_run_activities.py +0 -0
  189. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_run_cancellation_scope_replay.py +0 -0
  190. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_runtime_external_payload_transport.py +0 -0
  191. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_schedules.py +0 -0
  192. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_scoped_run_cancellation_context.py +0 -0
  193. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_sdk_metrics_contract.py +0 -0
  194. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_search_attribute_replay_identity.py +0 -0
  195. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_serializer.py +0 -0
  196. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_signals.py +0 -0
  197. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_sleep.py +0 -0
  198. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_standalone_activity_client.py +0 -0
  199. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_static_credential_validation.py +0 -0
  200. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_sticky_execution.py +0 -0
  201. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_sticky_history_suffix.py +0 -0
  202. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_storage_admission.py +0 -0
  203. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_sync.py +0 -0
  204. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_sync_activities.py +0 -0
  205. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_telemetry.py +0 -0
  206. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_telemetry_carrier.py +0 -0
  207. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_testing_failures.py +0 -0
  208. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_testing_harness.py +0 -0
  209. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_testing_nexus.py +0 -0
  210. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_threaded_heartbeat_example.py +0 -0
  211. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_tls_trust.py +0 -0
  212. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_transport_diagnostics.py +0 -0
  213. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_typed_values.py +0 -0
  214. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_typed_workflow_values.py +0 -0
  215. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_update_outcome.py +0 -0
  216. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_update_signal_condition_replay.py +0 -0
  217. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_updates.py +0 -0
  218. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_wait_condition.py +0 -0
  219. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_worker_deregistration.py +0 -0
  220. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_worker_observation.py +0 -0
  221. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_worker_session.py +0 -0
  222. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_worker_startup_buffered.py +0 -0
  223. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_worker_startup_raw.py +0 -0
  224. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_worker_startup_read_budget.py +0 -0
  225. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_worker_startup_snapshot.py +0 -0
  226. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_worker_status.py +0 -0
  227. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_worker_telemetry_wire.py +0 -0
  228. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_workflow_entry_arguments.py +0 -0
  229. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_workflow_entrypoint_validation.py +0 -0
  230. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_workflow_handler_validation.py +0 -0
  231. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_workflow_identity.py +0 -0
  232. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_workflow_result_timeout.py +0 -0
  233. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_workflow_streams.py +0 -0
  234. {durable_workflow-2.17.2 → durable_workflow-2.19.0}/tests/test_workflow_updates_conformance.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: durable-workflow
3
- Version: 2.17.2
3
+ Version: 2.19.0
4
4
  Summary: Python client and worker SDK for Durable Workflow Cloud and self-hosted Server
5
5
  Author: Durable Workflow Contributors
6
6
  License-Expression: MIT
@@ -146,6 +146,7 @@ for the complete cross-SDK contract.
146
146
  - [Python SDK guide](https://durable-workflow.com/docs/2.0/polyglot/python/)
147
147
  - [Complete SDK reference](docs/sdk-reference.md)
148
148
  - [Runnable examples](examples/)
149
+ - [Checkpointed batch source example](examples/CHECKPOINTED_BATCH.md) (SDK 2.18.0 accessor; synthetic provider)
149
150
  - [Separate workflow and activity worker processes](docs/guides/separate-workers.md)
150
151
  - [Symmetric SDK playground](https://github.com/durable-workflow/sample-app#symmetric-sdk-playground)
151
152
 
@@ -99,6 +99,7 @@ for the complete cross-SDK contract.
99
99
  - [Python SDK guide](https://durable-workflow.com/docs/2.0/polyglot/python/)
100
100
  - [Complete SDK reference](docs/sdk-reference.md)
101
101
  - [Runnable examples](examples/)
102
+ - [Checkpointed batch source example](examples/CHECKPOINTED_BATCH.md) (SDK 2.18.0 accessor; synthetic provider)
102
103
  - [Separate workflow and activity worker processes](docs/guides/separate-workers.md)
103
104
  - [Symmetric SDK playground](https://github.com/durable-workflow/sample-app#symmetric-sdk-playground)
104
105
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "durable-workflow"
7
- version = "2.17.2"
7
+ version = "2.19.0"
8
8
  description = "Python client and worker SDK for Durable Workflow Cloud and self-hosted Server"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -79,8 +79,8 @@ durable-workflow-replay-conformance = "durable_workflow.replay_conformance:main"
79
79
  durable-workflow-workflow-updates-conformance = "durable_workflow.workflow_updates_conformance:main"
80
80
 
81
81
  [tool.durable-workflow]
82
- product-train = "2.17.2"
83
- registry-version = "2.17.2"
82
+ product-train = "2.19.0"
83
+ registry-version = "2.19.0"
84
84
  supported-server-versions = "2.8.0"
85
85
  supported-server-release-baselines = { "2" = "2.8.0", "3" = "3.0.0" }
86
86
  worker-protocol-version = "1.20"
@@ -7,6 +7,7 @@ except PackageNotFoundError: # source checkout without installed metadata
7
7
  __version__ = "0.0.0+unknown"
8
8
 
9
9
  from . import activity, sync, testing, workflow
10
+ from ._activity_checkpoint import ActivityHeartbeatCheckpoint
10
11
  from .activity import ActivityContext, ActivityInfo, ActivityRetryInfo
11
12
  from .auth_composition import (
12
13
  AUTH_COMPOSITION_CONTRACT_SCHEMA,
@@ -70,6 +71,7 @@ from .client import (
70
71
  from .errors import (
71
72
  ActivityCancelled,
72
73
  ActivityFailed,
74
+ ActivityHeartbeatResumeUnavailable,
73
75
  ChildWorkflowCancelled,
74
76
  ChildWorkflowFailed,
75
77
  ChildWorkflowTerminated,
@@ -117,6 +119,7 @@ from .errors import (
117
119
  WorkflowNotFound,
118
120
  WorkflowPayloadDecodeError,
119
121
  WorkflowTaskCompletionTooLarge,
122
+ WorkflowTaskHistoryLimitExceeded,
120
123
  WorkflowTerminated,
121
124
  WorkflowTimedOut,
122
125
  WorkflowTimeoutCleanupRequested,
@@ -247,6 +250,7 @@ from .workflow import (
247
250
  Replayer,
248
251
  ReplayOutcome,
249
252
  Saga,
253
+ ScheduleOrigin,
250
254
  SelectionResult,
251
255
  StartChildWorkflow,
252
256
  replay,
@@ -260,6 +264,8 @@ __all__ = [
260
264
  "ActivityHandler",
261
265
  "ActivityInfo",
262
266
  "ActivityRetryInfo",
267
+ "ActivityHeartbeatCheckpoint",
268
+ "ActivityHeartbeatResumeUnavailable",
263
269
  "ActivityInterceptorContext",
264
270
  "ActivityRetryPolicy",
265
271
  "BridgeAdapterOutcome",
@@ -306,6 +312,7 @@ __all__ = [
306
312
  "ScheduleList",
307
313
  "ScheduleListError",
308
314
  "ScheduleNotFound",
315
+ "ScheduleOrigin",
309
316
  "ScheduleSpec",
310
317
  "ScheduleTriggerResult",
311
318
  "SearchAttributeList",
@@ -427,6 +434,7 @@ __all__ = [
427
434
  "WorkflowFailed",
428
435
  "WorkflowNotFound",
429
436
  "WorkflowTaskCompletionTooLarge",
437
+ "WorkflowTaskHistoryLimitExceeded",
430
438
  "WorkflowTerminated",
431
439
  "WorkflowTimedOut",
432
440
  "WorkflowTimeoutCleanupRequested",
@@ -0,0 +1,131 @@
1
+ """Immutable heartbeat-resume metadata captured from one negotiated poll."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import re
7
+ from collections.abc import Mapping
8
+ from dataclasses import dataclass, field
9
+ from datetime import datetime
10
+ from typing import Any
11
+
12
+ from ._typed_values import decode_payload_value, validate_annotation
13
+ from .errors import ActivityHeartbeatResumeUnavailable
14
+
15
+ _IDENTITY = ("task_id", "activity_execution_id", "activity_attempt_id", "workflow_id", "run_id", "namespace")
16
+ _TIMESTAMP = re.compile(
17
+ r"[0-9]{4}-[0-9]{2}-[0-9]{2}T(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]"
18
+ r"(?:\.[0-9]{1,9})?(?:Z|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])"
19
+ )
20
+
21
+
22
+ def _invalid() -> ValueError:
23
+ return ValueError("activity_heartbeat_resume v1 claim has an invalid checkpoint")
24
+
25
+
26
+ @dataclass(frozen=True, init=False)
27
+ class ActivityHeartbeatCheckpoint:
28
+ """The acknowledged snapshot received with this claim, never a pending write.
29
+
30
+ ``contract_version`` describes the negotiated wire contract. Server v1
31
+ supplies no checkpoint write sequence. Acknowledgement does not commit an
32
+ external business effect atomically.
33
+ """
34
+
35
+ acknowledged_at: str
36
+ contract_version: int = field(default=1, init=False)
37
+ _details_json: str = field(repr=False)
38
+
39
+ def __init__(self, details: Any, acknowledged_at: str) -> None:
40
+ if details is None or not isinstance(acknowledged_at, str) or not _TIMESTAMP.fullmatch(acknowledged_at):
41
+ raise _invalid()
42
+ try:
43
+ # Python 3.10's parser accepts fewer fractional forms. Validate the
44
+ # calendar/offset separately and retain the original precision.
45
+ calendar = re.sub(r"\.\d+(?=Z|[+-])", "", acknowledged_at)
46
+ datetime.fromisoformat(calendar.replace("Z", "+00:00"))
47
+ encoded = json.dumps(details, allow_nan=False)
48
+ except (ValueError, TypeError, OverflowError, RecursionError):
49
+ raise _invalid() from None
50
+ object.__setattr__(self, "acknowledged_at", acknowledged_at)
51
+ object.__setattr__(self, "_details_json", encoded)
52
+
53
+ def details(self, *, result_type: Any = None) -> Any:
54
+ """Return an independent copy, optionally decoded using SDK typed values."""
55
+ value = json.loads(self._details_json)
56
+ if result_type is None:
57
+ return value
58
+ validate_annotation(result_type, "checkpoint")
59
+ return decode_payload_value(value, result_type, "checkpoint")
60
+
61
+
62
+ @dataclass(frozen=True)
63
+ class _HeartbeatResume:
64
+ available: bool = False
65
+ checkpoint: ActivityHeartbeatCheckpoint | None = None
66
+ identity: tuple[Any, ...] = ()
67
+
68
+ def get(self) -> ActivityHeartbeatCheckpoint | None:
69
+ if not self.available:
70
+ raise ActivityHeartbeatResumeUnavailable()
71
+ return self.checkpoint
72
+
73
+
74
+ class _ActivityTask(dict[str, Any]):
75
+ """Keep poll metadata outside the task's unchanged public wire dictionary."""
76
+
77
+ def __init__(self, task: Mapping[str, Any], resume: _HeartbeatResume) -> None:
78
+ super().__init__(task)
79
+ self.heartbeat_resume = resume
80
+
81
+
82
+ def _identity(task: Mapping[str, Any]) -> tuple[Any, ...]:
83
+ values = tuple(task.get(name) for name in _IDENTITY)
84
+ attempt = task.get("attempt_number")
85
+ if (any(not isinstance(value, str) or not value.strip() for value in values)
86
+ or type(attempt) is not int or attempt < 1):
87
+ raise _invalid()
88
+ return (*values, attempt, task.get("lease_owner"), task.get("activity_type"), task.get("task_queue"))
89
+
90
+
91
+ def capture_poll(data: Mapping[str, Any], namespace: str, worker_id: str, task_queue: str | None = None) -> Any:
92
+ task = data.get("task")
93
+ capabilities = data.get("server_capabilities")
94
+ capability = capabilities.get("activity_heartbeat_resume") if isinstance(capabilities, Mapping) else None
95
+ if (not isinstance(task, dict) or not isinstance(capability, Mapping)
96
+ or capability.get("supported") is not True or type(capability.get("version")) is not int
97
+ or capability["version"] != 1):
98
+ return task
99
+ if "last_heartbeat_details" not in task and "last_heartbeat_at" not in task:
100
+ return task
101
+ identity = _identity(task)
102
+ if task["namespace"] != namespace or task.get("lease_owner") != worker_id:
103
+ raise _invalid()
104
+ if task_queue is not None and "task_queue" in task and task["task_queue"] != task_queue:
105
+ raise _invalid()
106
+ if "last_heartbeat_details" not in task or "last_heartbeat_at" not in task:
107
+ raise _invalid()
108
+ details, at = task["last_heartbeat_details"], task["last_heartbeat_at"]
109
+ if details is None and at is None:
110
+ checkpoint = None
111
+ elif details is not None and task["attempt_number"] > 1:
112
+ checkpoint = ActivityHeartbeatCheckpoint(details, at)
113
+ else:
114
+ raise _invalid()
115
+ return _ActivityTask(task, _HeartbeatResume(True, checkpoint, identity))
116
+
117
+
118
+ def claim_resume(
119
+ task: Mapping[str, Any], namespace: str | None, task_id: str, attempt_id: str, attempt: int, worker_id: str,
120
+ activity_type: str, task_queue: str,
121
+ ) -> _HeartbeatResume:
122
+ if not isinstance(task, _ActivityTask):
123
+ return _HeartbeatResume()
124
+ resume = task.heartbeat_resume
125
+ if (resume.identity != _identity(task) or task.get("namespace") != namespace
126
+ or task.get("task_id") != task_id or task.get("activity_attempt_id") != attempt_id
127
+ or type(attempt) is not int or task.get("attempt_number") != attempt
128
+ or task.get("lease_owner") != worker_id or task.get("activity_type") != activity_type
129
+ or "task_queue" in task and task["task_queue"] != task_queue):
130
+ raise _invalid()
131
+ return resume
@@ -8,6 +8,7 @@ from collections.abc import Awaitable, Callable, Mapping
8
8
  from dataclasses import InitVar, dataclass, field
9
9
  from typing import TYPE_CHECKING, Any
10
10
 
11
+ from ._activity_checkpoint import ActivityHeartbeatCheckpoint, _HeartbeatResume, claim_resume
11
12
  from ._activity_lease import current_activity_authority
12
13
  from .errors import ActivityCancelled, ActivityLeaseAuthorityLost
13
14
 
@@ -79,14 +80,20 @@ class ActivityInfo:
79
80
  task_queue: str
80
81
  worker_id: str
81
82
  task_metadata: InitVar[Mapping[str, Any] | None] = None
83
+ task_namespace: InitVar[str | None] = None
82
84
  retry_info: ActivityRetryInfo = field(init=False)
85
+ _heartbeat_resume: _HeartbeatResume = field(init=False, repr=False)
83
86
  workflow_id: str | None = field(init=False)
84
87
  run_id: str | None = field(init=False)
85
88
  activity_execution_id: str | None = field(init=False)
86
89
 
87
- def __post_init__(self, task_metadata: Mapping[str, Any] | None) -> None:
90
+ def __post_init__(self, task_metadata: Mapping[str, Any] | None, task_namespace: str | None) -> None:
88
91
  task = task_metadata if task_metadata is not None else {}
89
92
  object.__setattr__(self, "retry_info", ActivityRetryInfo.from_task(self.attempt_number, task))
93
+ object.__setattr__(self, "_heartbeat_resume", claim_resume(
94
+ task, task_namespace, self.task_id, self.activity_attempt_id, self.attempt_number, self.worker_id,
95
+ self.activity_type, self.task_queue,
96
+ ))
90
97
  for name in ("workflow_id", "run_id"):
91
98
  value = task.get(name)
92
99
  object.__setattr__(self, name, value if isinstance(value, str) and value else None)
@@ -125,6 +132,29 @@ class ActivityContext:
125
132
  """``True`` once the server has signalled that the owning workflow cancelled this activity."""
126
133
  return self._cancel_requested
127
134
 
135
+ def heartbeat_resume_version(self) -> int | None:
136
+ """The received contract version, or ``None`` when unavailable."""
137
+ return 1 if self._info._heartbeat_resume.available else None
138
+
139
+ def last_heartbeat_checkpoint(self) -> ActivityHeartbeatCheckpoint | None:
140
+ """Return the received snapshot, or ``None`` for supported empty state.
141
+
142
+ Raises ActivityHeartbeatResumeUnavailable for older or nonparticipating
143
+ claims, inline local activities and Server-free tests. Heartbeat writes
144
+ never change this snapshot, including rejected or uncertain writes.
145
+ """
146
+ return self._info._heartbeat_resume.get()
147
+
148
+ def last_heartbeat_details(self, *, result_type: Any = None) -> Any:
149
+ """Read acknowledged details, optionally decoded to an application type."""
150
+ checkpoint = self.last_heartbeat_checkpoint()
151
+ return checkpoint.details(result_type=result_type) if checkpoint is not None else None
152
+
153
+ def last_heartbeat_at(self) -> str | None:
154
+ """The original RFC3339 acknowledgement time without losing precision."""
155
+ checkpoint = self.last_heartbeat_checkpoint()
156
+ return checkpoint.acknowledged_at if checkpoint is not None else None
157
+
128
158
  def heartbeat_sync(self, details: dict[str, Any] | None = None) -> None:
129
159
  """Heartbeat from a synchronous activity thread and check attempt authority.
130
160
 
@@ -41,6 +41,7 @@ from urllib.parse import quote, unquote, urlencode, urlsplit
41
41
  import httpx
42
42
 
43
43
  from . import serializer
44
+ from ._activity_checkpoint import capture_poll as _capture_activity_checkpoint
44
45
  from ._activity_lease import ActivityLeaseAuthority, current_activity_authority
45
46
  from ._cancellation_scope import CancellationScopeOpenReceipt, scope_identity
46
47
  from ._cancellation_scope_history import (
@@ -65,6 +66,7 @@ from ._poll_transport import warn_early_cutoff as _warn_poll_cutoff
65
66
  from ._query_task_authority import QueryTaskAuthority, current_query_authority
66
67
  from ._typed_values import decode_payload_value, to_payload_values, validate_annotation
67
68
  from .errors import (
69
+ REQUEST_ID_AMBIGUOUS,
68
70
  REQUEST_ID_CONFLICT,
69
71
  ExternalPayloadIntegrityMismatch,
70
72
  ExternalPayloadOversized,
@@ -275,7 +277,7 @@ def _command_request_id(request_id: str | None, command: str) -> str:
275
277
  """Return the caller command key for one logical signal or update call.
276
278
 
277
279
  The key is the body field ``request_id`` (1-255 opaque, case-sensitive
278
- bytes). A caller-supplied key is sent verbatim; otherwise one
280
+ Unicode characters). A caller-supplied key is sent verbatim; otherwise one
279
281
  ``sdk-python-<command>-<uuid4 hex>`` key is generated per logical call so
280
282
  the transport retry policy resends the identical key.
281
283
  """
@@ -295,20 +297,26 @@ def _attach_request_id(exc: BaseException, request_id: str) -> None:
295
297
  def _command_request_failure(exc: Exception, *, command: str, request_id: str) -> Exception:
296
298
  """Return the exception a failed signal or update call should raise.
297
299
 
298
- A ``request_id_conflict`` refusal that reached the caller as a generic
299
- :class:`ServerError` becomes the command's typed failure. Every other
300
- exception is returned unchanged, annotated with the key that was sent.
300
+ A ``request_id_conflict`` or ``request_id_ambiguous`` refusal that reached
301
+ the caller as a generic :class:`ServerError` becomes the command's typed
302
+ failure. Every other exception is returned unchanged, annotated with the
303
+ key that was sent.
301
304
  """
302
- if isinstance(exc, ServerError) and exc.reason() == REQUEST_ID_CONFLICT:
305
+ reason = exc.reason() if isinstance(exc, ServerError) else None
306
+ if isinstance(exc, ServerError) and reason in (REQUEST_ID_CONFLICT, REQUEST_ID_AMBIGUOUS):
303
307
  message = exc.body.get("message") if isinstance(exc.body, dict) else None
304
308
  if not isinstance(message, str) or not message:
305
- message = f"{command} request id already retained with a different intent"
309
+ message = (
310
+ f"{command} request id already retained with a different intent"
311
+ if reason == REQUEST_ID_CONFLICT
312
+ else f"{command} request id matches an ambiguous retained command identity"
313
+ )
306
314
  if command == "update" and isinstance(exc.body, dict):
307
315
  return UpdateFailed(
308
- message, status=exc.status, body=exc.body, reason=REQUEST_ID_CONFLICT, request_id=request_id,
316
+ message, status=exc.status, body=exc.body, reason=reason, request_id=request_id,
309
317
  )
310
318
  return SignalFailed(
311
- message, reason=REQUEST_ID_CONFLICT, status=exc.status, body=exc.body, request_id=request_id,
319
+ message, reason=reason, status=exc.status, body=exc.body, request_id=request_id,
312
320
  )
313
321
  _attach_request_id(exc, request_id)
314
322
  return exc
@@ -4891,7 +4899,7 @@ class Client:
4891
4899
  :class:`WorkflowHandle` forwards its run identity automatically.
4892
4900
 
4893
4901
  ``request_id`` is the caller command key (1-255 opaque, case-sensitive
4894
- bytes). When omitted the client
4902
+ Unicode characters). When omitted the client
4895
4903
  generates ``sdk-python-signal-<uuid>`` once per call, so the transport
4896
4904
  retry policy resends the same key. Resending the same key with the same
4897
4905
  signal name, arguments and run target returns the original receipt
@@ -4906,7 +4914,12 @@ class Client:
4906
4914
  :class:`~durable_workflow.errors.SignalFailed` with
4907
4915
  ``reason == "request_id_conflict"`` when the key was already retained
4908
4916
  for a signal with a different intent; the retained command is described
4909
- in its ``details``. Every exception raised after the key was chosen,
4917
+ in its ``details``. ``reason == "request_id_ambiguous"`` means the key
4918
+ matches an ambiguous legacy retained identity: nothing was written and
4919
+ no receipt was selected. A legacy receipt retained before the Server
4920
+ recorded intent is returned with ``retained`` ``True`` and
4921
+ ``intent_verified`` ``False``; it is the original admission, not proof
4922
+ that this retry's intent matches. Every exception raised after the key was chosen,
4910
4923
  including transport errors, carries it as ``request_id``.
4911
4924
  """
4912
4925
  if run_id is not None and (not isinstance(run_id, str) or not run_id):
@@ -5131,7 +5144,7 @@ class Client:
5131
5144
  :meth:`update_outcome`, which never admits another update.
5132
5145
 
5133
5146
  ``request_id`` is the caller command key (1-255 opaque, case-sensitive
5134
- bytes) that makes a retry of this update safe. When omitted the client
5147
+ Unicode characters) that makes a retry of this update safe. When omitted the client
5135
5148
  generates ``sdk-python-update-<uuid>`` once per call, so the transport
5136
5149
  retry policy resends the same key. Resending the same key with the same
5137
5150
  update name, arguments and run target returns the original receipt
@@ -5147,7 +5160,10 @@ class Client:
5147
5160
  with the failure message, Server response and durable identities; the
5148
5161
  same type with ``reason == "request_id_conflict"`` reports a key that
5149
5162
  was already retained for an update with a different intent, described
5150
- in its ``details``. Every exception raised after the key was chosen,
5163
+ in its ``details``, and ``reason == "request_id_ambiguous"`` a key that
5164
+ matches an ambiguous legacy retained identity (nothing written, no
5165
+ receipt selected). A legacy receipt is returned with ``retained``
5166
+ ``True`` and ``intent_verified`` ``False``. Every exception raised after the key was chosen,
5151
5167
  including transport errors, carries it as ``request_id``.
5152
5168
  """
5153
5169
  await self._require_update_wait_stage(wait_for or "accepted")
@@ -6135,7 +6151,8 @@ class Client:
6135
6151
  if sticky_cache is not None:
6136
6152
  body["sticky_cache"] = sticky_cache
6137
6153
  return await self._request(
6138
- "POST", f"/worker/workflow-tasks/{task_id}/complete", worker=True, json=body
6154
+ "POST", f"/worker/workflow-tasks/{task_id}/complete", worker=True, json=body,
6155
+ context="task_completion",
6139
6156
  )
6140
6157
 
6141
6158
  async def fail_workflow_task(
@@ -6782,7 +6799,7 @@ class Client:
6782
6799
  except httpx.TimeoutException:
6783
6800
  continue
6784
6801
 
6785
- return (data or {}).get("task")
6802
+ return _capture_activity_checkpoint(data or {}, self.namespace, worker_id, task_queue)
6786
6803
 
6787
6804
  return None
6788
6805
 
@@ -27,6 +27,13 @@ class DurableWorkflowError(Exception):
27
27
  """Base class for every exception raised by the SDK."""
28
28
 
29
29
 
30
+ class ActivityHeartbeatResumeUnavailable(DurableWorkflowError):
31
+ """This claim did not supply the supported heartbeat-resume contract."""
32
+
33
+ def __init__(self) -> None:
34
+ super().__init__("activity_heartbeat_resume v1 is unavailable for this claim")
35
+
36
+
30
37
  class ReplayClockUnavailable(DurableWorkflowError):
31
38
  """The current execution has no proved business replay-time boundary."""
32
39
 
@@ -355,6 +362,71 @@ class WorkflowTaskCompletionTooLarge(ServerError):
355
362
  )
356
363
 
357
364
 
365
+ HISTORY_TRANSACTION_REFUSALS = frozenset({"history_transaction_limit_exceeded", "completion_budget_exceeded"})
366
+ _HISTORY_TRANSACTION_UNITS = {
367
+ "history_transaction_size": "history events",
368
+ "history_transaction_bytes": "history bytes",
369
+ "history_transaction_rows": "rows",
370
+ }
371
+
372
+
373
+ class WorkflowTaskHistoryLimitExceeded(WorkflowTaskCompletionTooLarge):
374
+ """The Server refused a completion over its history-transaction budget.
375
+
376
+ A workflow-task completion is recorded in one history transaction, bounded
377
+ by the Server's ``history_transaction_size`` (events),
378
+ ``history_transaction_bytes`` and ``history_transaction_rows`` structural
379
+ limits. A completion past one of them is refused with ``409`` and reason
380
+ ``history_transaction_limit_exceeded`` (or ``completion_budget_exceeded``
381
+ from the early local-activity count) before anything is recorded. Native
382
+ Server releases after 3.12.0 also name ``limit_kind``, the measured
383
+ ``current_value`` and the ``configured_limit`` (.github#228).
384
+
385
+ Replaying the task produces the same commands, so like
386
+ :class:`WorkflowTaskCompletionTooLarge` this is not retryable: the worker
387
+ fails the run once with a ``structural_limit`` failure instead of
388
+ reporting a workflow-task failure, which would block replay.
389
+
390
+ :attr:`limit_kind` is the Server's limit kind, or the refusal reason when
391
+ the Server named none. :attr:`limit` is the configured limit and
392
+ :attr:`size` the Server's measured value, in that limit's unit, when
393
+ reported.
394
+ """
395
+
396
+ def __init__(self, status: int, body: object, *, size: int | None = None) -> None:
397
+ ServerError.__init__(self, status, body)
398
+ fields = body if isinstance(body, dict) else {}
399
+ kind = fields.get("limit_kind")
400
+ limit = fields.get("configured_limit")
401
+ current = fields.get("current_value")
402
+ message = fields.get("message")
403
+ self.limit_kind = kind if isinstance(kind, str) and kind else str(self.reason() or "history_transaction_limit")
404
+ self.limit = limit if type(limit) is int else None
405
+ self.size = current if type(current) is int else None
406
+ self.server_message = message if isinstance(message, str) and message else None
407
+ self.args = (self.structural_limit_message(),)
408
+
409
+ @staticmethod
410
+ def matches(status: int, body: object) -> bool:
411
+ """Whether a response is a history-transaction budget refusal."""
412
+ return (
413
+ status == 409
414
+ and isinstance(body, dict)
415
+ and body.get("reason") in HISTORY_TRANSACTION_REFUSALS
416
+ and body.get("recorded") is not True
417
+ )
418
+
419
+ def structural_limit_message(self) -> str:
420
+ unit = _HISTORY_TRANSACTION_UNITS.get(self.limit_kind, "units")
421
+ size = f"{self.size} {unit}" if self.size is not None else "more than the limit allows"
422
+ limit = f"the server limit of {self.limit} {unit}" if self.limit is not None else "the server limit"
423
+ return (
424
+ f"Structural limit exceeded: {self.limit_kind}: the workflow task completion would write {size} "
425
+ f"in one history transaction, over {limit}. Split the fan-out into smaller batches, move work into "
426
+ "child workflows, or continue-as-new; offload large payloads with external payload storage."
427
+ )
428
+
429
+
358
430
  class NexusOperationFailed(DurableWorkflowError):
359
431
  """A Nexus service operation completed with a typed service failure."""
360
432
 
@@ -514,6 +586,13 @@ class QueryFailed(DurableWorkflowError):
514
586
  REQUEST_ID_CONFLICT = "request_id_conflict"
515
587
  """Reason reported when a command key is reused with a different intent."""
516
588
 
589
+ REQUEST_ID_AMBIGUOUS = "request_id_ambiguous"
590
+ """Reason reported when a command key matches an ambiguous legacy retained identity.
591
+
592
+ Nothing was written and no retained receipt was selected. Inspect the original
593
+ command before sending the input again under a new key.
594
+ """
595
+
517
596
  _REQUEST_ID_CONFLICT_FIELDS = (
518
597
  "request_id",
519
598
  "retained_command_id",
@@ -531,11 +610,22 @@ def _body_string(body: object, name: str) -> str | None:
531
610
  return None
532
611
 
533
612
 
613
+ _REQUEST_ID_AMBIGUOUS_FIELDS = ("request_id", "outcome", "retained", "intent_verified", "retryable")
614
+
615
+
534
616
  def _request_id_conflict_details(body: object) -> dict[str, Any]:
535
- """Return the retained-command fields of a ``request_id_conflict`` response body."""
536
- if not isinstance(body, dict) or body.get("reason") != REQUEST_ID_CONFLICT:
617
+ """Return the retained-command fields of a command-key refusal body.
618
+
619
+ ``request_id_conflict`` carries the retained command; ``request_id_ambiguous``
620
+ carries only its refusal markers because no retained receipt was selected.
621
+ """
622
+ if not isinstance(body, dict):
537
623
  return {}
538
- return {name: body[name] for name in _REQUEST_ID_CONFLICT_FIELDS if name in body}
624
+ if body.get("reason") == REQUEST_ID_CONFLICT:
625
+ return {name: body[name] for name in _REQUEST_ID_CONFLICT_FIELDS if name in body}
626
+ if body.get("reason") == REQUEST_ID_AMBIGUOUS:
627
+ return {name: body[name] for name in _REQUEST_ID_AMBIGUOUS_FIELDS if name in body}
628
+ return {}
539
629
 
540
630
 
541
631
  class SignalFailed(DurableWorkflowError):
@@ -548,7 +638,10 @@ class SignalFailed(DurableWorkflowError):
548
638
  already retained for a signal with a different intent, and
549
639
  :attr:`details` then carries ``retained_command_id``,
550
640
  ``retained_command_type``, ``retained_outcome`` and the mismatched
551
- ``conflict`` parts.
641
+ ``conflict`` parts. ``request_id_ambiguous`` means the key matches an
642
+ ambiguous legacy retained identity; nothing was written, no receipt was
643
+ selected, and :attr:`details` carries ``retained`` and
644
+ ``intent_verified`` (``False``).
552
645
  """
553
646
 
554
647
  def __init__(
@@ -660,7 +753,9 @@ class UpdateFailed(InvalidArgument):
660
753
  means the key was already retained for an update with a different intent,
661
754
  and :attr:`details` then carries ``retained_command_id``,
662
755
  ``retained_command_type``, ``retained_outcome`` and the mismatched
663
- ``conflict`` parts.
756
+ ``conflict`` parts. ``request_id_ambiguous`` means the key matches an
757
+ ambiguous legacy retained identity; nothing was written and no receipt
758
+ was selected.
664
759
  """
665
760
 
666
761
  def __init__(
@@ -1073,6 +1168,8 @@ def _raise_for_status(
1073
1168
 
1074
1169
  if WorkflowTaskCompletionTooLarge.matches(status, body):
1075
1170
  raise WorkflowTaskCompletionTooLarge(status, body, size=request_bytes)
1171
+ if context == "task_completion" and WorkflowTaskHistoryLimitExceeded.matches(status, body):
1172
+ raise WorkflowTaskHistoryLimitExceeded(status, body)
1076
1173
 
1077
1174
  reason = body.get("reason") if isinstance(body, dict) else None
1078
1175
  message = body.get("message", "") if isinstance(body, dict) else str(body)
@@ -1193,15 +1290,20 @@ def _raise_for_status(
1193
1290
  raise UpdateRejected(message or "update rejected", body=body)
1194
1291
  if reason in update_validation_failure_reasons:
1195
1292
  raise update_validation_failed("update validation failed")
1196
- if reason == REQUEST_ID_CONFLICT:
1293
+ if reason in (REQUEST_ID_CONFLICT, REQUEST_ID_AMBIGUOUS):
1197
1294
  # The retained command type names the key scope; the Server also
1198
1295
  # labels the control-plane operation. Either selects the typed failure.
1199
1296
  command_type = _body_string(body, "retained_command_type") or operation
1297
+ refusal = (
1298
+ "already retained with a different intent"
1299
+ if reason == REQUEST_ID_CONFLICT
1300
+ else "matches an ambiguous retained command identity"
1301
+ )
1200
1302
  if command_type == "signal":
1201
- raise signal_failed("signal request id already retained with a different intent")
1303
+ raise signal_failed(f"signal request id {refusal}")
1202
1304
  if command_type == "update" and isinstance(body, dict):
1203
1305
  raise UpdateFailed(
1204
- message or "update request id already retained with a different intent",
1306
+ message or f"update request id {refusal}",
1205
1307
  status=status,
1206
1308
  body=body,
1207
1309
  )
@@ -151,7 +151,7 @@ TYPED_SEARCH_ATTRIBUTES_CAPABILITY = "typed_search_attributes"
151
151
  DURABLE_SELECTION_CAPABILITY = "durable_selection"
152
152
  LOCAL_ACTIVITIES_CAPABILITY = "local_activities"
153
153
 
154
- # Command capabilities implemented by every high-level Python worker. Keep this
154
+ # Base capabilities implemented by every high-level Python worker. Keep this
155
155
  # advertisement explicit: worker capabilities are not inferred from runtime,
156
156
  # SDK, or protocol-version metadata.
157
157
  _WORKFLOW_COMMAND_CAPABILITIES = (
@@ -160,6 +160,7 @@ _WORKFLOW_COMMAND_CAPABILITIES = (
160
160
  DURABLE_SELECTION_CAPABILITY,
161
161
  LOCAL_ACTIVITIES_CAPABILITY,
162
162
  "workflow_entry_arguments_validation",
163
+ "activity_heartbeat_resume",
163
164
  )
164
165
 
165
166
  _WORKFLOW_WORK_TASK_KINDS = ("workflow", "update_validation")
@@ -2410,6 +2411,23 @@ class Worker:
2410
2411
  reference = store_external_payload(storage, data, codec=envelope["codec"])
2411
2412
  return {"codec": envelope["codec"], "external_storage": reference.to_dict()}
2412
2413
 
2414
+ async def _wait_local_retry_backoff(self, task: dict[str, Any], seconds: float) -> None:
2415
+ """Wait a local retry backoff while keeping the workflow task leased.
2416
+
2417
+ A backoff, such as the generated 60-second default cap, can be as long
2418
+ as the Server's workflow-task lease (60 seconds by default on native
2419
+ Server). Renew at the cooperative lease observer's cadence so the
2420
+ Server never reclaims the claim and reruns the local activity from its
2421
+ first attempt (.github#219). The full backoff is never shortened.
2422
+ """
2423
+ remaining = float(seconds)
2424
+ while remaining > 0:
2425
+ step = min(remaining, 5.0, self._heartbeat_interval)
2426
+ await asyncio.sleep(step)
2427
+ remaining -= step
2428
+ if remaining > 0:
2429
+ await self._renew_local_workflow_lease(task)
2430
+
2413
2431
  async def _execute_cooperative_local_callable(
2414
2432
  self, task: dict[str, Any], command: RecordLocalActivity, handler: Callable[..., Any],
2415
2433
  attempt_state: dict[str, Any],
@@ -2700,7 +2718,7 @@ class Worker:
2700
2718
  attempts.append(attempt_report)
2701
2719
  if retry:
2702
2720
  if backoff_seconds:
2703
- await asyncio.sleep(backoff_seconds)
2721
+ await self._wait_local_retry_backoff(task, backoff_seconds)
2704
2722
  continue
2705
2723
  return terminal_failure(
2706
2724
  status, message, exception_type,
@@ -3118,12 +3136,13 @@ class Worker:
3118
3136
  the typed error is raised again with the follow-up's error as its
3119
3137
  cause, so the caller never reports a workflow-task failure (``/fail``)
3120
3138
  on this path: the Server would retry the task into the same 413 or
3121
- block replay.
3139
+ block replay. A history-transaction budget refusal
3140
+ (:class:`WorkflowTaskHistoryLimitExceeded`, a 409) takes this path too.
3122
3141
  """
3123
3142
  message = error.structural_limit_message()
3124
3143
  log.error(
3125
- "workflow task %s completion refused by the server: %s (limit_kind=%s, size=%s bytes, "
3126
- "limit=%s bytes); failing the run instead of resending it",
3144
+ "workflow task %s completion refused by the server: %s (limit_kind=%s, measured=%s, "
3145
+ "limit=%s); failing the run instead of resending it",
3127
3146
  task_id,
3128
3147
  message,
3129
3148
  error.limit_kind,
@@ -3416,6 +3435,7 @@ class Worker:
3416
3435
  task_queue=self.task_queue,
3417
3436
  worker_id=self.worker_id,
3418
3437
  task_metadata=task,
3438
+ task_namespace=getattr(self.client, "namespace", None),
3419
3439
  ),
3420
3440
  client=self.client,
3421
3441
  )