durable-workflow 2.22.0__tar.gz → 2.23.1__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 (250) hide show
  1. {durable_workflow-2.22.0/src/durable_workflow.egg-info → durable_workflow-2.23.1}/PKG-INFO +1 -1
  2. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/pyproject.toml +3 -3
  3. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/__init__.py +4 -0
  4. durable_workflow-2.23.1/src/durable_workflow/_condition_input_order.py +140 -0
  5. durable_workflow-2.23.1/src/durable_workflow/_continue_as_new.py +35 -0
  6. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/client.py +35 -3
  7. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/errors.py +26 -1
  8. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/replay_verify.py +4 -5
  9. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/worker.py +71 -6
  10. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/workflow.py +341 -12
  11. {durable_workflow-2.22.0 → durable_workflow-2.23.1/src/durable_workflow.egg-info}/PKG-INFO +1 -1
  12. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow.egg-info/SOURCES.txt +4 -0
  13. durable_workflow-2.23.1/tests/test_continue_as_new_target.py +174 -0
  14. durable_workflow-2.23.1/tests/test_ordered_condition_input.py +67 -0
  15. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_replay_regression_corpus.py +24 -1
  16. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_replay_verify.py +37 -0
  17. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_worker.py +28 -0
  18. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/LICENSE +0 -0
  19. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/README.md +0 -0
  20. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/setup.cfg +0 -0
  21. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_activity_checkpoint.py +0 -0
  22. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_activity_lease.py +0 -0
  23. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_activity_process.py +0 -0
  24. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_avro.py +0 -0
  25. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_cancellation_scope.py +0 -0
  26. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_cancellation_scope_history.py +0 -0
  27. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_capabilities_digest.py +0 -0
  28. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_condition_fingerprint.py +0 -0
  29. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_cooperative_cancellation.py +0 -0
  30. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_failure_reporting.py +0 -0
  31. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_metric_routes.py +0 -0
  32. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_poll_transport.py +0 -0
  33. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_prepared_local_activity.py +0 -0
  34. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_query_task_authority.py +0 -0
  35. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_response_limit.py +0 -0
  36. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_sticky_workflow_cache.py +0 -0
  37. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/_typed_values.py +0 -0
  38. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/activity.py +0 -0
  39. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/auth_composition.py +0 -0
  40. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/cancellation.py +0 -0
  41. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/external_storage.py +0 -0
  42. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/external_task_input.py +0 -0
  43. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/external_task_result.py +0 -0
  44. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/history_bundle_verify.py +0 -0
  45. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/interceptors.py +0 -0
  46. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/invocable.py +0 -0
  47. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/metrics.py +0 -0
  48. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/nexus.py +0 -0
  49. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/py.typed +0 -0
  50. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/python_conformance.py +0 -0
  51. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/replay_clock.py +0 -0
  52. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/replay_clock_math.py +0 -0
  53. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/replay_conformance.py +0 -0
  54. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/retry_policy.py +0 -0
  55. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/serializer.py +0 -0
  56. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/server_compatibility.json +0 -0
  57. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/sync.py +0 -0
  58. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/telemetry.py +0 -0
  59. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/telemetry_carrier.py +0 -0
  60. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/testing.py +0 -0
  61. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/worker_session.py +0 -0
  62. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/worker_status.py +0 -0
  63. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow/workflow_updates_conformance.py +0 -0
  64. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow.egg-info/dependency_links.txt +0 -0
  65. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow.egg-info/entry_points.txt +0 -0
  66. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow.egg-info/requires.txt +0 -0
  67. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/src/durable_workflow.egg-info/top_level.txt +0 -0
  68. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_acceptance_authority.py +0 -0
  69. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_acceptance_consumer.py +0 -0
  70. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_acceptance_entry.py +0 -0
  71. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_cancellation_policies.py +0 -0
  72. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_checkpoint.py +0 -0
  73. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_context.py +0 -0
  74. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_exponential_retry.py +0 -0
  75. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_heartbeat_authority.py +0 -0
  76. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_identity.py +0 -0
  77. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_install_inventory.py +0 -0
  78. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_lease_authority.py +0 -0
  79. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_lease_renewal.py +0 -0
  80. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_lease_worker.py +0 -0
  81. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_process.py +0 -0
  82. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_retry_cap_cell.py +0 -0
  83. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_retry_info.py +0 -0
  84. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_run_closed_refusal.py +0 -0
  85. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_activity_worker_lost.py +0 -0
  86. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_auth_composition.py +0 -0
  87. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_avro_value_benchmark.py +0 -0
  88. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_avro_value_protocol.py +0 -0
  89. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_business_replay_clock.py +0 -0
  90. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_business_replay_clock_child.py +0 -0
  91. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_business_replay_clock_parallel.py +0 -0
  92. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_business_replay_clock_redrive.py +0 -0
  93. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_business_replay_clock_sequence_claims.py +0 -0
  94. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_cancellation_cause.py +0 -0
  95. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_cancellation_context.py +0 -0
  96. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_cancellation_remaining_time.py +0 -0
  97. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_cancellation_scope_admission.py +0 -0
  98. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_cancellation_scope_authoring.py +0 -0
  99. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_cancellation_scope_boundary.py +0 -0
  100. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_cancellation_scope_opening.py +0 -0
  101. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_capabilities_digest.py +0 -0
  102. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_capabilities_digest_unknown.py +0 -0
  103. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_checkpointed_batch_example.py +0 -0
  104. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_child_workflow_policies.py +0 -0
  105. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_ci_checkout.py +0 -0
  106. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_ci_integration_endpoint.py +0 -0
  107. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_client.py +0 -0
  108. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_client_iterators.py +0 -0
  109. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_client_telemetry.py +0 -0
  110. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_client_timeouts.py +0 -0
  111. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_codec_regression_corpus.py +0 -0
  112. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_command_keys_acceptance.py +0 -0
  113. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_command_keys_captured_inputs.py +0 -0
  114. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_command_keys_container_ownership.py +0 -0
  115. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_command_keys_workspace.py +0 -0
  116. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_committed_cancellation_scope_descendants.py +0 -0
  117. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_committed_cancellation_scope_groups.py +0 -0
  118. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_committed_cancellation_scope_history.py +0 -0
  119. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_committed_cancellation_scope_replay.py +0 -0
  120. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_completion_size_limit.py +0 -0
  121. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_condition_fingerprint.py +0 -0
  122. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_condition_occurrence_id.py +0 -0
  123. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_condition_replay_drift.py +0 -0
  124. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_control_plane_parity_fixtures.py +0 -0
  125. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_cooperative_cancellation.py +0 -0
  126. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_cooperative_cancellation_client.py +0 -0
  127. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_cooperative_cancellation_worker.py +0 -0
  128. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_cooperative_remote_worker.py +0 -0
  129. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_docs_release_channel.py +0 -0
  130. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_docstring_cross_references.py +0 -0
  131. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_durable_selection.py +0 -0
  132. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_empty_callback_failure.py +0 -0
  133. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_errors.py +0 -0
  134. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_external_storage.py +0 -0
  135. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_external_task_input.py +0 -0
  136. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_external_task_result.py +0 -0
  137. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_failure_reporting.py +0 -0
  138. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_generator_lifecycle.py +0 -0
  139. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_golden_history_replay.py +0 -0
  140. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_history_bundle_pruned.py +0 -0
  141. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_history_bundle_schema2.py +0 -0
  142. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_history_bundle_verify.py +0 -0
  143. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_history_event_contract.py +0 -0
  144. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_invocable.py +0 -0
  145. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_local_activity_backoff.py +0 -0
  146. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_local_failure_reporting.py +0 -0
  147. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_message_streams.py +0 -0
  148. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_metric_routes.py +0 -0
  149. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_metrics.py +0 -0
  150. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_native_timer_redrive_cell.py +0 -0
  151. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_native_timer_redrive_clock.py +0 -0
  152. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_nexus_durable_wait.py +0 -0
  153. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_nexus_namespace.py +0 -0
  154. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_nexus_wire.py +0 -0
  155. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_order_processing_example.py +0 -0
  156. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_parallel_completion_order_replay.py +0 -0
  157. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_parallel_failure_order.py +0 -0
  158. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_parallel_group_boundaries.py +0 -0
  159. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_parallel_group_policy.py +0 -0
  160. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_parallel_member_failure_open_siblings.py +0 -0
  161. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_parallel_saga_authoring.py +0 -0
  162. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_patch_history.py +0 -0
  163. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_payload_policy_refresh.py +0 -0
  164. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_pending_operation_replay.py +0 -0
  165. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_physical_command_key_readback.py +0 -0
  166. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_poll_failure_backoff.py +0 -0
  167. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_poll_transport.py +0 -0
  168. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_portal_source_split.py +0 -0
  169. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_prepared_local_activity_client.py +0 -0
  170. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_prepared_local_activity_groups.py +0 -0
  171. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_prepared_local_activity_policies.py +0 -0
  172. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_prepared_local_activity_worker.py +0 -0
  173. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_public_boundary_scanner.py +0 -0
  174. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_publish_workflow_isolation.py +0 -0
  175. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_published_activity_acceptance.py +0 -0
  176. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_published_pagination_evidence.py +0 -0
  177. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_pypi_project_surface.py +0 -0
  178. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_python_conformance.py +0 -0
  179. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_queries.py +0 -0
  180. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_query_task_authority.py +0 -0
  181. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_query_timeout_retry.py +0 -0
  182. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_quiesced_snapshot.py +0 -0
  183. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_readme_quickstart.py +0 -0
  184. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_redrive_call_ledger.py +0 -0
  185. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_redrive_replay.py +0 -0
  186. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_redrive_successor_evidence.py +0 -0
  187. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_registration_ambiguity.py +0 -0
  188. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_release_metadata.py +0 -0
  189. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_release_promotion.py +0 -0
  190. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_replay.py +0 -0
  191. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_replay_clock.py +0 -0
  192. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_replay_conformance.py +0 -0
  193. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_response_body_limit.py +0 -0
  194. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_result_continue_as_new.py +0 -0
  195. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_retry_cap_download.py +0 -0
  196. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_retry_cap_workflow.py +0 -0
  197. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_retry_policy.py +0 -0
  198. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_run_activities.py +0 -0
  199. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_run_cancellation_scope_replay.py +0 -0
  200. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_run_closed_settlement_replay.py +0 -0
  201. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_runtime_external_payload_transport.py +0 -0
  202. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_schedule_origin.py +0 -0
  203. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_schedules.py +0 -0
  204. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_scoped_run_cancellation_context.py +0 -0
  205. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_sdk_metrics_contract.py +0 -0
  206. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_search_attribute_replay_identity.py +0 -0
  207. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_serializer.py +0 -0
  208. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_signal_external_workflow.py +0 -0
  209. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_signal_with_start.py +0 -0
  210. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_signals.py +0 -0
  211. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_sleep.py +0 -0
  212. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_standalone_activity_client.py +0 -0
  213. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_static_credential_validation.py +0 -0
  214. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_sticky_execution.py +0 -0
  215. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_sticky_history_suffix.py +0 -0
  216. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_storage_admission.py +0 -0
  217. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_sync.py +0 -0
  218. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_sync_activities.py +0 -0
  219. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_synthetic_command_key_readback.py +0 -0
  220. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_telemetry.py +0 -0
  221. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_telemetry_carrier.py +0 -0
  222. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_testing_failures.py +0 -0
  223. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_testing_harness.py +0 -0
  224. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_testing_nexus.py +0 -0
  225. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_threaded_heartbeat_example.py +0 -0
  226. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_tls_trust.py +0 -0
  227. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_transport_diagnostics.py +0 -0
  228. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_typed_values.py +0 -0
  229. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_typed_workflow_values.py +0 -0
  230. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_update_outcome.py +0 -0
  231. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_update_signal_condition_replay.py +0 -0
  232. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_updates.py +0 -0
  233. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_wait_condition.py +0 -0
  234. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_worker_deregistration.py +0 -0
  235. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_worker_observation.py +0 -0
  236. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_worker_session.py +0 -0
  237. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_worker_startup_buffered.py +0 -0
  238. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_worker_startup_raw.py +0 -0
  239. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_worker_startup_read_budget.py +0 -0
  240. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_worker_startup_snapshot.py +0 -0
  241. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_worker_status.py +0 -0
  242. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_worker_telemetry_wire.py +0 -0
  243. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_worker_transient_runtime.py +0 -0
  244. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_workflow_entry_arguments.py +0 -0
  245. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_workflow_entrypoint_validation.py +0 -0
  246. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_workflow_handler_validation.py +0 -0
  247. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_workflow_identity.py +0 -0
  248. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_workflow_result_timeout.py +0 -0
  249. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/tests/test_workflow_streams.py +0 -0
  250. {durable_workflow-2.22.0 → durable_workflow-2.23.1}/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.22.0
3
+ Version: 2.23.1
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "durable-workflow"
7
- version = "2.22.0"
7
+ version = "2.23.1"
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.22.0"
83
- registry-version = "2.22.0"
82
+ product-train = "2.23.1"
83
+ registry-version = "2.23.1"
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"
@@ -8,6 +8,7 @@ except PackageNotFoundError: # source checkout without installed metadata
8
8
 
9
9
  from . import activity, sync, testing, workflow
10
10
  from ._activity_checkpoint import ActivityHeartbeatCheckpoint
11
+ from ._continue_as_new import ContinueAsNewTargetBuild
11
12
  from .activity import ActivityContext, ActivityInfo, ActivityRetryInfo
12
13
  from .auth_composition import (
13
14
  AUTH_COMPOSITION_CONTRACT_SCHEMA,
@@ -76,6 +77,7 @@ from .errors import (
76
77
  ChildWorkflowCancelled,
77
78
  ChildWorkflowFailed,
78
79
  ChildWorkflowTerminated,
80
+ ContinueAsNewTargetUnsupported,
79
81
  DuplicateRegistrationError,
80
82
  DurableOperationCancelled,
81
83
  DurableWorkflowError,
@@ -287,6 +289,8 @@ __all__ = [
287
289
  "ChildWorkflowTerminated",
288
290
  "Client",
289
291
  "ContinueAsNew",
292
+ "ContinueAsNewTargetBuild",
293
+ "ContinueAsNewTargetUnsupported",
290
294
  "DurableOperationCancelled",
291
295
  "DurableOperationHandle",
292
296
  "MessageStream",
@@ -0,0 +1,140 @@
1
+ """Canonical input positions for condition predicate replay."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Mapping, Sequence
6
+ from dataclasses import dataclass
7
+ from typing import Any
8
+
9
+ CAPABILITY = "condition_wait_input_order"
10
+ AUTHORING = "condition_wait_input_order_authoring"
11
+ ORDER = "durable_receipt_order"
12
+ PENDING_INPUT = "condition_wait_pending_input_sequence"
13
+
14
+
15
+ def marked(payload: Mapping[str, Any]) -> bool:
16
+ return payload.get(CAPABILITY) == ORDER
17
+
18
+
19
+ def positive_sequence(value: Any) -> int | None:
20
+ return value if type(value) is int and value > 0 else None
21
+
22
+
23
+ @dataclass(frozen=True)
24
+ class CompetingSelection:
25
+ terminal_id: str
26
+ sequence: int
27
+
28
+
29
+ def competing_selection(events: Sequence[Mapping[str, Any]], group_id: str) -> CompetingSelection | None:
30
+ candidates = [
31
+ (event, payload) for event in events
32
+ if event.get("event_type", event.get("type")) == "SelectionCandidateReady"
33
+ and isinstance(payload := event.get("payload"), Mapping)
34
+ and payload.get("selection_group_id") == group_id
35
+ ]
36
+ if not candidates:
37
+ return None
38
+ if len(candidates) != 1:
39
+ raise ValueError("an ordered selection has more than one competing terminal event")
40
+ candidate, payload = candidates[0]
41
+ terminal_id = payload.get("resolution_event_id")
42
+ sequence = positive_sequence(payload.get("resolution_event_sequence"))
43
+ if (not isinstance(terminal_id, str) or not terminal_id or sequence is None
44
+ or sequence >= (positive_sequence(candidate.get("sequence")) or 0)
45
+ or not any(
46
+ event.get("sequence") == sequence
47
+ and (event.get("id") or event.get("event_id")) == terminal_id
48
+ and event.get("event_type", event.get("type")) == payload.get("resolution_event_type")
49
+ for event in events
50
+ )):
51
+ raise ValueError("ordered selection candidate does not match its terminal history event")
52
+ return CompetingSelection(terminal_id, sequence)
53
+
54
+
55
+ @dataclass
56
+ class Wait:
57
+ opening_sequence: int
58
+ scheduled_sequence: int | None = None
59
+ timer_id: str | None = None
60
+ fired_sequence: int | None = None
61
+ settled: bool | None = None
62
+ satisfying_receipt: int | None = None
63
+
64
+
65
+ @dataclass(frozen=True)
66
+ class History:
67
+ waits: dict[str, Wait]
68
+ applied_signal_receipts: frozenset[int]
69
+ update_receipts: dict[int, int]
70
+
71
+
72
+ def read(events: Sequence[Mapping[str, Any]]) -> History:
73
+ if not any(
74
+ event.get("event_type", event.get("type")) == "ConditionWaitOpened"
75
+ and isinstance(event.get("payload"), Mapping) and marked(event["payload"])
76
+ for event in events
77
+ ):
78
+ return History({}, frozenset(), {})
79
+ waits: dict[str, Wait] = {}
80
+ receipts: dict[tuple[str, str], int] = {}
81
+ applied_signals: set[int] = set()
82
+ update_receipts: dict[int, int] = {}
83
+ for event in events:
84
+ kind = event.get("event_type", event.get("type"))
85
+ payload = event.get("payload")
86
+ if not isinstance(payload, Mapping):
87
+ continue
88
+ sequence = positive_sequence(event.get("sequence"))
89
+ command_id = event.get("workflow_command_id") or payload.get("workflow_command_id")
90
+ if sequence is not None and isinstance(command_id, str) and command_id:
91
+ if kind in ("SignalReceived", "UpdateAccepted"):
92
+ receipts.setdefault((kind, command_id), sequence)
93
+ elif kind == "SignalApplied":
94
+ receipt = receipts.get(("SignalReceived", command_id))
95
+ if receipt is not None:
96
+ applied_signals.add(receipt)
97
+ elif kind == "UpdateApplied":
98
+ receipt = receipts.get(("UpdateAccepted", command_id))
99
+ if receipt is not None:
100
+ update_receipts[sequence] = receipt
101
+ wait_id = payload.get("condition_wait_id")
102
+ if not isinstance(wait_id, str) or not wait_id:
103
+ continue
104
+ if kind == "ConditionWaitOpened" and marked(payload):
105
+ if sequence is None or wait_id in waits:
106
+ raise ValueError("ordered condition has an invalid opening sequence or repeated identity")
107
+ waits[wait_id] = Wait(sequence)
108
+ wait = waits.get(wait_id)
109
+ if wait is None:
110
+ continue
111
+ if kind == "TimerScheduled":
112
+ timer = payload.get("timer_id")
113
+ if (not marked(payload) or payload.get("timer_kind") != "condition_timeout"
114
+ or sequence is None or sequence <= wait.opening_sequence or not isinstance(timer, str)
115
+ or not timer or wait.scheduled_sequence is not None):
116
+ raise ValueError("ordered condition timer does not match its opening")
117
+ wait.scheduled_sequence = sequence
118
+ wait.timer_id = timer
119
+ elif kind == "TimerFired":
120
+ if (not marked(payload) or payload.get("timer_id") != wait.timer_id
121
+ or payload.get("timer_kind") != "condition_timeout" or wait.scheduled_sequence is None
122
+ or sequence is None or sequence <= wait.scheduled_sequence or wait.fired_sequence is not None):
123
+ raise ValueError("ordered condition fire does not match its original timer")
124
+ wait.fired_sequence = sequence
125
+ elif kind in ("ConditionWaitSatisfied", "ConditionWaitTimedOut"):
126
+ satisfied = kind == "ConditionWaitSatisfied"
127
+ receipt = positive_sequence(payload.get("input_receipt_sequence"))
128
+ if (not marked(payload) or wait.settled is not None or sequence is None
129
+ or sequence <= (wait.fired_sequence or wait.opening_sequence)
130
+ or payload.get("timer_fired_sequence") != wait.fired_sequence
131
+ or (receipt is not None and receipt >= sequence)
132
+ or (not satisfied and (wait.fired_sequence is None or receipt is not None))
133
+ or (satisfied and wait.fired_sequence is not None
134
+ and (receipt is None or receipt >= wait.fired_sequence))):
135
+ raise ValueError("ordered condition outcome does not match its original input boundary")
136
+ wait.settled = satisfied
137
+ wait.satisfying_receipt = receipt
138
+ if any(wait.scheduled_sequence is None for wait in waits.values()):
139
+ raise ValueError("ordered condition is missing its original timer schedule")
140
+ return History(waits, frozenset(applied_signals), update_receipts)
@@ -0,0 +1,35 @@
1
+ """Worker protocol contract for targeted continue-as-new."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import re
6
+ from collections.abc import Mapping
7
+ from typing import Literal, TypeAlias, TypeGuard
8
+
9
+ ContinueAsNewTargetBuild: TypeAlias = Literal["inherited", "promoted"]
10
+
11
+ CAPABILITY = "continue_as_new_target_build"
12
+ WORKER_PROTOCOL = "1.21"
13
+ PROMOTED_BUILD_UNAVAILABLE = "promoted_build_unavailable"
14
+
15
+
16
+ def valid_target(value: object) -> TypeGuard[ContinueAsNewTargetBuild]:
17
+ return isinstance(value, str) and value in ("inherited", "promoted")
18
+
19
+
20
+ def registration_supports_target(ack: object, worker_id: str, namespace: str | None, task_queue: str) -> bool:
21
+ if (
22
+ not isinstance(ack, Mapping)
23
+ or namespace is None
24
+ or ack.get("registered") is not True
25
+ or ack.get("worker_id") != worker_id
26
+ or ack.get("namespace") != namespace
27
+ or ack.get("task_queue") != task_queue
28
+ ):
29
+ return False
30
+ capabilities = ack.get("server_capabilities")
31
+ if not isinstance(capabilities, Mapping) or capabilities.get(CAPABILITY) is not True:
32
+ return False
33
+ protocol = ack.get("protocol_version")
34
+ match = re.fullmatch(r"1\.([0-9]{1,4})", protocol) if isinstance(protocol, str) else None
35
+ return match is not None and int(match[1]) >= 21
@@ -42,7 +42,7 @@ from urllib.parse import quote, unquote, urlencode, urlsplit
42
42
 
43
43
  import httpx
44
44
 
45
- from . import serializer
45
+ from . import _continue_as_new, serializer
46
46
  from ._activity_checkpoint import capture_poll as _capture_activity_checkpoint
47
47
  from ._activity_lease import ActivityLeaseAuthority, current_activity_authority
48
48
  from ._cancellation_scope import CancellationScopeOpenReceipt, scope_identity
@@ -73,6 +73,7 @@ from ._typed_values import decode_payload_value, to_payload_values, validate_ann
73
73
  from .errors import (
74
74
  REQUEST_ID_AMBIGUOUS,
75
75
  REQUEST_ID_CONFLICT,
76
+ ContinueAsNewTargetUnsupported,
76
77
  ExternalPayloadIntegrityMismatch,
77
78
  ExternalPayloadOversized,
78
79
  ExternalPayloadUnavailable,
@@ -2005,6 +2006,7 @@ class Client:
2005
2006
  self._cluster_info: dict[str, Any] | None = None
2006
2007
  self._cluster_info_lock = asyncio.Lock()
2007
2008
  self._capabilities_digest = ServerCapabilitiesDigest()
2009
+ self._continue_as_new_target_workers: set[tuple[str, str]] = set()
2008
2010
  self._runtime_external_payload_transport_cache: (
2009
2011
  _RuntimeExternalPayloadTransport | None
2010
2012
  ) = None
@@ -2023,6 +2025,7 @@ class Client:
2023
2025
  Safe to call multiple times.
2024
2026
  """
2025
2027
  self._workflow_payload_observers.clear()
2028
+ self._continue_as_new_target_workers.clear()
2026
2029
  await self._http.aclose()
2027
2030
 
2028
2031
  async def __aenter__(self) -> Client:
@@ -2208,6 +2211,7 @@ class Client:
2208
2211
  context: str = "",
2209
2212
  retry: bool = True,
2210
2213
  raise_for_status: Callable[..., None] = _raise_for_status,
2214
+ worker_protocol_version: str | None = None,
2211
2215
  ) -> Any:
2212
2216
  if worker and discovery:
2213
2217
  raise ValueError("a request cannot be both worker-plane and cluster discovery")
@@ -2269,6 +2273,8 @@ class Client:
2269
2273
  if worker and activity_authority is not None and activity_authority.governs(self, self.namespace, path):
2270
2274
  request_timeout = min(request_timeout, activity_authority.remaining())
2271
2275
  headers = self._discovery_headers() if discovery else self._headers(worker=worker)
2276
+ if worker and worker_protocol_version is not None:
2277
+ headers["X-Durable-Workflow-Protocol-Version"] = worker_protocol_version
2272
2278
  if capabilities_digest is not None:
2273
2279
  headers[CAPABILITIES_DIGEST_HEADER] = ServerCapabilitiesDigest.header(capabilities_digest)
2274
2280
  if progress_poll:
@@ -4101,6 +4107,7 @@ class Client:
4101
4107
 
4102
4108
  async def deregister_worker(self, worker_id: str) -> dict[str, Any]:
4103
4109
  """Remove a stale or retired worker from the server roster."""
4110
+ self._continue_as_new_target_workers.discard((self.namespace, worker_id))
4104
4111
  data = await self._request("DELETE", f"/workers/{quote(worker_id, safe='')}", context=worker_id)
4105
4112
  if not isinstance(data, dict):
4106
4113
  raise ServerError(
@@ -6177,7 +6184,12 @@ class Client:
6177
6184
  body["process_metrics"] = process_metrics
6178
6185
  if heartbeat_interval_seconds is not None:
6179
6186
  body["heartbeat_interval_seconds"] = heartbeat_interval_seconds
6180
- return await self._request("POST", "/worker/register", worker=True, json=body)
6187
+ session = (self.namespace, worker_id)
6188
+ self._continue_as_new_target_workers.discard(session)
6189
+ ack = await self._request("POST", "/worker/register", worker=True, json=body)
6190
+ if _continue_as_new.registration_supports_target(ack, worker_id, self.namespace, task_queue):
6191
+ self._continue_as_new_target_workers.add(session)
6192
+ return ack
6181
6193
 
6182
6194
  async def create_worker_session(
6183
6195
  self, worker_id: str, options: WorkerSessionOptions
@@ -6228,6 +6240,7 @@ class Client:
6228
6240
  not isinstance(registration_token, str) or re.fullmatch(r"[a-f0-9]{32}", registration_token) is None
6229
6241
  ):
6230
6242
  raise ValueError("registration_token must contain exactly 32 lowercase hexadecimal characters")
6243
+ self._continue_as_new_target_workers.discard((self.namespace, worker_id))
6231
6244
  fenced = registration_token is not None
6232
6245
  try:
6233
6246
  data = await self._request(
@@ -6444,6 +6457,18 @@ class Client:
6444
6457
  failure_type="WorkflowTaskWaitingForHistory",
6445
6458
  )
6446
6459
 
6460
+ supports_target = (self.namespace, lease_owner) in self._continue_as_new_target_workers
6461
+ continuation_protocol = None
6462
+ for command in commands:
6463
+ is_continuation = command.get("type") == "continue_as_new"
6464
+ if "target_build" in command:
6465
+ if not is_continuation or not _continue_as_new.valid_target(command["target_build"]):
6466
+ raise ValueError("invalid_target_build: use the exact inherited or promoted continuation target")
6467
+ if not supports_target:
6468
+ raise ContinueAsNewTargetUnsupported()
6469
+ if is_continuation and supports_target:
6470
+ continuation_protocol = _continue_as_new.WORKER_PROTOCOL
6471
+
6447
6472
  body: dict[str, Any] = {
6448
6473
  "lease_owner": lease_owner,
6449
6474
  "workflow_task_attempt": workflow_task_attempt,
@@ -6462,6 +6487,7 @@ class Client:
6462
6487
  return await self._request(
6463
6488
  "POST", f"/worker/workflow-tasks/{task_id}/complete", worker=True, json=body,
6464
6489
  context="task_completion",
6490
+ worker_protocol_version=continuation_protocol,
6465
6491
  )
6466
6492
 
6467
6493
  async def fail_workflow_task(
@@ -6482,6 +6508,11 @@ class Client:
6482
6508
  The runtime may block incompatible replay until compatible code and
6483
6509
  a supported repair are available instead of automatically retrying it.
6484
6510
  """
6511
+ continuation_protocol = None
6512
+ if failure_reason == _continue_as_new.PROMOTED_BUILD_UNAVAILABLE:
6513
+ if (self.namespace, lease_owner) not in self._continue_as_new_target_workers:
6514
+ raise ContinueAsNewTargetUnsupported()
6515
+ continuation_protocol = _continue_as_new.WORKER_PROTOCOL
6485
6516
  failure: dict[str, Any] = {"message": message}
6486
6517
  if failure_type is not None:
6487
6518
  failure["type"] = failure_type
@@ -6495,7 +6526,8 @@ class Client:
6495
6526
  "failure": failure,
6496
6527
  }
6497
6528
  return await self._request(
6498
- "POST", f"/worker/workflow-tasks/{task_id}/fail", worker=True, json=body
6529
+ "POST", f"/worker/workflow-tasks/{task_id}/fail", worker=True, json=body,
6530
+ worker_protocol_version=continuation_protocol,
6499
6531
  )
6500
6532
 
6501
6533
  async def heartbeat_workflow_task(
@@ -18,7 +18,7 @@ https://github.com/temporalio/sdk-python/issues/1292.
18
18
 
19
19
  from __future__ import annotations
20
20
 
21
- from typing import Any
21
+ from typing import Any, TypedDict
22
22
 
23
23
  from .cancellation import CancellationContext, ScopedCancellationContext
24
24
 
@@ -27,6 +27,15 @@ class DurableWorkflowError(Exception):
27
27
  """Base class for every exception raised by the SDK."""
28
28
 
29
29
 
30
+ class ContinueAsNewTargetUnsupported(DurableWorkflowError):
31
+ """The current worker registration cannot send a continue-as-new target."""
32
+
33
+ reason = "unsupported_target_build"
34
+
35
+ def __init__(self) -> None:
36
+ super().__init__(f"{self.reason}: the Server did not advertise build selection for this worker session")
37
+
38
+
30
39
  class ActivityHeartbeatResumeUnavailable(DurableWorkflowError):
31
40
  """This claim did not supply the supported heartbeat-resume contract."""
32
41
 
@@ -810,6 +819,14 @@ class WorkflowEntryArgumentsMismatchError(DurableWorkflowError):
810
819
  )
811
820
 
812
821
 
822
+ class WorkflowSourceLocation(TypedDict):
823
+ """Authored suspension site using the source filename without its directory."""
824
+
825
+ function: str
826
+ file: str
827
+ line: int
828
+
829
+
813
830
  class NonDeterministicReplayError(DurableWorkflowError):
814
831
  """Current workflow code yielded a command shape that does not match history."""
815
832
 
@@ -835,6 +852,14 @@ class NonDeterministicReplayError(DurableWorkflowError):
835
852
  self.workflow_sequence = workflow_sequence
836
853
  self.expected_shape = expected_shape
837
854
  self.recorded_event_types = list(recorded_event_types)
855
+ self.workflow_source: WorkflowSourceLocation | None = None
856
+
857
+ def __str__(self) -> str:
858
+ message = super().__str__()
859
+ source = self.workflow_source
860
+ if source is None:
861
+ return message
862
+ return f"{message} Authored at {source['function']} ({source['file']}:{source['line']})."
838
863
 
839
864
 
840
865
  class UpdateFailed(InvalidArgument):
@@ -553,12 +553,14 @@ def _replay_case(replayer: Replayer, case: Mapping[str, Any]) -> CaseReport:
553
553
  workflow_type=workflow_type,
554
554
  )
555
555
  except NonDeterministicReplayError as exc:
556
- divergence = {
556
+ divergence: dict[str, Any] = {
557
557
  "workflow_sequence": exc.workflow_sequence,
558
558
  "expected_shape": exc.expected_shape,
559
559
  "recorded_event_types": list(exc.recorded_event_types),
560
560
  "message": str(exc),
561
561
  }
562
+ if exc.workflow_source is not None:
563
+ divergence["workflow_source"] = exc.workflow_source
562
564
  return CaseReport(
563
565
  id=case_id,
564
566
  status=STATUS_DRIFTED,
@@ -570,10 +572,7 @@ def _replay_case(replayer: Replayer, case: Mapping[str, Any]) -> CaseReport:
570
572
  expected=case.get("expected"),
571
573
  error={
572
574
  "class": type(exc).__name__,
573
- "message": str(exc),
574
- "workflow_sequence": exc.workflow_sequence,
575
- "expected_shape": exc.expected_shape,
576
- "recorded_event_types": list(exc.recorded_event_types),
575
+ **divergence,
577
576
  },
578
577
  )
579
578
  except (TypeError, ValueError, ChildWorkflowFailed, WorkflowFailed) as exc:
@@ -41,7 +41,7 @@ from typing import Annotated, Any, Concatenate, Literal, ParamSpec, TypeVar, Uni
41
41
 
42
42
  import httpx
43
43
 
44
- from . import serializer
44
+ from . import _condition_input_order, _continue_as_new, serializer
45
45
  from ._activity_lease import (
46
46
  ACTIVITY_LEASE_RENEWAL_EXHAUSTED,
47
47
  ActivityLeaseAuthority,
@@ -84,6 +84,7 @@ from .errors import (
84
84
  ActivityFailed,
85
85
  ActivityWorkerLost,
86
86
  AvroNotInstalledError,
87
+ ContinueAsNewTargetUnsupported,
87
88
  DuplicateRegistrationError,
88
89
  DurableWorkflowError,
89
90
  ExternalPayloadError,
@@ -1465,6 +1466,7 @@ class Worker:
1465
1466
  self._poller_tasks: set[asyncio.Task[Any]] = set()
1466
1467
  self._registered = False
1467
1468
  self._deregistration_fenced = False
1469
+ self._continue_as_new_target_build_supported = False
1468
1470
  self._sticky_history_suffix_supported = False
1469
1471
  self._registration_token: str | None = None
1470
1472
  self._registration_worker_id: str | None = None
@@ -1475,6 +1477,7 @@ class Worker:
1475
1477
  self._query_tasks_supported = False
1476
1478
  self._workflow_memo_updates_supported = False
1477
1479
  self._signal_external_workflow_supported = False
1480
+ self._ordered_condition_inputs_supported = False
1478
1481
  self._update_validation_tasks_supported = False
1479
1482
  self._query_thread_stop = threading.Event()
1480
1483
  self._query_thread: threading.Thread | None = None
@@ -1709,6 +1712,9 @@ class Worker:
1709
1712
  "Server query_task_authority=true before registration")
1710
1713
  self._workflow_memo_updates_supported = _server_supports_workflow_memo_updates(info)
1711
1714
  self._signal_external_workflow_supported = _server_supports_signal_external_workflow(info)
1715
+ self._ordered_condition_inputs_supported = (
1716
+ isinstance(server_capabilities, Mapping) and _condition_input_order.marked(server_capabilities)
1717
+ )
1712
1718
  has_update_validators = any(
1713
1719
  contract["update_validators"] for contract in self.workflow_command_contracts.values()
1714
1720
  )
@@ -1736,6 +1742,8 @@ class Worker:
1736
1742
  if any(contract["updates"] for contract in self.workflow_command_contracts.values()):
1737
1743
  capabilities.append(WORKFLOW_UPDATES_CAPABILITY)
1738
1744
  capabilities.append(MESSAGE_STREAMS_CAPABILITY)
1745
+ if self._ordered_condition_inputs_supported:
1746
+ capabilities.append(_condition_input_order.CAPABILITY)
1739
1747
  capabilities.extend(self.capabilities)
1740
1748
  if self._nexus_cooperative_cancellation_supported and "nexus_cooperative_cancellation" not in capabilities:
1741
1749
  capabilities.append("nexus_cooperative_cancellation")
@@ -1763,6 +1771,7 @@ class Worker:
1763
1771
  "supported": True, "minimum_protocol_version": "1.18", "version": 1,
1764
1772
  }
1765
1773
 
1774
+ self._continue_as_new_target_build_supported = False
1766
1775
  ack = await self.client.register_worker(
1767
1776
  worker_id=self.worker_id,
1768
1777
  task_queue=self.task_queue,
@@ -1777,6 +1786,9 @@ class Worker:
1777
1786
  capabilities=capabilities,
1778
1787
  capability_manifest={
1779
1788
  **affinity_manifest,
1789
+ _continue_as_new.CAPABILITY: {
1790
+ "supported": True, "minimum_protocol_version": _continue_as_new.WORKER_PROTOCOL,
1791
+ },
1780
1792
  **({"nexus_cooperative_cancellation": {
1781
1793
  "supported": True, "minimum_protocol_version": "1.20",
1782
1794
  "implementation": "owned_workflow_run_canonical_delivery",
@@ -1798,6 +1810,9 @@ class Worker:
1798
1810
  task_slots=self._current_task_slots(),
1799
1811
  process_metrics=self._current_process_metrics(),
1800
1812
  )
1813
+ self._continue_as_new_target_build_supported = _continue_as_new.registration_supports_target(
1814
+ ack, self.worker_id, getattr(self.client, "namespace", None), self.task_queue,
1815
+ )
1801
1816
  if self._deregistration_fenced:
1802
1817
  token = ack.get("registration_token") if isinstance(ack, dict) else None
1803
1818
  if (
@@ -2117,6 +2132,13 @@ class Worker:
2117
2132
  self, cls: type, task: dict[str, Any], history: list[dict[str, Any]], start_input: list[Any],
2118
2133
  *, payload_codec: str | None, execute_local: Callable[[RecordLocalActivity], Any],
2119
2134
  ) -> tuple[ReplayOutcome, list[dict[str, Any]]]:
2135
+ pending_condition_input: tuple[int | None] | None = None
2136
+ if _condition_input_order.PENDING_INPUT in task:
2137
+ raw_sequence = task[_condition_input_order.PENDING_INPUT]
2138
+ sequence = _condition_input_order.positive_sequence(raw_sequence)
2139
+ if raw_sequence is not None and sequence is None:
2140
+ raise LocalActivityExecutionAborted("invalid ordered condition input snapshot")
2141
+ pending_condition_input = (sequence,)
2120
2142
  observation = task.get("cancellation_request")
2121
2143
  if observation is not None:
2122
2144
  observed = self._observe_workflow_cancellation(task, observation)
@@ -2148,6 +2170,10 @@ class Worker:
2148
2170
  allow_cancellation_scope_authoring=self._allow_cancellation_scope_authoring,
2149
2171
  allow_cancellation_scope_delivery=self._allow_cancellation_scope_delivery,
2150
2172
  record_parallel_failure_order=self.record_parallel_failure_order,
2173
+ allow_continue_as_new_target_build=self._continue_as_new_target_build_supported,
2174
+ allow_ordered_condition_inputs=self._ordered_condition_inputs_supported,
2175
+ author_ordered_condition_inputs=task.get(_condition_input_order.AUTHORING) is True,
2176
+ pending_condition_input=pending_condition_input,
2151
2177
  )
2152
2178
  if outcome.cancellation_scope_delivery is not None:
2153
2179
  if outcome.commands:
@@ -3091,7 +3117,7 @@ class Worker:
3091
3117
  workflow_task_attempt=attempt,
3092
3118
  message=f"workflow replay failed before update {update_id!r}: {exc}",
3093
3119
  failure_type=type(exc).__name__,
3094
- stack_trace=traceback.format_exc(),
3120
+ stack_trace=None,
3095
3121
  )
3096
3122
  except Exception as failure_error:
3097
3123
  log.warning("failed to report update replay failure: %s", failure_error)
@@ -3146,6 +3172,9 @@ class Worker:
3146
3172
  except _WorkflowClaimDeferred:
3147
3173
  log.info("workflow task %s released for durable successor work", task_id)
3148
3174
  return None
3175
+ except ContinueAsNewTargetUnsupported as error:
3176
+ log.info("workflow task %s left on its original claim: %s", task_id, error)
3177
+ return None
3149
3178
  except LocalActivityExecutionAborted as e:
3150
3179
  log.warning("abandoning workflow task %s before local activity commit: %s", task_id, e)
3151
3180
  return None
@@ -3178,7 +3207,7 @@ class Worker:
3178
3207
  workflow_task_attempt=attempt,
3179
3208
  message=f"replay failed: {e}",
3180
3209
  failure_type=type(e).__name__,
3181
- stack_trace=traceback.format_exc(),
3210
+ stack_trace=None if isinstance(e, NonDeterministicReplayError) else traceback.format_exc(),
3182
3211
  **failure_details,
3183
3212
  )
3184
3213
  except Exception as fe:
@@ -3186,6 +3215,15 @@ class Worker:
3186
3215
  return None
3187
3216
 
3188
3217
  workflow_commands = list(outcome.commands)
3218
+ if not workflow_commands and _condition_input_order.PENDING_INPUT in task:
3219
+ await self.client.fail_workflow_task(
3220
+ task_id=task_id,
3221
+ lease_owner=self.worker_id,
3222
+ workflow_task_attempt=attempt,
3223
+ message="Workflow task waiting for scheduled history.",
3224
+ failure_type="WorkflowTaskWaitingForHistory",
3225
+ )
3226
+ return None
3189
3227
 
3190
3228
  if (
3191
3229
  any(isinstance(command, UpsertMemo) for command in workflow_commands)
@@ -3316,7 +3354,27 @@ class Worker:
3316
3354
  message_stream_waits=outcome.message_stream_waits,
3317
3355
  sticky_cache=self._sticky_cache_claim(task, history, commands),
3318
3356
  )
3357
+ except ContinueAsNewTargetUnsupported as error:
3358
+ log.info("workflow task %s left on its original claim: %s", task_id, error)
3359
+ return None
3319
3360
  except Exception as e:
3361
+ if (
3362
+ isinstance(e, ServerError)
3363
+ and e.status == 409
3364
+ and e.reason() == _continue_as_new.PROMOTED_BUILD_UNAVAILABLE
3365
+ and isinstance(e.body, dict)
3366
+ and e.body.get("retryable") is True
3367
+ and e.body.get("request_admitted") is False
3368
+ and any(
3369
+ command.get("type") == "continue_as_new" and command.get("target_build") == "promoted"
3370
+ for command in commands
3371
+ )
3372
+ ):
3373
+ log.info("workflow task %s will retry after promoted build admission was refused", task_id)
3374
+ await self._report_workflow_task_after_completion_error(
3375
+ task_id, attempt, e, failure_reason=_continue_as_new.PROMOTED_BUILD_UNAVAILABLE,
3376
+ )
3377
+ return None
3320
3378
  log.warning("failed to complete workflow task %s: %s", task_id, e)
3321
3379
  if _is_storage_admission_error(e) or isinstance(e, WorkflowTaskCompletionTooLarge):
3322
3380
  return None
@@ -3453,15 +3511,22 @@ class Worker:
3453
3511
  task_id: str,
3454
3512
  attempt: int,
3455
3513
  error: Exception,
3514
+ *,
3515
+ failure_reason: str | None = None,
3456
3516
  ) -> None:
3517
+ promoted_unavailable = failure_reason == _continue_as_new.PROMOTED_BUILD_UNAVAILABLE
3457
3518
  try:
3458
3519
  await self.client.fail_workflow_task(
3459
3520
  task_id=task_id,
3460
3521
  lease_owner=self.worker_id,
3461
3522
  workflow_task_attempt=attempt,
3462
- message=f"workflow task completion failed after commands were produced: {error}",
3463
- failure_type=type(error).__name__,
3464
- stack_trace=traceback.format_exc(),
3523
+ message=(
3524
+ "The promoted build is unavailable for the successor workflow." if promoted_unavailable
3525
+ else f"workflow task completion failed after commands were produced: {error}"
3526
+ ),
3527
+ failure_type="PromotedBuildUnavailable" if promoted_unavailable else type(error).__name__,
3528
+ stack_trace=None if promoted_unavailable else traceback.format_exc(),
3529
+ failure_reason=failure_reason,
3465
3530
  )
3466
3531
  except Exception as fail_error:
3467
3532
  log.warning(