From 57987aae75adb442c0620bc716d702c4c28c55ac Mon Sep 17 00:00:00 2001 From: Durable Workflow Date: Thu, 1 Oct 2026 16:18:30 +0000 Subject: [PATCH 1/6] fix: reopen recorded conditions within service groups --- src/V2/Support/DefaultWorkflowTaskBridge.php | 93 ++++++- tests/Feature/V2/V2WorkflowTaskBridgeTest.php | 242 ++++++++++++++++++ .../Cargo.toml | 10 + .../README.md | 20 ++ .../src/main.rs | 154 +++++++++++ 5 files changed, 512 insertions(+), 7 deletions(-) create mode 100644 tests/fixtures/service-grouped-condition-reopen-rust/Cargo.toml create mode 100644 tests/fixtures/service-grouped-condition-reopen-rust/README.md create mode 100644 tests/fixtures/service-grouped-condition-reopen-rust/src/main.rs diff --git a/src/V2/Support/DefaultWorkflowTaskBridge.php b/src/V2/Support/DefaultWorkflowTaskBridge.php index 0cef079d..850ab11c 100644 --- a/src/V2/Support/DefaultWorkflowTaskBridge.php +++ b/src/V2/Support/DefaultWorkflowTaskBridge.php @@ -1053,7 +1053,7 @@ public function complete(string $taskId, array $commands): array ]; } - if (! self::parallelCommandsMatchSequences($parsed['non_terminal'], $sequence)) { + if (! self::parallelCommandsMatchSequences($parsed['non_terminal'], $sequence, $run)) { return [ 'completed' => false, 'task_id' => $taskId, @@ -1065,7 +1065,7 @@ public function complete(string $taskId, array $commands): array } $this->recordAppliedSignalForSignalResume($run, $task); - $this->recordSatisfiedConditionWaitForSignalResume($run, $task); + $this->recordSatisfiedConditionWaitForSignalResume($run, $task, $parsed['non_terminal']); foreach ($parsed['non_terminal'] as $command) { $sequence = $this->applyNonTerminalCommand($run, $task, $command, $sequence, $createdTaskIds); @@ -2059,9 +2059,14 @@ private function validateUpdateCommands(WorkflowRun $run, WorkflowTask $task, ar * either re-opening the wait or advancing to the next command. When a signal * resume advances, make that resolution explicit in history for replay and * Waterline instead of leaving only SignalReceived as an implicit cue. + * + * @param list $commands */ - private function recordSatisfiedConditionWaitForSignalResume(WorkflowRun $run, WorkflowTask $task): void - { + private function recordSatisfiedConditionWaitForSignalResume( + WorkflowRun $run, + WorkflowTask $task, + array $commands + ): void { $taskPayload = is_array($task->payload) ? $task->payload : []; if (($taskPayload['resume_source_kind'] ?? null) !== 'workflow_signal') { @@ -2100,7 +2105,18 @@ private function recordSatisfiedConditionWaitForSignalResume(WorkflowRun $run, W 'signal_wait_id' => self::nonEmptyString($taskPayload['signal_wait_id'] ?? null), ...$parallelMetadata, ], static fn (mixed $value): bool => $value !== null), $task); - ParallelChildGroup::claimSelectionWinner($run, $parallelPath, 'condition', $satisfiedEvent); + $occurrenceId = $wait['condition_wait_occurrence_id']; + $reopened = false; + foreach ($commands as $command) { + if ($occurrenceId !== null && $command['type'] === 'open_condition_wait' + && ($command['condition_wait_occurrence_id'] ?? null) === $occurrenceId) { + $reopened = true; + break; + } + } + if (! $reopened) { + ParallelChildGroup::claimSelectionWinner($run, $parallelPath, 'condition', $satisfiedEvent); + } $this->cancelOpenConditionTimer($run, $task, $wait); } @@ -5495,16 +5511,27 @@ private static function parallelMetadataForCommand(array $command): array /** * @param list $commands */ - private static function parallelCommandsMatchSequences(array $commands, int $baseSequence): bool + private static function parallelCommandsMatchSequences(array $commands, int $baseSequence, WorkflowRun $run): bool { $commandsBySequence = []; + $reopenedOccurrences = []; $sequence = $baseSequence; foreach ($commands as $command) { if (($command['type'] ?? null) === 'cancel_selection_operation') { continue; } - $commandsBySequence[$sequence] = $command; $path = $command['parallel_group_path'] ?? null; + if (is_array($path) && ($command['type'] ?? null) === 'open_condition_wait' + && self::recordedGroupedConditionReopenMatches($run, $command)) { + $occurrenceId = (string) $command['condition_wait_occurrence_id']; + if (isset($reopenedOccurrences[$occurrenceId])) { + return false; + } + $reopenedOccurrences[$occurrenceId] = true; + ++$sequence; + continue; + } + $commandsBySequence[$sequence] = $command; if (is_array($path)) { foreach ($path as $entry) { if (! is_array($entry) @@ -5578,6 +5605,58 @@ private static function parallelCommandsMatchSequences(array $commands, int $bas return true; } + /** + * A physical reopen keeps the original authored group/member path. Only + * existing, unresolved condition history can authorize that exception to + * the complete new-group batch and sequence checks. + * + * @param array $command + */ + private static function recordedGroupedConditionReopenMatches(WorkflowRun $run, array $command): bool + { + $occurrenceId = self::nonEmptyString($command['condition_wait_occurrence_id'] ?? null); + if ($occurrenceId === null) { + return false; + } + $opens = $run->historyEvents->filter( + static fn (WorkflowHistoryEvent $event): bool => $event->event_type === HistoryEventType::ConditionWaitOpened + && ($event->payload['condition_wait_occurrence_id'] ?? null) === $occurrenceId, + ); + $original = $opens->first(); + $latest = $opens->last(); + if (! $original instanceof WorkflowHistoryEvent || ! $latest instanceof WorkflowHistoryEvent) { + return false; + } + $path = ParallelChildGroup::metadataPathFromPayload($command); + if ($path === [] + || $path !== ParallelChildGroup::metadataPathFromPayload($original->payload) + || $path !== ParallelChildGroup::metadataPathFromPayload($latest->payload)) { + return false; + } + foreach (['condition_key', 'condition_definition_fingerprint', 'timeout_seconds'] as $field) { + if (($command[$field] ?? null) !== ($original->payload[$field] ?? null) + || ($command[$field] ?? null) !== ($latest->payload[$field] ?? null)) { + return false; + } + } + foreach ($path as $entry) { + if ($entry['parallel_group_base_sequence'] + $entry['parallel_group_index'] + !== ($original->payload['sequence'] ?? null)) { + return false; + } + } + + return ! $run->historyEvents->contains( + static fn (WorkflowHistoryEvent $event): bool => $event->sequence > $latest->sequence + && in_array( + $event->event_type, + [HistoryEventType::ConditionWaitSatisfied, HistoryEventType::ConditionWaitTimedOut], + true + ) + && ($event->payload['condition_wait_occurrence_id'] ?? null) === $occurrenceId, + ); + } + /** * @param array $command * @return array{ diff --git a/tests/Feature/V2/V2WorkflowTaskBridgeTest.php b/tests/Feature/V2/V2WorkflowTaskBridgeTest.php index 585f22e3..fe591f20 100644 --- a/tests/Feature/V2/V2WorkflowTaskBridgeTest.php +++ b/tests/Feature/V2/V2WorkflowTaskBridgeTest.php @@ -7889,6 +7889,163 @@ public function testWorkflowBridgeProjectRunHelperOwnsRelationHydration(): void ); } + #[DataProvider('groupedConditionModes')] + public function testRecordedGroupedConditionCanReopenWithoutChoosingASelectionWinner(string $mode): void + { + $run = $this->createWaitingRun(); + [$commands, $condition] = $this->groupedConditionCommands($mode); + $opened = $this->bridge->complete($this->createLeasedTask($run)->id, $commands); + $this->assertTrue($opened['completed']); + + for ($wake = 0; $wake < 2; ++$wake) { + $task = $this->groupedConditionSignalTask($run); + $outcome = $this->bridge->complete($task->id, [$condition]); + $this->assertTrue($outcome['completed'], (string) ($outcome['reason'] ?? '')); + $this->assertSame('waiting', $outcome['run_status']); + $events = WorkflowHistoryEvent::query() + ->where('workflow_run_id', $run->id) + ->orderBy('sequence') + ->get(); + $opens = $events->where('event_type', HistoryEventType::ConditionWaitOpened); + $this->assertCount($wake + 2, $opens); + $this->assertCount($wake + 1, $events->where('event_type', HistoryEventType::ConditionWaitSatisfied)); + $this->assertCount(0, $events->where('event_type', HistoryEventType::SelectionResolved)); + foreach ($opens as $open) { + $this->assertSame('rust:condition-wait:0', $open->payload['condition_wait_occurrence_id']); + $this->assertSame('two-votes', $open->payload['condition_key']); + $this->assertSame('sha256:two-votes-v1', $open->payload['condition_definition_fingerprint']); + $this->assertSame( + ParallelChildGroup::metadataPathFromPayload($condition), + ParallelChildGroup::metadataPathFromPayload($open->payload), + ); + } + } + + if ($mode === 'select') { + $outcome = $this->bridge->complete($this->groupedConditionSignalTask($run)->id, [[ + 'type' => 'complete_workflow', + 'result' => Serializer::serialize('approved'), + ]]); + $this->assertTrue($outcome['completed']); + $this->assertSame('completed', $outcome['run_status']); + $winner = WorkflowHistoryEvent::query() + ->where('workflow_run_id', $run->id) + ->where('event_type', HistoryEventType::SelectionResolved->value) + ->sole(); + $this->assertSame('votes', $winner->payload['member_key'] ?? null); + } + } + + /** + * @return array + */ + public static function groupedConditionModes(): array + { + return [ + 'parallel' => ['all'], + 'nested parallel' => ['nested'], + 'selection' => ['select'], + ]; + } + + #[DataProvider('changedGroupedConditions')] + public function testGroupedConditionReopenRejectsChangedRecordedIdentity(string $mode, string $change): void + { + $run = $this->createWaitingRun(); + [$commands, $condition] = $this->groupedConditionCommands($mode); + $this->assertTrue($this->bridge->complete($this->createLeasedTask($run)->id, $commands)['completed']); + $task = $this->groupedConditionSignalTask($run); + $before = WorkflowHistoryEvent::query()->where('workflow_run_id', $run->id)->count(); + match ($change) { + 'occurrence' => $condition['condition_wait_occurrence_id'] = 'changed', + 'key' => $condition['condition_key'] = 'changed', + 'predicate' => $condition['condition_definition_fingerprint'] = 'changed', + 'timeout' => $condition['timeout_seconds'] = 30, + 'group' => $condition['parallel_group_path'][0]['parallel_group_id'] = 'changed', + 'index' => $condition['parallel_group_path'][0]['parallel_group_index'] = 0, + 'size' => $condition['parallel_group_path'][0]['parallel_group_size'] = 1, + 'member' => $condition['parallel_group_path'][0]['selection_member_key'] = 'changed', + 'nesting' => array_pop($condition['parallel_group_path']), + }; + $outcome = $this->bridge->complete($task->id, [$condition]); + $this->assertFalse($outcome['completed']); + $this->assertSame('invalid_commands', $outcome['reason']); + $this->assertSame($before, WorkflowHistoryEvent::query()->where('workflow_run_id', $run->id)->count()); + $this->assertSame(TaskStatus::Leased, $task->fresh()->status); + } + + /** + * @return array + */ + public static function changedGroupedConditions(): array + { + $cases = []; + foreach (['all', 'nested', 'select'] as $mode) { + foreach (['occurrence', 'key', 'predicate', 'timeout', 'group', 'index', 'size'] as $change) { + $cases[$mode . ':' . $change] = [$mode, $change]; + } + } + $cases['selection member'] = ['select', 'member']; + $cases['nested group path'] = ['nested', 'nesting']; + + return $cases; + } + + public function testGroupedConditionDoesNotAdmitAnUnprovenPartialNewGroup(): void + { + $run = $this->createWaitingRun(); + [, $condition] = $this->groupedConditionCommands('nested'); + $outcome = $this->bridge->complete($this->createLeasedTask($run)->id, [$condition]); + $this->assertFalse($outcome['completed']); + $this->assertSame('invalid_commands', $outcome['reason']); + $this->assertSame(0, WorkflowHistoryEvent::query()->where('workflow_run_id', $run->id)->count()); + } + + public function testGroupedConditionDoesNotAcceptTwoReopensOfOneOccurrence(): void + { + $run = $this->createWaitingRun(); + [$commands, $condition] = $this->groupedConditionCommands('nested'); + $this->assertTrue($this->bridge->complete($this->createLeasedTask($run)->id, $commands)['completed']); + $task = $this->groupedConditionSignalTask($run); + $before = WorkflowHistoryEvent::query()->where('workflow_run_id', $run->id)->count(); + $outcome = $this->bridge->complete($task->id, [$condition, $condition]); + $this->assertFalse($outcome['completed']); + $this->assertSame('invalid_commands', $outcome['reason']); + $this->assertSame($before, WorkflowHistoryEvent::query()->where('workflow_run_id', $run->id)->count()); + } + + #[DataProvider('resolvedGroupedConditions')] + public function testGroupedConditionDoesNotReopenAfterItsRecordedResolution(HistoryEventType $resolution): void + { + $run = $this->createWaitingRun(); + [$commands, $condition] = $this->groupedConditionCommands('all'); + $this->assertTrue($this->bridge->complete($this->createLeasedTask($run)->id, $commands)['completed']); + $opened = WorkflowHistoryEvent::query() + ->where('workflow_run_id', $run->id) + ->where('event_type', HistoryEventType::ConditionWaitOpened->value) + ->sole(); + $task = $this->groupedConditionSignalTask($run); + $resolutionPayload = $opened->payload; + unset($resolutionPayload['task']); + WorkflowHistoryEvent::record($run, $resolution, $resolutionPayload, $task); + $before = WorkflowHistoryEvent::query()->where('workflow_run_id', $run->id)->count(); + $outcome = $this->bridge->complete($task->id, [$condition]); + $this->assertFalse($outcome['completed']); + $this->assertSame('invalid_commands', $outcome['reason']); + $this->assertSame($before, WorkflowHistoryEvent::query()->where('workflow_run_id', $run->id)->count()); + } + + /** + * @return array + */ + public static function resolvedGroupedConditions(): array + { + return [ + 'satisfied' => [HistoryEventType::ConditionWaitSatisfied], + 'timed out' => [HistoryEventType::ConditionWaitTimedOut], + ]; + } + public function testCompleteOpenConditionWaitWithoutTimeoutRecordsEventAndMarksWaiting(): void { $run = $this->createWaitingRun(); @@ -11936,6 +12093,91 @@ public function testCompleteContinueAsNewUsesHistoryProjectionRoleBinding(): voi ); } + /** + * @return array{list>, array} + */ + private function groupedConditionCommands(string $mode): array + { + $size = $mode === 'nested' ? 3 : 2; + $path = static function (int $index, string $kind) use ($mode, $size): array { + $entry = [ + 'parallel_group_id' => ($mode === 'select' ? 'select-calls:1:' : 'parallel-calls:1:') . $size, + 'parallel_group_kind' => 'mixed', + 'parallel_group_base_sequence' => 1, + 'parallel_group_size' => $size, + 'parallel_group_index' => $index, + ]; + if ($mode === 'select') { + $entry += [ + 'parallel_group_mode' => 'select', + 'selection_member_key' => $kind === 'condition' ? 'votes' : 'timer', + 'selection_member_index' => $index, + 'selection_member_base_sequence' => $index + 1, + 'selection_member_size' => 1, + 'selection_member_kind' => $kind, + ]; + } + $result = [$entry]; + if ($mode === 'nested' && $index > 0) { + $result[] = [ + 'parallel_group_id' => 'parallel-calls:2:2', + 'parallel_group_kind' => 'mixed', + 'parallel_group_base_sequence' => 2, + 'parallel_group_size' => 2, + 'parallel_group_index' => $index - 1, + ]; + } + + return $result; + }; + $commands = [[ + 'type' => 'start_timer', + 'delay_seconds' => 300, + 'parallel_group_path' => $path(0, 'timer'), + ]]; + if ($mode === 'nested') { + $commands[] = [ + 'type' => 'open_signal_wait', + 'signal_name' => 'never', + 'parallel_group_path' => $path(1, 'signal'), + ]; + } + $condition = [ + 'type' => 'open_condition_wait', + 'condition_wait_occurrence_id' => 'rust:condition-wait:0', + 'condition_key' => 'two-votes', + 'condition_definition_fingerprint' => 'sha256:two-votes-v1', + 'parallel_group_path' => $path($size - 1, 'condition'), + ]; + $condition += $condition['parallel_group_path'][array_key_last($condition['parallel_group_path'])]; + $commands[] = $condition; + foreach ($commands as &$command) { + $command += $command['parallel_group_path'][array_key_last($command['parallel_group_path'])]; + } + unset($command); + + return [$commands, $condition]; + } + + private function groupedConditionSignalTask(WorkflowRun $run): WorkflowTask + { + $signal = $this->recordReceivedSignal($run, 'vote', (string) Str::ulid()); + $task = $this->createLeasedTask($run); + $task->forceFill([ + 'payload' => [ + 'workflow_wait_kind' => 'signal', + 'resume_source_kind' => 'workflow_signal', + 'resume_source_id' => $signal->id, + 'workflow_signal_id' => $signal->id, + 'signal_name' => $signal->signal_name, + 'signal_wait_id' => $signal->signal_wait_id, + 'workflow_command_id' => $signal->workflow_command_id, + ], + ])->save(); + + return $task; + } + /** * @param array $waitCommand */ diff --git a/tests/fixtures/service-grouped-condition-reopen-rust/Cargo.toml b/tests/fixtures/service-grouped-condition-reopen-rust/Cargo.toml new file mode 100644 index 00000000..8a884477 --- /dev/null +++ b/tests/fixtures/service-grouped-condition-reopen-rust/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "workflow-601-published-repro" +version = "0.1.0" +edition = "2021" + +[dependencies] +durable-workflow = "=2.1.2" +tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] } +reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] } +serde_json = "1" diff --git a/tests/fixtures/service-grouped-condition-reopen-rust/README.md b/tests/fixtures/service-grouped-condition-reopen-rust/README.md new file mode 100644 index 00000000..b6764123 --- /dev/null +++ b/tests/fixtures/service-grouped-condition-reopen-rust/README.md @@ -0,0 +1,20 @@ +# Published service grouped-condition reproduction + +This fresh consumer uses the published Rust SDK pinned in `Cargo.toml`. Point it +at an isolated Server fixture with namespace `default` and token `test-token`. +Run language tooling in the repository runtime or an ephemeral Rust container. + +```sh +DURABLE_WORKFLOW_SERVER_URL=http://server:8080 \ + cargo run --manifest-path tests/fixtures/service-grouped-condition-reopen-rust/Cargo.toml +``` + +The consumer exercises scalar, nested parallel and keyed selection condition +waits through actual Worker registration, polling and completion. One vote is +insufficient for its two-vote predicate. Each case must durably open a second +physical wait. It prints a bounded JSON outcome/history summary and exits 1 if +the Server rejects work. + +The unchanged published counterfactual and exact tuple are retained in +[Workflow #601](https://github.com/durable-workflow/workflow/issues/601). +The cancellation source cases remain in Rust #55 and shared issue #136. diff --git a/tests/fixtures/service-grouped-condition-reopen-rust/src/main.rs b/tests/fixtures/service-grouped-condition-reopen-rust/src/main.rs new file mode 100644 index 00000000..030100f2 --- /dev/null +++ b/tests/fixtures/service-grouped-condition-reopen-rust/src/main.rs @@ -0,0 +1,154 @@ +use durable_workflow::{ + json, Client, ConditionWaitOptions, Error, ParallelOperation, Value, Worker, WorkflowHandle, +}; +use std::time::Duration; + +async fn history(endpoint: &str, handle: &WorkflowHandle) -> Value { + reqwest::Client::new() + .get(format!( + "{endpoint}/api/workflows/{}/runs/{}/history", + handle.workflow_id, + handle.run_id.as_deref().unwrap() + )) + .query(&[("page_size", "1000")]) + .bearer_auth("test-token") + .header("X-Namespace", "default") + .header("X-Durable-Workflow-Control-Plane-Version", "2") + .send() + .await + .unwrap() + .error_for_status() + .unwrap() + .json() + .await + .unwrap() +} + +fn opens(snapshot: &Value) -> usize { + snapshot["events"] + .as_array() + .unwrap() + .iter() + .filter(|event| event["event_type"] == "ConditionWaitOpened") + .count() +} + +async fn until_open( + worker: &Worker, + endpoint: &str, + handle: &WorkflowHandle, + target: usize, +) -> Result { + tokio::time::timeout(Duration::from_secs(20), async { + loop { + worker.run_once().await?; + let snapshot = history(endpoint, handle).await; + if opens(&snapshot) >= target { + return Ok(snapshot); + } + tokio::time::sleep(Duration::from_millis(50)).await; + } + }) + .await + .expect("bounded published reproduction") +} + +#[tokio::main] +async fn main() { + let endpoint = std::env::var("DURABLE_WORKFLOW_SERVER_URL").unwrap(); + let client = Client::builder(&endpoint) + .token(Some("test-token".to_string())) + .namespace("default") + .build() + .unwrap(); + let mut failed = false; + for mode in ["condition", "parallel", "selection"] { + let queue = format!("workflow601-{mode}-{}", durable_workflow::Uuid::new_v4()); + let mut worker = Worker::new(client.clone(), &queue) + .worker_id(format!("{queue}-worker")) + .poll_timeout(Duration::from_secs(1)); + worker.register_workflow( + "tests.published-condition-reopen", + move |ctx, _| async move { + let predicate_ctx = ctx.clone(); + let condition = || ConditionWaitOptions::new("two-votes", "sha256:two-votes-v1"); + match mode { + "condition" => { + ctx.wait_condition(condition(), move || { + Ok(predicate_ctx.signals("vote")?.len() >= 2) + }) + .await?; + } + "parallel" => { + ctx.parallel(vec![ + ParallelOperation::timer(Duration::from_secs(300)), + ParallelOperation::group(vec![ + ParallelOperation::signal("never"), + ParallelOperation::condition(condition(), move || { + Ok(predicate_ctx.signals("vote")?.len() >= 2) + }), + ]), + ]) + .await?; + } + "selection" => { + ctx.select_keyed(vec![ + ("timer", ParallelOperation::timer(Duration::from_secs(300))), + ( + "votes", + ParallelOperation::condition(condition(), move || { + Ok(predicate_ctx.signals("vote")?.len() >= 2) + }), + ), + ]) + .await?; + } + _ => unreachable!(), + } + Ok(Value::Null) + }, + ); + worker.register().await.unwrap(); + let handle = client + .start_workflow( + "tests.published-condition-reopen", + &queue, + &queue, + json!([]), + ) + .await + .unwrap(); + until_open(&worker, &endpoint, &handle, 1).await.unwrap(); + handle + .signal_selected_run("vote", json!(["first"])) + .await + .unwrap(); + let outcome = until_open(&worker, &endpoint, &handle, 2).await; + let snapshot = history(&endpoint, &handle).await; + let phases = snapshot["events"] + .as_array() + .unwrap() + .iter() + .map(|event| json!({"event_type":event["event_type"],"sequence":event["payload"]["sequence"]})) + .collect::>(); + let result = match outcome { + Ok(_) => json!({"outcome":"pass"}), + Err(Error::Http { status, body }) => { + failed = true; + let response: Value = serde_json::from_str(&body).unwrap(); + json!({"outcome":"product-fail","status":status.as_u16(),"reason":response["reason"]}) + } + Err(error) => { + failed = true; + json!({"outcome":"product-fail","error":error.to_string()}) + } + }; + println!( + "{}", + json!({"mode":mode,"result":result,"phases":phases,"opens":opens(&snapshot)}) + ); + } + if failed { + std::process::exit(1); + } +} From fc4ef6d5c29d219e595ad4d4f37f004b55b60585 Mon Sep 17 00:00:00 2001 From: Durable Workflow Date: Thu, 1 Oct 2026 16:23:26 +0000 Subject: [PATCH 2/6] test: retain grouped condition reopen counterfactual --- scripts/ci/validate-regression-corpus.py | 1 + .../V2EmbeddedReplayRegressionCorpusTest.php | 68 +++++++++++++++++++ ...ice-grouped-condition-physical-reopen.json | 32 +++++++++ ...tServiceGroupedConditionReopenWorkflow.php | 29 ++++++++ 4 files changed, 130 insertions(+) create mode 100644 tests/Fixtures/V2/ReplayRegression/service-grouped-condition-physical-reopen.json create mode 100644 tests/Fixtures/V2/TestServiceGroupedConditionReopenWorkflow.php diff --git a/scripts/ci/validate-regression-corpus.py b/scripts/ci/validate-regression-corpus.py index b31c72a1..4cd587f0 100644 --- a/scripts/ci/validate-regression-corpus.py +++ b/scripts/ci/validate-regression-corpus.py @@ -160,6 +160,7 @@ "tests/Fixtures/V2/TestParallelChildReplayWorkflow.php", "tests/Fixtures/V2/TestSequentialChildReplayWorkflow.php", "tests/Fixtures/V2/TestServiceResponseReplayWorkflow.php", + "tests/Fixtures/V2/TestServiceGroupedConditionReopenWorkflow.php", "tests/Fixtures/V2/TestSignalResumedParallelWorkflow.php", "tests/Unit/V2/ReplayRegressionCorpusTest.php", ), diff --git a/tests/Feature/V2/V2EmbeddedReplayRegressionCorpusTest.php b/tests/Feature/V2/V2EmbeddedReplayRegressionCorpusTest.php index 223779b9..1589b241 100644 --- a/tests/Feature/V2/V2EmbeddedReplayRegressionCorpusTest.php +++ b/tests/Feature/V2/V2EmbeddedReplayRegressionCorpusTest.php @@ -84,6 +84,10 @@ public function testFixturesExecuteThroughDeclaredReplayConsumers(): void $this->assertSignalResumedMixedGroupCommandSequenceFixture($fixture); } + if (($fixture['id'] ?? null) === 'service-grouped-condition-physical-reopen') { + $this->assertServiceGroupedConditionPhysicalReopen($fixture); + } + if (($fixture['id'] ?? null) === 'signal-applied-envelope-cold-replay') { $this->assertSignalAppliedEnvelopeColdReplay($fixture); } @@ -1064,6 +1068,70 @@ private function executeColdReplayFixture(array $fixture): void $this->assertStepMatches($fixture['expected'], $step, "{$fixture['id']} final outcome"); } + /** + * @param array $fixture + */ + private function assertServiceGroupedConditionPhysicalReopen(array $fixture): void + { + $this->clearWorkflowState(); + $workflow = $fixture['workflow']; + $stub = WorkflowStub::make( + $workflow['type'], + sprintf('regression-corpus-condition-reopen-%d', ++$this->workflowNumber), + ); + $stub->start(...$workflow['arguments']); + $run = WorkflowRun::query()->findOrFail($stub->runId()); + $bridge = $this->app->make(WorkflowTaskBridge::class); + $runner = WorkflowFiberRunner::forClass( + $workflow['type'], + $stub->id(), + $run->id, + $workflow['arguments'], + $workflow['payload_codec'], + ); + $commands = $runner->step() +->commands; + foreach ($commands as &$command) { + if ($command['type'] === 'open_condition_wait') { + // Service Workers supply the authored identity across physical + // reopens, as in the published Rust reproduction for #601. + $command['condition_wait_occurrence_id'] = 'rust:condition-wait:0'; + } + } + unset($command); + $condition = collect($commands) + ->firstWhere('type', 'open_condition_wait'); + $this->assertIsArray($condition); + + for ($wake = 0; $wake < 3; ++$wake) { + $task = WorkflowTask::query() + ->where('workflow_run_id', $run->id) + ->where('task_type', TaskType::Workflow->value) + ->where('status', TaskStatus::Ready->value) + ->firstOrFail(); + $this->assertTrue($bridge->claimStatus($task->id, 'corpus-condition-worker')['claimed']); + $outcome = $bridge->complete($task->id, $wake === 0 ? $commands : [$condition]); + $this->assertTrue($outcome['completed'], json_encode($outcome, JSON_THROW_ON_ERROR)); + $this->assertSame('waiting', $outcome['run_status']); + $opens = WorkflowHistoryEvent::query() + ->where('workflow_run_id', $run->id) + ->where('event_type', HistoryEventType::ConditionWaitOpened->value) + ->orderBy('sequence') + ->get(); + $this->assertCount($wake + 1, $opens); + $this->assertSame( + [$condition['condition_wait_occurrence_id']], + $opens->pluck('payload.condition_wait_occurrence_id') + ->unique() + ->values() + ->all(), + ); + if ($wake < 2) { + $this->assertTrue($stub->signal('vote', 'insufficient')->accepted()); + } + } + } + /** * @param array $fixture */ diff --git a/tests/Fixtures/V2/ReplayRegression/service-grouped-condition-physical-reopen.json b/tests/Fixtures/V2/ReplayRegression/service-grouped-condition-physical-reopen.json new file mode 100644 index 00000000..30d67eaf --- /dev/null +++ b/tests/Fixtures/V2/ReplayRegression/service-grouped-condition-physical-reopen.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://raw.githubusercontent.com/durable-workflow/.github/main/regression-corpus/evidence-schema.json", + "fixture_schema": "durable-workflow.replay-regression/v1", + "id": "service-grouped-condition-physical-reopen", + "protocol_version": "1.19", + "bindings": ["php"], + "workflow": { + "type": "Tests\\Fixtures\\V2\\TestServiceGroupedConditionReopenWorkflow", + "arguments": [], + "payload_codec": "avro" + }, + "command_sequence": [ + { + "completed": false, + "result": null, + "commands": [ + {"type": "start_timer", "delay_seconds": 300}, + {"type": "open_signal_wait", "signal_name": "never"}, + {"type": "open_condition_wait", "condition_key": "two-votes"} + ] + } + ], + "expected": { + "completed": false, + "result": null, + "commands": [ + {"type": "start_timer", "delay_seconds": 300}, + {"type": "open_signal_wait", "signal_name": "never"}, + {"type": "open_condition_wait", "condition_key": "two-votes"} + ] + } +} diff --git a/tests/Fixtures/V2/TestServiceGroupedConditionReopenWorkflow.php b/tests/Fixtures/V2/TestServiceGroupedConditionReopenWorkflow.php new file mode 100644 index 00000000..79ce5d05 --- /dev/null +++ b/tests/Fixtures/V2/TestServiceGroupedConditionReopenWorkflow.php @@ -0,0 +1,29 @@ + timer(300), + static fn () => all([ + static fn () => signal('never'), + static fn () => await(static fn (): bool => false, conditionKey: 'two-votes'), + ]), + ]); + } +} From a9a9d3a2e02e1c3b80733bb7c77b3326d2d798c0 Mon Sep 17 00:00:00 2001 From: Durable Workflow Date: Thu, 1 Oct 2026 16:46:29 +0000 Subject: [PATCH 3/6] test: freeze published grouped condition reproduction dependencies --- .../Cargo.lock | 1794 +++++++++++++++++ 1 file changed, 1794 insertions(+) create mode 100644 tests/fixtures/service-grouped-condition-reopen-rust/Cargo.lock diff --git a/tests/fixtures/service-grouped-condition-reopen-rust/Cargo.lock b/tests/fixtures/service-grouped-condition-reopen-rust/Cargo.lock new file mode 100644 index 00000000..a20f3ba4 --- /dev/null +++ b/tests/fixtures/service-grouped-condition-reopen-rust/Cargo.lock @@ -0,0 +1,1794 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "apache-avro" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36fa98bc79671c7981272d91a8753a928ff6a1cd8e4f20a44c45bd5d313840bf" +dependencies = [ + "bigdecimal", + "bon", + "digest", + "log", + "miniz_oxide", + "num-bigint", + "quad-rand", + "rand 0.9.5", + "regex-lite", + "serde", + "serde_bytes", + "serde_json", + "strum", + "strum_macros", + "thiserror 2.0.21", + "uuid", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bigdecimal" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fa3f3d8cbf4dffcfe4991de61d012bef509a409ecbe9dd41049bfe32b4d4653" +dependencies = [ + "autocfg", + "libm", + "num-bigint", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bon" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebeb9aaf9329dff6ceb65c689ca3db33dbf15f324909c60e4e5eef5701ce31b1" +dependencies = [ + "bon-macros", + "rustversion", +] + +[[package]] +name = "bon-macros" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77e9d642a7e3a318e37c2c9427b5a6a48aa1ad55dcd986f3034ab2239045a645" +dependencies = [ + "darling", + "ident_case", + "prettyplease", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.119", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cc" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f360145194ee8e21db5ee7f3fcd4fe52210864c75c985dae33218202c8bbe040" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core 0.10.1", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "num-traits", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "darling" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.119", +] + +[[package]] +name = "darling_macro" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "durable-workflow" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63bee7fcbb528f993e30fbb40d66e3f84f7842516f10f6f5944f453a601b48c5" +dependencies = [ + "apache-avro", + "base64 0.22.1", + "bon", + "chrono", + "futures-util", + "icu_collections", + "icu_locale_core", + "icu_normalizer", + "icu_properties", + "icu_provider", + "reqwest", + "serde", + "serde-value", + "serde_json", + "sha2", + "thiserror 1.0.69", + "tokio", + "uuid", + "yoke-derive", +] + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-macro", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", + "wasm-bindgen", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b501faa50e7a26c3d3560ca625132f4078a17771f4810baf70475ae48cbe43" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "js-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "lru-slab" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.119", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quad-rand" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a651516ddc9168ebd67b24afd085a718be02f8858fe406591b013d101ce2f40" + +[[package]] +name = "quinn" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.21", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe" +dependencies = [ + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand 0.10.3", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.21", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.61.2", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_pcg" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" +dependencies = [ + "rand_core 0.10.1", +] + +[[package]] +name = "regex-lite" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustls" +version = "0.23.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + +[[package]] +name = "serde_bytes" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "serde_json" +version = "1.0.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" + +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "tokio" +version = "1.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-ident" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "1.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef6dac1e96601b4fb3acccccff2139741fcb757cb9a36089bf5be91cfb285ce" +dependencies = [ + "getrandom 0.4.3", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.6", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "workflow-601-published-repro" +version = "0.1.0" +dependencies = [ + "durable-workflow", + "reqwest", + "serde_json", + "tokio", +] + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure 0.13.2", +] + +[[package]] +name = "zerocopy" +version = "0.8.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6df92bf3d9227be3d53173901ddbffac2babc27ae50f397776ffd6dc33f800cb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac4f328cf2f05d084e496c3e9c3f33ed0a183656a16e1fcec4d464d8373aec82" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", + "synstructure 0.14.0", +] + +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" From c092dd41a5b0aef1df06420759ad6b5185a61226 Mon Sep 17 00:00:00 2001 From: Durable Workflow Date: Thu, 1 Oct 2026 17:04:43 +0000 Subject: [PATCH 4/6] Replay committed condition winners and follow logical group resolution --- src/V2/Support/DefaultWorkflowTaskBridge.php | 47 ++++++-- src/V2/Support/ParallelChildGroup.php | 101 ++++++++++++++-- src/V2/Support/WorkflowTaskPayload.php | 20 +++ tests/Feature/V2/V2WorkflowTaskBridgeTest.php | 21 ++++ tests/Unit/V2/ParallelChildGroupTest.php | 114 ++++++++++++++++++ 5 files changed, 287 insertions(+), 16 deletions(-) diff --git a/src/V2/Support/DefaultWorkflowTaskBridge.php b/src/V2/Support/DefaultWorkflowTaskBridge.php index 850ab11c..9ce1459c 100644 --- a/src/V2/Support/DefaultWorkflowTaskBridge.php +++ b/src/V2/Support/DefaultWorkflowTaskBridge.php @@ -1065,7 +1065,11 @@ public function complete(string $taskId, array $commands): array } $this->recordAppliedSignalForSignalResume($run, $task); - $this->recordSatisfiedConditionWaitForSignalResume($run, $task, $parsed['non_terminal']); + $conditionSelectionResolution = $this->recordSatisfiedConditionWaitForSignalResume( + $run, + $task, + $parsed['non_terminal'], + ); foreach ($parsed['non_terminal'] as $command) { $sequence = $this->applyNonTerminalCommand($run, $task, $command, $sequence, $createdTaskIds); @@ -1082,7 +1086,13 @@ public function complete(string $taskId, array $commands): array $this->applyWorkflowFailure($run, $task, $terminal); } } else { - $this->markRunWaiting($run, $task, $parsed['non_terminal'], $createdTaskIds); + $this->markRunWaiting( + $run, + $task, + $parsed['non_terminal'], + $createdTaskIds, + $conditionSelectionResolution, + ); } return [ @@ -1292,6 +1302,7 @@ private function markRunWaiting( WorkflowTask $task, array $nonTerminalCommands, array &$createdTaskIds, + ?WorkflowHistoryEvent $conditionSelectionResolution = null, ): void { $run->forceFill([ 'status' => RunStatus::Waiting, @@ -1313,6 +1324,25 @@ private function markRunWaiting( $createdTaskIds[] = $nextMessageTask->id; } + if ($conditionSelectionResolution !== null + && ! WorkflowTask::query()->where('workflow_run_id', $run->id) + ->where('task_type', TaskType::Workflow->value) + ->whereIn('status', [TaskStatus::Ready->value, TaskStatus::Leased->value]) + ->exists()) { + $replayTask = WorkflowTask::query()->create([ + 'workflow_run_id' => $run->id, + 'namespace' => $run->namespace, + 'task_type' => TaskType::Workflow->value, + 'status' => TaskStatus::Ready->value, + 'available_at' => now(), + 'payload' => WorkflowTaskPayload::forConditionResolution($conditionSelectionResolution), + 'connection' => $run->connection, + 'queue' => $run->queue, + 'compatibility' => $run->compatibility, + ]); + $createdTaskIds[] = $replayTask->id; + } + if (self::commandsIncludeChildWorkflowStart($nonTerminalCommands)) { self::projectRunBestEffort($run, self::PROJECTION_RUN_RELATIONS_WITH_HISTORY, 'child_workflow_parent_wait'); } else { @@ -2066,17 +2096,17 @@ private function recordSatisfiedConditionWaitForSignalResume( WorkflowRun $run, WorkflowTask $task, array $commands - ): void { + ): ?WorkflowHistoryEvent { $taskPayload = is_array($task->payload) ? $task->payload : []; if (($taskPayload['resume_source_kind'] ?? null) !== 'workflow_signal') { - return; + return null; } $wait = $this->latestOpenConditionWait($run); if ($wait === null) { - return; + return null; } $this->markConditionWaitSignalConsumed($run, $task, $wait); @@ -2114,11 +2144,12 @@ private function recordSatisfiedConditionWaitForSignalResume( break; } } - if (! $reopened) { - ParallelChildGroup::claimSelectionWinner($run, $parallelPath, 'condition', $satisfiedEvent); - } + $selectionResolved = ! $reopened + && ParallelChildGroup::claimSelectionWinner($run, $parallelPath, 'condition', $satisfiedEvent); $this->cancelOpenConditionTimer($run, $task, $wait); + + return $selectionResolved ? $satisfiedEvent : null; } /** diff --git a/src/V2/Support/ParallelChildGroup.php b/src/V2/Support/ParallelChildGroup.php index bb2322e5..302b7e37 100644 --- a/src/V2/Support/ParallelChildGroup.php +++ b/src/V2/Support/ParallelChildGroup.php @@ -477,9 +477,7 @@ public static function validatedSelectionResolution( $event->id === $resolutionId); if (! $resolution instanceof WorkflowHistoryEvent || $resolution->event_type->value !== $resolutionType - || ! is_int($resolution->payload['sequence'] ?? null) - || $resolution->payload['sequence'] < $memberBase - || $resolution->payload['sequence'] >= $memberBase + $memberSize) { + || ! is_int($resolution->payload['sequence'] ?? null)) { self::throwSelectionMismatch( $memberBase, 'Winner resolution_event_id/type does not identify a terminal event for the authored member.', @@ -1060,11 +1058,27 @@ private static function resolutionEventForMember( HistoryEventType::ConditionWaitTimedOut, ]; + $memberSequences = []; + for ($sequence = $baseSequence; $sequence < $baseSequence + $size; ++$sequence) { + $opening = self::conditionOpeningForAuthoredSequence($run, $sequence); + $physicalSequence = $opening?->payload['sequence'] ?? $sequence; + $memberSequences[$physicalSequence] = $opening; + } + $events = $run->historyEvents - ->filter(static fn (WorkflowHistoryEvent $event): bool => in_array($event->event_type, $types, true) - && is_int($event->payload['sequence'] ?? null) - && $event->payload['sequence'] >= $baseSequence - && $event->payload['sequence'] < $baseSequence + $size) + ->filter(static function (WorkflowHistoryEvent $event) use ($types, $memberSequences): bool { + $sequence = $event->payload['sequence'] ?? null; + if (! in_array($event->event_type, $types, true) + || ! is_int($sequence) + || ! array_key_exists($sequence, $memberSequences)) { + return false; + } + + $opening = $memberSequences[$sequence]; + + return ! $opening instanceof WorkflowHistoryEvent + || self::conditionResolutionMatchesOpening($event, $opening); + }) ->sortBy(static fn (WorkflowHistoryEvent $event): int => $event->sequence); return $outcome === 'failed' ? $events->first() : $events->last(); @@ -1148,9 +1162,80 @@ private static function waitCompletedSuccessfully(WorkflowRun $run, int $sequenc ? [HistoryEventType::SignalApplied, HistoryEventType::TimerFired] : [HistoryEventType::ConditionWaitSatisfied, HistoryEventType::ConditionWaitTimedOut]; + $opening = $kind === 'condition' ? self::conditionOpeningForAuthoredSequence($run, $sequence) : null; + $sequence = $opening?->payload['sequence'] ?? $sequence; + return $run->historyEvents->contains(static fn (WorkflowHistoryEvent $event): bool => ($event->payload['sequence'] ?? null) === $sequence - && in_array($event->event_type, $terminalTypes, true)); + && in_array($event->event_type, $terminalTypes, true) + && (! $opening instanceof WorkflowHistoryEvent || self::conditionResolutionMatchesOpening( + $event, + $opening + ))); + } + + private static function conditionOpeningForAuthoredSequence( + WorkflowRun $run, + int $sequence, + ): ?WorkflowHistoryEvent { + $events = $run->historyEvents->sortBy('sequence'); + /** @var WorkflowHistoryEvent|null $original */ + $original = $events->first(static fn (WorkflowHistoryEvent $event): bool => + $event->event_type === HistoryEventType::ConditionWaitOpened + && ($event->payload['sequence'] ?? null) === $sequence); + $occurrence = self::stringValue($original?->payload['condition_wait_occurrence_id'] ?? null); + $path = self::metadataPathFromPayload($original?->payload ?? []); + if (! $original instanceof WorkflowHistoryEvent || $occurrence === null || $path === []) { + return $original; + } + + $latest = $original; + $satisfied = false; + $timedOut = false; + foreach ($events as $event) { + if (self::conditionResolutionMatchesOpening($event, $latest)) { + $satisfied = $satisfied || $event->event_type === HistoryEventType::ConditionWaitSatisfied; + $timedOut = $timedOut || $event->event_type === HistoryEventType::ConditionWaitTimedOut; + } + if ($event->event_type !== HistoryEventType::ConditionWaitOpened + || $event->sequence <= $original->sequence + || ($event->payload['condition_wait_occurrence_id'] ?? null) !== $occurrence) { + continue; + } + + $matches = is_int($event->payload['sequence'] ?? null) + && $event->payload['sequence'] > $latest->payload['sequence'] + && self::metadataPathFromPayload($event->payload) === $path; + foreach (['condition_key', 'condition_definition_fingerprint', 'timeout_seconds'] as $field) { + $matches = $matches && ($event->payload[$field] ?? null) === ($original->payload[$field] ?? null); + } + if (! $matches || ! $satisfied || $timedOut) { + self::throwSelectionMismatch( + $sequence, + 'Reopened condition does not match its satisfied authored predecessor.' + ); + } + $latest = $event; + $satisfied = false; + $timedOut = false; + } + + return $latest; + } + + private static function conditionResolutionMatchesOpening( + WorkflowHistoryEvent $resolution, + WorkflowHistoryEvent $opening, + ): bool { + return in_array($resolution->event_type, [ + HistoryEventType::ConditionWaitSatisfied, + HistoryEventType::ConditionWaitTimedOut, + ], true) + && $resolution->sequence > $opening->sequence + && ($resolution->payload['sequence'] ?? null) === ($opening->payload['sequence'] ?? null) + && ($resolution->payload['condition_wait_id'] ?? null) === ($opening->payload['condition_wait_id'] ?? null) + && ($resolution->payload['condition_wait_occurrence_id'] ?? null) + === ($opening->payload['condition_wait_occurrence_id'] ?? null); } private static function intValue(mixed $value): ?int diff --git a/src/V2/Support/WorkflowTaskPayload.php b/src/V2/Support/WorkflowTaskPayload.php index 70ad4827..d22f572b 100644 --- a/src/V2/Support/WorkflowTaskPayload.php +++ b/src/V2/Support/WorkflowTaskPayload.php @@ -98,6 +98,26 @@ public static function forActivityResolution(WorkflowHistoryEvent $event): array ], static fn (mixed $value): bool => $value !== null); } + /** + * @return array + */ + public static function forConditionResolution(WorkflowHistoryEvent $event): array + { + $payload = is_array($event->payload) ? $event->payload : []; + $waitId = self::nonEmptyString($payload['condition_wait_id'] ?? null); + + return array_filter([ + 'workflow_wait_kind' => 'condition', + 'open_wait_id' => $waitId, + 'resume_source_kind' => 'condition_resolution', + 'resume_source_id' => $event->id, + 'condition_wait_id' => $waitId, + 'condition_wait_occurrence_id' => self::nonEmptyString($payload['condition_wait_occurrence_id'] ?? null), + 'workflow_sequence' => self::intValue($payload['sequence'] ?? null), + 'workflow_event_type' => $event->event_type?->value, + ], static fn (mixed $value): bool => $value !== null); + } + /** * @return array */ diff --git a/tests/Feature/V2/V2WorkflowTaskBridgeTest.php b/tests/Feature/V2/V2WorkflowTaskBridgeTest.php index fe591f20..f370445b 100644 --- a/tests/Feature/V2/V2WorkflowTaskBridgeTest.php +++ b/tests/Feature/V2/V2WorkflowTaskBridgeTest.php @@ -7948,6 +7948,27 @@ public static function groupedConditionModes(): array ]; } + public function testResolvedReopenedConditionSelectionSchedulesItsCanonicalReplay(): void + { + $run = $this->createWaitingRun(); + [$commands, $condition] = $this->groupedConditionCommands('select'); + $this->assertTrue($this->bridge->complete($this->createLeasedTask($run)->id, $commands)['completed']); + $this->assertTrue( + $this->bridge->complete($this->groupedConditionSignalTask($run)->id, [$condition])['completed'] + ); + + $outcome = $this->bridge->complete($this->groupedConditionSignalTask($run)->id, []); + $this->assertTrue($outcome['completed']); + $this->assertSame('waiting', $outcome['run_status']); + $this->assertCount(1, $outcome['created_task_ids']); + $replayTask = WorkflowTask::query()->findOrFail($outcome['created_task_ids'][0]); + $this->assertSame(TaskType::Workflow, $replayTask->task_type); + $this->assertSame(TaskStatus::Ready, $replayTask->status); + $this->assertSame('condition_resolution', $replayTask->payload['resume_source_kind']); + $this->assertSame('ConditionWaitSatisfied', $replayTask->payload['workflow_event_type']); + $this->assertSame('rust:condition-wait:0', $replayTask->payload['condition_wait_occurrence_id']); + } + #[DataProvider('changedGroupedConditions')] public function testGroupedConditionReopenRejectsChangedRecordedIdentity(string $mode, string $change): void { diff --git a/tests/Unit/V2/ParallelChildGroupTest.php b/tests/Unit/V2/ParallelChildGroupTest.php index e43bf242..4df36375 100644 --- a/tests/Unit/V2/ParallelChildGroupTest.php +++ b/tests/Unit/V2/ParallelChildGroupTest.php @@ -295,6 +295,68 @@ public function testRecordedSelectionResolutionsBindEveryDurableMemberKindToItsT $this->assertSame($failure, ParallelChildGroup::memberFailureResolution($failedRun, 20, 1)); } + public function testReopenedConditionSelectionBindsItsLatestPhysicalResolution(): void + { + foreach ([HistoryEventType::ConditionWaitSatisfied, HistoryEventType::ConditionWaitTimedOut] as $type) { + [$events, $select, $marker] = $this->reopenedConditionSelectionHistory($type); + $run = $this->runWithHistoryEvents($events); + $validated = ParallelChildGroup::validatedSelectionResolution($run, $select, 10, $marker); + $this->assertSame(12, $validated['_resolution_sequence']); + $this->assertSame('condition-11', $validated['operation_identity']); + $this->assertTrue(ParallelChildGroup::selectionMemberIsTerminal($run, 11, 1, 'condition')); + } + } + + public function testReopenedConditionFalseWakeDoesNotCompleteItsLogicalMemberOrBarrier(): void + { + [$events] = $this->reopenedConditionSelectionHistory(HistoryEventType::ConditionWaitSatisfied); + $run = $this->runWithHistoryEvents(array_slice($events, 0, 3)); + $this->assertFalse(ParallelChildGroup::selectionMemberIsTerminal($run, 11, 1, 'condition')); + $this->assertFalse(ParallelChildGroup::selectionMemberIsTerminal($run, 11, 1, 'group')); + } + + public function testReopenedConditionResolutionRejectsChangedOrUnsettledPredecessors(): void + { + foreach ([ + 'condition_key', + 'condition_definition_fingerprint', + 'timeout_seconds', + 'path', + 'unsettled', + 'timed_out', + 'late', + ] as $change) { + [$events, $select, $marker] = $this->reopenedConditionSelectionHistory( + HistoryEventType::ConditionWaitSatisfied + ); + $payload = $events[2]->payload; + if ($change === 'path') { + $payload['parallel_group_path'][0]['selection_member_key'] = 'different'; + $events[2]->payload = $payload; + } elseif ($change === 'unsettled') { + unset($events[1]); + } elseif ($change === 'timed_out') { + $events[1]->event_type = HistoryEventType::ConditionWaitTimedOut; + } elseif ($change === 'late') { + $events[1]->sequence = 6; + } else { + $payload[$change] = $change === 'timeout_seconds' ? 31 : 'different'; + $events[2]->payload = $payload; + } + try { + ParallelChildGroup::validatedSelectionResolution( + $this->runWithHistoryEvents(array_values($events)), + $select, + 10, + $marker, + ); + $this->fail("Accepted {$change} predecessor."); + } catch (HistoryEventShapeMismatchException $error) { + $this->assertStringContainsString('satisfied authored predecessor', $error->getMessage()); + } + } + } + public function testMalformedRecordedSelectionWinnerMetadataIsRejected(): void { $opening = $this->historyEvent(HistoryEventType::TimerScheduled, 1, [ @@ -894,6 +956,58 @@ public function testSelectionWinnerUsesTerminalIdentityFallbackAndRejectsMissing ); } + /** + * @return array{list, SelectCall, WorkflowHistoryEvent} + */ + private function reopenedConditionSelectionHistory(HistoryEventType $resolutionType): array + { + $identity = [ + 'condition_wait_occurrence_id' => 'condition-occurrence', + 'condition_key' => 'ready', + 'condition_definition_fingerprint' => 'ready-v1', + 'timeout_seconds' => 30, + ...ParallelChildGroup::payloadForPath([ + ParallelChildGroup::groupEntry(10, 2, 1, 'mixed', 'select', 'winner', 1, 11, 1, 'condition'), + ]), + ]; + $initial = [ + ...$identity, + 'sequence' => 11, + 'condition_wait_id' => 'condition-11', + ]; + $reopened = [ + ...$identity, + 'sequence' => 12, + 'condition_wait_id' => 'condition-12', + ]; + $resolution = $this->historyEvent($resolutionType, 4, $reopened, 'condition-resolution'); + $marker = $this->historyEvent(HistoryEventType::SelectionResolved, 5, [ + 'selection_group_id' => 'select-calls:10:2', + 'selection_group_base_sequence' => 10, + 'selection_group_size' => 2, + 'member_key' => 'winner', + 'member_index' => 1, + 'member_base_sequence' => 11, + 'member_size' => 1, + 'operation_kind' => 'condition', + 'operation_identity' => 'condition-11', + 'outcome' => 'completed', + 'resolution_event_id' => $resolution->id, + 'resolution_event_type' => $resolutionType->value, + ], 'condition-marker'); + + return [[ + $this->historyEvent(HistoryEventType::ConditionWaitOpened, 1, $initial), + $this->historyEvent(HistoryEventType::ConditionWaitSatisfied, 2, $initial), + $this->historyEvent(HistoryEventType::ConditionWaitOpened, 3, $reopened), + $resolution, + $marker, + ], new SelectCall([ + 'skipped' => new TimerCall(300), + 'winner' => new AwaitCall(static fn (): bool => true, 'ready'), + ]), $marker]; + } + private function createRun(): WorkflowRun { $instance = WorkflowInstance::query()->create([ From 9118311fb36ed7bd6ecd4023e00a7bc9025c47e3 Mon Sep 17 00:00:00 2001 From: Durable Workflow Date: Thu, 1 Oct 2026 17:18:00 +0000 Subject: [PATCH 5/6] Resolve reopened grouped conditions through their timeout transport --- src/V2/Support/ParallelChildGroup.php | 32 +++++++++++++++++---- tests/Unit/V2/ParallelChildGroupTest.php | 36 ++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 9 deletions(-) diff --git a/src/V2/Support/ParallelChildGroup.php b/src/V2/Support/ParallelChildGroup.php index 302b7e37..4697b790 100644 --- a/src/V2/Support/ParallelChildGroup.php +++ b/src/V2/Support/ParallelChildGroup.php @@ -1059,14 +1059,27 @@ private static function resolutionEventForMember( ]; $memberSequences = []; + $conditionResolutions = []; for ($sequence = $baseSequence; $sequence < $baseSequence + $size; ++$sequence) { $opening = self::conditionOpeningForAuthoredSequence($run, $sequence); $physicalSequence = $opening?->payload['sequence'] ?? $sequence; $memberSequences[$physicalSequence] = $opening; + if ($opening instanceof WorkflowHistoryEvent) { + $conditionResolutions[$physicalSequence] = $run->historyEvents->sortBy('sequence')->first( + static fn (WorkflowHistoryEvent $event): bool => self::conditionResolutionMatchesOpening( + $event, + $opening + ) + ); + } } $events = $run->historyEvents - ->filter(static function (WorkflowHistoryEvent $event) use ($types, $memberSequences): bool { + ->filter(static function (WorkflowHistoryEvent $event) use ( + $types, + $memberSequences, + $conditionResolutions + ): bool { $sequence = $event->payload['sequence'] ?? null; if (! in_array($event->event_type, $types, true) || ! is_int($sequence) @@ -1077,7 +1090,7 @@ private static function resolutionEventForMember( $opening = $memberSequences[$sequence]; return ! $opening instanceof WorkflowHistoryEvent - || self::conditionResolutionMatchesOpening($event, $opening); + || ($conditionResolutions[$sequence]?->id ?? null) === $event->id; }) ->sortBy(static fn (WorkflowHistoryEvent $event): int => $event->sequence); @@ -1160,7 +1173,11 @@ private static function waitCompletedSuccessfully(WorkflowRun $run, int $sequenc { $terminalTypes = $kind === 'signal' ? [HistoryEventType::SignalApplied, HistoryEventType::TimerFired] - : [HistoryEventType::ConditionWaitSatisfied, HistoryEventType::ConditionWaitTimedOut]; + : [ + HistoryEventType::ConditionWaitSatisfied, + HistoryEventType::ConditionWaitTimedOut, + HistoryEventType::TimerFired, + ]; $opening = $kind === 'condition' ? self::conditionOpeningForAuthoredSequence($run, $sequence) : null; $sequence = $opening?->payload['sequence'] ?? $sequence; @@ -1195,7 +1212,7 @@ private static function conditionOpeningForAuthoredSequence( foreach ($events as $event) { if (self::conditionResolutionMatchesOpening($event, $latest)) { $satisfied = $satisfied || $event->event_type === HistoryEventType::ConditionWaitSatisfied; - $timedOut = $timedOut || $event->event_type === HistoryEventType::ConditionWaitTimedOut; + $timedOut = $timedOut || $event->event_type !== HistoryEventType::ConditionWaitSatisfied; } if ($event->event_type !== HistoryEventType::ConditionWaitOpened || $event->sequence <= $original->sequence @@ -1227,10 +1244,13 @@ private static function conditionResolutionMatchesOpening( WorkflowHistoryEvent $resolution, WorkflowHistoryEvent $opening, ): bool { - return in_array($resolution->event_type, [ + $terminal = in_array($resolution->event_type, [ HistoryEventType::ConditionWaitSatisfied, HistoryEventType::ConditionWaitTimedOut, - ], true) + ], true) || ($resolution->event_type === HistoryEventType::TimerFired + && ($resolution->payload['timer_kind'] ?? null) === 'condition_timeout'); + + return $terminal && $resolution->sequence > $opening->sequence && ($resolution->payload['sequence'] ?? null) === ($opening->payload['sequence'] ?? null) && ($resolution->payload['condition_wait_id'] ?? null) === ($opening->payload['condition_wait_id'] ?? null) diff --git a/tests/Unit/V2/ParallelChildGroupTest.php b/tests/Unit/V2/ParallelChildGroupTest.php index 4df36375..e6f71ca4 100644 --- a/tests/Unit/V2/ParallelChildGroupTest.php +++ b/tests/Unit/V2/ParallelChildGroupTest.php @@ -297,7 +297,11 @@ public function testRecordedSelectionResolutionsBindEveryDurableMemberKindToItsT public function testReopenedConditionSelectionBindsItsLatestPhysicalResolution(): void { - foreach ([HistoryEventType::ConditionWaitSatisfied, HistoryEventType::ConditionWaitTimedOut] as $type) { + foreach ([ + HistoryEventType::ConditionWaitSatisfied, + HistoryEventType::ConditionWaitTimedOut, + HistoryEventType::TimerFired, + ] as $type) { [$events, $select, $marker] = $this->reopenedConditionSelectionHistory($type); $run = $this->runWithHistoryEvents($events); $validated = ParallelChildGroup::validatedSelectionResolution($run, $select, 10, $marker); @@ -312,7 +316,25 @@ public function testReopenedConditionFalseWakeDoesNotCompleteItsLogicalMemberOrB [$events] = $this->reopenedConditionSelectionHistory(HistoryEventType::ConditionWaitSatisfied); $run = $this->runWithHistoryEvents(array_slice($events, 0, 3)); $this->assertFalse(ParallelChildGroup::selectionMemberIsTerminal($run, 11, 1, 'condition')); - $this->assertFalse(ParallelChildGroup::selectionMemberIsTerminal($run, 11, 1, 'group')); + $persisted = $this->createRun(); + foreach (array_slice($events, 0, 3) as $event) { + $this->record($persisted, $event->event_type, $event->payload); + } + $this->assertFalse(ParallelChildGroup::selectionMemberIsTerminal($persisted, 11, 1, 'group')); + } + + public function testReopenedConditionTimeoutTransportKeepsItsCanonicalResolutionAfterAcknowledgement(): void + { + [$events, $select, $marker] = $this->reopenedConditionSelectionHistory(HistoryEventType::TimerFired); + $events[] = $this->historyEvent(HistoryEventType::ConditionWaitTimedOut, 6, $events[2]->payload); + $run = $this->runWithHistoryEvents($events); + $validated = ParallelChildGroup::validatedSelectionResolution($run, $select, 10, $marker); + $this->assertSame('condition-resolution', $validated['resolution_event_id']); + $persisted = $this->createRun(); + foreach ($events as $event) { + $this->record($persisted, $event->event_type, $event->payload); + } + $this->assertTrue(ParallelChildGroup::selectionMemberIsTerminal($persisted, 11, 1, 'group')); } public function testReopenedConditionResolutionRejectsChangedOrUnsettledPredecessors(): void @@ -980,7 +1002,15 @@ private function reopenedConditionSelectionHistory(HistoryEventType $resolutionT 'sequence' => 12, 'condition_wait_id' => 'condition-12', ]; - $resolution = $this->historyEvent($resolutionType, 4, $reopened, 'condition-resolution'); + $resolutionPayload = $reopened; + if ($resolutionType === HistoryEventType::TimerFired) { + unset($resolutionPayload['timeout_seconds']); + $resolutionPayload += [ + 'timer_kind' => 'condition_timeout', + 'timer_id' => 'condition-timeout-12', + ]; + } + $resolution = $this->historyEvent($resolutionType, 4, $resolutionPayload, 'condition-resolution'); $marker = $this->historyEvent(HistoryEventType::SelectionResolved, 5, [ 'selection_group_id' => 'select-calls:10:2', 'selection_group_base_sequence' => 10, From 71f31baabea53cb4f4d334c6291896987f88db3a Mon Sep 17 00:00:00 2001 From: Durable Workflow Date: Thu, 1 Oct 2026 17:32:58 +0000 Subject: [PATCH 6/6] Preserve the authored operation when a selection deadline fires --- composer.json | 2 +- src/V2/Jobs/RunTimerTask.php | 17 +++--- src/V2/Support/ParallelChildGroup.php | 8 ++- tests/Feature/V2/V2WorkflowTaskBridgeTest.php | 54 +++++++++++++++++++ 4 files changed, 68 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 52c46589..c5a98fb2 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,7 @@ "dev-main": "2.0.x-dev" }, "durable-workflow": { - "product-train": "2.3.1", + "product-train": "2.3.2", "laravel-embedded-upgrade-contract": "resources/laravel-embedded-upgrade-contract.json", "laravel-dependency-security-policy": "resources/laravel-dependency-security-policy.json" }, diff --git a/src/V2/Jobs/RunTimerTask.php b/src/V2/Jobs/RunTimerTask.php index 66aae958..388c4af1 100644 --- a/src/V2/Jobs/RunTimerTask.php +++ b/src/V2/Jobs/RunTimerTask.php @@ -195,17 +195,13 @@ public function handle(): void 'lease_expires_at' => null, ])->save(); + $operationKind = match (true) { + $conditionWaitId !== null => 'condition', + $signalWaitId !== null => 'signal', + default => 'timer', + }; if ($parallelMetadataPath !== []) { - ParallelChildGroup::claimSelectionWinner( - $run, - $parallelMetadataPath, - match (true) { - $conditionWaitId !== null => 'condition', - $signalWaitId !== null => 'signal', - default => 'timer', - }, - $firedEvent, - ); + ParallelChildGroup::claimSelectionWinner($run, $parallelMetadataPath, $operationKind, $firedEvent); } if ( @@ -214,6 +210,7 @@ public function handle(): void $run, $parallelMetadataPath, TimerStatus::Fired, + $operationKind, ) ) { $this->projectRun($run, self::PROJECTION_RUN_RELATIONS); diff --git a/src/V2/Support/ParallelChildGroup.php b/src/V2/Support/ParallelChildGroup.php index 4697b790..8951fbc9 100644 --- a/src/V2/Support/ParallelChildGroup.php +++ b/src/V2/Support/ParallelChildGroup.php @@ -289,13 +289,16 @@ public static function shouldWakeParentOnActivityClosure( public static function shouldWakeParentOnTimerClosure( WorkflowRun $parentRun, array $metadata, - TimerStatus $closedTimerStatus + TimerStatus $closedTimerStatus, + string $operationKind = 'timer', ): bool { return self::shouldWakeParentOnClosure( $parentRun, self::normalizedPath($metadata), 'timer', $closedTimerStatus, + false, + $operationKind, ); } @@ -633,6 +636,7 @@ private static function shouldWakeParentOnClosure( string $closedKind, ActivityStatus|RunStatus|TimerStatus $closedStatus, bool $lockHistoryForUpdate = false, + ?string $closedOperationKind = null, ): bool { $successful = ! ( ($closedKind === 'activity' && $closedStatus !== ActivityStatus::Completed) @@ -654,7 +658,7 @@ private static function shouldWakeParentOnClosure( $metadata, $closedKind, $closedStatus, - $nestedMember ? 'group' : $closedKind, + $nestedMember ? 'group' : ($closedOperationKind ?? $closedKind), $lockHistoryForUpdate, ); } diff --git a/tests/Feature/V2/V2WorkflowTaskBridgeTest.php b/tests/Feature/V2/V2WorkflowTaskBridgeTest.php index f370445b..3be5d6dd 100644 --- a/tests/Feature/V2/V2WorkflowTaskBridgeTest.php +++ b/tests/Feature/V2/V2WorkflowTaskBridgeTest.php @@ -7969,6 +7969,60 @@ public function testResolvedReopenedConditionSelectionSchedulesItsCanonicalRepla $this->assertSame('rust:condition-wait:0', $replayTask->payload['condition_wait_occurrence_id']); } + #[DataProvider('delayedSelectionWaitDeadlines')] + public function testDelayedWaitDeadlineWakesItsAuthoredSelection(string $kind, bool $reopen): void + { + Queue::fake(); + $run = $this->createWaitingRun(); + [$commands, $condition] = $this->groupedConditionCommands('select'); + $condition['timeout_seconds'] = 1; + if ($kind === 'signal') { + $path = $condition['parallel_group_path']; + $path[0]['selection_member_kind'] = 'signal'; + $condition = [ + 'type' => 'open_signal_wait', + 'signal_name' => 'approval', + 'timeout_seconds' => 1, + 'parallel_group_path' => $path, + ]; + $condition += $path[array_key_last($path)]; + } + $commands[1] = $condition; + $this->assertTrue($this->bridge->complete($this->createLeasedTask($run)->id, $commands)['completed']); + if ($reopen) { + $this->assertTrue( + $this->bridge->complete($this->groupedConditionSignalTask($run)->id, [$condition])['completed'] + ); + } + $timerTask = WorkflowTask::query()->where('workflow_run_id', $run->id) + ->where('task_type', TaskType::Timer->value)->where('status', TaskStatus::Ready->value)->get() + ->first(static fn (WorkflowTask $task): bool => isset($task->payload[$kind . '_wait_id'])); + $this->assertInstanceOf(WorkflowTask::class, $timerTask); + Carbon::setTestNow(now()->addSeconds(2)); + + (new RunTimerTask($timerTask->id))->handle(); + + $this->assertSame(TaskStatus::Completed, $timerTask->refresh()->status); + $winner = WorkflowHistoryEvent::query()->where('workflow_run_id', $run->id) + ->where('event_type', HistoryEventType::SelectionResolved->value)->sole(); + $this->assertSame($kind, $winner->payload['operation_kind']); + $this->assertSame('TimerFired', $winner->payload['resolution_event_type']); + $this->assertSame(1, WorkflowTask::query()->where('workflow_run_id', $run->id) + ->where('task_type', TaskType::Workflow->value)->where('status', TaskStatus::Ready->value)->count()); + } + + /** + * @return array + */ + public static function delayedSelectionWaitDeadlines(): array + { + return [ + 'condition' => ['condition', false], + 'reopened condition' => ['condition', true], + 'signal' => ['signal', false], + ]; + } + #[DataProvider('changedGroupedConditions')] public function testGroupedConditionReopenRejectsChangedRecordedIdentity(string $mode, string $change): void {