Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(search): add task subtype to opensearch (#2183)
gbirmanabb324eaf90a
diff --git a/infra/stacks/opensearch/helpers/scripts/create_indices.ts b/infra/stacks/opensearch/helpers/scripts/create_indices.tsindex f61d3838a4..468e214224 100644--- a/infra/stacks/opensearch/helpers/scripts/create_indices.ts+++ b/infra/stacks/opensearch/helpers/scripts/create_indices.ts@@ -141,6 +141,11 @@ async function createDocumentIndex(opensearchClient: Client) {index: false,doc_values: true,},+ sub_type: {+ type: 'keyword',+ index: true,+ doc_values: true,+ },},},},diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex afb174773c..d893fc7ac4 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -8741,6 +8741,7 @@ dependencies = ["axum","chrono","comms_db_client",+ "document_sub_type","email_db_client","futures","http-body-util",diff --git a/rust/cloud-storage/document_storage_service/src/bin/backfill_search.rs b/rust/cloud-storage/document_storage_service/src/bin/backfill_search.rsindex 127f59bc3b..05eb319f36 100644--- a/rust/cloud-storage/document_storage_service/src/bin/backfill_search.rs+++ b/rust/cloud-storage/document_storage_service/src/bin/backfill_search.rs@@ -3,6 +3,7 @@/// - DATABASE_URL/// - SEARCH_EVENT_QUEUEuse anyhow::Context;+use chrono::{DateTime, Utc};use clap::Parser;use macro_entrypoint::MacroEntrypoint;use model::document::FileType;@@ -13,6 +14,15 @@ struct Args {/// Comma separated list of file types to process#[arg(long = "file_types", short = 'f')]file_types: Option<String>,+ /// Filter to only documents with this sub type (e.g. "task")+ #[arg(long = "sub_type", short = 's')]+ sub_type: Option<String>,+ /// Only include documents created after this time (ISO 8601, e.g. "2026-03-24T00:00:00Z")+ #[arg(long = "created_after")]+ created_after: Option<DateTime<Utc>>,+ /// Only include documents created before this time (ISO 8601, e.g. "2026-03-25T00:00:00Z")+ #[arg(long = "created_before")]+ created_before: Option<DateTime<Utc>>,}#[tokio::main]@@ -24,8 +34,13 @@ async fn main() -> anyhow::Result<()> {let file_types: Option<Vec<String>> = args.file_types.map(|s| s.split(',').map(|s| s.to_string()).collect());+ let sub_type = args.sub_type;+ let created_after = args.created_after;+ let created_before = args.created_before;- println!("Starting backfill_search with {file_types:?}");+ println!(+ "Starting backfill_search with file_types={file_types:?} sub_type={sub_type:?} created_after={created_after:?} created_before={created_before:?}"+ );let database_url = std::env::var("DATABASE_URL").context("DATABASE_URL not set")?;let db = PgPoolOptions::new()@@ -53,6 +68,9 @@ async fn main() -> anyhow::Result<()> {limit,offset,&file_types,+ &sub_type,+ &created_after,+ &created_before,).await.context("Failed to get documents")?;@@ -62,6 +80,9 @@ async fn main() -> anyhow::Result<()> {break;}+ let first_created = documents.first().and_then(|d| d.created_at);+ let last_created = documents.last().and_then(|d| d.created_at);+total += documents.len();sqs_client@@ -79,7 +100,12 @@ async fn main() -> anyhow::Result<()> {).await?;- println!("completed offset {offset} documents");+ println!(+ "completed batch: offset={offset} count={} created_at=[{} .. {}]",+ documents.len(),+ first_created.map_or("N/A".to_string(), |t| t.to_rfc3339()),+ last_created.map_or("N/A".to_string(), |t| t.to_rfc3339()),+ );offset += limit;}diff --git a/rust/cloud-storage/macro_db_client/.sqlx/query-0977b687594b92e6637fff17b6bf4c14b115a7329a678b647755c0d67e5a40e4.json b/rust/cloud-storage/macro_db_client/.sqlx/query-0977b687594b92e6637fff17b6bf4c14b115a7329a678b647755c0d67e5a40e4.jsondeleted file mode 100644index 8e811044bc..0000000000--- a/rust/cloud-storage/macro_db_client/.sqlx/query-0977b687594b92e6637fff17b6bf4c14b115a7329a678b647755c0d67e5a40e4.json+++ /dev/null@@ -1,41 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n d.id as document_id,\n d.owner as owner,\n d.\"fileType\" as \"file_type!\",\n COALESCE(db.id, di.id, dipdf.id) as \"document_version_id!\"\n FROM\n \"Document\" d\n LEFT JOIN LATERAL (\n SELECT\n b.id\n FROM\n \"DocumentBom\" b\n WHERE\n b.\"documentId\" = d.id\n ORDER BY\n b.\"createdAt\" DESC\n LIMIT 1\n ) db ON d.\"fileType\" = 'docx'\n LEFT JOIN LATERAL (\n SELECT\n i.id\n FROM\n \"DocumentInstance\" i\n WHERE\n i.\"documentId\" = d.id\n ORDER BY\n i.\"updatedAt\" ASC\n LIMIT 1\n ) dipdf ON d.\"fileType\" = 'pdf'\n LEFT JOIN LATERAL (\n SELECT\n i.id\n FROM\n \"DocumentInstance\" i\n WHERE\n i.\"documentId\" = d.id\n ORDER BY\n i.\"createdAt\" DESC\n LIMIT 1\n ) di ON d.\"fileType\" IS DISTINCT FROM 'docx' AND d.\"fileType\" IS DISTINCT FROM 'pdf'\n WHERE\n d.\"deletedAt\" IS NULL AND d.\"fileType\" IS NOT NULL\n ORDER BY d.\"updatedAt\" DESC\n LIMIT $1 OFFSET $2\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "document_id",- "type_info": "Text"- },- {- "ordinal": 1,- "name": "owner",- "type_info": "Text"- },- {- "ordinal": 2,- "name": "file_type!",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "document_version_id!",- "type_info": "Int8"- }- ],- "parameters": {- "Left": [- "Int8",- "Int8"- ]- },- "nullable": [- false,- false,- true,- null- ]- },- "hash": "0977b687594b92e6637fff17b6bf4c14b115a7329a678b647755c0d67e5a40e4"-}diff --git a/rust/cloud-storage/macro_db_client/.sqlx/query-594e0e7bd80d920c3d37e6739f7a01623ab9cde30224640c159eec0a7ba7d52b.json b/rust/cloud-storage/macro_db_client/.sqlx/query-594e0e7bd80d920c3d37e6739f7a01623ab9cde30224640c159eec0a7ba7d52b.jsondeleted file mode 100644index 8de4bf9345..0000000000--- a/rust/cloud-storage/macro_db_client/.sqlx/query-594e0e7bd80d920c3d37e6739f7a01623ab9cde30224640c159eec0a7ba7d52b.json+++ /dev/null@@ -1,42 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n d.id as document_id,\n d.owner as owner,\n d.\"fileType\" as \"file_type!\",\n COALESCE(db.id, di.id, dipdf.id) as \"document_version_id!\"\n FROM\n \"Document\" d\n LEFT JOIN LATERAL (\n SELECT\n b.id\n FROM\n \"DocumentBom\" b\n WHERE\n b.\"documentId\" = d.id\n ORDER BY\n b.\"createdAt\" DESC\n LIMIT 1\n ) db ON d.\"fileType\" = 'docx'\n LEFT JOIN LATERAL (\n SELECT\n i.id\n FROM\n \"DocumentInstance\" i\n WHERE\n i.\"documentId\" = d.id\n ORDER BY\n i.\"updatedAt\" ASC\n LIMIT 1\n ) dipdf ON d.\"fileType\" = 'pdf'\n LEFT JOIN LATERAL (\n SELECT\n i.id\n FROM\n \"DocumentInstance\" i\n WHERE\n i.\"documentId\" = d.id\n ORDER BY\n i.\"createdAt\" DESC\n LIMIT 1\n ) di ON d.\"fileType\" IS DISTINCT FROM 'docx' AND d.\"fileType\" IS DISTINCT FROM 'pdf'\n WHERE\n d.\"deletedAt\" IS NULL AND d.\"fileType\" = ANY($3)\n ORDER BY d.\"updatedAt\" DESC\n LIMIT $1 OFFSET $2\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "document_id",- "type_info": "Text"- },- {- "ordinal": 1,- "name": "owner",- "type_info": "Text"- },- {- "ordinal": 2,- "name": "file_type!",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "document_version_id!",- "type_info": "Int8"- }- ],- "parameters": {- "Left": [- "Int8",- "Int8",- "TextArray"- ]- },- "nullable": [- false,- false,- true,- null- ]- },- "hash": "594e0e7bd80d920c3d37e6739f7a01623ab9cde30224640c159eec0a7ba7d52b"-}diff --git a/rust/cloud-storage/macro_db_client/.sqlx/query-929e8e21a0b181340c4d74adbb26e14ec0c63b5f7da47d260f84eb0cfb15c575.json b/rust/cloud-storage/macro_db_client/.sqlx/query-929e8e21a0b181340c4d74adbb26e14ec0c63b5f7da47d260f84eb0cfb15c575.jsonnew file mode 100644index 0000000000..352ba12ced--- /dev/null+++ b/rust/cloud-storage/macro_db_client/.sqlx/query-929e8e21a0b181340c4d74adbb26e14ec0c63b5f7da47d260f84eb0cfb15c575.json@@ -0,0 +1,51 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n d.id as document_id,\n d.owner as owner,\n d.\"fileType\" as \"file_type!\",\n COALESCE(db.id, di.id, dipdf.id) as \"document_version_id!\",\n d.\"createdAt\"::timestamptz as \"created_at\"\n FROM\n \"Document\" d\n LEFT JOIN document_sub_type dst ON dst.document_id = d.id\n LEFT JOIN LATERAL (\n SELECT\n b.id\n FROM\n \"DocumentBom\" b\n WHERE\n b.\"documentId\" = d.id\n ORDER BY\n b.\"createdAt\" DESC\n LIMIT 1\n ) db ON d.\"fileType\" = 'docx'\n LEFT JOIN LATERAL (\n SELECT\n i.id\n FROM\n \"DocumentInstance\" i\n WHERE\n i.\"documentId\" = d.id\n ORDER BY\n i.\"updatedAt\" ASC\n LIMIT 1\n ) dipdf ON d.\"fileType\" = 'pdf'\n LEFT JOIN LATERAL (\n SELECT\n i.id\n FROM\n \"DocumentInstance\" i\n WHERE\n i.\"documentId\" = d.id\n ORDER BY\n i.\"createdAt\" DESC\n LIMIT 1\n ) di ON d.\"fileType\" IS DISTINCT FROM 'docx' AND d.\"fileType\" IS DISTINCT FROM 'pdf'\n WHERE\n d.\"deletedAt\" IS NULL\n AND d.\"fileType\" IS NOT NULL\n AND ($3::text[] IS NULL OR d.\"fileType\" = ANY($3))\n AND ($4::text IS NULL OR dst.sub_type::text = $4)\n AND ($5::timestamptz IS NULL OR d.\"createdAt\" >= $5)\n AND ($6::timestamptz IS NULL OR d.\"createdAt\" < $6)\n ORDER BY d.\"createdAt\" ASC, d.id ASC\n LIMIT $1 OFFSET $2\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "document_id",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "owner",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "file_type!",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "document_version_id!",+ "type_info": "Int8"+ },+ {+ "ordinal": 4,+ "name": "created_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Int8",+ "Int8",+ "TextArray",+ "Text",+ "Timestamptz",+ "Timestamptz"+ ]+ },+ "nullable": [+ false,+ false,+ true,+ null,+ null+ ]+ },+ "hash": "929e8e21a0b181340c4d74adbb26e14ec0c63b5f7da47d260f84eb0cfb15c575"+}diff --git a/rust/cloud-storage/macro_db_client/src/document/get_documents_search.rs b/rust/cloud-storage/macro_db_client/src/document/get_documents_search.rsindex b0e0ef80b1..f0caf969a9 100644--- a/rust/cloud-storage/macro_db_client/src/document/get_documents_search.rs+++ b/rust/cloud-storage/macro_db_client/src/document/get_documents_search.rs@@ -1,5 +1,6 @@use std::str::FromStr;+use chrono::{DateTime, Utc};use sqlx::{Pool, Postgres};use model::document::{BackfillSearchDocumentInformation, FileType};@@ -13,141 +14,87 @@ pub async fn get_documents_for_search(limit: i64,offset: i64,file_types: &Option<Vec<String>>,+ sub_type: &Option<String>,+ created_after: &Option<DateTime<Utc>>,+ created_before: &Option<DateTime<Utc>>,) -> anyhow::Result<Vec<BackfillSearchDocumentInformation>> {- let result = if let Some(file_types) = file_types {- sqlx::query!(- r#"+ let result = sqlx::query!(+ r#"+ SELECT+ d.id as document_id,+ d.owner as owner,+ d."fileType" as "file_type!",+ COALESCE(db.id, di.id, dipdf.id) as "document_version_id!",+ d."createdAt"::timestamptz as "created_at"+ FROM+ "Document" d+ LEFT JOIN document_sub_type dst ON dst.document_id = d.id+ LEFT JOIN LATERAL (SELECT- d.id as document_id,- d.owner as owner,- d."fileType" as "file_type!",- COALESCE(db.id, di.id, dipdf.id) as "document_version_id!"+ b.idFROM- "Document" d- LEFT JOIN LATERAL (- SELECT- b.id- FROM- "DocumentBom" b- WHERE- b."documentId" = d.id- ORDER BY- b."createdAt" DESC- LIMIT 1- ) db ON d."fileType" = 'docx'- LEFT JOIN LATERAL (- SELECT- i.id- FROM- "DocumentInstance" i- WHERE- i."documentId" = d.id- ORDER BY- i."updatedAt" ASC- LIMIT 1- ) dipdf ON d."fileType" = 'pdf'- LEFT JOIN LATERAL (- SELECT- i.id- FROM- "DocumentInstance" i- WHERE- i."documentId" = d.id- ORDER BY- i."createdAt" DESC- LIMIT 1- ) di ON d."fileType" IS DISTINCT FROM 'docx' AND d."fileType" IS DISTINCT FROM 'pdf'+ "DocumentBom" bWHERE- d."deletedAt" IS NULL AND d."fileType" = ANY($3)- ORDER BY d."updatedAt" DESC- LIMIT $1 OFFSET $2- "#,- limit,- offset,- file_types- )- .try_map(|row| {- Ok(BackfillSearchDocumentInformation {- document_id: row.document_id,- document_version_id: row.document_version_id,- owner: row.owner,- file_type: FileType::from_str(row.file_type.as_str()).map_err(|e| {- sqlx::Error::ColumnDecode {- index: "file_type".to_string(),- source: e.into(),- }- })?,- })- })- .fetch_all(db)- .await?- } else {- sqlx::query!(- r#"+ b."documentId" = d.id+ ORDER BY+ b."createdAt" DESC+ LIMIT 1+ ) db ON d."fileType" = 'docx'+ LEFT JOIN LATERAL (+ SELECT+ i.id+ FROM+ "DocumentInstance" i+ WHERE+ i."documentId" = d.id+ ORDER BY+ i."updatedAt" ASC+ LIMIT 1+ ) dipdf ON d."fileType" = 'pdf'+ LEFT JOIN LATERAL (SELECT- d.id as document_id,- d.owner as owner,- d."fileType" as "file_type!",- COALESCE(db.id, di.id, dipdf.id) as "document_version_id!"+ i.idFROM- "Document" d- LEFT JOIN LATERAL (- SELECT- b.id- FROM- "DocumentBom" b- WHERE- b."documentId" = d.id- ORDER BY- b."createdAt" DESC- LIMIT 1- ) db ON d."fileType" = 'docx'- LEFT JOIN LATERAL (- SELECT- i.id- FROM- "DocumentInstance" i- WHERE- i."documentId" = d.id- ORDER BY- i."updatedAt" ASC- LIMIT 1- ) dipdf ON d."fileType" = 'pdf'- LEFT JOIN LATERAL (- SELECT- i.id- FROM- "DocumentInstance" i- WHERE- i."documentId" = d.id- ORDER BY- i."createdAt" DESC- LIMIT 1- ) di ON d."fileType" IS DISTINCT FROM 'docx' AND d."fileType" IS DISTINCT FROM 'pdf'+ "DocumentInstance" iWHERE- d."deletedAt" IS NULL AND d."fileType" IS NOT NULL- ORDER BY d."updatedAt" DESC- LIMIT $1 OFFSET $2+ i."documentId" = d.id+ ORDER BY+ i."createdAt" DESC+ LIMIT 1+ ) di ON d."fileType" IS DISTINCT FROM 'docx' AND d."fileType" IS DISTINCT FROM 'pdf'+ WHERE+ d."deletedAt" IS NULL+ AND d."fileType" IS NOT NULL+ AND ($3::text[] IS NULL OR d."fileType" = ANY($3))+ AND ($4::text IS NULL OR dst.sub_type::text = $4)+ AND ($5::timestamptz IS NULL OR d."createdAt" >= $5)+ AND ($6::timestamptz IS NULL OR d."createdAt" < $6)+ ORDER BY d."createdAt" ASC, d.id ASC+ LIMIT $1 OFFSET $2"#,- limit,- offset- )- .try_map(|row| {- Ok(BackfillSearchDocumentInformation {- document_id: row.document_id,- document_version_id: row.document_version_id,- owner: row.owner,- file_type: FileType::from_str(row.file_type.as_str()).map_err(|e| {- sqlx::Error::ColumnDecode {- index: "file_type".to_string(),- source: e.into(),- }- })?,- })+ limit,+ offset,+ file_types.as_deref() as Option<&[String]>,+ sub_type.as_deref() as Option<&str>,+ *created_after as Option<DateTime<Utc>>,+ *created_before as Option<DateTime<Utc>>,+ )+ .try_map(|row| {+ Ok(BackfillSearchDocumentInformation {+ document_id: row.document_id,+ document_version_id: row.document_version_id,+ owner: row.owner,+ file_type: FileType::from_str(row.file_type.as_str()).map_err(|e| {+ sqlx::Error::ColumnDecode {+ index: "file_type".to_string(),+ source: e.into(),+ }+ })?,+ created_at: row.created_at,})- .fetch_all(db)- .await?- };+ })+ .fetch_all(db)+ .await?;Ok(result)}diff --git a/rust/cloud-storage/model/src/document/mod.rs b/rust/cloud-storage/model/src/document/mod.rsindex 80ac2689a8..de53bae104 100644--- a/rust/cloud-storage/model/src/document/mod.rs+++ b/rust/cloud-storage/model/src/document/mod.rs@@ -141,6 +141,7 @@ pub struct BackfillSearchDocumentInformation {pub document_version_id: i64,pub owner: String,pub file_type: FileType,+ pub created_at: Option<chrono::DateTime<chrono::Utc>>,}#[derive(sqlx::FromRow,diff --git a/rust/cloud-storage/opensearch_client/src/upsert/document.rs b/rust/cloud-storage/opensearch_client/src/upsert/document.rsindex bdebb191bc..accdc7dfdf 100644--- a/rust/cloud-storage/opensearch_client/src/upsert/document.rs+++ b/rust/cloud-storage/opensearch_client/src/upsert/document.rs@@ -30,6 +30,9 @@ pub struct UpsertDocumentArgs {pub content: String,/// The updated at time of the documentpub updated_at_seconds: EpochSeconds,+ /// The sub type of the document (e.g. task)+ #[serde(skip_serializing_if = "Option::is_none")]+ pub sub_type: Option<String>,}/// Process a single chunk of documentsdiff --git a/rust/cloud-storage/search_processing_service/Cargo.toml b/rust/cloud-storage/search_processing_service/Cargo.tomlindex c8e754f15e..169d8eafb6 100644--- a/rust/cloud-storage/search_processing_service/Cargo.toml+++ b/rust/cloud-storage/search_processing_service/Cargo.toml@@ -43,6 +43,7 @@ macro_middleware = { path = "../macro_middleware", default-features = false, feamacro_user_id = { path = "../macro_user_id" }macro_uuid = { path = "../macro_uuid" }mention_utils = { path = "../mention_utils" }+document_sub_type = { path = "../document_sub_type" }model = { path = "../model" }models_email = { path = "../models_email" }model_file_type = { path = "../model_file_type" }diff --git a/rust/cloud-storage/search_processing_service/src/process/document/raw_document.rs b/rust/cloud-storage/search_processing_service/src/process/document/raw_document.rsindex 1fb37cf192..2c90749c53 100644--- a/rust/cloud-storage/search_processing_service/src/process/document/raw_document.rs+++ b/rust/cloud-storage/search_processing_service/src/process/document/raw_document.rs@@ -96,6 +96,7 @@ pub async fn update_search_with_raw_document(};let document_name = document_info.document_name;+ let sub_type = document_info.sub_type.map(|st| st.to_string());let document_version_id = match search_extractor_message.file_type {// For static/converted files, we want to use the version from the search extractor message since@@ -190,6 +191,7 @@ pub async fn update_search_with_raw_document(owner_id: search_extractor_message.user_id.clone(),file_type: file_type.to_string(),updated_at_seconds: updated_at,+ sub_type: sub_type.clone(),}).collect()}@@ -205,6 +207,7 @@ pub async fn update_search_with_raw_document(owner_id: search_extractor_message.user_id.clone(),file_type: file_type.to_string(),updated_at_seconds: updated_at,+ sub_type: sub_type.clone(),}]}FileType::Md => {@@ -224,6 +227,7 @@ pub async fn update_search_with_raw_document(owner_id: search_extractor_message.user_id.clone(),file_type: file_type.to_string(),updated_at_seconds: updated_at,+ sub_type: sub_type.clone(),}).collect::<Vec<UpsertDocumentArgs>>()}@@ -241,6 +245,7 @@ pub async fn update_search_with_raw_document(owner_id: search_extractor_message.user_id.clone(),file_type: file_type.to_string(),updated_at_seconds: updated_at,+ sub_type: sub_type.clone(),}]}}@@ -264,6 +269,7 @@ fn generate_upserts(.as_str(),)?;let document_name = document_info.document_name;+ let sub_type = document_info.sub_type.map(|st| st.to_string());let upserts = result.into_iter()@@ -276,6 +282,7 @@ fn generate_upserts(owner_id: document_info.owner.to_string(),file_type: file_type.to_string(),updated_at_seconds: updated_at,+ sub_type: sub_type.clone(),}).collect::<Vec<UpsertDocumentArgs>>();@@ -383,5 +390,43 @@ mod tests {assert!(!upserts.is_empty());assert_eq!(upserts.len(), 2);+ assert_eq!(upserts[0].sub_type, None);+ }++ #[tokio::test]+ async fn test_generate_upsert_with_sub_type() {+ use document_sub_type::DocumentSubType;++ let document_info = DocumentMetadata {+ document_id: "BBB".to_string(),+ document_version_id: 0,+ owner: MacroUserIdStr::parse_from_str("macro|[email protected]").unwrap(),+ document_name: "test_task".to_string(),+ file_type: Some("md".to_string()),+ sha: None,+ project_id: None,+ project_name: None,+ branched_from_id: None,+ branched_from_version_id: None,+ document_family_id: None,+ document_bom: None,+ modification_data: None,+ created_at: None,+ updated_at: None,+ sub_type: Some(DocumentSubType::Task),+ deleted_at: None,+ };++ let markdown_result = vec![MarkdownParseResult {+ node_id: "node1".to_string(),+ raw_content: "# Task content".to_string(),+ content: "Task content".to_string(),+ }];++ let upserts =+ generate_upserts(document_info, markdown_result).expect("Could not generate upserts");++ assert_eq!(upserts.len(), 1);+ assert_eq!(upserts[0].sub_type, Some("task".to_string()));}}