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
perf(document-storage): stop compiling the whole service in its lib test (#9819)
teo968f842be27c
diff --git a/services/document_storage_service/AGENTS.md b/services/document_storage_service/AGENTS.mdindex 59506b6e5b..fe35d5607b 100644--- a/services/document_storage_service/AGENTS.md+++ b/services/document_storage_service/AGENTS.md@@ -88,6 +88,11 @@ threads, pins, recents, notifications, folders, activity.- Compose Soup without a separate property-definition reader; REST and GraphQL validate DATE range inputs before calling the service.+- Don't declare a function that reaches the router `pub async fn`, even in a private+ module. rustc compiles the body of every non-generic `pub async fn` in every build,+ so the lib test would compile the whole service. `server::run` returns `impl Future`+ for that reason.+- Several behaviors are Cargo-feature-gated (`connection_gateway`,`delete_document_worker`, `location_check`, all on by `default`) — a featuredisabled locally can hide a bug that only shows in deployed builds.diff --git a/services/document_storage_service/src/api.rs b/services/document_storage_service/src/api.rsindex 78e3ddd0a9..a1a54d3586 100644--- a/services/document_storage_service/src/api.rs+++ b/services/document_storage_service/src/api.rs@@ -49,7 +49,8 @@ mod threads;// auth based constantspub const MACRO_INTERNAL_USER_ID: &str = "macro|[email protected]";-pub async fn setup_and_serve(state: ApiContext) -> anyhow::Result<()> {+// `pub(crate)`, not `pub`: see `server::run`.+pub(crate) async fn setup_and_serve(state: ApiContext) -> anyhow::Result<()> {let sync_sessions = state.sync_sessions.clone();let app = api_router(state.clone()).layer(diff --git a/services/document_storage_service/src/server.rs b/services/document_storage_service/src/server.rsindex 3ab74acd4b..c23412f5f4 100644--- a/services/document_storage_service/src/server.rs+++ b/services/document_storage_service/src/server.rs@@ -209,7 +209,14 @@ maybe_env_vars! {}/// Build the service from the environment and serve until shutdown.-pub async fn run() -> anyhow::Result<()> {+// Not a `pub async fn`: rustc compiles the body of every non-generic `pub async fn`+// in every build, tests included, even when nothing calls it. This one reaches the+// whole router, so the lib test would compile the entire service.+pub fn run() -> impl Future<Output = anyhow::Result<()>> {+ run_server()+}++async fn run_server() -> anyhow::Result<()> {let env = Environment::new_or_prod();let aws_config = macro_aws_config::get_macro_aws_config().await;