Skip to main content

qail_workflow_postgres/
lib.rs

1//! QAIL Flow Ledger.
2//!
3//! PostgreSQL storage backend for `qail-workflow`.
4//!
5//! This crate keeps application side effects in the app executor while backing
6//! workflow state, leases, operation idempotency, side-effect replay, and
7//! timeout discovery with PostgreSQL tables. All database operations are built
8//! as QAIL AST commands and executed through `qail-pg`; the crate does not use
9//! raw SQL execution paths.
10//!
11//! Default tables:
12//!
13//! - `qail_workflow_states`
14//! - `qail_workflow_leases`
15//! - `qail_workflow_operations`
16//! - `qail_workflow_side_effects`
17
18#![deny(warnings)]
19#![deny(clippy::all)]
20#![deny(unused_imports)]
21#![deny(dead_code)]
22
23mod executor;
24mod store;
25mod tables;
26mod util;
27
28pub use executor::PgWorkflowExecutor;
29pub use store::PgWorkflowStore;
30pub use tables::PgWorkflowTables;
31
32#[cfg(test)]
33mod tests {
34    #[test]
35    fn crate_does_not_call_raw_sql_execution_paths() {
36        let source = concat!(
37            include_str!("executor.rs"),
38            include_str!("store.rs"),
39            include_str!("tables.rs"),
40            include_str!("util.rs")
41        );
42        let forbidden = [concat!("execute", "_simple("), concat!("simple", "_query(")];
43
44        for needle in forbidden {
45            assert!(
46                !source.contains(needle),
47                "qail-workflow-postgres must use QAIL AST operations, found {needle}"
48            );
49        }
50    }
51}