Skip to content

Commit 73851bd

Browse files
durable-workflow.github.io: update v2 changes
1 parent 1489ec4 commit 73851bd

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

docs/configuration/microservices.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ Like the activity task HTTP surface, these routes are the same first bridge expo
527527

528528
## Control Plane
529529

530-
A control-plane contract is exposed through `Workflow\V2\Contracts\WorkflowControlPlane`, registered as a singleton in the container. This contract lets a standalone server or external adapter start, signal, query, update, cancel, and terminate workflows using **durable type keys** instead of requiring local PHP class resolution.
530+
A control-plane contract is exposed through `Workflow\V2\Contracts\WorkflowControlPlane`, registered as a singleton in the container. This contract lets a standalone server or external adapter start, signal, query, update, cancel, terminate, repair, and archive workflows using **durable type keys** instead of requiring local PHP class resolution.
531531

532532
This is the key difference from `WorkflowStub::make()` and `WorkflowStub::load()`: the control plane accepts workflow type strings and instance ids directly, so a server process that does not have the workflow PHP classes installed can still drive the full workflow lifecycle. Workers that do have the classes pick up the actual replay work through the task bridges.
533533

@@ -627,6 +627,36 @@ $result = $controlPlane->terminate('order-12345', [
627627

628628
Both return `accepted` (bool), `workflow_instance_id`, `workflow_command_id`, and `reason` (on rejection). Rejection reasons include `instance_not_found`, `instance_not_started`, and `run_not_active`.
629629

630+
### Repairing a workflow
631+
632+
`repair()` requests a repair of the current workflow run. Repair re-projects the run summary, detects liveness issues, and creates a new workflow task when the run is in a repairable state. Only open runs on the current instance may be repaired:
633+
634+
```php
635+
$result = $controlPlane->repair('order-12345');
636+
637+
if ($result['accepted']) {
638+
// Repair was accepted and a new task was created
639+
}
640+
```
641+
642+
Rejection reasons include `instance_not_found`, `instance_not_started`, and `run_not_active` (run is already closed).
643+
644+
### Archiving a workflow
645+
646+
`archive()` marks a terminal workflow run as archived. Archived runs are excluded from active fleet views and may be eligible for cold storage or cleanup. Only closed (completed, failed, cancelled, terminated) runs may be archived:
647+
648+
```php
649+
$result = $controlPlane->archive('order-12345', [
650+
'reason' => 'Retention period expired',
651+
]);
652+
653+
if ($result['accepted']) {
654+
// Run is now archived
655+
}
656+
```
657+
658+
Archiving an already-archived run returns `accepted` with an `archive_not_needed` outcome. Rejection reasons include `instance_not_found`, `instance_not_started`, and `run_not_closed`.
659+
630660
### Describing a workflow
631661

632662
`describe()` returns the current state of a workflow instance without loading the full Waterline detail view. This is the recommended path for server APIs, CLI tools, and operator dashboards that need workflow state without the overhead of the full projection tree:
@@ -659,6 +689,8 @@ if ($result['found']) {
659689
$result['actions']['can_update']; // true (false for remote-only or non-current runs)
660690
$result['actions']['can_cancel']; // true
661691
$result['actions']['can_terminate']; // true
692+
$result['actions']['can_repair']; // true (false for closed runs or non-current runs)
693+
$result['actions']['can_archive']; // false (true only for terminal runs not yet archived)
662694
}
663695
```
664696

@@ -670,7 +702,7 @@ $result = $controlPlane->describe('order-12345', [
670702
]);
671703
```
672704

673-
Action availability reflects whether the operation can succeed right now: closed runs cannot accept commands, remote-only workflows cannot serve queries or updates locally, and non-current runs cannot receive signals, updates, cancellations, or terminations.
705+
Action availability reflects whether the operation can succeed right now: closed runs cannot accept commands, remote-only workflows cannot serve queries or updates locally, non-current runs cannot receive signals, updates, cancellations, terminations, or repairs, and only terminal runs that have not already been archived are eligible for archival.
674706

675707
### Contract and customization
676708

docs/failures-and-recovery.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ The category is determined automatically when the failure is recorded:
9696
- Infrastructure exceptions (database/PDO errors, queue max-attempts exceeded) classify as `internal`.
9797
- Timeout-indicating exceptions (messages containing "timed out", "timeout exceeded", "execution deadline", or "run deadline") classify as `timeout`.
9898
- All other business-logic exceptions default to `application`.
99+
- External worker failures (submitted through the workflow task bridge HTTP protocol) use the same classification rules based on the exception class name and message strings, even though the original throwable is not available in the host process.
99100

100101
### Workflow Timeout Enforcement
101102

0 commit comments

Comments
 (0)