Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(email): log contacts listing failures at warn (#7887)

teo2f27a778f197
diff --git a/crates/email_api_client/src/domain/service/contacts.rs b/crates/email_api_client/src/domain/service/contacts.rs
index 38e356281f..20538678aa 100644
--- a/crates/email_api_client/src/domain/service/contacts.rs
+++ b/crates/email_api_client/src/domain/service/contacts.rs
@@ -25,7 +25,10 @@ where
}
/// Lists primary contacts, optionally continuing an incremental synchronization.
- #[tracing::instrument(skip(self, sync_token), err)]
+ ///
+ /// Failures log at WARN: an expired sync token ([`EmailApiError::OutdatedCursor`])
+ /// or a grant without the contacts scopes is routine, and callers recover or skip.
+ #[tracing::instrument(skip(self, sync_token), err(level = "warn"))]
pub async fn list_contacts(
&self,
link_id: Uuid,
@@ -41,7 +44,9 @@ where
}
/// Lists automatically collected contacts, optionally continuing a synchronization.
- #[tracing::instrument(skip(self, sync_token), err)]
+ ///
+ /// Failures log at WARN for the same reasons as [`Self::list_contacts`].
+ #[tracing::instrument(skip(self, sync_token), err(level = "warn"))]
pub async fn list_other_contacts(
&self,
link_id: Uuid,
diff --git a/crates/gmail_client/src/contacts.rs b/crates/gmail_client/src/contacts.rs
index 7d71163d24..2ba421a69c 100644
--- a/crates/gmail_client/src/contacts.rs
+++ b/crates/gmail_client/src/contacts.rs
@@ -27,7 +27,10 @@ pub(crate) async fn get_self_connection(
}
/// Fetches all pages of the user's contacts and returns raw People resources.
-#[tracing::instrument(skip(client, access_token, sync_token), err)]
+///
+/// Failures log at WARN: expired sync tokens and links granted without the
+/// contacts scopes are routine, and the contacts sync recovers or skips them.
+#[tracing::instrument(skip(client, access_token, sync_token), err(level = "warn"))]
pub(crate) async fn list_connections(
client: &GmailClient,
access_token: &str,
@@ -81,7 +84,9 @@ pub(crate) async fn list_connections(
}
/// Fetches all pages of "Other Contacts" and returns raw People resources.
-#[tracing::instrument(skip(client, access_token, sync_token), err)]
+///
+/// Failures log at WARN for the same reasons as [`list_connections`].
+#[tracing::instrument(skip(client, access_token, sync_token), err(level = "warn"))]
pub(crate) async fn list_other_contacts(
client: &GmailClient,
access_token: &str,
diff --git a/crates/gmail_client/src/lib.rs b/crates/gmail_client/src/lib.rs
index eb6593da22..c91ae5206f 100644
--- a/crates/gmail_client/src/lib.rs
+++ b/crates/gmail_client/src/lib.rs
@@ -311,7 +311,8 @@ impl GmailClient {
/// Fetches all of the user's main contacts, handling pagination.
/// Returns raw Gmail PersonResource objects and a sync token for future incremental updates.
/// Callers should map PersonResource to service layer Contact.
- #[tracing::instrument(skip(self, access_token, sync_token), err)]
+ /// Failures log at WARN: expired sync tokens and missing contacts scopes are routine.
+ #[tracing::instrument(skip(self, access_token, sync_token), err(level = "warn"))]
pub async fn get_contacts(
&self,
access_token: &str,
@@ -324,7 +325,8 @@ impl GmailClient {
/// These are typically contacts auto-created from interactions.
/// Returns raw Gmail PersonResource objects and a sync token.
/// Callers should map PersonResource to service layer Contact.
- #[tracing::instrument(skip(self, access_token, sync_token), err)]
+ /// Failures log at WARN: expired sync tokens and missing contacts scopes are routine.
+ #[tracing::instrument(skip(self, access_token, sync_token), err(level = "warn"))]
pub async fn get_other_contacts(
&self,
access_token: &str,