From daeb59877b075c2344a7c86c94a25c0a4ba828bf Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Fri, 21 Aug 2026 21:20:57 -0700 Subject: [PATCH] fix(push): align fresh database message matching Signed-off-by: Tom Brow Co-authored-by: Codex Ai-assisted: true --- crates/buzz-db/src/migration.rs | 4 ++++ crates/buzz-relay/src/handlers/push_lease.rs | 2 +- schema/schema.sql | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/buzz-db/src/migration.rs b/crates/buzz-db/src/migration.rs index c584f00e12..2afc418010 100644 --- a/crates/buzz-db/src/migration.rs +++ b/crates/buzz-db/src/migration.rs @@ -1115,6 +1115,10 @@ mod tests { assert!(sql.contains("CREATE OR REPLACE FUNCTION enqueue_push_match_job")); assert!(sql.contains("NEW.kind IN (9, 40002, 45001, 45003)")); assert!(!sql.contains("NEW.kind IN (7, 9, 1059, 40007, 46010)")); + + let desired_schema = include_str!("../../../schema/schema.sql"); + assert!(desired_schema.contains("NEW.kind IN (9, 40002, 45001, 45003)")); + assert!(!desired_schema.contains("NEW.kind IN (7, 9, 1059, 40007, 46010)")); } #[test] diff --git a/crates/buzz-relay/src/handlers/push_lease.rs b/crates/buzz-relay/src/handlers/push_lease.rs index f858611dff..d3e0188dbb 100644 --- a/crates/buzz-relay/src/handlers/push_lease.rs +++ b/crates/buzz-relay/src/handlers/push_lease.rs @@ -709,7 +709,7 @@ mod tests { .collect::>() .join(", "); let predicate = format!("NEW.kind IN ({kinds})"); - let migration = include_str!("../../../../migrations/0032_push_message_kinds.sql"); + let migration = include_str!("../../../../migrations/0033_push_message_kinds.sql"); assert!( migration.contains(&predicate), "migration trigger must use PUSH_KINDS exactly: {predicate}" diff --git a/schema/schema.sql b/schema/schema.sql index 6e14e6be1b..66208bdc0f 100644 --- a/schema/schema.sql +++ b/schema/schema.sql @@ -920,7 +920,7 @@ BEGIN -- Keep this allowlist identical to the relay's validated NIP-PL descriptor. -- Centralizing it on the events table covers every durable producer, -- including internal paths that bypass live dispatch. - IF NEW.kind IN (7, 9, 1059, 40007, 46010) THEN + IF NEW.kind IN (9, 40002, 45001, 45003) THEN PERFORM pg_advisory_xact_lock_shared( hashtextextended('buzz_push_gate:' || NEW.community_id::text, 0)); IF EXISTS (