Skip to content

feat!: suspend, signal and resumeDue; optimistic locking (v3.0.0) - #59

Merged
lam0819 merged 3 commits into
mainfrom
sync/v3
Nov 26, 2026
Merged

lam0819 merged 3 commits into
mainfrom
sync/v3

Conversation

@lam0819

@lam0819 lam0819 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Workflows can wait for people and time without holding a process, and two processes can no longer overwrite each other's progress. Breaking: see CHANGELOG.md and UPGRADE.md.

  • ActionResult::suspend($for, $resumeAt). WorkflowEngine::signal() finishes the waiting step and keeps its payload under steps.<id>, so transitions can branch on it. resumeDue() ends timed waits.
  • Optimistic locking: StorageAdapter::save() is a compare-and-swap on the instance revision and throws ConcurrentModificationException. InMemoryStorage keeps snapshots.
  • DelayAction suspends instead of usleep(). SIGALRM timeouts are opt-in (signalTimeouts: true), because they are unsafe in web requests and FrankenPHP/Octane workers.
  • New: WorkflowDefinition::fingerprint(), plus WorkflowSuspendedEvent and WorkflowResumedEvent.
  • PHPStan level 9 (was 6, no ignores). Malformed definitions and data are rejected with clear errors instead of being coerced; the list is in CHANGELOG.
  • 222 tests (was 161). New: tests/Unit/SuspendResumeTest.php and tests/Unit/MalformedInputTest.php.
  • The development-status warning is removed from the README.

Developed in forestops-platform (packages/workflow-engine-core, git subtree) and pushed back here with git subtree push. Please merge with a merge commit, not a squash, so later subtree syncs stay linear. Next: tag v3.0.0, then solutionforest/workflow-engine-laravel#17 (v2.0.0).

Local: Pint, PHPStan 9 and Pest pass.

solutionforest team added 3 commits November 26, 2026 07:42
…c locking; no blocking delays

A step returns ActionResult::suspend(for, resumeAt) to wait for a signal or a time without holding a process. WorkflowEngine::signal() finishes the waiting step (payload kept under steps.<id>), resumeDue() ends timed waits. Saves are compare-and-swap on a revision (ConcurrentModificationException). DelayAction suspends instead of usleep(). SIGALRM timeouts only with signalTimeouts: true. Instances record the definition fingerprint.
@lam0819
lam0819 merged commit e65da7b into main Nov 26, 2026
4 of 16 checks passed
@lam0819
lam0819 deleted the sync/v3 branch November 26, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant