Skip to content

feat(bundle): debug:durable lists the workflows and their handlers - #1046

Merged
gplanchat merged 7 commits into
mainfrom
feat/debug-durable
Oct 15, 2026
Merged

gplanchat merged 7 commits into
mainfrom
feat/debug-durable

Conversation

@gplanchat

Copy link
Copy Markdown
Owner

To read a workflow today you open the class and look for the attributes. debug:messenger and debug:event-dispatcher answer the same question for their component; Durable has no equivalent.

debug:durable lists the registered workflows:

$ bin/console debug:durable
 ---------- ------------------------------ ------------------------------------------
  Type       Class                          Entry point
 ---------- ------------------------------ ------------------------------------------
  shipping   App\Workflow\ShippingWorkflow  ship(string $orderId, int $parcels = …): array

(An illustration of the shape, not captured output.) With a type or a class, it shows the entry point and each handler by the name a caller sends: parcel.picked for a signal, status for a query, change-address for an update, with the method and its parameter types.

What is in the diff

  • WorkflowDescriber, WorkflowDescription and WorkflowHandler (new, Gplanchat\Durable\Workflow): a workflow class read into readonly objects, with the lookups WorkflowDefinitionLoader uses (inputParameters() for the entry point, so the environment and activity stubs do not appear). A class with no #[AsWorkflowMethod] raises WorkflowHasNoEntryPoint.
  • DebugDurableCommand takes the list of workflow classes as its only argument.
  • WorkflowPass fills that argument with the classes it already registers, so the command lists what the registry holds.
  • The container snapshot gains the command's line; WorkflowPassTest covers the argument.
  • The package page, English and French.

Tests: WorkflowDescriberTest and DebugDurableCommandTest are the first commit and fail until the next two.

Checked on this branch: the whole unit suite (3339 tests), PHPStan on the repository (exit 0), Psalm (exit 0, no baseline entry), php-cs-fixer on each changed file.

Not covered

  • Activities are not listed yet: a workflow declares them by #[Activities(Contract::class)] on a parameter, and the contract's methods deserve their own section. That is the next slice.
  • No --format=json and no backend or task-queue summary yet.
  • I did not run the command in a real application; the container wiring is covered by the snapshot and WorkflowPassTest.
  • The command reads attributes on every call and caches nothing. A warmer like ActivityContractCacheWarmer can come if the cost shows.

This adds a public command, so it needs a second reviewer before the gate.

@gplanchat gplanchat added enhancement New feature or request bundle src/DurableBundle labels Oct 12, 2026
# Conflicts:
#	tests/unit/DurableBundle/DependencyInjection/Fixtures/container-snapshot.txt
@gplanchat
gplanchat merged commit c082782 into main Oct 15, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bundle src/DurableBundle enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant