:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(warehouse-sources): add eight tables to the close source (#102946)
Tom Owers1c37d8d97503
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.mdindex 0f97f44f4dd5..eba6b3d7223c 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md@@ -1633,21 +1633,21 @@ Note: Endpoint list taken from the API doc index navigation. Excluded /register,## Close — gaps-Today (10): `Activities`, `Contacts`, `EmailTemplates`, `LeadStatuses`, `Leads`, `Opportunities`, `OpportunityStatuses`, `Pipelines`, `Tasks`, `Users`+Today (18): `Activities`, `ActivityCustomFields`, `ContactCustomFields`, `Contacts`, `EmailTemplates`, `Events`, `LeadCustomFields`, `LeadStatuses`, `Leads`, `Opportunities`, `OpportunityCustomFields`, `OpportunityStatuses`, `Organizations`, `Outcomes`, `Pipelines`, `SharedCustomFields`, `Tasks`, `Users`Diffed against: <https://api.close.com/api/openapi.json>-- [ ] `/custom_field/lead/, /custom_field/contact/, /custom_field/opportunity/, /custom_field/activity/, /custom_field/shared/ (+ /custom_field_schema/{object_type}/)` — Lookup that resolves the opaque custom.cf\_\* field IDs already embedded in the synced Leads, Contacts and Opportunities rows - without it those columns are unreadable (high)-- [ ] `/event/` — Event log: full per-object change history (field-level old/new values) for leads, opportunities and tasks; note Close caps it near 30 days of retention so it must be appended incrementally (high)+- [x] `/custom_field/lead/, /custom_field/contact/, /custom_field/opportunity/, /custom_field/activity/, /custom_field/shared/ (+ /custom_field_schema/{object_type}/)` — Lookup that resolves the opaque custom.cf\_\* field IDs already embedded in the synced Leads, Contacts and Opportunities rows - without it those columns are unreadable (high)+- [x] `/event/` — Event log: full per-object change history (field-level old/new values) for leads, opportunities and tasks; note Close caps it near 30 days of retention so it must be appended incrementally (high)- [ ] `/sequence/ and /sequence_subscription/` — Outbound sequence definitions plus per-contact enrollment state, the core outbound-motion analysis Close users want (medium)- [ ] `/custom_object_type/ and /custom_object/` — Custom object instances plus their type definitions - the only way to query org-specific objects modeled outside leads/opportunities (medium)-- [ ] `/outcome/` — Call outcome lookup that resolves the outcome IDs carried on call activities we already sync (medium)-- [ ] `/organization/{id}/` — Org record including memberships, resolving which users belong to which organization and with what role (medium)+- [x] `/outcome/` — Call outcome lookup that resolves the outcome IDs carried on call activities we already sync (medium)+- [x] `/organization/{id}/` — Org record including memberships, resolving which users belong to which organization and with what role (medium)- [ ] `/group/ and /role/` — User groups and permission roles - the grouping dimensions for slicing the Users table in rep-performance reporting (medium)- [ ] `/comment/ and /comment_thread/` — Internal collaboration volume on leads and opportunities (low)- [ ] `/form/` — Form definitions that resolve the form IDs on FormSubmission activities (low)-Note: Close ships a real OpenAPI 3 spec at https://api.close.com/api/openapi.json (135 GET paths); the source dir already documents it in close/api_inventory.md. The existing `Activities` table syncs the polymorphic /activity/ endpoint, so per-type activity endpoints (calls, emails, notes, SMS, meetings, lead/opportunity status changes) are already covered by it - I did not count them as gaps. Stage/status history is therefore available today via /activity/status_change/\*.+Note: `/custom_field_schema/{object_type}/` was skipped while ticking the custom fields line: it is a single-object read per object type whose `fields` array is the same rows the per-type `/custom_field/{object_type}/` tables now carry, ordered for display. Close ships a real OpenAPI 3 spec at https://api.close.com/api/openapi.json (135 GET paths); the source dir already documents it in close/api_inventory.md. The existing `Activities` table syncs the polymorphic /activity/ endpoint, so per-type activity endpoints (calls, emails, notes, SMS, meetings, lead/opportunity status changes) are already covered by it - I did not count them as gaps. Stage/status history is therefore available today via /activity/status_change/\*.## Cloudbeds — **thin**diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/close/api_inventory.md b/products/warehouse_sources/backend/temporal/data_imports/sources/close/api_inventory.mdindex a97ebc2b8740..59c7ed6f9284 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/close/api_inventory.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/close/api_inventory.md@@ -12,9 +12,11 @@ Spec: <https://api.close.com/api/openapi.json> (version 1.0.0).- Most list endpoints use offset pagination: `_skip` (offset) + `_limit` (default 100).Response body: `{"data": [...], "has_more": <bool>}`.-- Some small dimension endpoints (`/status/lead/`, `/status/opportunity/`, `/pipeline/`) return all- rows in one response with no pagination params; they may omit `has_more`. The paginator treats a- missing/false `has_more` as the last page.+- Some small dimension endpoints (`/status/lead/`, `/status/opportunity/`, `/pipeline/`,+ `/custom_field/shared/`) return all rows in one response with no pagination params; they may omit+ `has_more`. The paginator treats a missing/false `has_more` as the last page.+- The event log (`/event/`) rejects `_skip` entirely. It pages with `_cursor` and returns the next+ cursor as `cursor_next` (null on the last page) — see below.- Close caps `_skip` per resource. Every endpoint except Leads and Contacts exposes a server-sidedate filter (or is a single-page dimension table), so an incremental sync never accumulates adeep enough offset to reach the cap.@@ -52,27 +54,50 @@ Notes:Only endpoints with a genuine server-side timestamp filter get `supports_incremental=True`:-| Endpoint | Path | Offset pag | Server-side date filter | `_order_by` | Incremental |-| --------------- | ---------------------- | ---------- | --------------------------------------------------- | ----------- | ----------------------------- |-| Activities | `/activity/` | yes | `date_created__gte/lte/gt/lt` | yes | date_created |-| Opportunities | `/opportunity/` | yes | `date_created__*`, `date_updated__*`, `date_won__*` | yes | date_created (+ date_updated) |-| Tasks | `/task/` | yes | `date_created__*`, `date_updated__*`, `date__*` | yes | date_created (+ date_updated) |-| Leads | `/data/search/` | keyset | `date_created`, `date_updated` (Advanced Filtering) | sort | date_created (+ date_updated) |-| Contacts | `/data/search/` | keyset | `date_created`, `date_updated` (Advanced Filtering) | sort | date_created (+ date_updated) |-| Users | `/user/` | yes | none | yes | full refresh |-| Lead statuses | `/status/lead/` | no | none | no | full refresh |-| Opp. statuses | `/status/opportunity/` | no | none | no | full refresh |-| Pipelines | `/pipeline/` | no | none | no | full refresh |-| Email templates | `/email_template/` | yes | none | no | full refresh |+| Endpoint | Path | Offset pag | Server-side date filter | `_order_by` | Incremental |+| ----------------- | ------------------------------ | ---------- | --------------------------------------------------- | ----------- | ----------------------------- |+| Activities | `/activity/` | yes | `date_created__gte/lte/gt/lt` | yes | date_created |+| Opportunities | `/opportunity/` | yes | `date_created__*`, `date_updated__*`, `date_won__*` | yes | date_created (+ date_updated) |+| Tasks | `/task/` | yes | `date_created__*`, `date_updated__*`, `date__*` | yes | date_created (+ date_updated) |+| Leads | `/data/search/` | keyset | `date_created`, `date_updated` (Advanced Filtering) | sort | date_created (+ date_updated) |+| Contacts | `/data/search/` | keyset | `date_created`, `date_updated` (Advanced Filtering) | sort | date_created (+ date_updated) |+| Events | `/event/` | cursor | `date_updated__gt/gte/lt/lte` | no | date_updated |+| Users | `/user/` | yes | none | yes | full refresh |+| Lead statuses | `/status/lead/` | no | none | no | full refresh |+| Opp. statuses | `/status/opportunity/` | no | none | no | full refresh |+| Pipelines | `/pipeline/` | no | none | no | full refresh |+| Email templates | `/email_template/` | yes | none | no | full refresh |+| Outcomes | `/outcome/` | yes | none | no | full refresh |+| Organizations | `/organization/{id}/` | n/a | none | no | full refresh |+| Custom fields | `/custom_field/{object_type}/` | yes | none | no | full refresh |+| Shared cust. flds | `/custom_field/shared/` | no | none | no | full refresh |Notes:- The plain `GET /lead/` and `GET /contact/` list endpoints expose **no** `date_*` filter param(only `_skip`/`_limit`/`_fields`, plus `lead_id` on contacts). Both resources go throughAdvanced Filtering instead, which is also how Airbyte reaches a `date_updated` cursor for leads.-- The Event Log (`/event/`) does support `date_updated__gte` but is capped to ~30 days of history and- has consolidation/ordering caveats, so it is intentionally left out of v1; it can be added later as- an append-only stream.+- Organizations has no list endpoint. `/me/` returns the organizations the API key belongs to, and+ each one is then read from `/organization/{id}/`. The default response already carries+ `memberships` with `user_*` fields, so no `_expand` is needed.+- Custom field definitions are what resolve the opaque `custom.cf_*` keys on synced leads, contacts+ and opportunities. `/custom_field_schema/{object_type}/` is deliberately not synced: it is a+ single-object read per object type whose `fields` array is the same rows the per-type+ `/custom_field/{object_type}/` tables already carry, ordered for display.++## Event log (`/event/`)++- Retention is about 30 days, so the table is a rolling window rather than full history.+- Rows arrive newest-first and there is no sort param, hence `sort_mode="desc"`. The pipeline only+ commits the watermark once a descending run finishes.+- Pagination is `_cursor` + `cursor_next`; `_limit` is capped at and defaults to 50.+- Close documents that a cursor request must re-send every other filter **except** `date_updated`,+ so `date_updated__gte` only bounds the first request. Later pages would walk back through the+ whole retention window, so `CloseEventCursorPaginator` stops as soon as an entire page predates+ the watermark.+- Events are consolidated: repeated updates to one object reuse the event, moving `date_updated`+ forward while `date_created` stays put. Merging on `id` is therefore correct, and `date_created`+ stays a stable partition key.## Primary keys & partition keysdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/close/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/close/canonical_descriptions.pyindex f9c0972a71ff..7dcc33260a55 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/close/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/close/canonical_descriptions.py@@ -7,6 +7,7 @@ Sourced from the official Close API reference (https://developer.close.com/) andfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (CanonicalDescriptions,+ CanonicalEndpoint,)# Fields shared by most Close objects; merged into each entry so we don't repeat them.@@ -22,6 +23,32 @@ def _columns(**overrides: str) -> dict[str, str]:return {**_COMMON_COLUMNS, **overrides}+# Custom field definitions share one shape across every object type they attach to.+def _custom_field_columns(**overrides: str) -> dict[str, str]:+ return _columns(+ name="The custom field's name, as shown in Close.",+ description="Free-form description of the custom field.",+ type="Data type of the field, for example text, number, date or user.",+ choices="Allowed values, for a choices field.",+ accepts_multiple_values="Whether the field can hold more than one value.",+ editable_with_roles="Roles allowed to edit the field. Empty means every role can.",+ created_by="ID of the user who created the custom field.",+ updated_by="ID of the user who last updated the custom field.",+ **overrides,+ )+++def _custom_field_table(object_type: str, table: str) -> CanonicalEndpoint:+ return {+ "description": (+ f"A {object_type} custom field definition. Resolves the opaque custom.cf_* keys "+ f"carried on the {table} rows."+ ),+ "docs_url": f"https://developer.close.com/api/resources/custom-fields/custom-fields-{object_type}/",+ "columns": _custom_field_columns(),+ }++CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"Leads": {"description": "A lead — a company or person being sold to, the central CRM record in Close.",@@ -140,4 +167,65 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {created_by="ID of the user who created the template.",),},+ "Events": {+ "description": (+ "An event log entry — one change to a Close object, with the fields that changed and "+ "their previous values. Close keeps about 30 days of history."+ ),+ "docs_url": "https://developer.close.com/api/resources/events/",+ "columns": _columns(+ date_updated=(+ "Time at which the event was last updated. Close consolidates repeated updates to "+ "the same object into one event, which moves this forward while date_created stays put."+ ),+ object_type="Type of the object the event is about, for example lead or activity.email.",+ object_id="ID of the object the event is about.",+ lead_id="ID of the related lead, or null when the event is not tied to one.",+ action="What happened to the object, for example created, updated or deleted.",+ changed_fields="Names of the fields an update event changed.",+ data="The affected object as the API would return it. Null for delete events.",+ previous_data="Previous values of the changed fields. All attributes for a delete event.",+ user_id="ID of the user whose action generated the event, or null.",+ api_key_id="ID of the API key that generated the event, or null.",+ request_id="Identifier shared by every event from the same request.",+ meta="Extra context for certain event types, such as the bulk action or merge ids.",+ ),+ },+ "Outcomes": {+ "description": "A call or meeting outcome — the standardized result a rep picks when logging one.",+ "docs_url": "https://developer.close.com/api/resources/outcomes/",+ "columns": _columns(+ name="The outcome's name.",+ description="Free-form description of the outcome.",+ type="Whether the outcome is a custom one or the built-in voicemail-dropped outcome.",+ applies_to="Activity types the outcome can be applied to: calls, meetings, or both.",+ created_by="ID of the user who created the outcome.",+ updated_by="ID of the user who last updated the outcome.",+ ),+ },+ "Organizations": {+ "description": "The Close organization — the environment a team works in, with its memberships.",+ "docs_url": "https://developer.close.com/api/resources/organizations/",+ "columns": _columns(+ name="The organization's name.",+ memberships="Active members of the organization, each with their user and role ids.",+ inactive_memberships="Members who no longer have access to the organization.",+ lead_statuses="Lead statuses configured in the organization.",+ created_by="ID of the user who created the organization.",+ ),+ },+ "LeadCustomFields": _custom_field_table("lead", "Leads"),+ "ContactCustomFields": _custom_field_table("contact", "Contacts"),+ "OpportunityCustomFields": _custom_field_table("opportunity", "Opportunities"),+ "ActivityCustomFields": _custom_field_table("activity", "Activities"),+ "SharedCustomFields": {+ "description": (+ "A custom field definition usable on more than one object type. Resolves the "+ "custom.cf_* keys on the objects it is associated with."+ ),+ "docs_url": "https://developer.close.com/api/resources/custom-fields/custom-fields-shared/",+ "columns": _custom_field_columns(+ associations="Object types the field can be used on, and whether it is required on each.",+ ),+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/close/close.py b/products/warehouse_sources/backend/temporal/data_imports/sources/close/close.pyindex aaecac5bdcdb..a2e76670e3d7 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/close/close.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/close/close.py@@ -1,12 +1,14 @@import base64-import dataclassesfrom collections.abc import Iteratorfrom datetime import UTC, date, datetimefrom typing import Any, Optionalfrom dateutil import parser-from requests import Response, Session+from requests import Request, Response, Sessionfrom structlog.types import FilteringBoundLogger+from urllib3.util.retry import Retry++from posthog.dataclasses import frozenfrom products.warehouse_sources.backend.temporal.data_imports.sources.close.search import (ALL_CUSTOM_FIELDS_SELECTOR,@@ -25,6 +27,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.resrest_api_resource,)from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.paginators import (+ BasePaginator,OffsetPaginator,SinglePagePaginator,)@@ -37,6 +40,9 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.typCLOSE_BASE_URL = "https://api.close.com/api/v1"PAGE_LIMIT = 100+# Close caps the event log's `_limit` at 50 and defaults to it.+EVENT_PAGE_LIMIT = 50+REQUEST_TIMEOUT_SECONDS = 30# Far-past cutoff used on the first incremental sync (no stored watermark yet) so we# pull the full history before the cursor takes over on subsequent runs.INITIAL_INCREMENTAL_VALUE = "1970-01-01T00:00:00+00:00"@@ -49,9 +55,11 @@ INITIAL_INCREMENTAL_VALUE = "1970-01-01T00:00:00+00:00"CLOSE_RETRY = DEFAULT_RETRY.new(allowed_methods=frozenset(DEFAULT_RETRY.allowed_methods or ()) | {"POST"})+@frozenclass CloseResumeConfig:next_skip: int = 0+ # Event log walk: the `cursor_next` the next page starts from.+ next_cursor: Optional[str] = None# Advanced Filtering walk (Leads/Contacts): the last cursor-field value already emitted.search_anchor: Optional[str] = Nonesearch_cursor_field: Optional[str] = None@@ -74,6 +82,20 @@ def _format_close_datetime(value: Any) -> str:return dt.astimezone(UTC).isoformat()+def _parse_close_datetime(value: Any) -> Optional[datetime]:+ """Parse a Close timestamp into a UTC-aware datetime, or None when it isn't one."""+ if isinstance(value, datetime):+ dt = value+ elif isinstance(value, str) and value:+ try:+ dt = parser.parse(value)+ except (ValueError, OverflowError):+ return None+ else:+ return None+ return dt.replace(tzinfo=UTC) if dt.tzinfo is None else dt.astimezone(UTC)++class CloseOffsetPaginator(OffsetPaginator):"""Offset paginator driven by Close's `has_more` response flag.@@ -122,10 +144,80 @@ class CloseOffsetPaginator(OffsetPaginator):self._has_next_page = True+class CloseEventCursorPaginator(BasePaginator):+ """Cursor paginator for Close's event log.++ `/event/` rejects `_skip`: it pages with `_cursor` and hands back the next cursor as+ `cursor_next`. Close documents that a cursor request must re-send every other filter+ *except* `date_updated`, so an incremental window only bounds the first request and later+ pages walk back through history unbounded. Events arrive newest-first, so once a whole page+ predates the watermark everything behind it has already been synced and we stop.+ """++ def __init__(self, stop_when_older_than: Optional[datetime] = None) -> None:+ super().__init__()+ self._cursor: Optional[str] = None+ self._stop_when_older_than = stop_when_older_than++ def init_request(self, request: Request) -> None:+ # Only set when resuming a part-walked run; a fresh run starts at the newest event.+ if self._cursor is not None:+ self._apply_cursor(request)++ def update_state(self, response: Response, data: Optional[list[Any]] = None) -> None:+ if not data:+ self._cursor = None+ self._has_next_page = False+ return++ try:+ body = response.json()+ except ValueError:+ body = None+ cursor = body.get("cursor_next") if isinstance(body, dict) else None+ next_cursor = cursor if isinstance(cursor, str) and cursor else None+ if next_cursor is not None and next_cursor == self._cursor:+ # Following it again would re-request the same page for as long as the activity runs.+ raise ValueError("Close returned the same event cursor twice")+ self._cursor = next_cursor+ self._has_next_page = self._cursor is not None++ if self._has_next_page and self._stop_when_older_than is not None:+ timestamps = [+ parsed+ for parsed in (_parse_close_datetime(row.get("date_updated")) for row in data if isinstance(row, dict))+ if parsed is not None+ ]+ if len(timestamps) == len(data) and max(timestamps) < self._stop_when_older_than:+ self._has_next_page = False++ def update_request(self, request: Request) -> None:+ if self._cursor is not None:+ self._apply_cursor(request)++ def _apply_cursor(self, request: Request) -> None:+ if request.params is None:+ request.params = {}+ request.params.pop("date_updated__gte", None)+ request.params["_cursor"] = self._cursor++ def get_resume_state(self) -> Optional[dict[str, Any]]:+ if self._has_next_page and self._cursor is not None:+ return {"cursor": self._cursor}+ return None++ def set_resume_state(self, state: dict[str, Any]) -> None:+ cursor = state.get("cursor")+ if cursor:+ self._cursor = str(cursor)+ self._has_next_page = True++def get_resource(endpoint: str,should_use_incremental_field: bool,incremental_field: Optional[str],+ db_incremental_field_last_value: Optional[Any] = None,) -> EndpointResource:config: CloseEndpointConfig = CLOSE_ENDPOINTS[endpoint]@@ -147,15 +239,24 @@ def get_resource(# (matches SourceResponse.sort_mode="asc").params["_order_by"] = cursor+ paginator: Optional[BasePaginator] = None+ # Dimension endpoints that take no `_skip`/`_limit` get a single-page paginator so we don't+ # inject pagination params the API doesn't accept; offset endpoints use the client default.+ if config.pagination == "single_page":+ paginator = SinglePagePaginator()+ elif config.pagination == "event_cursor":+ params["_limit"] = EVENT_PAGE_LIMIT+ paginator = CloseEventCursorPaginator(+ stop_when_older_than=_parse_close_datetime(db_incremental_field_last_value) if is_incremental else None+ )+endpoint_def: Endpoint = {"data_selector": config.data_selector,"path": config.path,"params": params,}- # Dimension endpoints that take no `_skip`/`_limit` get a single-page paginator so we don't- # inject pagination params the API doesn't accept; everything else uses the client default.- if not config.paginated:- endpoint_def["paginator"] = SinglePagePaginator()+ if paginator is not None:+ endpoint_def["paginator"] = paginatorreturn {"name": config.name,@@ -167,10 +268,10 @@ def get_resource(}-def _make_search_session(api_key: str) -> Session:+def _make_session(api_key: str, retry: Optional[Retry] = None) -> Session:basic_token = base64.b64encode(f"{api_key}:".encode("ascii")).decode("ascii")return make_tracked_session(- retry=CLOSE_RETRY,+ retry=retry,headers={"Authorization": f"Basic {basic_token}"},redact_values=(api_key, basic_token),)@@ -220,7 +321,7 @@ def close_search_source(resumable_source_manager.save_state(CloseResumeConfig(search_anchor=anchor, search_cursor_field=cursor_field))def items() -> Iterator[list[dict[str, Any]]]:- session = _make_search_session(api_key)+ session = _make_session(api_key, retry=CLOSE_RETRY)# One `custom` selector pulls every custom field, so the field list stays bounded no# matter how many an org has. See ALL_CUSTOM_FIELDS_SELECTOR.fields = [*config.search_fields, ALL_CUSTOM_FIELDS_SELECTOR]@@ -248,6 +349,55 @@ def close_search_source()+def _organization_ids(me: dict[str, Any]) -> list[str]:+ """Collect the organization ids this API key can read, in the order Close lists them."""+ ids = [+ organization["id"]+ for organization in me.get("organizations") or []+ if isinstance(organization, dict) and organization.get("id")+ ]+ ids += [+ membership["organization_id"]+ for membership in me.get("memberships") or []+ if isinstance(membership, dict) and membership.get("organization_id")+ ]+ return list(dict.fromkeys(ids))+++def close_organizations_source(api_key: str, endpoint: str) -> SourceResponse:+ """Read every organization the API key belongs to.++ Close publishes no `/organization/` list endpoint, so `/me/` supplies the ids and each+ organization is fetched on its own.+ """+ config = CLOSE_ENDPOINTS[endpoint]++ def items() -> Iterator[list[dict[str, Any]]]:+ session = _make_session(api_key)+ me_response = session.get(f"{CLOSE_BASE_URL}/me/", timeout=REQUEST_TIMEOUT_SECONDS)+ me_response.raise_for_status()+ me = me_response.json()++ rows: list[dict[str, Any]] = []+ for organization_id in _organization_ids(me if isinstance(me, dict) else {}):+ response = session.get(f"{CLOSE_BASE_URL}/organization/{organization_id}/", timeout=REQUEST_TIMEOUT_SECONDS)+ response.raise_for_status()+ organization = response.json()+ if isinstance(organization, dict):+ rows.append(organization)++ if rows:+ yield rows++ return SourceResponse(+ name=endpoint,+ items=items,+ primary_keys=config.primary_keys,+ partition_count=1,+ partition_size=1,+ )++def close_source(api_key: str,endpoint: str,@@ -259,7 +409,9 @@ def close_source(should_use_incremental_field: bool = False,incremental_field: Optional[str] = None,) -> SourceResponse:- if CLOSE_ENDPOINTS[endpoint].search_object_type is not None:+ endpoint_config = CLOSE_ENDPOINTS[endpoint]++ if endpoint_config.search_object_type is not None:return close_search_source(api_key=api_key,endpoint=endpoint,@@ -270,6 +422,9 @@ def close_source(incremental_field=incremental_field,)+ if endpoint_config.fan_out_from_me:+ return close_organizations_source(api_key=api_key, endpoint=endpoint)+config: RESTAPIConfig = {"client": {"base_url": CLOSE_BASE_URL,@@ -283,18 +438,28 @@ def close_source(# Write disposition is set per-resource in get_resource (it always wins over# resource_defaults), so no default is needed here."resource_defaults": {},- "resources": [get_resource(endpoint, should_use_incremental_field, incremental_field)],+ "resources": [+ get_resource(endpoint, should_use_incremental_field, incremental_field, db_incremental_field_last_value)+ ],}initial_paginator_state: Optional[dict[str, Any]] = Noneif resumable_source_manager.can_resume():resume_config = resumable_source_manager.load_state()if resume_config is not None:- initial_paginator_state = {"skip": resume_config.next_skip}+ if endpoint_config.pagination == "event_cursor":+ if resume_config.next_cursor is not None:+ initial_paginator_state = {"cursor": resume_config.next_cursor}+ else:+ initial_paginator_state = {"skip": resume_config.next_skip}def save_checkpoint(state: Optional[dict[str, Any]]) -> None:# Persist only when there's a next page to resume to. Redis TTL handles cleanup on completion.- if state and state.get("skip") is not None:+ if not state:+ return+ if state.get("cursor") is not None:+ resumable_source_manager.save_state(CloseResumeConfig(next_cursor=str(state["cursor"])))+ elif state.get("skip") is not None:resumable_source_manager.save_state(CloseResumeConfig(next_skip=int(state["skip"])))resource = rest_api_resource(@@ -306,8 +471,6 @@ def close_source(initial_paginator_state=initial_paginator_state,)- endpoint_config = CLOSE_ENDPOINTS[endpoint]-return SourceResponse(name=endpoint,items=lambda: resource,@@ -317,6 +480,7 @@ def close_source(partition_mode="datetime" if endpoint_config.partition_key else None,partition_format="month" if endpoint_config.partition_key else None,partition_keys=[endpoint_config.partition_key] if endpoint_config.partition_key else None,+ sort_mode=endpoint_config.sort_mode,)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/close/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/close/settings.pyindex 8833db57d832..57aa497c70e3 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/close/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/close/settings.py@@ -1,6 +1,9 @@-from dataclasses import dataclass, field-from typing import Optional+from dataclasses import field+from typing import Literal, Optional+from posthog.dataclasses import frozen++from products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SortModefrom products.warehouse_sources.backend.types import IncrementalField, IncrementalFieldType@@ -60,7 +63,14 @@ CONTACT_SEARCH_FIELDS = []-@dataclass+# How an endpoint pages. "offset" is Close's usual `_skip`/`_limit`. A few small dimension+# endpoints (lead/opportunity statuses, pipelines, shared custom fields) return every row in one+# response and take no pagination params ("single_page"). The event log rejects `_skip` entirely+# and pages with `_cursor`/`cursor_next` ("event_cursor"). See api_inventory.md.+PaginationStyle = Literal["offset", "single_page", "event_cursor"]+++@frozenclass CloseEndpointConfig:name: strpath: str@@ -74,10 +84,12 @@ class CloseEndpointConfig:# Whether the list endpoint accepts the `_order_by` query param (needed to force# ascending order for incremental cursor advancement).supports_order_by: bool = False- # Whether the endpoint uses `_skip`/`_limit` offset pagination. A few small dimension- # endpoints (lead/opportunity statuses, pipelines) return every row in one response and- # take no pagination params, so they use a single-page paginator instead (see api_inventory.md).- paginated: bool = True+ pagination: PaginationStyle = "offset"+ # Order rows arrive in. Only the event log is descending, and it offers no sort param.+ sort_mode: SortMode = "asc"+ # `/organization/{id}/` has no list counterpart, so the organization ids come from `/me/`+ # and each organization is fetched on its own (see close.py).+ fan_out_from_me: bool = False# Advanced Filtering object type. Set only for the two resources whose list endpoints expose# no date filter at all, so offset pagination is the only option and Close's `_skip` cap# eventually truncates the table (see api_inventory.md).@@ -141,25 +153,72 @@ CLOSE_ENDPOINTS: dict[str, CloseEndpointConfig] = {name="LeadStatuses",path="/status/lead/",table_name="lead_statuses",- paginated=False,+ pagination="single_page",),"OpportunityStatuses": CloseEndpointConfig(name="OpportunityStatuses",path="/status/opportunity/",table_name="opportunity_statuses",- paginated=False,+ pagination="single_page",),"Pipelines": CloseEndpointConfig(name="Pipelines",path="/pipeline/",table_name="pipelines",- paginated=False,+ pagination="single_page",),"EmailTemplates": CloseEndpointConfig(name="EmailTemplates",path="/email_template/",table_name="email_templates",),+ "Events": CloseEndpointConfig(+ name="Events",+ path="/event/",+ table_name="events",+ incremental_fields=[_date_incremental_field("date_updated")],+ partition_key="date_created",+ pagination="event_cursor",+ sort_mode="desc",+ ),+ "Outcomes": CloseEndpointConfig(+ name="Outcomes",+ path="/outcome/",+ table_name="outcomes",+ ),+ "Organizations": CloseEndpointConfig(+ name="Organizations",+ path="/organization/{id}/",+ table_name="organizations",+ pagination="single_page",+ fan_out_from_me=True,+ ),+ "LeadCustomFields": CloseEndpointConfig(+ name="LeadCustomFields",+ path="/custom_field/lead/",+ table_name="lead_custom_fields",+ ),+ "ContactCustomFields": CloseEndpointConfig(+ name="ContactCustomFields",+ path="/custom_field/contact/",+ table_name="contact_custom_fields",+ ),+ "OpportunityCustomFields": CloseEndpointConfig(+ name="OpportunityCustomFields",+ path="/custom_field/opportunity/",+ table_name="opportunity_custom_fields",+ ),+ "ActivityCustomFields": CloseEndpointConfig(+ name="ActivityCustomFields",+ path="/custom_field/activity/",+ table_name="activity_custom_fields",+ ),+ "SharedCustomFields": CloseEndpointConfig(+ name="SharedCustomFields",+ path="/custom_field/shared/",+ table_name="shared_custom_fields",+ pagination="single_page",+ ),}ENDPOINTS = tuple(CLOSE_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close.py b/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close.pyindex 0daa4589b0b4..4cbfa0ba3a0c 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close.py@@ -10,9 +10,12 @@ from requests import Request, Responsefrom products.warehouse_sources.backend.temporal.data_imports.sources.close.close import (INITIAL_INCREMENTAL_VALUE,+ CloseEventCursorPaginator,CloseOffsetPaginator,CloseResumeConfig,_format_close_datetime,+ _organization_ids,+ close_organizations_source,close_source,get_resource,validate_credentials,@@ -140,6 +143,13 @@ class TestGetResource:("OpportunityStatuses", "opportunity_statuses"),("Pipelines", "pipelines"),("EmailTemplates", "email_templates"),+ ("Events", "events"),+ ("Outcomes", "outcomes"),+ ("LeadCustomFields", "lead_custom_fields"),+ ("ContactCustomFields", "contact_custom_fields"),+ ("OpportunityCustomFields", "opportunity_custom_fields"),+ ("ActivityCustomFields", "activity_custom_fields"),+ ("SharedCustomFields", "shared_custom_fields"),],)def test_table_name_and_primary_key(self, endpoint: str, table_name: str) -> None:@@ -148,7 +158,9 @@ class TestGetResource:assert resource["primary_key"] == ["id"]assert _endpoint(resource)["data_selector"] == "data"- @pytest.mark.parametrize("endpoint", ["Users", "Pipelines", "EmailTemplates"])+ @pytest.mark.parametrize(+ "endpoint", ["Users", "Pipelines", "EmailTemplates", "Outcomes", "LeadCustomFields", "SharedCustomFields"]+ )def test_full_refresh_endpoints_never_incremental(self, endpoint: str) -> None:# Even when the user enables incremental, endpoints with no server-side date filter# stay on full replace and emit no `__gte` param.@@ -177,20 +189,29 @@ class TestGetResource:assert resource["write_disposition"] == "replace"assert not any(key.endswith("__gte") for key in _params(resource))- @pytest.mark.parametrize("endpoint", ["LeadStatuses", "OpportunityStatuses", "Pipelines"])+ @pytest.mark.parametrize("endpoint", ["LeadStatuses", "OpportunityStatuses", "Pipelines", "SharedCustomFields"])def test_non_paginated_endpoints_use_single_page_paginator(self, endpoint: str) -> None:# Dimension endpoints that take no `_skip`/`_limit` override the client offset paginator# so we never inject pagination params the API doesn't accept.resource = get_resource(endpoint, should_use_incremental_field=False, incremental_field=None)assert isinstance(_endpoint(resource)["paginator"], SinglePagePaginator)- @pytest.mark.parametrize("endpoint", ["Opportunities", "Activities", "Tasks", "Users", "EmailTemplates"])+ @pytest.mark.parametrize(+ "endpoint", ["Opportunities", "Activities", "Tasks", "Users", "EmailTemplates", "Outcomes", "LeadCustomFields"]+ )def test_paginated_endpoints_inherit_client_paginator(self, endpoint: str) -> None:# Offset-paginated endpoints don't set an endpoint-level paginator, so they fall back to# the client-level CloseOffsetPaginator.resource = get_resource(endpoint, should_use_incremental_field=False, incremental_field=None)assert "paginator" not in _endpoint(resource)+ def test_events_use_the_cursor_paginator_and_capped_limit(self) -> None:+ # `/event/` rejects `_skip`, so it must never inherit the client offset paginator, and+ # Close caps its page size at 50.+ resource = get_resource("Events", should_use_incremental_field=False, incremental_field=None)+ assert isinstance(_endpoint(resource)["paginator"], CloseEventCursorPaginator)+ assert _params(resource)["_limit"] == 50+class TestCloseSourcePartitioning:@pytest.mark.parametrize(@@ -201,9 +222,12 @@ class TestCloseSourcePartitioning:("Opportunities", True),("Activities", True),("Tasks", True),+ ("Events", True),("Users", False),("LeadStatuses", False),("Pipelines", False),+ ("Outcomes", False),+ ("LeadCustomFields", False),],)def test_partition_config(self, endpoint: str, expects_partition: bool) -> None:@@ -359,6 +383,232 @@ class TestCloseSourceResumeBehavior:assert sent_params[0]["date_updated__gte"] == "2024-06-01T12:00:00+00:00"+ def test_events_window_only_the_first_request_then_page_by_cursor(self) -> None:+ manager = MagicMock(spec=ResumableSourceManager)+ manager.can_resume.return_value = False++ responses = [+ _make_http_response(+ {"data": [{"id": "ev_2", "date_updated": "2024-06-05T00:00:00+00:00"}], "cursor_next": "cursor_2"}+ ),+ _make_http_response(+ {"data": [{"id": "ev_1", "date_updated": "2024-06-03T00:00:00+00:00"}], "cursor_next": None}+ ),+ ]+ sent_params = self._drive(+ "Events",+ manager,+ responses,+ should_use_incremental_field=True,+ incremental_field="date_updated",+ db_incremental_field_last_value=datetime(2024, 6, 1, 12, 0, 0, tzinfo=UTC),+ )++ assert sent_params[0]["date_updated__gte"] == "2024-06-01T12:00:00+00:00"+ assert sent_params[0]["_limit"] == 50+ assert "_skip" not in sent_params[0]+ assert sent_params[1]["_cursor"] == "cursor_2"+ assert "date_updated__gte" not in sent_params[1]++ saved = [call.args[0] for call in manager.save_state.call_args_list]+ assert saved == [CloseResumeConfig(next_cursor="cursor_2")]++ def test_events_stop_once_a_page_predates_the_watermark(self) -> None:+ # Without the client-side stop the cursor walk would keep going back through Close's+ # whole retention window on every incremental sync.+ manager = MagicMock(spec=ResumableSourceManager)+ manager.can_resume.return_value = False++ responses = [+ _make_http_response(+ {"data": [{"id": "ev_2", "date_updated": "2024-06-05T00:00:00+00:00"}], "cursor_next": "cursor_2"}+ ),+ _make_http_response(+ {"data": [{"id": "ev_1", "date_updated": "2024-05-20T00:00:00+00:00"}], "cursor_next": "cursor_3"}+ ),+ ]+ sent_params = self._drive(+ "Events",+ manager,+ responses,+ should_use_incremental_field=True,+ incremental_field="date_updated",+ db_incremental_field_last_value=datetime(2024, 6, 1, 12, 0, 0, tzinfo=UTC),+ )++ assert len(sent_params) == 2++ def test_events_resume_seeds_the_saved_cursor(self) -> None:+ manager = MagicMock(spec=ResumableSourceManager)+ manager.can_resume.return_value = True+ manager.load_state.return_value = CloseResumeConfig(next_cursor="cursor_7")++ responses = [+ _make_http_response(+ {"data": [{"id": "ev_9", "date_updated": "2024-06-05T00:00:00+00:00"}], "cursor_next": None}+ )+ ]+ sent_params = self._drive("Events", manager, responses)++ assert sent_params[0]["_cursor"] == "cursor_7"+++class TestCloseEventCursorPaginator:+ @staticmethod+ def _page(rows: list[dict[str, Any]], cursor_next: str | None) -> Response:+ return _make_http_response({"data": rows, "cursor_next": cursor_next})++ def test_follows_cursor_next_and_stops_on_null(self) -> None:+ paginator = CloseEventCursorPaginator()+ rows = [{"id": "ev_1", "date_updated": "2024-06-05T00:00:00+00:00"}]++ paginator.update_state(self._page(rows, "cursor_2"), rows)+ assert paginator.has_next_page is True++ request = Request(method="GET", url="https://api.close.com/api/v1/event/")+ paginator.update_request(request)+ assert request.params["_cursor"] == "cursor_2"++ paginator.update_state(self._page(rows, None), rows)+ assert paginator.has_next_page is False++ def test_empty_page_stops(self) -> None:+ paginator = CloseEventCursorPaginator()+ paginator.update_state(self._page([], "cursor_2"), [])+ assert paginator.has_next_page is False++ @pytest.mark.parametrize(+ ("newest_in_page", "expected_next_page"),+ [+ # Events arrive newest-first, so a page still holding anything at or after the+ # watermark may be followed by more unsynced rows.+ ("2024-06-05T00:00:00+00:00", True),+ ("2024-06-01T12:00:00+00:00", True),+ # A page entirely behind the watermark means everything further back is already+ # synced; walking on would re-fetch the whole retention window every sync.+ ("2024-05-31T23:59:59+00:00", False),+ ],+ )+ def test_stops_once_a_whole_page_predates_the_watermark(+ self, newest_in_page: str, expected_next_page: bool+ ) -> None:+ paginator = CloseEventCursorPaginator(stop_when_older_than=datetime(2024, 6, 1, 12, 0, 0, tzinfo=UTC))+ rows = [+ {"id": "ev_1", "date_updated": newest_in_page},+ {"id": "ev_2", "date_updated": "2024-01-01T00:00:00+00:00"},+ ]++ paginator.update_state(self._page(rows, "cursor_2"), rows)++ assert paginator.has_next_page is expected_next_page++ def test_a_row_we_cannot_date_keeps_the_walk_going(self) -> None:+ # An unparseable timestamp says nothing about whether the page predates the watermark,+ # so stopping on the rows we can read would skip everything behind it.+ paginator = CloseEventCursorPaginator(stop_when_older_than=datetime(2024, 6, 1, 12, 0, 0, tzinfo=UTC))+ rows: list[dict[str, Any]] = [+ {"id": "ev_1", "date_updated": "2024-05-01T00:00:00+00:00"},+ {"id": "ev_2", "date_updated": None},+ ]++ paginator.update_state(self._page(rows, "cursor_2"), rows)++ assert paginator.has_next_page is True++ def test_a_cursor_that_repeats_raises(self) -> None:+ # Following it again would re-request the same page for as long as the activity runs.+ paginator = CloseEventCursorPaginator()+ rows = [{"id": "ev_1", "date_updated": "2024-06-05T00:00:00+00:00"}]+ paginator.update_state(self._page(rows, "cursor_2"), rows)++ with pytest.raises(ValueError, match="same event cursor twice"):+ paginator.update_state(self._page(rows, "cursor_2"), rows)++ def test_walks_on_without_a_watermark(self) -> None:+ paginator = CloseEventCursorPaginator()+ rows = [{"id": "ev_1", "date_updated": "2019-01-01T00:00:00+00:00"}]++ paginator.update_state(self._page(rows, "cursor_2"), rows)++ assert paginator.has_next_page is True++ def test_cursor_request_drops_the_date_filter(self) -> None:+ # Close documents that a cursor request re-sends every filter except `date_updated`.+ paginator = CloseEventCursorPaginator()+ rows = [{"id": "ev_1", "date_updated": "2024-06-05T00:00:00+00:00"}]+ paginator.update_state(self._page(rows, "cursor_2"), rows)++ request = Request(+ method="GET",+ url="https://api.close.com/api/v1/event/",+ params={"date_updated__gte": "2024-06-01T12:00:00+00:00", "_limit": 50},+ )+ paginator.update_request(request)++ assert "date_updated__gte" not in request.params+ assert request.params == {"_limit": 50, "_cursor": "cursor_2"}++ def test_resume_state_round_trip(self) -> None:+ paginator = CloseEventCursorPaginator()+ rows = [{"id": "ev_1", "date_updated": "2024-06-05T00:00:00+00:00"}]+ paginator.update_state(self._page(rows, "cursor_2"), rows)+ assert paginator.get_resume_state() == {"cursor": "cursor_2"}++ resumed = CloseEventCursorPaginator()+ resumed.set_resume_state({"cursor": "cursor_2"})+ request = Request(method="GET", url="https://api.close.com/api/v1/event/")+ resumed.init_request(request)+ assert request.params["_cursor"] == "cursor_2"++ def test_no_resume_state_on_terminal_page(self) -> None:+ paginator = CloseEventCursorPaginator()+ rows = [{"id": "ev_1", "date_updated": "2024-06-05T00:00:00+00:00"}]+ paginator.update_state(self._page(rows, None), rows)+ assert paginator.get_resume_state() is None+++class TestCloseOrganizationsSource:+ @pytest.mark.parametrize(+ ("me", "expected"),+ [+ ({"organizations": [{"id": "orga_1"}]}, ["orga_1"]),+ ({"memberships": [{"organization_id": "orga_1"}]}, ["orga_1"]),+ # `/me/` lists the same org under both keys, and each row must only be fetched once.+ ({"organizations": [{"id": "orga_1"}], "memberships": [{"organization_id": "orga_1"}]}, ["orga_1"]),+ (+ {"organizations": [{"id": "orga_1"}], "memberships": [{"organization_id": "orga_2"}]},+ ["orga_1", "orga_2"],+ ),+ ({}, []),+ ],+ )+ def test_organization_ids(self, me: dict[str, Any], expected: list[str]) -> None:+ assert _organization_ids(me) == expected++ @patch("products.warehouse_sources.backend.temporal.data_imports.sources.close.close._make_session")+ def test_fetches_each_organization_named_by_me(self, mock_make_session: MagicMock) -> None:+ # Close publishes no `/organization/` list endpoint, so a missed `/me/` hop syncs nothing.+ responses: dict[str, dict[str, Any]] = {+ "https://api.close.com/api/v1/me/": {"organizations": [{"id": "orga_1"}, {"id": "orga_2"}]},+ "https://api.close.com/api/v1/organization/orga_1/": {"id": "orga_1", "name": "First"},+ "https://api.close.com/api/v1/organization/orga_2/": {"id": "orga_2", "name": "Second"},+ }+ mock_make_session.return_value.get.side_effect = lambda url, **_: _make_http_response(responses[url])++ response = close_organizations_source(api_key="api_test", endpoint="Organizations")+ batches = list(cast(Iterable[Any], response.items()))++ assert batches == [[{"id": "orga_1", "name": "First"}, {"id": "orga_2", "name": "Second"}]]+ assert response.primary_keys == ["id"]++ @patch("products.warehouse_sources.backend.temporal.data_imports.sources.close.close._make_session")+ def test_yields_nothing_when_me_names_no_organization(self, mock_make_session: MagicMock) -> None:+ mock_make_session.return_value.get.return_value = _make_http_response({"id": "user_1"})++ response = close_organizations_source(api_key="api_test", endpoint="Organizations")++ assert list(cast(Iterable[Any], response.items())) == []+class TestValidateCredentials:@pytest.mark.parametrize(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_search.py b/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_search.pyindex d1c939e10485..023fd02799a1 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_search.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_search.py@@ -275,8 +275,8 @@ class TestSearchSourceWiring:manager.can_resume.return_value = Falsesession = FakeSession([_response({"data": []})])monkeypatch.setattr(- "products.warehouse_sources.backend.temporal.data_imports.sources.close.close._make_search_session",- lambda _api_key: session,+ "products.warehouse_sources.backend.temporal.data_imports.sources.close.close._make_session",+ lambda _api_key, **_kwargs: session,)response = close_source(@@ -299,8 +299,8 @@ class TestSearchSourceWiring:manager.can_resume.return_value = Falsesession = FakeSession([_response({"data": []})])monkeypatch.setattr(- "products.warehouse_sources.backend.temporal.data_imports.sources.close.close._make_search_session",- lambda _api_key: session,+ "products.warehouse_sources.backend.temporal.data_imports.sources.close.close._make_session",+ lambda _api_key, **_kwargs: session,)response = close_search_source(@@ -338,8 +338,8 @@ class TestSearchSourceWiring:manager.can_resume.return_value = Falsesession = FakeSession([_response({"data": []})])monkeypatch.setattr(- "products.warehouse_sources.backend.temporal.data_imports.sources.close.close._make_search_session",- lambda _api_key: session,+ "products.warehouse_sources.backend.temporal.data_imports.sources.close.close._make_session",+ lambda _api_key, **_kwargs: session,)response = close_search_source(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_source.pyindex f457ad05c65a..4b7fb774bb30 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_source.py@@ -6,7 +6,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.close.settfrom products.warehouse_sources.backend.temporal.data_imports.sources.close.source import CloseSourcefrom products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.close import CloseSourceConfig-INCREMENTAL_ENDPOINTS = {"Leads", "Contacts", "Opportunities", "Activities", "Tasks"}+INCREMENTAL_ENDPOINTS = {"Leads", "Contacts", "Opportunities", "Activities", "Tasks", "Events"}class TestCloseSource: