#[test]
fn no_payload_carries_a_vector() {
const ALLOWED: &str = "embedding_model";
for trigger in macrame::schema::ddl::CREATE_TRIGGERS {
let scrubbed = trigger.replace(ALLOWED, "");
for needle in ["embedding", "vector", "F32_BLOB", "f32_blob"] {
assert!(
!scrubbed.contains(needle),
"a trigger payload references {needle:?}; Doctrine VII excludes \
embeddings from transaction_log. The only permitted exception is \
{ALLOWED:?}, which names a model rather than carrying a vector."
);
}
}
}
#[tokio::test]
async fn the_permitted_exception_is_still_a_scalar_column() {
let dir = tempfile::TempDir::new().unwrap();
let db = libsql::Builder::new_local(dir.path().join("t.db"))
.build()
.await
.unwrap();
let conn = db.connect().unwrap();
macrame::schema::migrations::run(&conn).await.unwrap();
let mut rows = conn.query("PRAGMA table_info(concepts)", ()).await.unwrap();
let mut found = None;
while let Some(row) = rows.next().await.unwrap() {
let name: String = row.get(1).unwrap();
if name == "embedding_model" {
found = Some(row.get::<String>(2).unwrap());
}
}
assert_eq!(
found.as_deref(),
Some("TEXT"),
"embedding_model must stay a scalar name, or Doctrine VII's carve-out \
in no_payload_carries_a_vector stops being sound"
);
}