From a5fa63cfc48735a799147f2e39522260e6fecc90 Mon Sep 17 00:00:00 2001 From: jm Date: Wed, 14 Oct 2026 22:54:24 +0000 Subject: [PATCH] fix(db): preserve canvas validation and IFC schema gates Co-authored-by: Codex Signed-off-by: jm --- crates/buzz-db/src/runtime/migration.rs | 9 +++++++++ crates/buzz-db/src/store/event.rs | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/crates/buzz-db/src/runtime/migration.rs b/crates/buzz-db/src/runtime/migration.rs index a525e130d8..e6050109af 100644 --- a/crates/buzz-db/src/runtime/migration.rs +++ b/crates/buzz-db/src/runtime/migration.rs @@ -2292,6 +2292,15 @@ mod postgres_tests { } expected_fences.extend(personal.fence_attachments); expected_fences.extend(["artifact_heads", "artifact_revisions"].map(str::to_owned)); + let ifc = surface( + MIGRATOR + .iter() + .find(|m| m.version == 62) + .expect("IFC policy migration") + .sql + .as_ref(), + ); + expected_fences.extend(ifc.fence_attachments); assert_eq!( expected_fences, schema.fence_attachments, "write-fence attachment targets differ after recovery policy" diff --git a/crates/buzz-db/src/store/event.rs b/crates/buzz-db/src/store/event.rs index 00b1266c64..636f64cb6d 100644 --- a/crates/buzz-db/src/store/event.rs +++ b/crates/buzz-db/src/store/event.rs @@ -2096,6 +2096,12 @@ pub async fn insert_canvas_head_checked( channel_id: Uuid, precondition: ChannelHeadPrecondition<'_>, ) -> Result<(StoredEvent, ChannelHeadWriteStatus)> { + let kind_i32 = buzz_core::kind::event_kind_i32(event); + if kind_i32 != KIND_CANVAS as i32 { + return Err(DbError::InvalidData(format!( + "insert_canvas_head_checked requires kind {KIND_CANVAS}, got {kind_i32}" + ))); + } let mut tx = crate::begin_community_event_write_transaction( pool, community_id,