diff --git a/crates/buzz-core/src/kind.rs b/crates/buzz-core/src/kind.rs index 06fc320ac0..578ad6ded5 100644 --- a/crates/buzz-core/src/kind.rs +++ b/crates/buzz-core/src/kind.rs @@ -443,10 +443,10 @@ pub const KIND_THREAD_SUMMARY: u32 = 39005; /// clients must not infer `has_more` from row counts. pub const KIND_WINDOW_BOUNDS: u32 = 39006; -/// Workflow definition (parameterized replaceable, d=workflow_uuid). /// Ephemeral, relay-authored hint that a durable workflow delivery is ready. pub const KIND_WORKFLOW_AGENT_WAKE: u32 = 24620; +/// Workflow definition (parameterized replaceable, d=workflow_uuid). pub const KIND_WORKFLOW_DEF: u32 = 30620; /// NIP-DV: per-viewer DM visibility snapshot (relay-signed, parameterized diff --git a/crates/buzz-db/src/deletion.rs b/crates/buzz-db/src/deletion.rs index fbe69f22a6..60f518bffc 100644 --- a/crates/buzz-db/src/deletion.rs +++ b/crates/buzz-db/src/deletion.rs @@ -79,6 +79,7 @@ pub const EXPECTED_SCOPED_TABLES: &[&str] = &[ "subscriptions", "thread_metadata", "users", + "workflow_agent_deliveries", "workflow_approvals", "workflow_runs", "workflows", @@ -86,6 +87,7 @@ pub const EXPECTED_SCOPED_TABLES: &[&str] = &[ /// Foreign-key-safe child-before-parent order for the PostgreSQL purge. pub const PURGE_SCOPED_TABLES: &[&str] = &[ + "workflow_agent_deliveries", "workflow_approvals", "scheduled_workflow_fires", "workflow_runs", diff --git a/crates/buzz-db/src/migration.rs b/crates/buzz-db/src/migration.rs index 80be5328d3..c37006d061 100644 --- a/crates/buzz-db/src/migration.rs +++ b/crates/buzz-db/src/migration.rs @@ -640,7 +640,7 @@ mod tests { let mut migrations: Vec<_> = MIGRATOR.iter().collect(); migrations.sort_by_key(|migration| migration.version); - assert_eq!(migrations.len(), 33); + assert_eq!(migrations.len(), 34); assert_eq!(migrations[0].version, 1); assert_eq!(&*migrations[0].description, "initial schema"); assert!(migrations[0] @@ -1549,6 +1549,10 @@ mod tests { let mut expected_fences = migration.fence_attachments.clone(); expected_fences.remove("product_feedback"); expected_fences.remove("rate_limit_violations"); + // Migration 0034 attaches the fence to the durable managed-agent + // delivery inbox after 0029; the desired-state schema carries it + // inline. + expected_fences.insert("workflow_agent_deliveries".to_owned()); assert_eq!( expected_fences, schema.fence_attachments, "write-fence attachment targets differ after recovery policy" diff --git a/schema/schema.sql b/schema/schema.sql index 2eab7e137a..69d3173af3 100644 --- a/schema/schema.sql +++ b/schema/schema.sql @@ -35,6 +35,7 @@ CREATE TYPE delivery_method AS ENUM ('webhook', 'websocket'); CREATE TYPE subscription_status AS ENUM ('active', 'paused', 'deleted'); CREATE TYPE pause_reason AS ENUM ('user', 'system', 'rate_limit'); CREATE TYPE channel_add_policy AS ENUM ('anyone', 'owner_only', 'nobody'); +CREATE TYPE workflow_agent_delivery_status AS ENUM ('pending', 'claimed'); -- ── Communities ─────────────────────────────────────────────────────────────── -- Conformance: row zero (host binding). The host map. `resolve_host(host)`