fix(db): preserve canvas validation and IFC schema gates

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: jm <jm@squareup.com>
This commit is contained in:
jm
2026-10-14 22:54:24 +00:00
parent 0f853f4d4a
commit a5fa63cfc4
2 changed files with 15 additions and 0 deletions

View File

@@ -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"

View File

@@ -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,