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(calendar): read the GraphQL calendar feed from the primary (#8666)
gbirmana699634d0662
diff --git a/services/document_storage_service/AGENTS.md b/services/document_storage_service/AGENTS.mdindex 7972bbfe92..2054652e0a 100644--- a/services/document_storage_service/AGENTS.md+++ b/services/document_storage_service/AGENTS.md@@ -64,6 +64,9 @@ threads, pins, recents, notifications, folders, activity.- Soup GraphQL reads a replica with multi-second lag; a read immediately aftera write through the same request needs the primary-reading loader, not thedefault one — see `crates/graphql_soup`.+- The GraphQL calendar feed (occurrence ranges and `calendarChanges`) reads the+ primary, like the REST calendar routes: a `refresh_calendar` poke goes out as+ a write commits, so a replica-backed delta misses the change it announces.## Relateddiff --git a/services/document_storage_service/src/server.rs b/services/document_storage_service/src/server.rsindex a653c0f642..1fefe51042 100644--- a/services/document_storage_service/src/server.rs+++ b/services/document_storage_service/src/server.rs@@ -1883,20 +1883,24 @@ pub async fn run() -> anyhow::Result<()> {let user_api_key_service = Arc::new(UserApiKeyServiceImpl::new(PgUserApiKeysRepo::new(db.clone(),)));+ // The GraphQL own-calendar feed reads the primary, like the REST calendar+ // routes: a `refresh_calendar` poke goes out as the write commits, and the+ // delta it triggers would find nothing on a lagging replica, leaving the+ // change unseen until some later poke. Range reads share the pool so a+ // page cannot overwrite what a delta already applied with older rows.let calendar_read_service = Arc::new(calendar_events::domain::service::CalendarService::new(- calendar_events::outbound::pg::PgCalendarRepository::new(readonly_db.clone()),+ calendar_events::outbound::pg::PgCalendarRepository::new(db.clone()),));let graphql_calendar_context = graphql_calendar::CalendarGraphqlContext::new(calendar_read_service.clone(),Arc::new(calendar_events::domain::changes::CalendarChangeService::new(- calendar_events::outbound::pg::PgCalendarRepository::new(readonly_db.clone()),+ calendar_events::outbound::pg::PgCalendarRepository::new(db.clone()),),),);// Team policy reads use the primary so a sharing downgrade cannot be- // served from a lagging replica. The GraphQL own-calendar feed retains- // its existing readonly-pool routing.+ // served from a lagging replica.let calendar_state = CalendarRouterState::new(Arc::new(calendar_events::domain::service::CalendarService::new(