Repository navigation
feat(processes): run a process after the change is saved - #234
Merged
artem-broccoli merged 4 commits intoNov 15, 2026
Merged
Conversation
An on_event trigger with run "after_commit" queues one pg-boss job per process and event inside the change's transaction. After the commit the job starts the runs of the version it carries, in its own transaction and under the process's lock, skipping a turned-off process, gone records, runs in progress and starts already taken, so retries start nothing twice. Jobs carry a hop count and stop after 10 hops.
artem-broccoli
deleted the
artem/bro-264-run-a-process-after-the-change-is-saved
branch
November 15, 2026 07:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A process can now run after the change that triggers it is saved, so slow steps or steps that reach outside systems never hold up or fail the save.
on_eventtrigger takes"run": "after_commit"(nofaultMode). Before the change commits, each matching after-commit process gets oneprocesses.startRunsAfterCommitjob per event, queued in the change's transaction: a rollback drops it, the commit makes it runnable.start_key). A retry or a second delivery starts nothing.tx.hop, set withtransact(work, { hop })). A job queued from a job's transaction is one hop further; none is queued past 10 hops, so after-commit processes that trigger each other stop.Testing
whenqueues nothing; a gone record, a turned-off process, a carried older version; a self-triggering process stops after 10 hops. Domain tests for the trigger shapes, a transaction test for the hop.pnpm dev: turned on an after-commit process onemployees.added, added a person and killed the API container straight away. The person was saved, one job waited (hop 1), no run existed. After restarting the API the job completed and started exactly one run with its task. A copy of the same job then completed and started nothing (already_startedlogged). A job with a broken version id failed three attempts and logged one error with its ids.pnpm check,pnpm test:integrationandpnpm test:e2epass.Release Notes: