Skip to content

feat(openworkflow): export the backend API and test suite - #893

Merged
jamescmartinez merged 8 commits into
openworkflowdev:mainfrom
cliftonc:backend-api
Dec 4, 2026
Merged

jamescmartinez merged 8 commits into
openworkflowdev:mainfrom
cliftonc:backend-api

Conversation

@cliftonc

Copy link
Copy Markdown
Contributor

Follow-up to #880

Summary

As discussed in #880, this exposes the Backend API and the backend test suite so backends can be maintained outside this repo. The Drizzle backend will live in a separate openworkflow-drizzle package that builds on both.

Changes

  • openworkflow/backend: the Backend interface and its param and result types, plus the helpers the built-in backends share for logic that doesn't depend on storage (computeFailedWorkflowRunUpdate, prepareWorkflowRerun, resolveCancelWorkflowRunConflict, nextScheduleOccurrence, isTerminalStatus, the cursor/pagination helpers, toWorkflowRunCounts, requireRow, wrapError). It only re-exports what the SQLite and Postgres backends already import from core/.
  • openworkflow/testing: testBackend() and TestBackendOptions. files re-includes dist/testing/backend.testsuite.* and dist/testing/schedules.testsuite.*, and vitest becomes an optional peer dependency.
  • A Custom Backends docs page under Backends that covers the interface, the helpers, and running testBackend. It says the backend API is experimental before 1.0 and may change in a minor release, so backends should pin the OpenWorkflow versions they support.

I added /backend as a new subpath instead of adding to openworkflow/internal, since internal is what the CLI and dashboard use and isn't documented. Happy to fold it into internal if you'd prefer.

The two exports are separate commits if you'd like to take only one.

Tested by packing the tarball into a scratch project, typechecking imports from openworkflow/backend, and running testBackend from openworkflow/testing against BackendSqlite (86 tests pass). npm run ci checks pass locally.

Add a documented subpath for people writing their own `Backend`. It exports
the `Backend` interface and its param and result types, plus the helpers the
built-in backends share for the rules that don't depend on storage: retry on
failure, rerun, cancel conflicts, schedule occurrences, pagination, and row
and error checks. A custom backend that uses them behaves the same way as the
SQLite and Postgres backends.

`openworkflow/internal` stays as it is for the CLI and dashboard. The new docs
page marks the backend API as experimental before 1.0, so backends should pin
the OpenWorkflow versions they support.
…ting

Publish `testBackend()`, the suite the SQLite and Postgres backends run, so
people can check a custom `Backend` against the same tests. Vitest becomes an
optional peer dependency.
@pkg-pr-new

pkg-pr-new Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/openworkflowdev/openworkflow/@openworkflow/cli@893
npm i https://pkg.pr.new/openworkflowdev/openworkflow/@openworkflow/dashboard@893
npm i https://pkg.pr.new/openworkflowdev/openworkflow@893

commit: 1e44157

@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Exposes the backend contract, shared helpers, and test suite for custom backends.

  • Custom backends can use OpenWorkflow’s public contract and shared workflow rules.
  • Custom backends can run the shared backend test suite through OpenWorkflow.

Reviews (4) · Last reviewed commit: "fix(openworkflow): restore the terminal ..." · Reviewed by Greptile

Comment thread apps/docs/docs/custom-backends.mdx Resolved
@cliftonc

Copy link
Copy Markdown
Contributor Author

Morning; is there more you need from me before we might be able to merge this?

@jamescmartinez

Copy link
Copy Markdown
Contributor

ahh, this was buried in my notifications, apologies. I'll get this merged today. @cliftonc

@jamescmartinez
jamescmartinez merged commit 337aa11 into openworkflowdev:main Dec 4, 2026
8 checks passed
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.

2 participants