Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 2 additions & 139 deletions app/Http/Controllers/Api/WorkerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
use App\Support\WorkflowQueryTaskBroker;
use App\Support\WorkflowReplayEligibility;
use App\Support\WorkflowStreamCommandProcessor;
use App\Support\WorkflowStreamService;
use App\Support\WorkflowTaskCompletionValidation;
use App\Support\WorkflowTaskLeaseRecovery;
use App\Support\WorkflowTaskPoller;
use App\Support\WorkflowUpdateValidationTaskBroker;
Expand Down Expand Up @@ -1659,144 +1659,7 @@ private function mutateWorkflowTaskCommands(Request $request, string $taskId, bo
'message_stream_waits.*.after_position' => ['required', 'integer', 'min:0'],
]);

$completionRules = [
'lease_owner' => ['required', 'string'],
'workflow_task_attempt' => ['required', 'integer', 'min:1'],
'commands' => ['required', 'array', 'min:1'],
'commands.*.type' => ['required', 'string'],
'commands.*.cancellation_scope_id' => ['sometimes', 'string', 'min:1', 'max:255'],
'commands.*.cancellation_cleanup' => ['sometimes', 'required', 'array:scope_id,request_id,delivery_history_event_id'],
'commands.*.cancellation_cleanup.scope_id' => ['sometimes', 'required', 'string', 'max:255'],
'commands.*.cancellation_cleanup.request_id' => ['required_with:commands.*.cancellation_cleanup', 'string', 'max:255'],
'commands.*.cancellation_cleanup.delivery_history_event_id' => ['required_with:commands.*.cancellation_cleanup', 'string', 'max:255'],
'commands.*.result' => ['nullable'],
'commands.*.activity_type' => ['nullable', 'string'],
'commands.*.arguments' => ['nullable'],
'commands.*.connection' => ['nullable', 'string'],
'commands.*.queue' => ['nullable', 'string'],
'commands.*.retry_policy' => ['nullable', 'array'],
'commands.*.retry_policy.max_attempts' => ['nullable', 'integer', 'min:1'],
'commands.*.retry_policy.backoff_seconds' => ['nullable', 'array'],
'commands.*.retry_policy.backoff_seconds.*' => ['integer', 'min:0'],
'commands.*.retry_policy.non_retryable_error_types' => ['nullable', 'array'],
'commands.*.retry_policy.non_retryable_error_types.*' => ['string'],
'commands.*.retry_policy.*' => ['nullable'],
'commands.*.start_to_close_timeout' => ['nullable', 'integer', 'min:1'],
'commands.*.schedule_to_start_timeout' => ['nullable', 'integer', 'min:1'],
'commands.*.schedule_to_close_timeout' => ['nullable', 'integer', 'min:1'],
'commands.*.heartbeat_timeout' => ['nullable', 'integer', 'min:1'],
'commands.*.execution_mode' => ['nullable', 'string', 'in:local'],
'commands.*.outcome' => ['nullable', 'string', 'in:completed,failed,timed_out,cancelled'],
'commands.*.attempts' => ['nullable', 'array', 'max:100'],
'commands.*.attempts.*.attempt_id' => ['nullable', 'string', 'max:255'],
'commands.*.attempts.*.attempt_number' => ['required', 'integer', 'min:1'],
'commands.*.attempts.*.outcome' => ['required', 'string', 'in:completed,failed,timed_out,cancelled'],
'commands.*.attempts.*.duration_ms' => ['nullable', 'integer', 'min:0'],
'commands.*.attempts.*.message' => ['nullable', 'string'],
'commands.*.attempts.*.exception_type' => ['nullable', 'string', 'max:255'],
'commands.*.attempts.*.non_retryable' => ['nullable', 'boolean'],
'commands.*.attempts.*.timeout_kind' => ['nullable', 'string', 'in:start_to_close,schedule_to_close,heartbeat'],
'commands.*.attempts.*.retry_reason' => ['nullable', 'string', 'in:failure,timeout,cold_replay'],
'commands.*.attempts.*.backoff_seconds' => ['nullable', 'integer', 'min:0'],
'commands.*.attempts.*.heartbeats' => ['nullable', 'array', 'max:1000'],
'commands.*.attempts.*.heartbeats.*.details' => ['nullable', 'array'],
'commands.*.attempts.*.heartbeats.*.elapsed_ms' => ['nullable', 'integer', 'min:0'],
'commands.*.attempts.*.heartbeats.*.*' => ['nullable'],
'commands.*.attempts.*.*' => ['nullable'],
'commands.*.worker_session' => ['nullable', 'array'],
'commands.*.worker_session.session_id' => ['nullable', 'string', 'max:255'],
'commands.*.worker_session.connection' => ['nullable', 'string', 'max:255'],
'commands.*.worker_session.queue' => ['nullable', 'string', 'max:255'],
'commands.*.worker_session.requirements' => ['nullable', 'array'],
'commands.*.worker_session.requirements.*' => ['string', 'max:255'],
'commands.*.worker_session.lease_seconds' => ['nullable', 'integer', 'min:1'],
'commands.*.worker_session.ttl_seconds' => ['nullable', 'integer', 'min:1'],
'commands.*.worker_session.max_concurrent_activities' => ['nullable', 'integer', 'min:1'],
'commands.*.worker_session.create_if_missing' => ['nullable', 'boolean'],
'commands.*.worker_session.allow_reacquire_after_failure' => ['nullable', 'boolean'],
'commands.*.execution_timeout_seconds' => ['nullable', 'integer', 'min:1'],
'commands.*.run_timeout_seconds' => ['nullable', 'integer', 'min:1'],
'commands.*.workflow_type' => ['nullable', 'string'],
'commands.*.delay_seconds' => ['nullable', 'integer', 'min:0'],
'commands.*.message' => ['nullable', 'string'],
'commands.*.timeout_kind' => ['nullable', 'string', 'in:start_to_close,schedule_to_close,heartbeat'],
'commands.*.payload_codec' => ['nullable', 'string'],
'commands.*.update_id' => ['nullable', 'string'],
'commands.*.exception_class' => ['nullable', 'string'],
'commands.*.exception_type' => ['nullable', 'string'],
'commands.*.exception' => ['nullable', 'array'],
'commands.*.failed_step_sequence' => ['nullable', 'integer', 'min:1'],
'commands.*.failed_activity_execution_id' => ['nullable', 'string', 'max:255'],
'commands.*.change_id' => ['nullable', 'string'],
'commands.*.version' => ['nullable', 'integer'],
'commands.*.min_supported' => ['nullable', 'integer'],
'commands.*.max_supported' => ['nullable', 'integer'],
'commands.*.attributes' => ['nullable', 'array'],
'commands.*.attribute_types' => ['nullable', 'array'],
'commands.*.attribute_types.*' => ['string'],
'commands.*.entries' => ['nullable', 'array'],
'commands.*.non_retryable' => ['nullable', 'boolean'],
'commands.*.parent_close_policy' => ['nullable', 'string'],
'commands.*.cancellation_policy' => ['nullable', 'string', 'in:try_cancel,wait_cancellation_completed,abandon'],
'commands.*.condition_key' => ['nullable', 'string'],
'commands.*.condition_definition_fingerprint' => ['nullable', 'string'],
'commands.*.condition_wait_occurrence_id' => ['nullable', 'string'],
'commands.*.signal_name' => ['nullable', 'string'],
'commands.*.timeout_seconds' => ['nullable', 'integer', 'min:0'],
'commands.*.endpoint_name' => ['nullable', 'string', 'max:191'],
'commands.*.service_name' => ['nullable', 'string', 'max:191'],
'commands.*.operation_name' => ['nullable', 'string', 'max:191'],
'commands.*.request_payload' => ['nullable'],
'commands.*.namespace' => ['nullable', 'string', 'max:191'],
'commands.*.caller_namespace' => ['nullable', 'string', 'max:191'],
'commands.*.service_call_id' => ['nullable', 'string', 'max:191'],
'commands.*.idempotency_key' => ['nullable', 'string', 'max:191'],
'commands.*.mode_override' => ['nullable', 'string', 'in:sync,async'],
'commands.*.wait_for' => ['nullable', 'string', 'in:accepted,completed'],
'commands.*.wait_timeout_seconds' => ['nullable', 'integer', 'min:0'],
'commands.*.target_workflow_instance_id' => ['nullable', 'string', 'max:191'],
'commands.*.target_workflow_run_id' => ['nullable', 'string', 'max:191'],
'commands.*.business_key' => ['nullable', 'string', 'max:191'],
'commands.*.labels' => ['nullable', 'array'],
'commands.*.memo' => ['nullable', 'array'],
'commands.*.search_attributes' => ['nullable', 'array'],
'commands.*.duplicate_start_policy' => ['nullable', 'string', 'in:reject_duplicate,return_existing_active'],
'commands.*.metadata' => ['nullable', 'array'],
'commands.*.request_payload_reference' => ['nullable', 'string', 'max:191'],
'commands.*.principal_subject' => ['prohibited'],
'commands.*.principal_method' => ['prohibited'],
'commands.*.principal_roles' => ['prohibited'],
'commands.*.principal_tenant' => ['prohibited'],
'commands.*.principal_claims' => ['prohibited'],
...WorkflowCommandNormalizer::parallelMetadataValidationRules(),
'commands.*.workflow_stream' => ['nullable', 'array'],
'commands.*.workflow_stream.operation' => ['required_with:commands.*.workflow_stream', 'string', 'in:append,close,error'],
'commands.*.workflow_stream.stream_name' => ['required_with:commands.*.workflow_stream', 'string', 'max:191'],
'commands.*.workflow_stream.command_identity' => ['required_with:commands.*.workflow_stream', 'string', 'max:191'],
'commands.*.workflow_stream.command_ordinal' => ['required_with:commands.*.workflow_stream', 'integer', 'min:0'],
'commands.*.workflow_stream.items' => ['nullable', 'array', 'max:'.WorkflowStreamService::DEFAULT_MAX_ITEMS_PER_APPEND],
'commands.*.workflow_stream.items.*' => ['array'],
'commands.*.workflow_stream.items.*.payload' => ['nullable'],
'commands.*.workflow_stream.items.*.payload_reference' => ['nullable', 'string', 'max:191'],
'commands.*.workflow_stream.items.*.payload_codec' => ['nullable', 'string', 'max:64'],
'commands.*.workflow_stream.items.*.idempotency_key' => ['nullable', 'string', 'max:191'],
'commands.*.workflow_stream.items.*.item_type' => ['nullable', 'string', 'max:64'],
'commands.*.workflow_stream.items.*.content_type' => ['nullable', 'string', 'max:191'],
'commands.*.workflow_stream.max_pending_items' => ['nullable', 'integer', 'min:1'],
'commands.*.workflow_stream.error_reason' => ['nullable', 'string', 'max:191'],
'commands.*.workflow_stream.retention_seconds' => ['nullable', 'integer', 'min:1'],
'sticky_cache' => ['nullable', 'array'],
'sticky_cache.worker_id' => ['required_with:sticky_cache', 'string', 'max:255'],
'sticky_cache.workflow_id' => ['required_with:sticky_cache', 'string', 'max:255'],
'sticky_cache.run_id' => ['required_with:sticky_cache', 'string', 'max:255'],
'sticky_cache.build_id' => ['required_with:sticky_cache', 'string', 'max:255'],
'sticky_cache.ttl_seconds' => ['required_with:sticky_cache', 'integer', 'min:1', 'max:3600'],
'sticky_cache.metrics' => ['nullable', 'array'],
'sticky_cache.metrics.hit' => ['nullable', 'integer', 'min:0'],
'sticky_cache.metrics.miss' => ['nullable', 'integer', 'min:0'],
'sticky_cache.metrics.eviction' => ['nullable', 'integer', 'min:0'],
'sticky_cache.metrics.forced_cold_replay' => ['nullable', 'integer', 'min:0'],
];
$completionRules = WorkflowTaskCompletionValidation::rules();

$topLevelRules = [];
if ($group) {
Expand Down
Loading
Loading