durable-workflow 2.30.0__tar.gz → 2.31.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 (265) hide show
  1. {durable_workflow-2.30.0/src/durable_workflow.egg-info → durable_workflow-2.31.0}/PKG-INFO +1 -1
  2. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/pyproject.toml +3 -3
  3. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/replay_clock.py +80 -0
  4. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/workflow.py +18 -1
  5. {durable_workflow-2.30.0 → durable_workflow-2.31.0/src/durable_workflow.egg-info}/PKG-INFO +1 -1
  6. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow.egg-info/SOURCES.txt +1 -0
  7. durable_workflow-2.31.0/tests/test_business_replay_clock_condition.py +283 -0
  8. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_replay_regression_corpus.py +2 -0
  9. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/LICENSE +0 -0
  10. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/README.md +0 -0
  11. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/setup.cfg +0 -0
  12. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/__init__.py +0 -0
  13. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_activity_checkpoint.py +0 -0
  14. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_activity_lease.py +0 -0
  15. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_activity_process.py +0 -0
  16. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_avro.py +0 -0
  17. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_cancellation_scope.py +0 -0
  18. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_cancellation_scope_history.py +0 -0
  19. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_capabilities_digest.py +0 -0
  20. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_condition_fingerprint.py +0 -0
  21. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_condition_input_order.py +0 -0
  22. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_continue_as_new.py +0 -0
  23. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_cooperative_cancellation.py +0 -0
  24. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_failure_reporting.py +0 -0
  25. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_metric_routes.py +0 -0
  26. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_parallel_group_policy.py +0 -0
  27. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_payload_protection.py +0 -0
  28. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_poll_transport.py +0 -0
  29. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_prepared_local_activity.py +0 -0
  30. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_query_task_authority.py +0 -0
  31. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_response_limit.py +0 -0
  32. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_sticky_workflow_cache.py +0 -0
  33. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_timeout_cleanup.py +0 -0
  34. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/_typed_values.py +0 -0
  35. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/activity.py +0 -0
  36. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/auth_composition.py +0 -0
  37. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/cancellation.py +0 -0
  38. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/client.py +0 -0
  39. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/errors.py +0 -0
  40. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/external_storage.py +0 -0
  41. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/external_task_input.py +0 -0
  42. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/external_task_result.py +0 -0
  43. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/history_bundle_verify.py +0 -0
  44. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/interceptors.py +0 -0
  45. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/invocable.py +0 -0
  46. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/metrics.py +0 -0
  47. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/nexus.py +0 -0
  48. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/prepared_payload.py +0 -0
  49. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/py.typed +0 -0
  50. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/python_conformance.py +0 -0
  51. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/replay_clock_math.py +0 -0
  52. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/replay_conformance.py +0 -0
  53. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/replay_verify.py +0 -0
  54. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/retry_policy.py +0 -0
  55. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/serializer.py +0 -0
  56. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/server_compatibility.json +0 -0
  57. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/sync.py +0 -0
  58. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/telemetry.py +0 -0
  59. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/telemetry_carrier.py +0 -0
  60. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/testing.py +0 -0
  61. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/worker.py +0 -0
  62. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/worker_session.py +0 -0
  63. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/worker_status.py +0 -0
  64. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow/workflow_updates_conformance.py +0 -0
  65. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow.egg-info/dependency_links.txt +0 -0
  66. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow.egg-info/entry_points.txt +0 -0
  67. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow.egg-info/requires.txt +0 -0
  68. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/src/durable_workflow.egg-info/top_level.txt +0 -0
  69. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_acceptance_authority.py +0 -0
  70. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_acceptance_consumer.py +0 -0
  71. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_acceptance_entry.py +0 -0
  72. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_cancellation_policies.py +0 -0
  73. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_checkpoint.py +0 -0
  74. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_context.py +0 -0
  75. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_exponential_retry.py +0 -0
  76. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_heartbeat_authority.py +0 -0
  77. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_heartbeat_unavailable.py +0 -0
  78. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_identity.py +0 -0
  79. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_install_inventory.py +0 -0
  80. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_lease_authority.py +0 -0
  81. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_lease_renewal.py +0 -0
  82. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_lease_worker.py +0 -0
  83. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_process.py +0 -0
  84. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_retry_cap_cell.py +0 -0
  85. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_retry_info.py +0 -0
  86. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_run_closed_refusal.py +0 -0
  87. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_activity_worker_lost.py +0 -0
  88. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_auth_composition.py +0 -0
  89. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_avro_value_benchmark.py +0 -0
  90. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_avro_value_protocol.py +0 -0
  91. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_business_replay_clock.py +0 -0
  92. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_business_replay_clock_child.py +0 -0
  93. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_business_replay_clock_entry.py +0 -0
  94. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_business_replay_clock_parallel.py +0 -0
  95. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_business_replay_clock_query_attestation.py +0 -0
  96. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_business_replay_clock_redrive.py +0 -0
  97. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_business_replay_clock_selection.py +0 -0
  98. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_business_replay_clock_sequence_claims.py +0 -0
  99. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_cancellation_cause.py +0 -0
  100. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_cancellation_context.py +0 -0
  101. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_cancellation_remaining_time.py +0 -0
  102. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_cancellation_scope_admission.py +0 -0
  103. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_cancellation_scope_authoring.py +0 -0
  104. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_cancellation_scope_boundary.py +0 -0
  105. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_cancellation_scope_opening.py +0 -0
  106. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_capabilities_digest.py +0 -0
  107. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_capabilities_digest_unknown.py +0 -0
  108. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_checkpointed_batch_example.py +0 -0
  109. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_child_workflow_policies.py +0 -0
  110. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_ci_checkout.py +0 -0
  111. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_ci_integration_endpoint.py +0 -0
  112. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_client.py +0 -0
  113. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_client_iterators.py +0 -0
  114. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_client_payload_protection.py +0 -0
  115. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_client_telemetry.py +0 -0
  116. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_client_timeouts.py +0 -0
  117. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_coalescing_signal_timer_replay.py +0 -0
  118. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_codec_regression_corpus.py +0 -0
  119. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_command_keys_acceptance.py +0 -0
  120. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_command_keys_captured_inputs.py +0 -0
  121. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_command_keys_container_ownership.py +0 -0
  122. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_command_keys_workspace.py +0 -0
  123. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_committed_cancellation_scope_descendants.py +0 -0
  124. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_committed_cancellation_scope_groups.py +0 -0
  125. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_committed_cancellation_scope_history.py +0 -0
  126. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_committed_cancellation_scope_replay.py +0 -0
  127. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_completion_size_limit.py +0 -0
  128. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_condition_fingerprint.py +0 -0
  129. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_condition_occurrence_id.py +0 -0
  130. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_condition_replay_drift.py +0 -0
  131. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_continue_as_new_target.py +0 -0
  132. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_control_plane_parity_fixtures.py +0 -0
  133. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_cooperative_cancellation.py +0 -0
  134. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_cooperative_cancellation_client.py +0 -0
  135. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_cooperative_cancellation_worker.py +0 -0
  136. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_cooperative_remote_worker.py +0 -0
  137. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_docs_release_channel.py +0 -0
  138. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_docstring_cross_references.py +0 -0
  139. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_durable_selection.py +0 -0
  140. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_empty_callback_failure.py +0 -0
  141. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_errors.py +0 -0
  142. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_external_storage.py +0 -0
  143. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_external_task_input.py +0 -0
  144. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_external_task_result.py +0 -0
  145. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_failure_reporting.py +0 -0
  146. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_generator_lifecycle.py +0 -0
  147. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_golden_history_replay.py +0 -0
  148. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_history_bundle_pruned.py +0 -0
  149. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_history_bundle_schema2.py +0 -0
  150. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_history_bundle_verify.py +0 -0
  151. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_history_event_contract.py +0 -0
  152. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_invocable.py +0 -0
  153. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_local_activity_backoff.py +0 -0
  154. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_local_failure_reporting.py +0 -0
  155. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_message_streams.py +0 -0
  156. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_metric_routes.py +0 -0
  157. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_metrics.py +0 -0
  158. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_native_timer_redrive_cell.py +0 -0
  159. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_native_timer_redrive_clock.py +0 -0
  160. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_nexus_durable_wait.py +0 -0
  161. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_nexus_namespace.py +0 -0
  162. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_nexus_wire.py +0 -0
  163. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_order_processing_example.py +0 -0
  164. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_ordered_condition_input.py +0 -0
  165. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_parallel_completion_order_replay.py +0 -0
  166. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_parallel_failure_order.py +0 -0
  167. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_parallel_group_boundaries.py +0 -0
  168. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_parallel_group_policy.py +0 -0
  169. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_parallel_member_failure_open_siblings.py +0 -0
  170. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_parallel_saga_authoring.py +0 -0
  171. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_patch_history.py +0 -0
  172. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_payload_policy_refresh.py +0 -0
  173. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_payload_protection.py +0 -0
  174. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_pending_operation_replay.py +0 -0
  175. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_physical_command_key_readback.py +0 -0
  176. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_poll_failure_backoff.py +0 -0
  177. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_poll_transport.py +0 -0
  178. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_portal_source_split.py +0 -0
  179. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_prepared_local_activity_client.py +0 -0
  180. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_prepared_local_activity_groups.py +0 -0
  181. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_prepared_local_activity_policies.py +0 -0
  182. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_prepared_local_activity_worker.py +0 -0
  183. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_protected_workflow_replay.py +0 -0
  184. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_public_boundary_scanner.py +0 -0
  185. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_publish_workflow_isolation.py +0 -0
  186. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_published_activity_acceptance.py +0 -0
  187. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_published_pagination_evidence.py +0 -0
  188. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_pypi_project_surface.py +0 -0
  189. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_python_conformance.py +0 -0
  190. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_queries.py +0 -0
  191. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_query_task_authority.py +0 -0
  192. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_query_timeout_retry.py +0 -0
  193. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_quiesced_snapshot.py +0 -0
  194. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_readme_quickstart.py +0 -0
  195. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_redrive_call_ledger.py +0 -0
  196. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_redrive_replay.py +0 -0
  197. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_redrive_successor_evidence.py +0 -0
  198. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_registration_ambiguity.py +0 -0
  199. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_release_metadata.py +0 -0
  200. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_release_promotion.py +0 -0
  201. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_replay.py +0 -0
  202. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_replay_clock.py +0 -0
  203. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_replay_conformance.py +0 -0
  204. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_replay_verify.py +0 -0
  205. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_response_body_limit.py +0 -0
  206. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_result_continue_as_new.py +0 -0
  207. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_retry_cap_download.py +0 -0
  208. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_retry_cap_workflow.py +0 -0
  209. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_retry_policy.py +0 -0
  210. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_run_activities.py +0 -0
  211. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_run_cancellation_scope_replay.py +0 -0
  212. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_run_closed_settlement_replay.py +0 -0
  213. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_runtime_external_payload_transport.py +0 -0
  214. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_schedule_origin.py +0 -0
  215. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_schedules.py +0 -0
  216. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_scoped_run_cancellation_context.py +0 -0
  217. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_sdk_metrics_contract.py +0 -0
  218. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_search_attribute_replay_identity.py +0 -0
  219. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_serializer.py +0 -0
  220. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_signal_external_workflow.py +0 -0
  221. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_signal_with_start.py +0 -0
  222. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_signals.py +0 -0
  223. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_sleep.py +0 -0
  224. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_standalone_activity_client.py +0 -0
  225. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_static_credential_validation.py +0 -0
  226. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_sticky_execution.py +0 -0
  227. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_sticky_history_suffix.py +0 -0
  228. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_storage_admission.py +0 -0
  229. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_sync.py +0 -0
  230. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_sync_activities.py +0 -0
  231. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_synthetic_command_key_readback.py +0 -0
  232. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_telemetry.py +0 -0
  233. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_telemetry_carrier.py +0 -0
  234. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_testing_failures.py +0 -0
  235. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_testing_harness.py +0 -0
  236. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_testing_nexus.py +0 -0
  237. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_threaded_heartbeat_example.py +0 -0
  238. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_timeout_cleanup.py +0 -0
  239. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_tls_trust.py +0 -0
  240. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_transport_diagnostics.py +0 -0
  241. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_typed_values.py +0 -0
  242. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_typed_workflow_values.py +0 -0
  243. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_update_outcome.py +0 -0
  244. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_update_signal_condition_replay.py +0 -0
  245. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_updates.py +0 -0
  246. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_wait_condition.py +0 -0
  247. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_worker.py +0 -0
  248. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_worker_deregistration.py +0 -0
  249. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_worker_observation.py +0 -0
  250. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_worker_session.py +0 -0
  251. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_worker_startup_buffered.py +0 -0
  252. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_worker_startup_raw.py +0 -0
  253. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_worker_startup_read_budget.py +0 -0
  254. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_worker_startup_snapshot.py +0 -0
  255. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_worker_status.py +0 -0
  256. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_worker_telemetry_wire.py +0 -0
  257. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_worker_transient_5xx_retry.py +0 -0
  258. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_worker_transient_runtime.py +0 -0
  259. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_workflow_entry_arguments.py +0 -0
  260. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_workflow_entrypoint_validation.py +0 -0
  261. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_workflow_handler_validation.py +0 -0
  262. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_workflow_identity.py +0 -0
  263. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_workflow_result_timeout.py +0 -0
  264. {durable_workflow-2.30.0 → durable_workflow-2.31.0}/tests/test_workflow_streams.py +0 -0
  265. {durable_workflow-2.30.0 → durable_workflow-2.31.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.30.0
3
+ Version: 2.31.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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "durable-workflow"
7
- version = "2.30.0"
7
+ version = "2.31.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"
@@ -82,8 +82,8 @@ durable-workflow-replay-conformance = "durable_workflow.replay_conformance:main"
82
82
  durable-workflow-workflow-updates-conformance = "durable_workflow.workflow_updates_conformance:main"
83
83
 
84
84
  [tool.durable-workflow]
85
- product-train = "2.30.0"
86
- registry-version = "2.30.0"
85
+ product-train = "2.31.0"
86
+ registry-version = "2.31.0"
87
87
  supported-server-versions = "2.8.0"
88
88
  supported-server-release-baselines = { "2" = "2.8.0", "3" = "3.0.0" }
89
89
  worker-protocol-version = "1.20"
@@ -14,6 +14,7 @@ from dataclasses import dataclass
14
14
  from datetime import datetime, timezone
15
15
  from typing import Any, ParamSpec, TypeGuard, TypeVar
16
16
 
17
+ from ._condition_input_order import marked as _ordered_condition
17
18
  from .errors import ReplayClockUnavailable
18
19
  from .replay_clock_math import canonical_milliseconds, from_canonical_milliseconds
19
20
 
@@ -37,6 +38,11 @@ _GroupMember = tuple[int | None, int, str | int, Sequence[Mapping[str, Any]] | N
37
38
  ENTRY_SCHEMA = "durable-workflow.worker-replay-clock/v1"
38
39
  _ENTRY_SOURCES = frozenset({"run_started_at", "redrive_replayed_started_at"})
39
40
  _ENTRY_INSTANT = re.compile(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z", re.ASCII)
41
+ _CONDITION_ROWS = frozenset({
42
+ "ConditionWaitOpened", "ConditionWaitSatisfied", "ConditionWaitTimedOut", "ConditionWaitCancelled",
43
+ "TimerScheduled", "TimerFired", "TimerCancelled",
44
+ })
45
+ _SCALAR_GROUP_FIELDS = ("parallel_group", "parallel_group_id", "selection_group", *_SELECTION_FIELDS)
40
46
 
41
47
 
42
48
  @dataclass(frozen=True)
@@ -318,6 +324,9 @@ class BusinessReplayClock:
318
324
  # group carries it into the next resume without consuming history.
319
325
  self._pending_entry = True
320
326
  self._current_entry = False
327
+ # What the last resumed segment could read when it yielded. A condition
328
+ # wait that consumes no clock boundary resumes with exactly this value.
329
+ self._yielded: tuple[tuple[int | None, datetime | None], bool] = ((None, None), False)
321
330
  # A query or validation rebuild whose task does not attest the entry
322
331
  # carrier cannot know what the workflow task's entry read returned.
323
332
  self.entry_unattested = False
@@ -399,6 +408,7 @@ class BusinessReplayClock:
399
408
  self._current, self._pending = self._pending, (None, None)
400
409
  entry, self._pending_entry = self._pending_entry, False
401
410
  self._current_entry = entry
411
+ self._yielded = (self._current, entry)
402
412
  with execution_scope(owner, self._current[1], entry=entry):
403
413
  return function(*args)
404
414
 
@@ -420,6 +430,76 @@ class BusinessReplayClock:
420
430
  self._pending = self._current
421
431
  self._pending_entry = self._current_entry
422
432
 
433
+ def keep_condition_prior(self) -> None:
434
+ """A satisfied or non-advancing condition resumes with its yield's value.
435
+
436
+ External workers' Servers record ``ConditionWaitSatisfied`` and an
437
+ ordered timeout only when the resuming task completes, after workflow
438
+ code has run. Neither time exists on the first execution, so neither
439
+ is read on replay: the clock keeps what the waiting code last saw,
440
+ including an unavailable value and its entry attestation.
441
+ """
442
+ self._pending, self._pending_entry = self._yielded
443
+
444
+ def observe_condition_timeout(self, wait_id: Any, *, reconstruction: bool) -> None:
445
+ """Use the condition-timeout ``TimerFired`` that ended this physical wait.
446
+
447
+ The Server records that fire before the resuming task, so the first
448
+ execution and every replay read the same instant. A Core
449
+ ``ConditionWaitTimedOut`` is accepted only at that same instant;
450
+ another time, like an ordered-input timeout the worker resolved
451
+ itself, keeps the prior value. Unproved evidence is unavailable.
452
+ """
453
+ self._pending, self._pending_entry = (None, None), False
454
+ if not _identity(wait_id):
455
+ return
456
+ rows: dict[str, list[int]] = {}
457
+ for index, event in enumerate(self.events):
458
+ payload = event.get("payload")
459
+ if isinstance(payload, Mapping) and payload.get("condition_wait_id") == wait_id:
460
+ kind = _kind(event)
461
+ if kind not in _CONDITION_ROWS:
462
+ return
463
+ rows.setdefault(kind, []).append(index)
464
+ opened, scheduled, fired, timed_out = (rows.get(kind, []) for kind in (
465
+ "ConditionWaitOpened", "TimerScheduled", "TimerFired", "ConditionWaitTimedOut"))
466
+ if (len(opened) != 1 or len(scheduled) != 1 or len(fired) != 1 or len(timed_out) > 1
467
+ or any(rows.get(kind) for kind in ("ConditionWaitSatisfied", "ConditionWaitCancelled", "TimerCancelled"))
468
+ or not opened[0] < scheduled[0] < fired[0] or timed_out and timed_out[0] < fired[0]):
469
+ return
470
+ opening = self.events[opened[0]]["payload"]
471
+ sequence = _sequence(opening)
472
+ timer = self.events[scheduled[0]]["payload"].get("timer_id")
473
+ if sequence is None or not _identity(timer):
474
+ return
475
+ for index in (*opened, *scheduled, *fired, *timed_out):
476
+ body = self.events[index]["payload"]
477
+ is_timer = _kind(self.events[index]) in ("TimerScheduled", "TimerFired")
478
+ if (_sequence(body) != sequence or any(key in body for key in _REUSE_FIELDS)
479
+ or any(body.get(field) is not None for field in _SCALAR_GROUP_FIELDS)
480
+ or body.get("parallel_group_path") not in (None, [])
481
+ or body.get("cancellation_scope_id") not in (None, "root")
482
+ or (is_timer and (body.get("timer_kind") != "condition_timeout" or body.get("timer_id") != timer))
483
+ or (not is_timer and "timer_id" in body and body["timer_id"] != timer)):
484
+ return
485
+ if self._redrive_declared and (self._resume_step is None or sequence < self._resume_step):
486
+ return
487
+ if _ordered_condition(opening):
488
+ self.keep_condition_prior()
489
+ return
490
+ time = _time(_recorded_value(self.events[fired[0]]))
491
+ if time is None:
492
+ return
493
+ if timed_out:
494
+ if _time(_recorded_value(self.events[timed_out[0]])) != time:
495
+ self.keep_condition_prior()
496
+ return
497
+ elif reconstruction:
498
+ # Core's query replay needs the explicit resolution; a fire alone
499
+ # grants no callback authority there.
500
+ return
501
+ self._pending = (None, time)
502
+
423
503
  def observe_selection(self, marker_index: int, terminal_index: int | None, base_sequence: int) -> None:
424
504
  """Use the matched decision when it follows its unique winner terminal."""
425
505
  self._pending = (None, None)
@@ -3337,7 +3337,10 @@ class WorkflowContext:
3337
3337
  This additive clock supports scalar persisted activities, timers and
3338
3338
  children, explicit redrive start, validated selection decisions, and
3339
3339
  remote groups of activities, timers and children, including mixed
3340
- groups. A selection uses its recorded decision instant. Group success
3340
+ groups. A selection uses its recorded decision instant. A satisfied
3341
+ ``wait_condition`` keeps the value read before the wait, and a
3342
+ condition timeout reads its recorded condition-timeout timer fire.
3343
+ Group success
3341
3344
  retains the selected event's full precision;
3342
3345
  matching caught failure uses canonical-v1 integer milliseconds.
3343
3346
  Ordinary entry reads the run's canonical start from the workflow
@@ -9277,6 +9280,7 @@ def _replay_state(
9277
9280
  )
9278
9281
  if already_satisfied:
9279
9282
  terminal_condition_reopen_cmd = None
9283
+ ctx._business_clock.keep_condition_prior()
9280
9284
  next_value = True
9281
9285
  continue
9282
9286
  if next_opened_mismatch is not None:
@@ -9361,6 +9365,9 @@ def _replay_state(
9361
9365
  _advance_cancellation_clock([condition_wait_terminal_indexes.get(opened_id)])
9362
9366
  _release_ordered_condition_receivers(opened_id)
9363
9367
  terminal_condition_reopen_cmd = None
9368
+ # The worker writes an ordered resolution at
9369
+ # completion; its time is never a boundary.
9370
+ ctx._business_clock.keep_condition_prior()
9364
9371
  next_value = resolution_value
9365
9372
  wait_yield_count += 1
9366
9373
  break
@@ -9389,6 +9396,10 @@ def _replay_state(
9389
9396
  wait_yield_count = next_wait_index
9390
9397
  continue
9391
9398
  terminal_condition_reopen_cmd = None
9399
+ ctx._business_clock.observe_condition_timeout(
9400
+ opened.get("condition_wait_id") if opened is not None else None,
9401
+ reconstruction=reconstruction_only,
9402
+ )
9392
9403
  next_value = False
9393
9404
  wait_yield_count += 1
9394
9405
  break
@@ -9419,6 +9430,9 @@ def _replay_state(
9419
9430
  )
9420
9431
  terminal_condition_chain_first = wait_opened[first_open_index]
9421
9432
  terminal_condition_chain_current = opened
9433
+ # A satisfaction is recorded when the resuming task
9434
+ # completes, after this code ran: keep the prior value.
9435
+ ctx._business_clock.keep_condition_prior()
9422
9436
  next_value = True
9423
9437
  wait_yield_count += 1
9424
9438
  break
@@ -9430,6 +9444,9 @@ def _replay_state(
9430
9444
  )
9431
9445
  terminal_condition_chain_first = wait_opened[first_open_index]
9432
9446
  terminal_condition_chain_current = opened
9447
+ # A satisfaction is recorded when the resuming task
9448
+ # completes, after this code ran: keep the prior value.
9449
+ ctx._business_clock.keep_condition_prior()
9433
9450
  next_value = True
9434
9451
  wait_yield_count += 1
9435
9452
  break
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: durable-workflow
3
- Version: 2.30.0
3
+ Version: 2.31.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
@@ -86,6 +86,7 @@ tests/test_avro_value_benchmark.py
86
86
  tests/test_avro_value_protocol.py
87
87
  tests/test_business_replay_clock.py
88
88
  tests/test_business_replay_clock_child.py
89
+ tests/test_business_replay_clock_condition.py
89
90
  tests/test_business_replay_clock_entry.py
90
91
  tests/test_business_replay_clock_parallel.py
91
92
  tests/test_business_replay_clock_query_attestation.py
@@ -0,0 +1,283 @@
1
+ """Condition waits and the business replay clock (.github#215, decision of 2026-12-01).
2
+
3
+ An external worker's Server writes ``ConditionWaitSatisfied`` (and an ordered
4
+ ``ConditionWaitTimedOut``) when the resuming workflow task completes, after the
5
+ code that follows the wait has run. A satisfied wait therefore keeps the value
6
+ the waiting code last saw, on the first execution and on every replay. A
7
+ condition timeout reads the ``TimerFired`` the Server recorded before the task.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ from copy import deepcopy
13
+ from typing import Any
14
+
15
+ import pytest
16
+
17
+ from durable_workflow import serializer, workflow
18
+ from durable_workflow.workflow import CompleteWorkflow, WaitCondition, WorkflowContext, replay
19
+ from tests.business_clock_workflows import ConditionBusinessClockWorkflow, clock_text
20
+
21
+ RUN = "condition-clock-run"
22
+ START = "2026-11-01T00:00:00.123456Z"
23
+ ACTIVITY = "2026-11-01T00:00:01.250000Z"
24
+ SATISFIED = "2026-11-01T00:00:03.654321Z"
25
+ FIRED = "2026-11-01T00:00:08.812345Z"
26
+ ACTIVITY_TEXT = "2026-11-01T00:00:01.250000+00:00"
27
+ FIRED_TEXT = "2026-11-01T00:00:08.812345+00:00"
28
+ ENTRY_TEXT = "2026-11-01T00:00:00.123456+00:00"
29
+
30
+
31
+ def _event(kind: str, at: str | None, **payload: Any) -> dict[str, Any]:
32
+ event: dict[str, Any] = {"event_type": kind, "payload": payload}
33
+ if at is not None:
34
+ event["recorded_at"] = at
35
+ return event
36
+
37
+
38
+ def _carrier() -> dict[str, Any]:
39
+ return {"schema": "durable-workflow.worker-replay-clock/v1", "workflow_run_id": RUN,
40
+ "started_at": START, "source": "run_started_at"}
41
+
42
+
43
+ def _opened(wait: str, sequence: int, key: str, ordinal: int, at: str, **extra: Any) -> dict[str, Any]:
44
+ return _event("ConditionWaitOpened", at, sequence=sequence, condition_wait_id=wait, condition_key=key,
45
+ condition_wait_occurrence_id=f"python:condition-wait:{ordinal}", **extra)
46
+
47
+
48
+ def _timer(kind: str, at: str, wait: str = "wait-2", **extra: Any) -> dict[str, Any]:
49
+ return _event(kind, at, sequence=3, condition_wait_id=wait, timer_id="timeout-2",
50
+ timer_kind="condition_timeout", delay_seconds=5, **extra)
51
+
52
+
53
+ def _prefix() -> list[dict[str, Any]]:
54
+ return [
55
+ _event("WorkflowStarted", "2026-11-01T00:00:00.200000Z"),
56
+ _event("ActivityScheduled", "2026-11-01T00:00:00.300000Z", sequence=1,
57
+ activity_execution_id="clock-activity", activity_type="clock.first"),
58
+ _event("ActivityCompleted", ACTIVITY, sequence=1, activity_execution_id="clock-activity",
59
+ activity_type="clock.first", result=serializer.envelope("done")),
60
+ _opened("wait-1", 2, "approval", 0, "2026-11-01T00:00:01.300000Z"),
61
+ _event("SignalReceived", "2026-11-01T00:00:03.500000Z", signal_name="approve", workflow_sequence=2,
62
+ value=serializer.envelope([]), payload_codec="avro"),
63
+ ]
64
+
65
+
66
+ def _satisfied() -> dict[str, Any]:
67
+ return _event("ConditionWaitSatisfied", SATISFIED, sequence=2, condition_wait_id="wait-1",
68
+ condition_key="approval", condition_wait_occurrence_id="python:condition-wait:0")
69
+
70
+
71
+ def _timeout_rows(timed_out: str | None = None) -> list[dict[str, Any]]:
72
+ rows = [
73
+ _opened("wait-2", 3, "deadline", 1, SATISFIED, timeout_seconds=5),
74
+ _timer("TimerScheduled", SATISFIED),
75
+ _timer("TimerFired", FIRED),
76
+ ]
77
+ if timed_out is not None:
78
+ rows.append(_event("ConditionWaitTimedOut", timed_out, sequence=3, condition_wait_id="wait-2",
79
+ condition_key="deadline", timeout_seconds=5, timer_id="timeout-2",
80
+ condition_wait_occurrence_id="python:condition-wait:1"))
81
+ return rows
82
+
83
+
84
+ def _run(
85
+ events: list[dict[str, Any]], *, entry: bool = True, workflow_cls: type = ConditionBusinessClockWorkflow,
86
+ ) -> list[Any]:
87
+ outcome = replay(workflow_cls, deepcopy(events), [], payload_codec="avro", run_id=RUN,
88
+ replay_clock_entry=_carrier() if entry else None)
89
+ try:
90
+ return list(outcome.commands)
91
+ finally:
92
+ outcome.close()
93
+
94
+
95
+ def _result(events: list[dict[str, Any]], **kwargs: Any) -> dict[str, Any]:
96
+ commands = _run(events, **kwargs)
97
+ assert len(commands) == 1 and isinstance(commands[0], CompleteWorkflow), commands
98
+ return dict(commands[0].result)
99
+
100
+
101
+ def test_live_and_recorded_satisfaction_both_keep_the_value_before_the_wait() -> None:
102
+ # The first execution resolves the wait from the signal; nothing records
103
+ # its time before the following code runs.
104
+ live = _run(_prefix())
105
+ assert isinstance(live[-1], WaitCondition) and live[-1].timeout_seconds == 5
106
+ replayed = _result(_prefix() + [_satisfied()] + _timeout_rows())
107
+ assert replayed["before"] == replayed["after_satisfied"] == ACTIVITY_TEXT
108
+ assert replayed["after_satisfied"] != "2026-11-01T00:00:03.654321+00:00"
109
+ assert replayed["repeated_reads_equal"] is True
110
+
111
+
112
+ @workflow.defn(name="tests.replay.business-clock-condition-probe")
113
+ class _FirstReadProbe:
114
+ """Persists the first execution's read in the next command, as live code would."""
115
+
116
+ def __init__(self) -> None:
117
+ self.ready = False
118
+
119
+ @workflow.signal("approve")
120
+ def approve(self) -> None:
121
+ self.ready = True
122
+
123
+ def run(self, ctx: WorkflowContext): # type: ignore[no-untyped-def]
124
+ yield ctx.schedule_activity("clock.first", [])
125
+ yield ctx.wait_condition(lambda: self.ready, key="approval")
126
+ observed = clock_text(ctx)
127
+ yield ctx.schedule_activity("clock.echo", [observed])
128
+ return observed
129
+
130
+
131
+ def test_first_execution_and_replay_read_the_same_value_after_a_satisfied_wait() -> None:
132
+ first = _run(_prefix(), workflow_cls=_FirstReadProbe)
133
+ assert first[-1].activity_type == "clock.echo"
134
+ first_read = first[-1].arguments[0]
135
+ echoed = _prefix() + [_satisfied(),
136
+ _event("ActivityScheduled", SATISFIED, sequence=3, activity_execution_id="echo",
137
+ activity_type="clock.echo"),
138
+ _event("ActivityCompleted", "2026-11-01T00:00:04Z", sequence=3, activity_execution_id="echo",
139
+ activity_type="clock.echo", result=serializer.envelope(first_read))]
140
+ (complete,) = _run(echoed, workflow_cls=_FirstReadProbe)
141
+ assert isinstance(complete, CompleteWorkflow)
142
+ assert complete.result == first_read == ACTIVITY_TEXT
143
+
144
+
145
+ def test_entry_and_unavailable_prior_values_are_kept_as_they_were() -> None:
146
+ @workflow.defn(name="tests.replay.business-clock-condition-entry")
147
+ class EntryWait:
148
+ def __init__(self) -> None:
149
+ self.ready = False
150
+
151
+ @workflow.signal("approve")
152
+ def approve(self) -> None:
153
+ self.ready = True
154
+
155
+ def run(self, ctx: WorkflowContext): # type: ignore[no-untyped-def]
156
+ before = clock_text(ctx)
157
+ yield ctx.wait_condition(lambda: self.ready, key="approval")
158
+ return [before, clock_text(ctx)]
159
+
160
+ events = [
161
+ _event("WorkflowStarted", "2026-11-01T00:00:00.200000Z"),
162
+ _opened("wait-1", 1, "approval", 0, "2026-11-01T00:00:00.300000Z"),
163
+ _event("SignalReceived", "2026-11-01T00:00:03.500000Z", signal_name="approve", workflow_sequence=1,
164
+ value=serializer.envelope([]), payload_codec="avro"),
165
+ _event("ConditionWaitSatisfied", SATISFIED, sequence=1, condition_wait_id="wait-1",
166
+ condition_key="approval", condition_wait_occurrence_id="python:condition-wait:0"),
167
+ ]
168
+ for entry, expected in ((True, ENTRY_TEXT), (False, None)):
169
+ (live,) = _run(events[:3], entry=entry, workflow_cls=EntryWait)
170
+ (recorded,) = _run(events, entry=entry, workflow_cls=EntryWait)
171
+ assert live.result == recorded.result == [expected, expected]
172
+
173
+
174
+ def test_a_condition_timeout_reads_its_timer_fire_on_first_execution_and_replay() -> None:
175
+ first = _result(_prefix() + [_satisfied()] + _timeout_rows())
176
+ assert first["timed_out"] is True and first["after_timeout"] == FIRED_TEXT
177
+ # Core also records the timeout at the fire's instant.
178
+ core = _result(_prefix() + [_satisfied()] + _timeout_rows(timed_out=FIRED))
179
+ assert core == first
180
+ assert first["after_immediate"] == FIRED_TEXT and first["immediate"] is True
181
+
182
+
183
+ def test_a_timeout_recorded_at_another_instant_keeps_the_prior_value() -> None:
184
+ result = _result(_prefix() + [_satisfied()] + _timeout_rows(timed_out="2026-11-01T00:00:08.900000Z"))
185
+ assert result["timed_out"] is True and result["after_timeout"] == ACTIVITY_TEXT
186
+
187
+
188
+ def test_an_ordered_timeout_keeps_the_prior_value_on_first_execution_and_replay() -> None:
189
+ # The fire alone authorizes nothing: the worker resolves an ordered wait
190
+ # itself, and the Server writes that resolution at completion time.
191
+ rows = _timeout_rows()
192
+ rows[0]["payload"].update(condition_wait_input_order="durable_receipt_order", deadline_policy="occurrence")
193
+ replay_ordered = _timeout_rows(timed_out="2026-11-01T00:00:08.990000Z")
194
+ replay_ordered[0]["payload"].update(condition_wait_input_order="durable_receipt_order",
195
+ deadline_policy="occurrence")
196
+ from durable_workflow.replay_clock import BusinessReplayClock
197
+
198
+ for events in (_prefix() + [_satisfied()] + rows, _prefix() + [_satisfied()] + replay_ordered):
199
+ clock = BusinessReplayClock(events, "", RUN, sequence_claim=lambda payload: payload.get("sequence"))
200
+ clock._yielded = ((None, None), False)
201
+ clock.observe_condition_timeout("wait-2", reconstruction=False)
202
+ assert clock._pending == (None, None)
203
+ marker = object()
204
+ clock._yielded = ((4, marker), False) # type: ignore[assignment]
205
+ clock.observe_condition_timeout("wait-2", reconstruction=False)
206
+ assert clock._pending == (4, marker)
207
+
208
+
209
+ @pytest.mark.parametrize("mutation", [
210
+ "missing-fire", "duplicate-fire", "foreign-timer", "invalid-time", "grouped", "reused", "fire-before-schedule",
211
+ "satisfied-and-timed-out",
212
+ ])
213
+ def test_unproved_timeout_evidence_is_unavailable(mutation: str) -> None:
214
+ rows = _timeout_rows()
215
+ if mutation == "missing-fire":
216
+ rows[2] = _event("ConditionWaitTimedOut", FIRED, sequence=3, condition_wait_id="wait-2", timeout_seconds=5,
217
+ condition_key="deadline", condition_wait_occurrence_id="python:condition-wait:1")
218
+ elif mutation == "duplicate-fire":
219
+ rows.append(_timer("TimerFired", FIRED))
220
+ elif mutation == "foreign-timer":
221
+ rows[2]["payload"]["timer_id"] = "other"
222
+ elif mutation == "invalid-time":
223
+ rows[2]["recorded_at"] = "not-a-time"
224
+ elif mutation == "grouped":
225
+ rows[1]["payload"]["parallel_group_id"] = "parallel-calls:3:1"
226
+ elif mutation == "reused":
227
+ rows[2]["payload"]["reused_recorded_at"] = FIRED
228
+ elif mutation == "fire-before-schedule":
229
+ rows[1], rows[2] = rows[2], rows[1]
230
+ else:
231
+ rows.append(_event("ConditionWaitSatisfied", FIRED, sequence=3, condition_wait_id="wait-2"))
232
+ from durable_workflow.replay_clock import BusinessReplayClock
233
+
234
+ events = _prefix() + [_satisfied()] + rows
235
+ clock = BusinessReplayClock(events, "", RUN, sequence_claim=lambda payload: payload.get("sequence"))
236
+ clock._yielded = ((4, None), False)
237
+ clock.observe_condition_timeout("wait-2", reconstruction=False)
238
+ assert clock._pending == (None, None)
239
+
240
+
241
+ def test_query_reconstruction_needs_the_explicit_core_resolution() -> None:
242
+ from durable_workflow.replay_clock import BusinessReplayClock
243
+
244
+ for timed_out, expected in ((None, None), (FIRED, "2026-11-01T00:00:08.812345+00:00")):
245
+ events = _prefix() + [_satisfied()] + _timeout_rows(timed_out=timed_out)
246
+ clock = BusinessReplayClock(events, "", RUN, sequence_claim=lambda payload: payload.get("sequence"))
247
+ clock.observe_condition_timeout("wait-2", reconstruction=True)
248
+ time = clock._pending[1]
249
+ assert (time.isoformat(timespec="microseconds") if time else None) == expected
250
+
251
+
252
+ def test_reopened_waits_keep_the_prior_value_and_time_out_on_the_final_wait() -> None:
253
+ @workflow.defn(name="tests.replay.business-clock-condition-reopen")
254
+ class Reopen:
255
+ def __init__(self) -> None:
256
+ self.notes = 0
257
+
258
+ @workflow.signal("note")
259
+ def note(self) -> None:
260
+ self.notes += 1
261
+
262
+ def run(self, ctx: WorkflowContext): # type: ignore[no-untyped-def]
263
+ yield ctx.schedule_activity("clock.first", [])
264
+ ok = yield ctx.wait_condition(lambda: self.notes >= 5, key="deadline", timeout=60)
265
+ return [ok, clock_text(ctx)]
266
+
267
+ prefix = _prefix()[:3]
268
+ first = _event("ConditionWaitOpened", "2026-11-01T00:00:01.300000Z", sequence=2, condition_wait_id="w1",
269
+ condition_key="deadline", timeout_seconds=60, condition_wait_occurrence_id="python:condition-wait:0")
270
+ note = _event("SignalReceived", "2026-11-01T00:00:02Z", signal_name="note", workflow_sequence=2,
271
+ value=serializer.envelope([]), payload_codec="avro")
272
+ satisfied = _event("ConditionWaitSatisfied", "2026-11-01T00:00:02.100000Z", sequence=2, condition_wait_id="w1",
273
+ condition_key="deadline", timeout_seconds=60,
274
+ condition_wait_occurrence_id="python:condition-wait:0")
275
+ second = _event("ConditionWaitOpened", "2026-11-01T00:00:02.100000Z", sequence=3, condition_wait_id="w2",
276
+ condition_key="deadline", timeout_seconds=59,
277
+ condition_wait_occurrence_id="python:condition-wait:0")
278
+ scheduled = _event("TimerScheduled", "2026-11-01T00:00:02.100000Z", sequence=3, condition_wait_id="w2",
279
+ timer_id="t2", timer_kind="condition_timeout", delay_seconds=59)
280
+ fired = _event("TimerFired", "2026-11-01T00:01:01.300000Z", sequence=3, condition_wait_id="w2",
281
+ timer_id="t2", timer_kind="condition_timeout", delay_seconds=59)
282
+ (complete,) = _run(prefix + [first, note, satisfied, second, scheduled, fired], workflow_cls=Reopen)
283
+ assert complete.result == [False, "2026-11-01T00:01:01.300000+00:00"]
@@ -34,6 +34,7 @@ from durable_workflow.workflow import (
34
34
  )
35
35
  from tests.business_clock_workflows import (
36
36
  ChildBusinessClockWorkflow,
37
+ ConditionBusinessClockWorkflow,
37
38
  CyclicFinalizerBusinessClockWorkflow,
38
39
  EmptyGroupEntryWorkflow,
39
40
  NativeRedriveBusinessClockWorkflow,
@@ -464,6 +465,7 @@ WORKFLOWS = [
464
465
  ExternalSignalSenderWorkflow,
465
466
  IntegrationSenderWorkflow,
466
467
  ChildBusinessClockWorkflow,
468
+ ConditionBusinessClockWorkflow,
467
469
  CyclicFinalizerBusinessClockWorkflow,
468
470
  ParallelActivityBusinessClockWorkflow,
469
471
  ParallelChildBusinessClockWorkflow,