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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ dw workflow:update order-123 approve --input='{"approver":"admin"}'
dw bridge:webhook stripe --action=start_workflow --idempotency-key=stripe-event-1001 --target='{"workflow_type":"orders.fulfillment","task_queue":"external-workflows","business_key":"order-1001"}' --input='{"order_id":"order-1001"}'
dw bridge:webhook pagerduty --action=signal_workflow --idempotency-key=pd-event-3003 --target='{"workflow_id":"wf-remediation-42","signal_name":"incident_escalated"}' --input='{"severity":"critical"}' --json

# Cancel a workflow (workflow code can observe and clean up)
# Close a workflow as cancelled (workflow code does not run cleanup)
dw workflow:cancel order-123 --reason="Customer request"
dw workflow:cancel --all-matching='customer-42' --yes --reason="Customer request"

Expand Down
11 changes: 6 additions & 5 deletions src/Commands/WorkflowCommand/CancelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ protected function configure(): void
{
parent::configure();
$this->setName('workflow:cancel')
->setDescription('Request cancellation of a workflow')
->setDescription('Close a workflow as cancelled')
->setHelp(<<<'HELP'
Request cooperative cancellation. The workflow receives a cancellation
signal and has a chance to run its cancellation handlers.
Close the workflow run as cancelled immediately. Open tasks and timers are
cancelled; workflow code does not resume to run cleanup. Arrange compensation
before this command or use external reconciliation.

<comment>Examples:</comment>

Expand Down Expand Up @@ -79,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return $this->renderJson($output, $result);
}

$output->writeln('<info>Cancellation requested</info>');
$output->writeln('<info>Workflow cancelled</info>');
$output->writeln(' Workflow ID: '.$result['workflow_id']);
$this->writeNamespaceLine($output, $result);
$output->writeln(' Outcome: '.$result['outcome']);
Expand Down Expand Up @@ -178,7 +179,7 @@ private function executeBatchCancel(InputInterface $input, OutputInterface $outp
return $this->renderBatchJson($output, $summary, $exitCode);
}

$output->writeln(sprintf('<info>Cancellation requested for %d workflow%s.</info>', count($results), count($results) === 1 ? '' : 's'));
$output->writeln(sprintf('<info>Cancelled %d workflow%s.</info>', count($results), count($results) === 1 ? '' : 's'));
$this->writeNamespaceLine($output, $summary);
$output->writeln(sprintf(' Matched: %d', count($matches)));
$output->writeln(sprintf(' Failed: %d', count($failures)));
Expand Down
2 changes: 1 addition & 1 deletion tests/Commands/WorkflowControlPlaneCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public function test_cancel_command_batch_cancels_matching_workflows_after_confi

$display = $tester->getDisplay();
self::assertStringContainsString('Cancel 2 workflows matching [customer-42]?', $display);
self::assertStringContainsString('Cancellation requested for 2 workflows.', $display);
self::assertStringContainsString('Cancelled 2 workflows.', $display);
self::assertStringContainsString('Matched: 2', $display);
self::assertStringContainsString('wf-1', $display);
self::assertStringContainsString('wf-2', $display);
Expand Down
Loading