mirror of
https://github.com/block/buzz.git
synced 2026-11-13 21:01:53 +00:00
fix(db): integrate delivery inbox into deletion and schema surfaces
Migration 0034 introduced workflow_agent_deliveries without wiring the four integration surfaces that pin new tenant tables: - schema.sql desired-state bootstrap lacked the workflow_agent_delivery_status enum the inline table definition uses, so desired-state apply failed with 'type does not exist'. - EXPECTED_SCOPED_TABLES / PURGE_SCOPED_TABLES omitted the table, so the deletion catalog inventory failed closed on 'unknown' drift (by design) across the deletion suite; purge order puts the delivery inbox before its workflow_runs/workflows/events parents. - The embedded-migrator count pin still said 33. - The 0029/schema.sql fence-parity test did not account for 0034 attaching the community write fence to the new table. Also restore the doc comment on KIND_WORKFLOW_DEF: the wake-kind constant was inserted between the comment and its item, leaving KIND_WORKFLOW_DEF undocumented and failing clippy -D missing-docs. Co-authored-by: Wakko <0999168a3b1a4dabdf398cf43ba2893bb29b74dc06d0b31c2d3b51dbebea1612@buzz.block.builderlab.xyz> Signed-off-by: Logan Johnson <loganj@squareup.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)`
|
||||
|
||||
Reference in New Issue
Block a user