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
fix(soup): project parent filter (#298)
Sean Aye7bf9b8c521a6
diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/dynamic.rsindex 310f58d253..c85c9ca4b1 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/dynamic.rs@@ -250,7 +250,7 @@ fn build_project_filter(ast: Option<&Expr<ProjectLiteral>>) -> String {filter_ast::ExprFrame::Or(a, b) => format!("({a} OR {b})"),filter_ast::ExprFrame::Not(a) => format!("(NOT {a})"),filter_ast::ExprFrame::Literal(ProjectLiteral::ProjectId(p)) => {- format!("p.id = '{p}'")+ format!(r#"p."parentId" = '{p}'"#)}filter_ast::ExprFrame::Literal(ProjectLiteral::Owner(o)) => format!("p.owner = '{o}'"),});diff --git a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rsindex 7a57faa57f..b1d58fc272 100644--- a/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs+++ b/rust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rs@@ -1180,15 +1180,18 @@ async fn test_filter_by_project_ids(db: PgPool) -> anyhow::Result<()> {}}- assert_eq!(project_ids.len(), 2, "Should get exactly 2 projects");+ assert_eq!(+ project_ids.len(),+ 1,+ "Should get exactly 1 project (project-B, child of project-A)"+ );assert_eq!(doc_count, 5, "Should get all documents");assert_eq!(chat_count, 4, "Should get all chats");let returned_ids = project_ids;let expected_ids: HashSet<Uuid> = [- "11111111-1111-1111-1111-111111111111",- "44444444-4444-4444-4444-444444444444",+ "22222222-2222-2222-2222-222222222222", // Project B (parentId = project-A)].iter().map(|&s| Uuid::parse_str(s).unwrap())@@ -1196,7 +1199,7 @@ async fn test_filter_by_project_ids(db: PgPool) -> anyhow::Result<()> {assert_eq!(returned_ids, expected_ids,- "Should get the correct projects"+ "Should get project-B (child of project-A)");Ok(())@@ -1251,8 +1254,13 @@ async fn test_combined_entity_filters(db: PgPool) -> anyhow::Result<()> {).await?;- // Should get: doc-in-A, doc-in-B, chat-standalone, project-D = 4 items- assert_eq!(items.len(), 4, "Should get 4 items total");+ // Should get: doc-in-A, doc-in-B, chat-standalone = 3 items+ // Note: project filter for project-D returns 0 projects (no children of project-D exist)+ assert_eq!(+ items.len(),+ 3,+ "Should get 3 items total (2 docs + 1 chat, no projects match parentId filter)"+ );let mut doc_count = 0;let mut chat_count = 0;@@ -1277,20 +1285,18 @@ async fn test_combined_entity_filters(db: PgPool) -> anyhow::Result<()> {"Should only get standalone chat");}- SoupItem::Project(project) => {+ SoupItem::Project(_project) => {project_count += 1;- assert_eq!(- project.id,- Uuid::parse_str("44444444-4444-4444-4444-444444444444").unwrap(),- "Should only get project-D"- );}}}assert_eq!(doc_count, 2, "Should get 2 documents");assert_eq!(chat_count, 1, "Should get 1 chat");- assert_eq!(project_count, 1, "Should get 1 project");+ assert_eq!(+ project_count, 0,+ "Should get 0 projects (no children of project-D)"+ );Ok(())}