Problem/Motivation
The booking workflow starts while the order is still pending and modifiable; the order only freezes at the place step (pending to placed). So a branch variable derived from the order lines that is computed at workflow start is premature and can go stale if the order changes.
Today BookingWorkflowStarter reaches into the optional yoyaku_payment resolver to compute yoyaku_requires_payment at start, which is both a core-to-submodule coupling and a too-early computation. The n_prepare_cancel "Open cancellation window" node exists only to inject the cancellation variables at runtime, a bespoke node doing generic work. And since #3612964 added per-resource settlement, the example workflow still always routes to the manual attendance task and always runs the deposit branch, whether or not they apply.
Proposed resolution
Introduce a tagged-service seam, WorkflowVariableProvider, so a submodule contributes workflow variables computed from the order without any central code knowing about them.
Produce each variable once, at the step that can produce it cheaply and no later than its earliest consumer needs it:
- The payment step produces the payment variables (it already resolves the payable there), so payment routing, which runs before the place step, has them in time.
- The place step produces the order-shape variables once the order is final: the settlement mode and the cancellation window (absorbing n_prepare_cancel, which is then removed).
Downstream forks read the produced variables: gate the deposit fork on a positive deposit amount, the attendance flow on settlement being manual for every line (with a direct flow to the confirmed end otherwise), and the cancellation branch on self-cancellation being allowed. Mirror each condition on the join edge so the inclusive gateway and its quorum join stay balanced.
Remove the optional yoyaku_payment dependency from BookingWorkflowStarter.
Remaining tasks
- Add the provider seam and the producing steps.
- Move payment, settlement and cancellation variable production to providers.
- Gate the example workflow branches and remove n_prepare_cancel.
- Tests, documentation and French translations.
Issue fork yoyaku-3613003
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mably commentedComment #5
mably commentedComment #7
mably commented