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): paginate crm_companies past the cursor (#3651)
Evan Hutnikbc43d8739cce
diff --git a/rust/cloud-storage/.sqlx/query-e1661b2dd9feaf90960460b587fb5639ae2ea1210a6eef750d607ed54c245616.json b/rust/cloud-storage/.sqlx/query-fc567a15d9fdb4dd36547a34b9b3d43ef5cb4e898a074e2655d84efcad25dc4d.jsonsimilarity index 50%rename from rust/cloud-storage/.sqlx/query-e1661b2dd9feaf90960460b587fb5639ae2ea1210a6eef750d607ed54c245616.jsonrename to rust/cloud-storage/.sqlx/query-fc567a15d9fdb4dd36547a34b9b3d43ef5cb4e898a074e2655d84efcad25dc4d.jsonindex 43e5288ec3..4389f1a7d0 100644--- a/rust/cloud-storage/.sqlx/query-e1661b2dd9feaf90960460b587fb5639ae2ea1210a6eef750d607ed54c245616.json+++ b/rust/cloud-storage/.sqlx/query-fc567a15d9fdb4dd36547a34b9b3d43ef5cb4e898a074e2655d84efcad25dc4d.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n WITH limited_companies AS (\n SELECT\n c.id,\n c.team_id,\n c.email_sync,\n c.hidden,\n c.first_interaction,\n c.last_interaction\n FROM crm_companies c\n WHERE c.team_id = $1\n AND c.hidden = FALSE\n AND EXISTS (\n SELECT 1 FROM team_crm_settings tcs\n WHERE tcs.team_id = $1 AND tcs.crm_enabled\n )\n AND (cardinality($2::uuid[]) = 0 OR c.id = ANY($2::uuid[]))\n ORDER BY\n CASE $4\n WHEN 'created_at' THEN c.first_interaction\n ELSE c.last_interaction\n END DESC,\n c.id DESC\n LIMIT $3\n )\n SELECT\n lc.id AS \"company_id!\",\n lc.team_id AS \"company_team_id!\",\n lc.email_sync AS \"company_email_sync!\",\n lc.hidden AS \"company_hidden!\",\n lc.first_interaction AS \"company_created_at!\",\n lc.last_interaction AS \"company_updated_at!\",\n d.id AS \"domain_id?\",\n d.domain AS \"domain?\",\n d.created_at AS \"domain_created_at?\",\n dd.name AS \"dir_name?\",\n dd.description AS \"dir_description?\"\n FROM limited_companies lc\n LEFT JOIN crm_domains d ON d.company_id = lc.id\n LEFT JOIN crm_domain_directory dd\n ON LOWER(dd.domain) = LOWER(d.domain)\n ORDER BY\n CASE $4\n WHEN 'created_at' THEN lc.first_interaction\n ELSE lc.last_interaction\n END DESC,\n lc.id DESC,\n d.created_at ASC NULLS LAST\n ",+ "query": "\n WITH limited_companies AS (\n SELECT\n c.id,\n c.team_id,\n c.email_sync,\n c.hidden,\n c.first_interaction,\n c.last_interaction\n FROM crm_companies c\n WHERE c.team_id = $1\n AND c.hidden = FALSE\n AND EXISTS (\n SELECT 1 FROM team_crm_settings tcs\n WHERE tcs.team_id = $1 AND tcs.crm_enabled\n )\n AND (cardinality($2::uuid[]) = 0 OR c.id = ANY($2::uuid[]))\n -- Keyset seek (NULL = first page): keep only rows that\n -- sort strictly after the cursor.\n AND (\n $5::timestamptz IS NULL\n OR (\n CASE $4\n WHEN 'created_at' THEN c.first_interaction\n ELSE c.last_interaction\n END,\n c.id::text\n ) < ($5, $6)\n )\n ORDER BY\n CASE $4\n WHEN 'created_at' THEN c.first_interaction\n ELSE c.last_interaction\n END DESC,\n c.id DESC\n LIMIT $3\n )\n SELECT\n lc.id AS \"company_id!\",\n lc.team_id AS \"company_team_id!\",\n lc.email_sync AS \"company_email_sync!\",\n lc.hidden AS \"company_hidden!\",\n lc.first_interaction AS \"company_created_at!\",\n lc.last_interaction AS \"company_updated_at!\",\n d.id AS \"domain_id?\",\n d.domain AS \"domain?\",\n d.created_at AS \"domain_created_at?\",\n dd.name AS \"dir_name?\",\n dd.description AS \"dir_description?\"\n FROM limited_companies lc\n LEFT JOIN crm_domains d ON d.company_id = lc.id\n LEFT JOIN crm_domain_directory dd\n ON LOWER(dd.domain) = LOWER(d.domain)\n ORDER BY\n CASE $4\n WHEN 'created_at' THEN lc.first_interaction\n ELSE lc.last_interaction\n END DESC,\n lc.id DESC,\n d.created_at ASC NULLS LAST\n ","describe": {"columns": [{@@ -64,6 +64,8 @@"Uuid","UuidArray","Int8",+ "Text",+ "Timestamptz","Text"]},@@ -81,5 +83,5 @@true]},- "hash": "e1661b2dd9feaf90960460b587fb5639ae2ea1210a6eef750d607ed54c245616"+ "hash": "fc567a15d9fdb4dd36547a34b9b3d43ef5cb4e898a074e2655d84efcad25dc4d"}diff --git a/rust/cloud-storage/crm/src/domain/companies_repo.rs b/rust/cloud-storage/crm/src/domain/companies_repo.rsindex 42a1445294..70699690d6 100644--- a/rust/cloud-storage/crm/src/domain/companies_repo.rs+++ b/rust/cloud-storage/crm/src/domain/companies_repo.rs@@ -19,6 +19,18 @@ pub enum CrmCompanyListSort {CreatedAt,}+/// Keyset cursor for [`CompaniesRepository::list_companies_for_soup`].+/// Carries the sort timestamp + id of the previous soup page's last row+/// so the next page seeks strictly past it. `None` = first page.+#[derive(Debug, Clone, Copy)]+pub struct CrmCompanySoupCursor {+ /// Sort timestamp of the previous page's last row —+ /// `first_interaction`/`last_interaction` per [`CrmCompanyListSort`].+ pub last_sort_ts: DateTime<Utc>,+ /// Id of the previous page's last row; tiebreaks equal timestamps.+ pub last_id: uuid::Uuid,+}+/// The CompaniesRepository defines persistence operations for CRM/// companies and their associated domains.pub trait CompaniesRepository: Clone + Send + Sync + 'static {@@ -289,12 +301,14 @@ pub trait CompaniesRepository: Clone + Send + Sync + 'static {/// team-level killswitch (missing or `crm_enabled = false` →/// empty) and excludes `hidden = true` rows. Empty `company_ids`/// = all non-hidden companies; non-empty = whitelist. Both sort- /// orders tiebreak on `id DESC`.+ /// orders tiebreak on `id DESC`. `cursor` seeks strictly past the+ /// previous soup page's last row (`None` = first page).fn list_companies_for_soup(&self,team_id: &uuid::Uuid,company_ids: &[uuid::Uuid],sort: CrmCompanyListSort,+ cursor: Option<CrmCompanySoupCursor>,limit: i64,) -> impl Future<Output = Result<Vec<CrmCompanyForSoup>, CrmError>> + Send;diff --git a/rust/cloud-storage/crm/src/domain/service.rs b/rust/cloud-storage/crm/src/domain/service.rsindex 326cbb2c46..989146e736 100644--- a/rust/cloud-storage/crm/src/domain/service.rs+++ b/rust/cloud-storage/crm/src/domain/service.rs@@ -2,7 +2,7 @@use crate::domain::{comment::{CrmComment, CrmCommentEntityType, CrmCommentThread, DeleteCrmCommentResult},- companies_repo::{CompaniesRepository, CrmCompanyListSort},+ companies_repo::{CompaniesRepository, CrmCompanyListSort, CrmCompanySoupCursor},company_metadata_resolver::CompanyMetadataResolver,generic_email_domains::is_generic_email_domain,model::{CrmCompany, CrmCompanyForSoup, CrmContact, CrmError, CrmScopePrecheck},@@ -186,6 +186,7 @@ pub trait CrmService: Clone + Send + Sync + 'static {team_id: &uuid::Uuid,company_ids: &[uuid::Uuid],sort: CrmCompanyListSort,+ cursor: Option<CrmCompanySoupCursor>,limit: i64,) -> impl Future<Output = Result<Vec<CrmCompanyForSoup>, CrmError>> + Send;@@ -493,10 +494,11 @@ whereteam_id: &uuid::Uuid,company_ids: &[uuid::Uuid],sort: CrmCompanyListSort,+ cursor: Option<CrmCompanySoupCursor>,limit: i64,) -> Result<Vec<CrmCompanyForSoup>, CrmError> {self.companies_repository- .list_companies_for_soup(team_id, company_ids, sort, limit)+ .list_companies_for_soup(team_id, company_ids, sort, cursor, limit).await}@@ -666,6 +668,7 @@ impl CrmService for NoOpCrmService {_team_id: &uuid::Uuid,_company_ids: &[uuid::Uuid],_sort: CrmCompanyListSort,+ _cursor: Option<CrmCompanySoupCursor>,_limit: i64,) -> Result<Vec<CrmCompanyForSoup>, CrmError> {Ok(Vec::new())diff --git a/rust/cloud-storage/crm/src/outbound/companies_repo.rs b/rust/cloud-storage/crm/src/outbound/companies_repo.rsindex ed2618817e..7363ebbfd6 100644--- a/rust/cloud-storage/crm/src/outbound/companies_repo.rs+++ b/rust/cloud-storage/crm/src/outbound/companies_repo.rs@@ -7,7 +7,7 @@ use crate::domain::{comment::{CrmComment, CrmCommentEntityType, CrmCommentThread, CrmThread, DeleteCrmCommentResult,},- companies_repo::{CompaniesRepository, CrmCompanyListSort},+ companies_repo::{CompaniesRepository, CrmCompanyListSort, CrmCompanySoupCursor},model::{CrmAddressStatus, CrmCompany, CrmCompanyForSoup, CrmContact, CrmDomain, CrmDomainStatus,CrmError, CrmScopePrecheck, DomainMetadata,@@ -976,12 +976,18 @@ impl CompaniesRepository for CompaniesRepositoryImpl {team_id: &uuid::Uuid,company_ids: &[uuid::Uuid],sort: CrmCompanyListSort,+ cursor: Option<CrmCompanySoupCursor>,limit: i64,) -> Result<Vec<CrmCompanyForSoup>, CrmError> {let sort_method_str = match sort {CrmCompanyListSort::UpdatedAt => "updated_at",CrmCompanyListSort::CreatedAt => "created_at",};+ // Keyset seek past the previous soup page's last row. Compared as+ // (sort_ts, id::text) to match the main soup query's tiebreak in+ // pg_soup_repo/expanded/by_cursor.rs. NULL = first page.+ let cursor_ts = cursor.map(|c| c.last_sort_ts);+ let cursor_id = cursor.map(|c| c.last_id.to_string());// CTE limits companies before the domain/directory joins; the// outer ORDER BY repeats the CTE's sort + `d.created_at ASC`@@ -1007,6 +1013,18 @@ impl CompaniesRepository for CompaniesRepositoryImpl {WHERE tcs.team_id = $1 AND tcs.crm_enabled)AND (cardinality($2::uuid[]) = 0 OR c.id = ANY($2::uuid[]))+ -- Keyset seek (NULL = first page): keep only rows that+ -- sort strictly after the cursor.+ AND (+ $5::timestamptz IS NULL+ OR (+ CASE $4+ WHEN 'created_at' THEN c.first_interaction+ ELSE c.last_interaction+ END,+ c.id::text+ ) < ($5, $6)+ )ORDER BYCASE $4WHEN 'created_at' THEN c.first_interaction@@ -1043,6 +1061,8 @@ impl CompaniesRepository for CompaniesRepositoryImpl {company_ids,limit,sort_method_str,+ cursor_ts,+ cursor_id,).fetch_all(&self.pool).awaitdiff --git a/rust/cloud-storage/crm/src/outbound/companies_repo/test.rs b/rust/cloud-storage/crm/src/outbound/companies_repo/test.rsindex 9cd5fc2bb2..ccd4d22534 100644--- a/rust/cloud-storage/crm/src/outbound/companies_repo/test.rs+++ b/rust/cloud-storage/crm/src/outbound/companies_repo/test.rs@@ -1559,7 +1559,7 @@ async fn list_for_soup_returns_empty_when_killswitch_missing(pool: PgPool) -> anlet repo = CompaniesRepositoryImpl::new(pool);let result = repo- .list_companies_for_soup(&team, &[], CrmCompanyListSort::UpdatedAt, 100)+ .list_companies_for_soup(&team, &[], CrmCompanyListSort::UpdatedAt, None, 100).await?;assert!(result.is_empty(),@@ -1581,7 +1581,7 @@ async fn list_for_soup_returns_empty_when_killswitch_off(pool: PgPool) -> anyhowlet repo = CompaniesRepositoryImpl::new(pool);let result = repo- .list_companies_for_soup(&team, &[], CrmCompanyListSort::UpdatedAt, 100)+ .list_companies_for_soup(&team, &[], CrmCompanyListSort::UpdatedAt, None, 100).await?;assert!(result.is_empty());Ok(())@@ -1602,7 +1602,7 @@ async fn list_for_soup_excludes_hidden_rows(pool: PgPool) -> anyhow::Result<()>let repo = CompaniesRepositoryImpl::new(pool);let result = repo- .list_companies_for_soup(&team, &[], CrmCompanyListSort::UpdatedAt, 100)+ .list_companies_for_soup(&team, &[], CrmCompanyListSort::UpdatedAt, None, 100).await?;let ids: Vec<Uuid> = result.iter().map(|c| c.company.id).collect();assert_eq!(ids, vec![visible], "hidden = TRUE rows must not appear");@@ -1637,7 +1637,7 @@ async fn list_for_soup_hydrates_name_and_description_from_directory(let repo = CompaniesRepositoryImpl::new(pool);let result = repo- .list_companies_for_soup(&team, &[], CrmCompanyListSort::UpdatedAt, 100)+ .list_companies_for_soup(&team, &[], CrmCompanyListSort::UpdatedAt, None, 100).await?;assert_eq!(result.len(), 1);assert_eq!(result[0].name.as_deref(), Some("Acme Inc."));@@ -1672,7 +1672,7 @@ async fn list_for_soup_returns_none_for_negative_cache_directory_row(let repo = CompaniesRepositoryImpl::new(pool);let result = repo- .list_companies_for_soup(&team, &[], CrmCompanyListSort::UpdatedAt, 100)+ .list_companies_for_soup(&team, &[], CrmCompanyListSort::UpdatedAt, None, 100).await?;assert_eq!(result.len(), 1);assert_eq!(result[0].name, None);@@ -1691,7 +1691,7 @@ async fn list_for_soup_filters_by_company_ids_when_non_empty(pool: PgPool) -> anlet repo = CompaniesRepositoryImpl::new(pool);let result = repo- .list_companies_for_soup(&team, &[wanted], CrmCompanyListSort::UpdatedAt, 100)+ .list_companies_for_soup(&team, &[wanted], CrmCompanyListSort::UpdatedAt, None, 100).await?;let ids: Vec<Uuid> = result.iter().map(|c| c.company.id).collect();assert_eq!(ids, vec![wanted]);@@ -1711,13 +1711,150 @@ async fn list_for_soup_does_not_leak_other_team_rows(pool: PgPool) -> anyhow::Relet repo = CompaniesRepositoryImpl::new(pool);let result = repo- .list_companies_for_soup(&team_b, &[], CrmCompanyListSort::UpdatedAt, 100)+ .list_companies_for_soup(&team_b, &[], CrmCompanyListSort::UpdatedAt, None, 100).await?;let ids: Vec<Uuid> = result.iter().map(|c| c.company.id).collect();assert_eq!(ids, vec![b_only]);Ok(())}+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]+async fn list_for_soup_paginates_past_cursor(pool: PgPool) -> anyhow::Result<()> {+ let team = Uuid::now_v7();+ seed_team(&pool, team, "macro|[email protected]").await?;+ enable_crm_for_team(&pool, team).await?;++ // Five companies with strictly increasing interaction timestamps.+ // Parsed (not `now()`) so they carry no sub-microsecond precision+ // that Postgres would truncate out from under the cursor compare.+ let mut companies = Vec::new();+ for day in 1..=5 {+ let domain = format!("c{day}.com");+ let id = insert_company(&pool, team, true, &[domain.as_str()]).await?;+ let ts: chrono::DateTime<chrono::Utc> = format!("2024-01-0{day}T00:00:00Z").parse()?;+ sqlx::query(+ r#"UPDATE crm_companies+ SET first_interaction = $2, last_interaction = $2+ WHERE id = $1"#,+ )+ .bind(id)+ .bind(ts)+ .execute(&pool)+ .await?;+ companies.push(id);+ }+ // Descending by timestamp → newest (day 5) first.+ let expected: Vec<Uuid> = companies.iter().rev().copied().collect();++ let repo = CompaniesRepositoryImpl::new(pool);++ // Walk every page with limit=2, threading the keyset cursor from the+ // last row of each page — exactly how the soup paginator drives it.+ let mut seen: Vec<Uuid> = Vec::new();+ let mut cursor: Option<CrmCompanySoupCursor> = None;+ let mut first_page: Vec<Uuid> = Vec::new();+ for page_idx in 0..10 {+ let page = repo+ .list_companies_for_soup(&team, &[], CrmCompanyListSort::UpdatedAt, cursor, 2)+ .await?;+ if page.is_empty() {+ break;+ }+ let page_ids: Vec<Uuid> = page.iter().map(|c| c.company.id).collect();+ if page_idx == 0 {+ first_page = page_ids.clone();+ } else {+ // Regression: a follow-up page must not re-serve page one.+ // (The pre-fix query ignored the cursor and always did this.)+ assert_ne!(+ page_ids, first_page,+ "cursor did not advance — page {page_idx} repeated the first page"+ );+ }+ let last = page.last().unwrap();+ cursor = Some(CrmCompanySoupCursor {+ last_sort_ts: last.company.updated_at,+ last_id: last.company.id,+ });+ let exhausted = page.len() < 2;+ seen.extend(page_ids);+ if exhausted {+ break;+ }+ }++ assert_eq!(+ seen, expected,+ "pagination must yield every company exactly once in descending interaction order"+ );+ Ok(())+}++#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]+async fn list_for_soup_pagination_breaks_ties_on_id(pool: PgPool) -> anyhow::Result<()> {+ let team = Uuid::now_v7();+ seed_team(&pool, team, "macro|[email protected]").await?;+ enable_crm_for_team(&pool, team).await?;++ // One newest company, then a tied pair, then two older. At limit=2+ // the tied pair straddles the page-1/page-2 boundary, so pagination+ // must lean on the `id` half of the keyset — a timestamp-only seek+ // would skip the second tied row (its ts is not `< cursor_ts`).+ let newest: chrono::DateTime<chrono::Utc> = "2024-01-05T00:00:00Z".parse()?;+ let tie: chrono::DateTime<chrono::Utc> = "2024-01-04T00:00:00Z".parse()?;+ let mid: chrono::DateTime<chrono::Utc> = "2024-01-03T00:00:00Z".parse()?;+ let oldest: chrono::DateTime<chrono::Utc> = "2024-01-02T00:00:00Z".parse()?;++ let mut want: Vec<(chrono::DateTime<chrono::Utc>, Uuid)> = Vec::new();+ for (idx, ts) in [newest, tie, tie, mid, oldest].into_iter().enumerate() {+ let domain = format!("tie{idx}.com");+ let id = insert_company(&pool, team, true, &[domain.as_str()]).await?;+ sqlx::query(+ r#"UPDATE crm_companies+ SET first_interaction = $2, last_interaction = $2+ WHERE id = $1"#,+ )+ .bind(id)+ .bind(ts)+ .execute(&pool)+ .await?;+ want.push((ts, id));+ }+ // Expected DB order: last_interaction DESC, then id DESC. Computed+ // from the ids actually generated, so it holds regardless of which+ // tied row drew the larger uuid.+ want.sort_by(|a, b| b.0.cmp(&a.0).then(b.1.cmp(&a.1)));+ let expected: Vec<Uuid> = want.iter().map(|(_, id)| *id).collect();++ let repo = CompaniesRepositoryImpl::new(pool);+ let mut seen: Vec<Uuid> = Vec::new();+ let mut cursor: Option<CrmCompanySoupCursor> = None;+ for _ in 0..10 {+ let page = repo+ .list_companies_for_soup(&team, &[], CrmCompanyListSort::UpdatedAt, cursor, 2)+ .await?;+ if page.is_empty() {+ break;+ }+ let last = page.last().unwrap();+ cursor = Some(CrmCompanySoupCursor {+ last_sort_ts: last.company.updated_at,+ last_id: last.company.id,+ });+ let exhausted = page.len() < 2;+ seen.extend(page.iter().map(|c| c.company.id));+ if exhausted {+ break;+ }+ }++ assert_eq!(+ seen, expected,+ "tied timestamps must paginate by id without skipping or repeating across the boundary"+ );+ Ok(())+}+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]async fn list_contacts_returns_visible_ordered_alphabetically(pool: PgPool) -> anyhow::Result<()> {let team_id = Uuid::now_v7();diff --git a/rust/cloud-storage/soup/src/domain/models.rs b/rust/cloud-storage/soup/src/domain/models.rsindex 3513032539..9c789bb479 100644--- a/rust/cloud-storage/soup/src/domain/models.rs+++ b/rust/cloud-storage/soup/src/domain/models.rs@@ -7,7 +7,7 @@ pub use grouping::{use call::domain::models::GetCallRecordsRequest;use comms::domain::models::GetChannelsRequest;-use crm::domain::companies_repo::CrmCompanyListSort;+use crm::domain::companies_repo::{CrmCompanyListSort, CrmCompanySoupCursor};use email::domain::models::{GetEmailsRequest, PreviewView};use entity_access::domain::models::{EntityAccessReceipt, MemberTeamRole};use filter_ast::Expr;@@ -367,16 +367,31 @@ impl SoupRequest<Option<EntityFilterAst>> {}).ok()?;- let (sort_method, filter_ast): (SimpleSortMethod, Option<&EntityFilterAst>) =- match &self.cursor {- SoupQuery::Simple(SimpleQueryInner(Query::Sort(t, f))) => (*t, f.as_ref()),- SoupQuery::Simple(SimpleQueryInner(Query::Cursor(CursorWithValAndFilter {- val,- filter,- ..- }))) => (val.sort_type, filter.as_ref()),- SoupQuery::Frecency(_) => return None,- };+ // Follow-up pages carry a keyset cursor (sort_ts + id of the+ // previous page's last row); the first page has none. Without+ // this the CRM sub-query always returned offset 0, so every+ // page re-served the same top companies.+ let (sort_method, filter_ast, cursor): (+ SimpleSortMethod,+ Option<&EntityFilterAst>,+ Option<CrmCompanySoupCursor>,+ ) = match &self.cursor {+ SoupQuery::Simple(SimpleQueryInner(Query::Sort(t, f))) => (*t, f.as_ref(), None),+ SoupQuery::Simple(SimpleQueryInner(Query::Cursor(CursorWithValAndFilter {+ id,+ val,+ filter,+ ..+ }))) => (+ val.sort_type,+ filter.as_ref(),+ Some(CrmCompanySoupCursor {+ last_sort_ts: val.last_val,+ last_id: *id,+ }),+ ),+ SoupQuery::Frecency(_) => return None,+ };// No viewed_at signal for crm_company yet — ViewedAt/ViewedUpdated// fall back to updated_at.@@ -400,6 +415,7 @@ impl SoupRequest<Option<EntityFilterAst>> {team_id,company_ids,sort,+ cursor,// Match the soup paginator's bounds so the CRM layer doesn't// overfetch on an oversized client limit.limit: self.limit.clamp(20, 500) as i64,@@ -481,6 +497,8 @@ pub struct GetCrmCompaniesRequest {pub company_ids: Vec<Uuid>,/// Which timestamp column to sort by.pub sort: CrmCompanyListSort,+ /// Keyset cursor to seek past the previous page (`None` = first page).+ pub cursor: Option<CrmCompanySoupCursor>,/// Upper bound on rows returned — the soup paginator re-slices.pub limit: i64,}diff --git a/rust/cloud-storage/soup/src/domain/service.rs b/rust/cloud-storage/soup/src/domain/service.rsindex d437be846a..177fe97841 100644--- a/rust/cloud-storage/soup/src/domain/service.rs+++ b/rust/cloud-storage/soup/src/domain/service.rs@@ -412,12 +412,13 @@ whereteam_id,company_ids,sort,+ cursor,limit,} = req;Ok(Either::Right(self.crm_service- .list_companies_for_soup(&team_id, &company_ids, sort, limit)+ .list_companies_for_soup(&team_id, &company_ids, sort, cursor, limit).await.map_err(|_| SoupErr::CrmErr)?.into_iter()