durable-workflow 2.23.1__tar.gz → 2.27.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.
- {durable_workflow-2.23.1/src/durable_workflow.egg-info → durable_workflow-2.27.0}/PKG-INFO +3 -1
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/pyproject.toml +6 -3
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/__init__.py +10 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_activity_lease.py +2 -2
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_activity_process.py +59 -4
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_avro.py +4 -1
- durable_workflow-2.27.0/src/durable_workflow/_parallel_group_policy.py +25 -0
- durable_workflow-2.27.0/src/durable_workflow/_payload_protection.py +236 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_prepared_local_activity.py +4 -3
- durable_workflow-2.27.0/src/durable_workflow/_timeout_cleanup.py +63 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/activity.py +25 -7
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/client.py +642 -86
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/errors.py +54 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/history_bundle_verify.py +10 -1
- durable_workflow-2.27.0/src/durable_workflow/prepared_payload.py +197 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/replay_clock.py +81 -4
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/retry_policy.py +42 -1
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/serializer.py +60 -10
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/sync.py +43 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/testing.py +8 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/worker.py +628 -153
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/workflow.py +366 -43
- {durable_workflow-2.23.1 → durable_workflow-2.27.0/src/durable_workflow.egg-info}/PKG-INFO +3 -1
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow.egg-info/SOURCES.txt +13 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow.egg-info/requires.txt +3 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_checkpoint.py +3 -1
- durable_workflow-2.27.0/tests/test_activity_heartbeat_unavailable.py +297 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_process.py +55 -0
- durable_workflow-2.27.0/tests/test_business_replay_clock_entry.py +296 -0
- durable_workflow-2.27.0/tests/test_business_replay_clock_query_attestation.py +153 -0
- durable_workflow-2.27.0/tests/test_client_payload_protection.py +401 -0
- durable_workflow-2.27.0/tests/test_coalescing_signal_timer_replay.py +193 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_cooperative_remote_worker.py +90 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_history_bundle_verify.py +82 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_parallel_group_policy.py +125 -8
- durable_workflow-2.27.0/tests/test_payload_protection.py +170 -0
- durable_workflow-2.27.0/tests/test_protected_workflow_replay.py +164 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_query_task_authority.py +62 -1
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_replay_regression_corpus.py +84 -1
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_runtime_external_payload_transport.py +142 -2
- durable_workflow-2.27.0/tests/test_timeout_cleanup.py +430 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_updates.py +98 -1
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_worker_status.py +36 -0
- durable_workflow-2.27.0/tests/test_worker_transient_5xx_retry.py +370 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_worker_transient_runtime.py +10 -1
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/LICENSE +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/README.md +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/setup.cfg +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_activity_checkpoint.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_cancellation_scope.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_cancellation_scope_history.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_capabilities_digest.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_condition_fingerprint.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_condition_input_order.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_continue_as_new.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_cooperative_cancellation.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_failure_reporting.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_metric_routes.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_poll_transport.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_query_task_authority.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_response_limit.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_sticky_workflow_cache.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_typed_values.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/auth_composition.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/cancellation.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/external_storage.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/external_task_input.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/external_task_result.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/interceptors.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/invocable.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/metrics.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/nexus.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/py.typed +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/python_conformance.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/replay_clock_math.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/replay_conformance.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/replay_verify.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/server_compatibility.json +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/telemetry.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/telemetry_carrier.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/worker_session.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/worker_status.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/workflow_updates_conformance.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow.egg-info/dependency_links.txt +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow.egg-info/entry_points.txt +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow.egg-info/top_level.txt +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_acceptance_authority.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_acceptance_consumer.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_acceptance_entry.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_cancellation_policies.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_context.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_exponential_retry.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_heartbeat_authority.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_identity.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_install_inventory.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_lease_authority.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_lease_renewal.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_lease_worker.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_retry_cap_cell.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_retry_info.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_run_closed_refusal.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_activity_worker_lost.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_auth_composition.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_avro_value_benchmark.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_avro_value_protocol.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_business_replay_clock.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_business_replay_clock_child.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_business_replay_clock_parallel.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_business_replay_clock_redrive.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_business_replay_clock_sequence_claims.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_cancellation_cause.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_cancellation_context.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_cancellation_remaining_time.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_cancellation_scope_admission.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_cancellation_scope_authoring.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_cancellation_scope_boundary.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_cancellation_scope_opening.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_capabilities_digest.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_capabilities_digest_unknown.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_checkpointed_batch_example.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_child_workflow_policies.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_ci_checkout.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_ci_integration_endpoint.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_client.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_client_iterators.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_client_telemetry.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_client_timeouts.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_codec_regression_corpus.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_command_keys_acceptance.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_command_keys_captured_inputs.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_command_keys_container_ownership.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_command_keys_workspace.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_committed_cancellation_scope_descendants.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_committed_cancellation_scope_groups.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_committed_cancellation_scope_history.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_committed_cancellation_scope_replay.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_completion_size_limit.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_condition_fingerprint.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_condition_occurrence_id.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_condition_replay_drift.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_continue_as_new_target.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_control_plane_parity_fixtures.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_cooperative_cancellation.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_cooperative_cancellation_client.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_cooperative_cancellation_worker.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_docs_release_channel.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_docstring_cross_references.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_durable_selection.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_empty_callback_failure.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_errors.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_external_storage.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_external_task_input.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_external_task_result.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_failure_reporting.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_generator_lifecycle.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_golden_history_replay.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_history_bundle_pruned.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_history_bundle_schema2.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_history_event_contract.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_invocable.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_local_activity_backoff.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_local_failure_reporting.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_message_streams.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_metric_routes.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_metrics.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_native_timer_redrive_cell.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_native_timer_redrive_clock.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_nexus_durable_wait.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_nexus_namespace.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_nexus_wire.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_order_processing_example.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_ordered_condition_input.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_parallel_completion_order_replay.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_parallel_failure_order.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_parallel_group_boundaries.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_parallel_member_failure_open_siblings.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_parallel_saga_authoring.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_patch_history.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_payload_policy_refresh.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_pending_operation_replay.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_physical_command_key_readback.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_poll_failure_backoff.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_poll_transport.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_portal_source_split.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_prepared_local_activity_client.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_prepared_local_activity_groups.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_prepared_local_activity_policies.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_prepared_local_activity_worker.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_public_boundary_scanner.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_publish_workflow_isolation.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_published_activity_acceptance.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_published_pagination_evidence.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_pypi_project_surface.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_python_conformance.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_queries.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_query_timeout_retry.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_quiesced_snapshot.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_readme_quickstart.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_redrive_call_ledger.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_redrive_replay.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_redrive_successor_evidence.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_registration_ambiguity.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_release_metadata.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_release_promotion.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_replay.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_replay_clock.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_replay_conformance.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_replay_verify.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_response_body_limit.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_result_continue_as_new.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_retry_cap_download.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_retry_cap_workflow.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_retry_policy.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_run_activities.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_run_cancellation_scope_replay.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_run_closed_settlement_replay.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_schedule_origin.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_schedules.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_scoped_run_cancellation_context.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_sdk_metrics_contract.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_search_attribute_replay_identity.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_serializer.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_signal_external_workflow.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_signal_with_start.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_signals.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_sleep.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_standalone_activity_client.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_static_credential_validation.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_sticky_execution.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_sticky_history_suffix.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_storage_admission.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_sync.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_sync_activities.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_synthetic_command_key_readback.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_telemetry.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_telemetry_carrier.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_testing_failures.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_testing_harness.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_testing_nexus.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_threaded_heartbeat_example.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_tls_trust.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_transport_diagnostics.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_typed_values.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_typed_workflow_values.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_update_outcome.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_update_signal_condition_replay.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_wait_condition.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_worker.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_worker_deregistration.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_worker_observation.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_worker_session.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_worker_startup_buffered.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_worker_startup_raw.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_worker_startup_read_budget.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_worker_startup_snapshot.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_worker_telemetry_wire.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_workflow_entry_arguments.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_workflow_entrypoint_validation.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_workflow_handler_validation.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_workflow_identity.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_workflow_result_timeout.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.0}/tests/test_workflow_streams.py +0 -0
- {durable_workflow-2.23.1 → durable_workflow-2.27.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.
|
|
3
|
+
Version: 2.27.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
|
|
@@ -25,6 +25,8 @@ License-File: LICENSE
|
|
|
25
25
|
Requires-Dist: httpx>=0.27
|
|
26
26
|
Requires-Dist: certifi>=2026.10.19
|
|
27
27
|
Requires-Dist: fastavro<2,>=1.12.2
|
|
28
|
+
Provides-Extra: protection
|
|
29
|
+
Requires-Dist: PyNaCl<2,>=1.6.2; extra == "protection"
|
|
28
30
|
Provides-Extra: telemetry
|
|
29
31
|
Requires-Dist: opentelemetry-api<2,>=1.45.1; extra == "telemetry"
|
|
30
32
|
Provides-Extra: dev
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "durable-workflow"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.27.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"
|
|
@@ -42,6 +42,9 @@ dependencies = [
|
|
|
42
42
|
]
|
|
43
43
|
|
|
44
44
|
[project.optional-dependencies]
|
|
45
|
+
protection = [
|
|
46
|
+
"PyNaCl>=1.6.2,<2",
|
|
47
|
+
]
|
|
45
48
|
telemetry = [
|
|
46
49
|
"opentelemetry-api>=1.45.1,<2",
|
|
47
50
|
]
|
|
@@ -79,8 +82,8 @@ durable-workflow-replay-conformance = "durable_workflow.replay_conformance:main"
|
|
|
79
82
|
durable-workflow-workflow-updates-conformance = "durable_workflow.workflow_updates_conformance:main"
|
|
80
83
|
|
|
81
84
|
[tool.durable-workflow]
|
|
82
|
-
product-train = "2.
|
|
83
|
-
registry-version = "2.
|
|
85
|
+
product-train = "2.27.0"
|
|
86
|
+
registry-version = "2.27.0"
|
|
84
87
|
supported-server-versions = "2.8.0"
|
|
85
88
|
supported-server-release-baselines = { "2" = "2.8.0", "3" = "3.0.0" }
|
|
86
89
|
worker-protocol-version = "1.20"
|
|
@@ -9,6 +9,7 @@ except PackageNotFoundError: # source checkout without installed metadata
|
|
|
9
9
|
from . import activity, sync, testing, workflow
|
|
10
10
|
from ._activity_checkpoint import ActivityHeartbeatCheckpoint
|
|
11
11
|
from ._continue_as_new import ContinueAsNewTargetBuild
|
|
12
|
+
from ._payload_protection import PayloadProtection
|
|
12
13
|
from .activity import ActivityContext, ActivityInfo, ActivityRetryInfo
|
|
13
14
|
from .auth_composition import (
|
|
14
15
|
AUTH_COMPOSITION_CONTRACT_SCHEMA,
|
|
@@ -74,6 +75,7 @@ from .errors import (
|
|
|
74
75
|
ActivityCancelled,
|
|
75
76
|
ActivityFailed,
|
|
76
77
|
ActivityHeartbeatResumeUnavailable,
|
|
78
|
+
ActivityHeartbeatUnavailable,
|
|
77
79
|
ChildWorkflowCancelled,
|
|
78
80
|
ChildWorkflowFailed,
|
|
79
81
|
ChildWorkflowTerminated,
|
|
@@ -97,6 +99,7 @@ from .errors import (
|
|
|
97
99
|
NexusOperationFailed,
|
|
98
100
|
NonDeterministicReplayError,
|
|
99
101
|
NonRetryableError,
|
|
102
|
+
PayloadProtectionError,
|
|
100
103
|
QueryFailed,
|
|
101
104
|
QueryTaskAuthorityLost,
|
|
102
105
|
ReplayClockUnavailable,
|
|
@@ -220,6 +223,7 @@ from .nexus import (
|
|
|
220
223
|
NEXUS_OPERATION_RESULT_VERSION,
|
|
221
224
|
NexusOperationResult,
|
|
222
225
|
)
|
|
226
|
+
from .prepared_payload import PreparedPayloadCommand
|
|
223
227
|
from .replay_verify import (
|
|
224
228
|
CaseReport as ReplayCaseReport,
|
|
225
229
|
)
|
|
@@ -253,6 +257,7 @@ from .workflow import (
|
|
|
253
257
|
MessageStream,
|
|
254
258
|
MessageStreamMessage,
|
|
255
259
|
NexusServiceCall,
|
|
260
|
+
ParallelOutcome,
|
|
256
261
|
Replayer,
|
|
257
262
|
ReplayOutcome,
|
|
258
263
|
Saga,
|
|
@@ -274,6 +279,7 @@ __all__ = [
|
|
|
274
279
|
"ActivityRetryInfo",
|
|
275
280
|
"ActivityHeartbeatCheckpoint",
|
|
276
281
|
"ActivityHeartbeatResumeUnavailable",
|
|
282
|
+
"ActivityHeartbeatUnavailable",
|
|
277
283
|
"ActivityInterceptorContext",
|
|
278
284
|
"ActivityRetryPolicy",
|
|
279
285
|
"BridgeAdapterOutcome",
|
|
@@ -311,6 +317,7 @@ __all__ = [
|
|
|
311
317
|
"Replayer",
|
|
312
318
|
"Saga",
|
|
313
319
|
"SagaCompensationFailed",
|
|
320
|
+
"ParallelOutcome",
|
|
314
321
|
"SelectionResult",
|
|
315
322
|
"ScheduleAction",
|
|
316
323
|
"ScheduleAlreadyExists",
|
|
@@ -423,6 +430,9 @@ __all__ = [
|
|
|
423
430
|
"RuntimeCapabilityUnsupported",
|
|
424
431
|
"RuntimeDiscoveryUnavailable",
|
|
425
432
|
"RuntimeExternalPayloadReference",
|
|
433
|
+
"PayloadProtection",
|
|
434
|
+
"PayloadProtectionError",
|
|
435
|
+
"PreparedPayloadCommand",
|
|
426
436
|
"PrometheusMetrics",
|
|
427
437
|
"PayloadSizeWarningConfig",
|
|
428
438
|
"PayloadSizeWarningContext",
|
|
@@ -51,7 +51,7 @@ def renewal_retry_delay(failures: int) -> float:
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
async def release_worker_lost(client: Any, *, task_id: str, activity_attempt_id: str, lease_owner: str,
|
|
54
|
-
cause: str, timeout: float) -> bool:
|
|
54
|
+
cause: str, timeout: float, message: str | None = None) -> bool:
|
|
55
55
|
"""Release a claim the worker cannot maintain, by the cross-SDK contract.
|
|
56
56
|
|
|
57
57
|
Call only after the execution is confirmed stopped (or never started):
|
|
@@ -61,7 +61,7 @@ async def release_worker_lost(client: Any, *, task_id: str, activity_attempt_id:
|
|
|
61
61
|
try:
|
|
62
62
|
await asyncio.wait_for(client.fail_activity_task(
|
|
63
63
|
task_id=task_id, activity_attempt_id=activity_attempt_id, lease_owner=lease_owner,
|
|
64
|
-
message=f"activity worker released the claim: lease could not be renewed ({cause})",
|
|
64
|
+
message=message or f"activity worker released the claim: lease could not be renewed ({cause})",
|
|
65
65
|
failure_type=WORKER_LOST_FAILURE_TYPE, failure_class=ActivityWorkerLost.__name__,
|
|
66
66
|
non_retryable=False, details={"reason": WORKER_LOST_FAILURE_TYPE, "cause": cause},
|
|
67
67
|
), timeout=timeout)
|
{durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_activity_process.py
RENAMED
|
@@ -10,6 +10,7 @@ from __future__ import annotations
|
|
|
10
10
|
|
|
11
11
|
import asyncio
|
|
12
12
|
import inspect
|
|
13
|
+
import math
|
|
13
14
|
import multiprocessing
|
|
14
15
|
import pickle
|
|
15
16
|
import selectors
|
|
@@ -29,11 +30,44 @@ from .activity import ActivityContext, ActivityInfo, _set_context
|
|
|
29
30
|
from .errors import ActivityCancelled, NonRetryableError
|
|
30
31
|
from .interceptors import ActivityInterceptorContext, WorkerInterceptor
|
|
31
32
|
|
|
33
|
+
# A cooperative callback is two spawn-context interpreters (supervisor, then
|
|
34
|
+
# callback) that import the SDK and the handler before reporting readiness. On
|
|
35
|
+
# a busy host that takes far longer than an idle start, so the default wait is
|
|
36
|
+
# generous; Worker.activity_spawn_timeout or ACTIVITY_SPAWN_TIMEOUT_ENV changes it.
|
|
37
|
+
DEFAULT_SPAWN_READINESS_TIMEOUT = 30.0
|
|
38
|
+
ACTIVITY_SPAWN_TIMEOUT_ENV = "DURABLE_WORKFLOW_ACTIVITY_SPAWN_TIMEOUT"
|
|
39
|
+
# worker_lost release cause when a callback misses spawn readiness.
|
|
40
|
+
ACTIVITY_SPAWN_READINESS_TIMEOUT = "activity_spawn_readiness_timeout"
|
|
41
|
+
_CLOSE_JOIN_TIMEOUT = 5.0
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def validate_spawn_readiness_timeout(value: float, name: str = "activity_spawn_timeout") -> float:
|
|
45
|
+
if isinstance(value, bool) or not isinstance(value, (int, float)) or not math.isfinite(value) or value <= 0:
|
|
46
|
+
raise ValueError(f"{name} must be a positive, finite number of seconds")
|
|
47
|
+
return float(value)
|
|
48
|
+
|
|
32
49
|
|
|
33
50
|
class CallbackProcessLost(RuntimeError):
|
|
34
51
|
"""The owner could not prove the callback outcome or physical stop."""
|
|
35
52
|
|
|
36
53
|
|
|
54
|
+
class CallbackSpawnTimeout(CallbackProcessLost):
|
|
55
|
+
"""The callback did not report spawn readiness in time and was confirmed stopped.
|
|
56
|
+
|
|
57
|
+
The handler had not been reported started. Raised only after the
|
|
58
|
+
supervisor (and so the callback) is joined, so the claim can be released
|
|
59
|
+
for a retry without two executions overlapping.
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
def __init__(self, timeout: float) -> None:
|
|
63
|
+
self.timeout = timeout
|
|
64
|
+
super().__init__(
|
|
65
|
+
f"cooperative activity callback did not report spawn readiness within {timeout:g}s; the host may "
|
|
66
|
+
"be overloaded. Raise Worker.activity_spawn_timeout (DURABLE_WORKFLOW_ACTIVITY_SPAWN_TIMEOUT) or lower "
|
|
67
|
+
"max_concurrent_activity_tasks"
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
37
71
|
@dataclass(frozen=True)
|
|
38
72
|
class CallbackInvocation:
|
|
39
73
|
handler: Callable[..., Any]
|
|
@@ -214,7 +248,10 @@ class SupervisedCallback:
|
|
|
214
248
|
never supplies stop evidence. The worker integration remains a separate gate.
|
|
215
249
|
"""
|
|
216
250
|
|
|
217
|
-
def __init__(
|
|
251
|
+
def __init__(
|
|
252
|
+
self, invocation: CallbackInvocation, *, readiness_timeout: float = DEFAULT_SPAWN_READINESS_TIMEOUT,
|
|
253
|
+
) -> None:
|
|
254
|
+
self._readiness_timeout = validate_spawn_readiness_timeout(readiness_timeout, "readiness_timeout")
|
|
218
255
|
serialized = invocation.serialize()
|
|
219
256
|
self.directory = tempfile.mkdtemp(prefix="dw-activity-")
|
|
220
257
|
try:
|
|
@@ -241,13 +278,31 @@ class SupervisedCallback:
|
|
|
241
278
|
self._supervisor.start()
|
|
242
279
|
self._started = True
|
|
243
280
|
self._supervisor_channel.close()
|
|
244
|
-
|
|
281
|
+
try:
|
|
282
|
+
message = await asyncio.wait_for(self._receive(), timeout=self._readiness_timeout)
|
|
283
|
+
except asyncio.TimeoutError:
|
|
284
|
+
await self._close_unready()
|
|
285
|
+
raise CallbackSpawnTimeout(self._readiness_timeout) from None
|
|
245
286
|
if message != b"B":
|
|
246
287
|
raise CallbackProcessLost("callback did not prove spawn readiness")
|
|
247
288
|
except BaseException:
|
|
248
289
|
await self.close()
|
|
290
|
+
# A clean supervisor exit, including after the owner cancelled
|
|
291
|
+
# this start, proves its callback was reaped.
|
|
292
|
+
if self._exitcode == 0:
|
|
293
|
+
self.stopped = True
|
|
249
294
|
raise
|
|
250
295
|
|
|
296
|
+
async def _close_unready(self) -> None:
|
|
297
|
+
# The supervisor may still be starting on a busy host. Closing the
|
|
298
|
+
# owner channel makes it reap its callback and exit; allow it as long
|
|
299
|
+
# as readiness was allowed. Only a clean supervisor exit proves the
|
|
300
|
+
# callback joined, so anything else stays CallbackProcessLost.
|
|
301
|
+
await self.close(join_timeout=max(2 * _CLOSE_JOIN_TIMEOUT, self._readiness_timeout))
|
|
302
|
+
if self._exitcode != 0:
|
|
303
|
+
raise CallbackProcessLost("callback supervisor did not confirm a clean join after spawn timeout")
|
|
304
|
+
self.stopped = True
|
|
305
|
+
|
|
251
306
|
async def _receive(self) -> bytes:
|
|
252
307
|
try:
|
|
253
308
|
message = await asyncio.get_running_loop().sock_recv(self._owner, 1)
|
|
@@ -311,7 +366,7 @@ class SupervisedCallback:
|
|
|
311
366
|
raise CallbackProcessLost("callback supervisor did not confirm a clean join")
|
|
312
367
|
self.stopped = True
|
|
313
368
|
|
|
314
|
-
async def close(self) -> None:
|
|
369
|
+
async def close(self, *, join_timeout: float = _CLOSE_JOIN_TIMEOUT) -> None:
|
|
315
370
|
if self._joined:
|
|
316
371
|
return
|
|
317
372
|
if not self._closed:
|
|
@@ -319,7 +374,7 @@ class SupervisedCallback:
|
|
|
319
374
|
self._owner.close()
|
|
320
375
|
self._supervisor_channel.close()
|
|
321
376
|
if self._started:
|
|
322
|
-
await asyncio.to_thread(self._supervisor.join,
|
|
377
|
+
await asyncio.to_thread(self._supervisor.join, join_timeout)
|
|
323
378
|
if self._supervisor.is_alive():
|
|
324
379
|
raise CallbackProcessLost("callback supervisor has not confirmed shutdown")
|
|
325
380
|
self._exitcode = self._supervisor.exitcode
|
|
@@ -17,7 +17,7 @@ import math
|
|
|
17
17
|
from functools import lru_cache
|
|
18
18
|
from typing import Any
|
|
19
19
|
|
|
20
|
-
from .errors import AvroNotInstalledError
|
|
20
|
+
from .errors import AvroNotInstalledError, PayloadProtectionError
|
|
21
21
|
|
|
22
22
|
VALUE_SCHEMA_JSON = (
|
|
23
23
|
'{"type":"record","name":"Value","namespace":"durable_workflow.protocol",'
|
|
@@ -34,6 +34,7 @@ VALUE_SCHEMA_JSON = (
|
|
|
34
34
|
)
|
|
35
35
|
VALUE_SCHEMA_FINGERPRINT_HEX = "e2a33dff55802237"
|
|
36
36
|
VALUE_SCHEMA_FINGERPRINT = bytes.fromhex(VALUE_SCHEMA_FINGERPRINT_HEX)
|
|
37
|
+
PROTECTED_VALUE_SCHEMA_FINGERPRINT = bytes.fromhex("0ba70c3fd6c311ca")
|
|
37
38
|
SINGLE_OBJECT_MAGIC = b"\xC3\x01"
|
|
38
39
|
_INT64_MIN = -(2**63)
|
|
39
40
|
_INT64_MAX = 2**63 - 1
|
|
@@ -245,6 +246,8 @@ def _decode_base64(blob: str) -> bytes:
|
|
|
245
246
|
|
|
246
247
|
|
|
247
248
|
def _schema_for_fingerprint(fingerprint: bytes) -> Any:
|
|
249
|
+
if fingerprint == PROTECTED_VALUE_SCHEMA_FINGERPRINT:
|
|
250
|
+
raise PayloadProtectionError("payload_envelope_unsupported")
|
|
248
251
|
if fingerprint != VALUE_SCHEMA_FINGERPRINT:
|
|
249
252
|
raise ValueError(
|
|
250
253
|
"unsupported_payload_schema: unknown CRC-64-AVRO fingerprint "
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Shared discovery and worker registration contract for parallel groups."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Iterable, Mapping
|
|
6
|
+
from typing import Literal
|
|
7
|
+
|
|
8
|
+
ParallelFailurePolicy = Literal["propagate", "cancel_remaining", "settle"]
|
|
9
|
+
CAPABILITY = "parallel_group_policies"
|
|
10
|
+
POLICIES: tuple[ParallelFailurePolicy, ...] = ("propagate", "cancel_remaining", "settle")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def canonical_policies(values: Iterable[str]) -> tuple[ParallelFailurePolicy, ...]:
|
|
14
|
+
names = tuple(values)
|
|
15
|
+
if any(not isinstance(name, str) or name not in POLICIES for name in names) or len(set(names)) != len(names):
|
|
16
|
+
raise ValueError("parallel_group_policies requires distinct version 1 policy names")
|
|
17
|
+
return tuple(name for name in POLICIES if name in names)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def read_descriptor(descriptor: object) -> tuple[ParallelFailurePolicy, ...]:
|
|
21
|
+
if (not isinstance(descriptor, Mapping) or set(descriptor) != {"supported", "version", "policies"}
|
|
22
|
+
or descriptor["supported"] is not True or type(descriptor["version"]) is not int
|
|
23
|
+
or descriptor["version"] != 1 or not isinstance(descriptor["policies"], list) or not descriptor["policies"]):
|
|
24
|
+
raise ValueError("parallel_group_policies has an invalid version 1 descriptor")
|
|
25
|
+
return canonical_policies(descriptor["policies"])
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"""The authenticated Avro ProtectedValue v1 transform."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import base64
|
|
6
|
+
import io
|
|
7
|
+
import re
|
|
8
|
+
import secrets
|
|
9
|
+
from collections.abc import Mapping
|
|
10
|
+
from dataclasses import dataclass
|
|
11
|
+
from functools import lru_cache
|
|
12
|
+
from types import MappingProxyType
|
|
13
|
+
from typing import Any, Literal, get_args
|
|
14
|
+
|
|
15
|
+
from . import _avro
|
|
16
|
+
from .errors import PayloadProtectionError
|
|
17
|
+
|
|
18
|
+
BoundaryKind = Literal[
|
|
19
|
+
"workflow_input", "workflow_result", "activity_input", "activity_result", "signal_input",
|
|
20
|
+
"update_input", "update_result", "query_input", "query_result", "side_effect_result",
|
|
21
|
+
]
|
|
22
|
+
PROTECTED_WORKFLOW_PAYLOADS: Mapping[str, tuple[str, BoundaryKind]] = MappingProxyType({
|
|
23
|
+
"schedule_activity": ("arguments", "activity_input"),
|
|
24
|
+
"start_child_workflow": ("arguments", "workflow_input"),
|
|
25
|
+
"continue_as_new": ("arguments", "workflow_input"),
|
|
26
|
+
"complete_workflow": ("result", "workflow_result"),
|
|
27
|
+
"complete_update": ("result", "update_result"),
|
|
28
|
+
"record_side_effect": ("result", "side_effect_result"),
|
|
29
|
+
})
|
|
30
|
+
_BOUNDARY_KINDS = frozenset(get_args(BoundaryKind))
|
|
31
|
+
_VERSION = 1
|
|
32
|
+
_ALGORITHM = "xchacha20poly1305-ietf"
|
|
33
|
+
_KEY_ID_PATTERN = re.compile(r"[A-Za-z0-9._:-]{1,128}")
|
|
34
|
+
_NONCE_BYTES = 24
|
|
35
|
+
_KEY_BYTES = 32
|
|
36
|
+
_TAG_BYTES = 16
|
|
37
|
+
_PROTECTED_FRAME = _avro.SINGLE_OBJECT_MAGIC + _avro.PROTECTED_VALUE_SCHEMA_FINGERPRINT
|
|
38
|
+
_PLAIN_FRAME = _avro.SINGLE_OBJECT_MAGIC + _avro.VALUE_SCHEMA_FINGERPRINT
|
|
39
|
+
_AAD_PREFIX = b"durable-workflow.payload-protection\0"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@dataclass(frozen=True)
|
|
43
|
+
class ProtectionContext:
|
|
44
|
+
"""Authoritative namespace and logical payload boundary from the protocol."""
|
|
45
|
+
|
|
46
|
+
namespace: str
|
|
47
|
+
kind: BoundaryKind
|
|
48
|
+
|
|
49
|
+
def __post_init__(self) -> None:
|
|
50
|
+
if not isinstance(self.namespace, str) or not self.namespace:
|
|
51
|
+
raise ValueError("Payload protection requires a nonempty namespace")
|
|
52
|
+
if self.kind not in _BOUNDARY_KINDS:
|
|
53
|
+
raise ValueError("Unsupported payload protection boundary")
|
|
54
|
+
|
|
55
|
+
def _aad(self, key_id: str) -> bytes:
|
|
56
|
+
fields = (_ALGORITHM, key_id, self.namespace, self.kind)
|
|
57
|
+
parts = [field.encode("utf-8") for field in fields]
|
|
58
|
+
return _AAD_PREFIX + bytes([_VERSION]) + b"".join(
|
|
59
|
+
len(part).to_bytes(4, "big") + part for part in parts
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@lru_cache(maxsize=1)
|
|
64
|
+
def _protected_schema() -> Any:
|
|
65
|
+
from fastavro import parse_schema
|
|
66
|
+
|
|
67
|
+
return parse_schema({
|
|
68
|
+
"type": "record",
|
|
69
|
+
"name": "ProtectedValue",
|
|
70
|
+
"namespace": "durable_workflow.protocol",
|
|
71
|
+
"fields": [
|
|
72
|
+
{"name": "dw_protected", "type": "int"},
|
|
73
|
+
{"name": "alg", "type": "string"},
|
|
74
|
+
{"name": "key_id", "type": "string"},
|
|
75
|
+
{"name": "nonce", "type": "bytes"},
|
|
76
|
+
{"name": "ciphertext", "type": "bytes"},
|
|
77
|
+
],
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class PayloadProtection:
|
|
82
|
+
"""Process-local key configuration for Avro v1 write and read operations."""
|
|
83
|
+
|
|
84
|
+
def __init__(
|
|
85
|
+
self,
|
|
86
|
+
keys: Mapping[str, bytes],
|
|
87
|
+
*,
|
|
88
|
+
active_key_id: str | None = None,
|
|
89
|
+
allow_plaintext: bool = False,
|
|
90
|
+
) -> None:
|
|
91
|
+
try:
|
|
92
|
+
from nacl.bindings import (
|
|
93
|
+
crypto_aead_xchacha20poly1305_ietf_decrypt,
|
|
94
|
+
crypto_aead_xchacha20poly1305_ietf_encrypt,
|
|
95
|
+
)
|
|
96
|
+
from nacl.exceptions import CryptoError
|
|
97
|
+
except ImportError:
|
|
98
|
+
raise ImportError("Payload protection requires durable-workflow[protection]") from None
|
|
99
|
+
|
|
100
|
+
configured: dict[str, bytes] = {}
|
|
101
|
+
for key_id, key in keys.items():
|
|
102
|
+
if not isinstance(key_id, str) or _KEY_ID_PATTERN.fullmatch(key_id) is None:
|
|
103
|
+
raise ValueError("Invalid payload protection key ID")
|
|
104
|
+
if not isinstance(key, bytes) or len(key) != _KEY_BYTES:
|
|
105
|
+
raise ValueError("Payload protection keys must be 32 bytes")
|
|
106
|
+
if key_id in configured:
|
|
107
|
+
raise ValueError("Duplicate payload protection key ID")
|
|
108
|
+
configured[key_id] = key
|
|
109
|
+
if active_key_id is not None and active_key_id not in configured:
|
|
110
|
+
raise ValueError("The active payload protection key is not configured")
|
|
111
|
+
if type(allow_plaintext) is not bool:
|
|
112
|
+
raise TypeError("allow_plaintext must be a boolean")
|
|
113
|
+
|
|
114
|
+
self._keys = MappingProxyType(configured)
|
|
115
|
+
self._active_key_id = active_key_id
|
|
116
|
+
self._allow_plaintext = allow_plaintext
|
|
117
|
+
self._encrypt = crypto_aead_xchacha20poly1305_ietf_encrypt
|
|
118
|
+
self._decrypt = crypto_aead_xchacha20poly1305_ietf_decrypt
|
|
119
|
+
self._crypto_error = CryptoError
|
|
120
|
+
|
|
121
|
+
def __getstate__(self) -> Any:
|
|
122
|
+
raise TypeError("Payload protection keys cannot be serialized")
|
|
123
|
+
|
|
124
|
+
def protect(self, value: Any, context: ProtectionContext) -> str:
|
|
125
|
+
"""Encode once at admission, retaining the returned text for retries."""
|
|
126
|
+
from fastavro import schemaless_writer
|
|
127
|
+
|
|
128
|
+
key_id = self._active_key_id
|
|
129
|
+
if key_id is None:
|
|
130
|
+
raise PayloadProtectionError("payload_key_unavailable")
|
|
131
|
+
plaintext = base64.b64decode(_avro.encode(value), validate=True)
|
|
132
|
+
nonce = secrets.token_bytes(_NONCE_BYTES)
|
|
133
|
+
ciphertext = self._encrypt(plaintext, context._aad(key_id), nonce, self._keys[key_id])
|
|
134
|
+
frame = io.BytesIO(_PROTECTED_FRAME)
|
|
135
|
+
frame.seek(len(_PROTECTED_FRAME))
|
|
136
|
+
schemaless_writer(frame, _protected_schema(), {
|
|
137
|
+
"dw_protected": _VERSION,
|
|
138
|
+
"alg": _ALGORITHM,
|
|
139
|
+
"key_id": key_id,
|
|
140
|
+
"nonce": nonce,
|
|
141
|
+
"ciphertext": ciphertext,
|
|
142
|
+
})
|
|
143
|
+
return base64.b64encode(frame.getvalue()).decode("ascii")
|
|
144
|
+
|
|
145
|
+
def open(self, blob: str, context: ProtectionContext) -> Any:
|
|
146
|
+
"""Open a v1 envelope, using the named key and the exact context."""
|
|
147
|
+
raw = _decode_frame(blob)
|
|
148
|
+
if raw.startswith(_PLAIN_FRAME):
|
|
149
|
+
if not self._allow_plaintext:
|
|
150
|
+
raise PayloadProtectionError("payload_protection_required")
|
|
151
|
+
return _avro.decode(blob)
|
|
152
|
+
key_id, nonce, ciphertext = _read_protected_frame(blob, raw)
|
|
153
|
+
key = self._keys.get(key_id)
|
|
154
|
+
if key is None:
|
|
155
|
+
raise PayloadProtectionError("payload_key_unavailable")
|
|
156
|
+
try:
|
|
157
|
+
plaintext = self._decrypt(ciphertext, context._aad(key_id), nonce, key)
|
|
158
|
+
except self._crypto_error:
|
|
159
|
+
raise PayloadProtectionError("payload_authentication_failed") from None
|
|
160
|
+
if not plaintext.startswith(_PLAIN_FRAME):
|
|
161
|
+
raise PayloadProtectionError("payload_plaintext_invalid")
|
|
162
|
+
try:
|
|
163
|
+
return _avro.decode(base64.b64encode(plaintext).decode("ascii"))
|
|
164
|
+
except (ValueError, RecursionError):
|
|
165
|
+
raise PayloadProtectionError("payload_plaintext_invalid") from None
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@dataclass(frozen=True)
|
|
169
|
+
class BoundPayloadProtection:
|
|
170
|
+
"""Bind one process-local configuration to one authoritative boundary."""
|
|
171
|
+
|
|
172
|
+
configuration: PayloadProtection
|
|
173
|
+
context: ProtectionContext
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
@dataclass(frozen=True)
|
|
177
|
+
class NamespacePayloadProtection:
|
|
178
|
+
"""Bind one configuration to the workflow's authoritative namespace."""
|
|
179
|
+
|
|
180
|
+
configuration: PayloadProtection
|
|
181
|
+
namespace: str
|
|
182
|
+
|
|
183
|
+
def __post_init__(self) -> None:
|
|
184
|
+
ProtectionContext(self.namespace, "workflow_input")
|
|
185
|
+
|
|
186
|
+
def bind(self, kind: BoundaryKind) -> BoundPayloadProtection:
|
|
187
|
+
return BoundPayloadProtection(self.configuration, ProtectionContext(self.namespace, kind))
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def check_protected_frame(blob: str) -> None:
|
|
191
|
+
"""Check an already encoded protected request without using any key."""
|
|
192
|
+
_read_protected_frame(blob, _decode_frame(blob))
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def _decode_frame(blob: str) -> bytes:
|
|
196
|
+
try:
|
|
197
|
+
return base64.b64decode(blob, validate=True)
|
|
198
|
+
except (ValueError, TypeError):
|
|
199
|
+
raise PayloadProtectionError("payload_envelope_unsupported") from None
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def _read_protected_frame(blob: str, raw: bytes) -> tuple[str, bytes, bytes]:
|
|
203
|
+
if not raw.startswith(_PROTECTED_FRAME) or base64.b64encode(raw).decode("ascii") != blob:
|
|
204
|
+
raise PayloadProtectionError("payload_envelope_unsupported")
|
|
205
|
+
return _parse_envelope(raw)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def _parse_envelope(raw: bytes) -> tuple[str, bytes, bytes]:
|
|
209
|
+
from fastavro import schemaless_reader
|
|
210
|
+
|
|
211
|
+
buffer = io.BytesIO(raw)
|
|
212
|
+
buffer.seek(len(_PROTECTED_FRAME))
|
|
213
|
+
try:
|
|
214
|
+
envelope = schemaless_reader(buffer, _protected_schema())
|
|
215
|
+
except (EOFError, ValueError, OverflowError):
|
|
216
|
+
raise PayloadProtectionError("payload_envelope_unsupported") from None
|
|
217
|
+
if not isinstance(envelope, dict):
|
|
218
|
+
raise PayloadProtectionError("payload_envelope_unsupported")
|
|
219
|
+
key_id = envelope.get("key_id")
|
|
220
|
+
nonce = envelope.get("nonce")
|
|
221
|
+
ciphertext = envelope.get("ciphertext")
|
|
222
|
+
version = envelope.get("dw_protected")
|
|
223
|
+
if (
|
|
224
|
+
buffer.read(1)
|
|
225
|
+
or type(version) is not int
|
|
226
|
+
or version != _VERSION
|
|
227
|
+
or envelope.get("alg") != _ALGORITHM
|
|
228
|
+
or not isinstance(key_id, str)
|
|
229
|
+
or _KEY_ID_PATTERN.fullmatch(key_id) is None
|
|
230
|
+
or not isinstance(nonce, bytes)
|
|
231
|
+
or len(nonce) != _NONCE_BYTES
|
|
232
|
+
or not isinstance(ciphertext, bytes)
|
|
233
|
+
or len(ciphertext) < _TAG_BYTES
|
|
234
|
+
):
|
|
235
|
+
raise PayloadProtectionError("payload_envelope_unsupported")
|
|
236
|
+
return key_id, nonce, ciphertext
|
{durable_workflow-2.23.1 → durable_workflow-2.27.0}/src/durable_workflow/_prepared_local_activity.py
RENAMED
|
@@ -17,7 +17,7 @@ from datetime import datetime, timedelta
|
|
|
17
17
|
from typing import Any
|
|
18
18
|
|
|
19
19
|
from . import serializer
|
|
20
|
-
from ._activity_process import CallbackInvocation, SupervisedCallback
|
|
20
|
+
from ._activity_process import DEFAULT_SPAWN_READINESS_TIMEOUT, CallbackInvocation, SupervisedCallback
|
|
21
21
|
from .cancellation import CancellationContext
|
|
22
22
|
from .client import Client
|
|
23
23
|
from .workflow import LocalActivityExecutionAborted
|
|
@@ -243,9 +243,10 @@ class PreparedAttempt:
|
|
|
243
243
|
class PreparedLocalRunner:
|
|
244
244
|
def __init__(
|
|
245
245
|
self, client: Client, attempt: PreparedAttempt, *, observe: Callable[[Mapping[str, Any]], Any],
|
|
246
|
-
shutdown: asyncio.Event,
|
|
246
|
+
shutdown: asyncio.Event, spawn_timeout: float = DEFAULT_SPAWN_READINESS_TIMEOUT,
|
|
247
247
|
) -> None:
|
|
248
248
|
self.client = client
|
|
249
|
+
self.spawn_timeout = spawn_timeout
|
|
249
250
|
self.attempt = attempt
|
|
250
251
|
self.observe = observe
|
|
251
252
|
self.shutdown = shutdown
|
|
@@ -301,7 +302,7 @@ class PreparedLocalRunner:
|
|
|
301
302
|
# Admission was fenced before any process existed.
|
|
302
303
|
await self.acknowledge_stop()
|
|
303
304
|
raise
|
|
304
|
-
callback = SupervisedCallback(invocation)
|
|
305
|
+
callback = SupervisedCallback(invocation, readiness_timeout=self.spawn_timeout)
|
|
305
306
|
self.callback = callback
|
|
306
307
|
processes.add(callback)
|
|
307
308
|
background: list[asyncio.Task[Any]] = []
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Worker side of deadline-triggered timeout cleanup (server#1201, workflow#863).
|
|
2
|
+
|
|
3
|
+
A worker that delivers cooperative cancellation advertises ``timeout_cleanup``
|
|
4
|
+
version 1, so the Server admits starts that reserve cleanup time on its queue.
|
|
5
|
+
When the engine's timeout request reaches workflow code as
|
|
6
|
+
:class:`~durable_workflow.errors.WorkflowTimeoutCleanupRequested` and the
|
|
7
|
+
workflow lets that exception escape, uncaught or re-raised, the
|
|
8
|
+
``fail_workflow`` command carries ``failure.interruption: "timeout_cleanup"``.
|
|
9
|
+
The Server then records the cleanup as completed, and the run still closes as
|
|
10
|
+
timed out. Any other failure, including one that wraps the interruption, is an
|
|
11
|
+
ordinary failure, which the Server records as failed cleanup. The marker never
|
|
12
|
+
starts cleanup; the Server accepts it only while the run's own engine timeout
|
|
13
|
+
request is active.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
from collections.abc import Sequence
|
|
19
|
+
from typing import Any
|
|
20
|
+
|
|
21
|
+
from .cancellation import CancellationContext
|
|
22
|
+
from .errors import WorkflowTimeoutCleanupRequested
|
|
23
|
+
|
|
24
|
+
CAPABILITY = "timeout_cleanup"
|
|
25
|
+
INTERRUPTION = "timeout_cleanup"
|
|
26
|
+
MINIMUM_PROTOCOL_VERSION = "1.20"
|
|
27
|
+
VERSION = 1
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def manifest_entry() -> dict[str, Any]:
|
|
31
|
+
"""The registration ``capability_manifest`` entry native Server admits."""
|
|
32
|
+
return {"supported": True, "minimum_protocol_version": MINIMUM_PROTOCOL_VERSION, "version": VERSION}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def failure_interruption(
|
|
36
|
+
failure: BaseException, *, delivered: Sequence[BaseException], run_id: str,
|
|
37
|
+
) -> str | None:
|
|
38
|
+
"""The portable marker for an escaped timeout interruption, else ``None``.
|
|
39
|
+
|
|
40
|
+
Only the exception object the runtime raised for this run's root request
|
|
41
|
+
with ``cause: "timeout"`` qualifies. An exception the application
|
|
42
|
+
constructs, a different exception raised from or wrapping the delivered
|
|
43
|
+
one, an ordinary or explicit ``cause: "cancellation"`` request and a
|
|
44
|
+
descendant or scoped request are not marked. The type alone never decides.
|
|
45
|
+
"""
|
|
46
|
+
if not isinstance(failure, WorkflowTimeoutCleanupRequested):
|
|
47
|
+
return None
|
|
48
|
+
if not any(failure is candidate for candidate in delivered):
|
|
49
|
+
return None
|
|
50
|
+
context = failure.context
|
|
51
|
+
if (
|
|
52
|
+
not isinstance(context, CancellationContext)
|
|
53
|
+
or not context.is_timeout
|
|
54
|
+
or context.scope_origin is not None
|
|
55
|
+
or failure.request_id is None
|
|
56
|
+
or failure.request_id != context.request_id
|
|
57
|
+
or context.request_id != context.root_request_id
|
|
58
|
+
or context.parent_request_id is not None
|
|
59
|
+
or not run_id
|
|
60
|
+
or context.root_workflow_run_id != run_id
|
|
61
|
+
):
|
|
62
|
+
return None
|
|
63
|
+
return INTERRUPTION
|