feat(orch8): embeddable crate — durable execution as a Rust library#64
Merged
Conversation
New workspace member `orch8`: a curated pre-1.0 facade over orch8-engine/orch8-storage/orch8-types that embeds the durable workflow engine in any tokio application. - Engine::builder(): .storage(sqlite file / sqlite in-memory / postgres), .handler(name, async closure) on top of the server's built-in registry, .tick_interval(Duration), .tenant(..); build() opens storage, applies schema/migrations and runs crash recovery (mirrors server startup). - engine.start()/shutdown(): background tick loop on the HOST's runtime with CancellationToken + graceful drain; engine.tick_once() for manual-tick embedding. - Instance/sequence ops without HTTP: upsert_sequence (idempotent per name+version), create_instance (options struct with Default, including idempotency-key dedupe), get_instance, send_signal (terminal-state rejection + wake), list_instances. - Examples: quickstart (sqlite file, custom handler, templated 2-step run), kill_resistant (run twice — instance survives process exit), embedded_axum (shared engine behind HTTP endpoints). - Integration tests: background-loop completion, manual ticking, human-input signal wake, bounded graceful shutdown, facade CRUD semantics. Rustdoc with inline quickstart; doc warnings denied. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
The primary strategic bet from docs/FEATURE_OPPORTUNITIES.md (Bet A, 34/40):
cargo add orch8— durable execution as a library, the way SQLite is a database.publish = falsefor now): curated re-exports +Engine/EngineBuilder/Storage/CreateInstanceOptions/Error— internals stay free to churn behind it. Zero visibility changes were needed in internal crates — the engine was already embeddable.build()mirrors server startup (schema/migrations + stale-instance recovery);shutdown()cancels and drains;tick_once()supports manual-tick embedding for test harnesses.upsert_sequenceis create-or-get per (tenant, namespace, name, version) — versions stay immutable so running instances stay pinned.quickstart(sqlite + custom handler to completion),kill_resistant(run twice — the surviving instance resumes after process death),embedded_axum(HTTP service sharing the engine).Tests
6 passing in
orch8/tests+ doc-test: background-loop completion, manual tick, signal-gated wait + wake, bounded graceful shutdown, CRUD/idempotency semantics. fmt/clippy/doc/check gates clean workspace-wide.Caveats
shutdown()is terminal (documented); postgres wired but not CI-exercised (no PG harness in repo);list_instancesfixed newest-first/100 (minimal pre-1.0 surface).🤖 Generated with Claude Code