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: use graphemes for counting item name lengths (#2141)
Will Hutchinsonce474cc59f64
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex 8bfa688a63..e2ea3f84fa 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -1819,6 +1819,7 @@ dependencies = ["tokio","tower 0.5.2","tracing",+ "unicode-segmentation","utoipa",]@@ -3058,6 +3059,7 @@ dependencies = ["tower 0.5.2","tower-http","tracing",+ "unicode-segmentation","urlencoding","utoipa","utoipa-swagger-ui",@@ -3161,6 +3163,7 @@ dependencies = ["tokio","tower 0.5.2","tracing",+ "unicode-segmentation","urlencoding","utoipa","uuid",diff --git a/rust/cloud-storage/Cargo.toml b/rust/cloud-storage/Cargo.tomlindex 2ba3dbe8f1..4f6add6f93 100644--- a/rust/cloud-storage/Cargo.toml+++ b/rust/cloud-storage/Cargo.toml@@ -246,5 +246,6 @@ js-sys = "0.3"once_cell = "1.21.3"scraper = "0.18"strum_macros = "0.27.1"+unicode-segmentation = "1.9.0"url = "2.5.0"zip = "=2.4.2"diff --git a/rust/cloud-storage/chat/Cargo.toml b/rust/cloud-storage/chat/Cargo.tomlindex db0bb40482..336481e4b7 100644--- a/rust/cloud-storage/chat/Cargo.toml+++ b/rust/cloud-storage/chat/Cargo.toml@@ -1,21 +1,26 @@[package]-name = "chat"-version = "0.1.0"edition = "2024"+name = "chat"publish = false+version = "0.1.0"[features]-default = ["ports", "inbound", "outbound"]+default = ["inbound", "outbound", "ports"]+inbound = ["dep:axum", "dep:model_user", "entity_access/inbound", "ports"]+outbound = [+ "dep:macro_share_permissions",+ "dep:macro_uuid",+ "dep:sqlx",+ "ports",+]ports = []-inbound = ["ports", "dep:axum", "dep:model_user", "entity_access/inbound"]-outbound = ["ports", "dep:sqlx", "dep:macro_share_permissions", "dep:macro_uuid"][dependencies]# Domain (always included)ai = { path = "../ai" }anyhow = { workspace = true }-entity_access = { path = "../entity_access", default-features = false }chrono = { workspace = true }+entity_access = { path = "../entity_access", default-features = false }macro_user_id = { path = "../macro_user_id" }model = { path = "../model" }models_permissions = { path = "../models_permissions" }@@ -24,6 +29,7 @@ serde_json = { workspace = true }thiserror = { workspace = true }tokio = { workspace = true }tracing = { workspace = true }+unicode-segmentation = { workspace = true }# Inbound (HTTP handlers)axum = { workspace = true, optional = true }diff --git a/rust/cloud-storage/chat/src/domain/service.rs b/rust/cloud-storage/chat/src/domain/service.rsindex 8bf2234c4a..04c0c4ed55 100644--- a/rust/cloud-storage/chat/src/domain/service.rs+++ b/rust/cloud-storage/chat/src/domain/service.rs@@ -9,6 +9,7 @@ use entity_access::domain::models::{};use macro_user_id::user_id::MacroUserIdStr;use models_permissions::share_permission::SharePermissionV2;+use unicode_segmentation::UnicodeSegmentation;/// Concrete service implementation that delegates to a [`ChatRepo`].pub struct ChatServiceImpl<R> {@@ -39,7 +40,7 @@ impl<R: ChatRepo> ChatService for ChatServiceImpl<R> {user_id: MacroUserIdStr<'static>,args: CreateChatArgs,) -> Result<String, ChatErr> {- if args.name.chars().count() > 100 {+ if args.name.graphemes(true).count() > 100 {return Err(ChatErr::BadRequest("name too long".to_string()));}@@ -111,7 +112,7 @@ impl<R: ChatRepo> ChatService for ChatServiceImpl<R> {args: PatchChatArgs,) -> Result<(), ChatErr> {if let Some(name) = args.name.as_ref()- && name.chars().count() > 100+ && name.graphemes(true).count() > 100{return Err(ChatErr::BadRequest("name too long".to_string()));}diff --git a/rust/cloud-storage/document_storage_service/Cargo.toml b/rust/cloud-storage/document_storage_service/Cargo.tomlindex 1ac1b56237..d0af8058aa 100644--- a/rust/cloud-storage/document_storage_service/Cargo.toml+++ b/rust/cloud-storage/document_storage_service/Cargo.toml@@ -134,6 +134,7 @@ tokio = { workspace = true }tower = { workspace = true }tower-http = { workspace = true, features = ["compression-gzip"] }tracing = { workspace = true }+unicode-segmentation = { workspace = true }urlencoding = { workspace = true }utoipa = { workspace = true, features = ["axum_extras"] }utoipa-swagger-ui = { workspace = true, features = ["axum"] }diff --git a/rust/cloud-storage/document_storage_service/src/api/projects/create_project.rs b/rust/cloud-storage/document_storage_service/src/api/projects/create_project.rsindex d35aca4293..f8a0537004 100644--- a/rust/cloud-storage/document_storage_service/src/api/projects/create_project.rs+++ b/rust/cloud-storage/document_storage_service/src/api/projects/create_project.rs@@ -12,6 +12,7 @@ use model::{};use models_permissions::share_permission::SharePermissionV2;use models_permissions::share_permission::access_level::EditAccessLevel;+use unicode_segmentation::UnicodeSegmentation;/// Creates a new project./// The project can be created as a sub-project of another project or as a top-level project.@@ -59,7 +60,7 @@ async fn create_project_v2(user_context: MacroUserExtractor,req: CreateProjectRequest,) -> Result<Project, (StatusCode, String)> {- if req.name.chars().count() > 100 {+ if req.name.graphemes(true).count() > 100 {return Err((StatusCode::BAD_REQUEST, "name too long".to_string()));}diff --git a/rust/cloud-storage/document_storage_service/src/api/projects/edit_project.rs b/rust/cloud-storage/document_storage_service/src/api/projects/edit_project.rsindex 8e8a852bbf..5f8f951ef2 100644--- a/rust/cloud-storage/document_storage_service/src/api/projects/edit_project.rs+++ b/rust/cloud-storage/document_storage_service/src/api/projects/edit_project.rs@@ -14,6 +14,7 @@ use model::response::{GenericErrorResponse, SuccessResponse};use model::{project::BasicProject, response::GenericSuccessResponse};use model::{project::request::PatchProjectRequestV2, response::ErrorResponse, user::UserContext};use models_permissions::share_permission::access_level::{AccessLevel, EditAccessLevel};+use unicode_segmentation::UnicodeSegmentation;#[derive(serde::Deserialize)]pub struct Params {@@ -99,7 +100,7 @@ async fn edit_project_v2(req: PatchProjectRequestV2,) -> Result<(), (StatusCode, String)> {if let Some(name) = req.name.as_ref()- && name.chars().count() > 100+ && name.graphemes(true).count() > 100{return Err((StatusCode::BAD_REQUEST, "name too long".to_string()));}diff --git a/rust/cloud-storage/documents/Cargo.toml b/rust/cloud-storage/documents/Cargo.tomlindex d66b2707cd..c10c2932ca 100644--- a/rust/cloud-storage/documents/Cargo.toml+++ b/rust/cloud-storage/documents/Cargo.toml@@ -37,6 +37,7 @@ serde = { workspace = true }serde_json = { workspace = true }thiserror = { workspace = true }tracing = { workspace = true }+unicode-segmentation = { workspace = true }uuid = { workspace = true }# Domain models (always included)diff --git a/rust/cloud-storage/documents/src/domain/service.rs b/rust/cloud-storage/documents/src/domain/service.rsindex 28212ea260..1abdfaad5a 100644--- a/rust/cloud-storage/documents/src/domain/service.rs+++ b/rust/cloud-storage/documents/src/domain/service.rs@@ -6,6 +6,7 @@ mod tests;use std::borrow::Cow;use std::str::FromStr;use std::time::{SystemTime, UNIX_EPOCH};+use unicode_segmentation::UnicodeSegmentation;use anyhow::anyhow;use cloudfront_sign::{SignedOptions, get_signed_url};@@ -476,7 +477,7 @@ impl<R: DocumentRepo, U: PresignedUploadUrlPort, T: TaskPropertiesPort, C: Conneargs: CreateDocumentRepoArgs,job_id: Option<String>,) -> Result<CreateDocumentResponseData, DocumentError> {- if args.document_name.chars().count() > 100 {+ if args.document_name.graphemes(true).count() > 100 {return Err(DocumentError::BadRequest("name too long".to_string()));}@@ -582,7 +583,7 @@ impl<R: DocumentRepo, U: PresignedUploadUrlPort, T: TaskPropertiesPort, C: Conneargs: EditDocumentServiceArgs,) -> Result<(), DocumentError> {if let Some(name) = args.document_name.as_ref()- && name.chars().count() > 100+ && name.graphemes(true).count() > 100{return Err(DocumentError::BadRequest("name too long".to_string()));}diff --git a/rust/cloud-storage/opensearch_client/Cargo.toml b/rust/cloud-storage/opensearch_client/Cargo.tomlindex 80253a3e9d..41f8fe1135 100644--- a/rust/cloud-storage/opensearch_client/Cargo.toml+++ b/rust/cloud-storage/opensearch_client/Cargo.toml@@ -23,5 +23,5 @@ serde_json = { workspace = true }strum = { workspace = true }thiserror = { workspace = true }tracing = { workspace = true }-unicode-segmentation = "1.9.0"+unicode-segmentation = { workspace = true }uuid = { workspace = true }