Commit 2d3c6bf
docs(adr): revise ADR-0037 after code + industry self-review
Self-review against the actual engine (flat shared variable Map; suspend = a
thrown FlowSuspendSignal unwinding the stack; runRegion bans region pause;
traverseNext already fans out unconditional edges via Promise.all) and against
Camunda/Zeebe/Flowable/Step Functions found the first draft adopted the token
tree as a data structure while missing the execution model that makes it work:
- recursion + throw-to-suspend must become an explicit token scheduler (a
thrown exception cannot pause branch A while branch B keeps running);
- the flat shared variable Map must become hierarchical scope variables (read
up the tree) — NOT the copy-on-write/merge scheme the first draft invented,
which no major engine uses;
- sibling token resumes must serialize per run (Camunda's per-instance
optimistic locking) — so the concurrency is logical, not parallel execution.
Given that true cost, the revision splits the decision into two tracks and
recommends Track A first:
- Track A (now, no engine-core change): multi-instance / aggregating nodes —
parallel approvals as one `approval` node aggregating N decisions, batch
approvals as a `map` node. Camunda multi-instance / Step Functions Map shape.
- Track B (deferred, recorded): the general token/scope tree + scheduler +
hierarchical scoping, started only when a flow needs arbitrary-position
concurrent pause that multi-instance can't express.
Keeps the correct parts (reject Temporal replay per ADR-0018 open registry;
authoring model + DAG invariant preserved; single-token = back-compat anchor).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 8deaccc commit 2d3c6bf
1 file changed
Lines changed: 199 additions & 209 deletions
0 commit comments