: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(data-warehouse): add gong trackers, scorecard answers and interaction stats (#109932)
Tom Owers3a83092ab8b6
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 1a74f680067f..e51bbb6b9776 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@@ -3726,14 +3726,14 @@ Note: The swagger-ui URL recorded in the source (https://customapi.goldcast.io/s## Gong — gaps-Today (5): `calls`, `calls_extensive`, `scorecards`, `users`, `workspaces`+Today (10): `answered_scorecards`, `calls`, `calls_content`, `calls_extensive`, `interaction_stats`, `scorecards`, `trackers`, `transcripts`, `users`, `workspaces`Diffed against: <https://help.gong.io/llms.txt>-- [ ] `calls/transcript (POST /v2/calls/transcript)` — the actual conversation text - Gong's headline data and the thing most warehouse users want (high)-- [ ] `stats/activity/scorecards` — answered scorecard responses; we currently only sync scorecard definitions, not the reviews (high)-- [ ] `settings/trackers` — lookup resolving the tracker IDs that appear on calls_extensive (high)-- [ ] `stats/interaction` — talk ratio, patience, longest monologue - Gong's signature conversation metrics per user (high)+- [x] `calls/transcript (POST /v2/calls/transcript)` — the actual conversation text - Gong's headline data and the thing most warehouse users want (high)+- [x] `stats/activity/scorecards` — answered scorecard responses; we currently only sync scorecard definitions, not the reviews (high)+- [x] `settings/trackers` — lookup resolving the tracker IDs that appear on calls_extensive (high)+- [x] `stats/interaction` — talk ratio, patience, longest monologue - Gong's signature conversation metrics per user (high)- [ ] `stats/activity/day-by-day` — daily per-rep activity fact table for coaching and adoption reporting (high)- [ ] `call-outcomes` — lookup resolving call outcome values used to segment calls (medium)- [ ] `stats/activity/aggregate-by-period` — pre-aggregated activity by period, cheaper than deriving from raw calls (medium)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/canonical_descriptions.pyindex ce274119a41b..5d5eb4e6f370 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/canonical_descriptions.py@@ -104,6 +104,55 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"updated": "Time at which the scorecard was last updated.",},},+ "trackers": {+ "description": "A keyword tracker — a set of words and phrases Gong looks for in calls. AI trackers are not included.",+ "docs_url": "https://help.gong.io/apidocs/retrieve-tracker-details-v2settingstrackers-1",+ "columns": {+ "trackerId": "Unique identifier for the tracker.",+ "trackerName": "Name of the tracker.",+ "workspaceId": "Identifier of the workspace the tracker belongs to.",+ "languageKeywords": "The words and phrases the tracker looks for, grouped by language, and whether related word forms also count.",+ "affiliation": "Whose speech the tracker counts: Anyone, Company, or NonCompany.",+ "partOfQuestion": "Whether the keywords count only when said as part of a question.",+ "saidAt": "Part of the call the tracker looks at: Anytime, First, or Last.",+ "saidAtInterval": "Length of the part of the call set by `saidAt`, in the unit set by `saidAtUnit`.",+ "saidAtUnit": "Unit of `saidAtInterval`: minutes or a percentage of the call duration.",+ "saidInTopics": "Topics of the call that the tracker looks in.",+ "filterQuery": "JSON filter that selects the calls the tracker applies to.",+ "created": "Time at which the tracker was created.",+ "creatorUserId": "Identifier of the user who created the tracker. Null for built-in trackers.",+ "updated": "Time at which the tracker settings were last updated.",+ "updaterUserId": "Identifier of the user who last updated the tracker. Null for built-in trackers.",+ },+ },+ "answered_scorecards": {+ "description": "A completed scorecard review of a call: the answers a reviewer, or Gong's automatic review, gave to each scorecard question.",+ "docs_url": "https://help.gong.io/apidocs/retrieve-answered-scorecards-for-applicable-reviewed-users-or-scorecards-for-a-date-range-v2statsactivityscorecards",+ "columns": {+ "answeredScorecardId": "Unique identifier for this answered scorecard.",+ "scorecardId": "Identifier of the scorecard that was answered. Joins to `scorecards.scorecardId`.",+ "scorecardName": "Name of the scorecard.",+ "callId": "Identifier of the reviewed call. Joins to `calls.id`.",+ "callStartTime": "Time at which the reviewed call started.",+ "reviewedUserId": "Identifier of the user being reviewed, who hosted the call. Joins to `users.id`.",+ "reviewerUserId": "Identifier of the user who answered the scorecard. Null for automatic reviews.",+ "reviewMethod": "How the scorecard was answered: MANUAL or AUTOMATIC.",+ "editorUserId": "Identifier of the last user to edit the answers. Null when nobody else edited them.",+ "reviewTime": "Time at which the review was completed and published.",+ "visibilityType": "Who can see the review: PUBLIC, PRIVATE, or OPT_IN_USERS.",+ "answers": "The answers, one per question — the question id and revision, whether it is the overall question, the score (1 to 50), the answer text, the selected options, and whether the question was marked not applicable.",+ },+ },+ "interaction_stats": {+ "description": "Conversation metrics for one Gong user over one day, such as longest monologue, interactivity, patience, and question rate.",+ "docs_url": "https://help.gong.io/apidocs/retrieve-interaction-stats-for-applicable-users-by-date-v2statsinteraction",+ "columns": {+ "userId": "Identifier of the user. Joins to `users.id`.",+ "userEmailAddress": "Email address of the user.",+ "day": "Day the stats cover (YYYY-MM-DD, in the company's time zone in Gong).",+ "personInteractionStats": "The stats for that day, each with a `name` and a numeric `value`.",+ },+ },"workspaces": {"description": "A Gong workspace grouping users, calls, and settings.","docs_url": "https://gong.app.gong.io/settings/api/documentation#get-/v2/workspaces",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/gong.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/gong.pyindex 199652f90ecd..246882035ea7 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/gong.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/gong.py@@ -1,3 +1,4 @@+import reimport base64from collections.abc import Iteratorfrom datetime import UTC, date, datetime, timedelta@@ -30,6 +31,11 @@ MAX_WINDOW_DAYS = 90DEFAULT_INITIAL_LOOKBACK_DAYS = 365+# Gong answers a date window with nothing in it using a 404 such as "No calls found corresponding to+# the provided filters" rather than an empty 200.+_EMPTY_WINDOW_404 = re.compile(r"\bno [\w ]+ found\b")++class GongRetryableError(Exception):pass@@ -64,6 +70,10 @@ def _to_datetime(value: Any) -> Optional[datetime]:return parsed.replace(tzinfo=UTC) if parsed.tzinfo is None else parsed.astimezone(UTC)+def _start_of_day(value: datetime) -> datetime:+ return value.replace(hour=0, minute=0, second=0, microsecond=0)++def _get_headers(access_key: str, access_key_secret: str) -> dict[str, str]:token = base64.b64encode(f"{access_key}:{access_key_secret}".encode()).decode()return {@@ -172,10 +182,8 @@ def get_rows(if response.status_code == 429 or response.status_code >= 500:raise GongRetryableError(f"Gong API error (retryable): status={response.status_code}, url={url}")- # Gong's `/v2/calls` answers a date window with no processed calls using a 404- # ("No calls found corresponding to the provided filters") rather than an empty 200.- # Treat it as an empty page so the sync skips the window instead of failing.- if config.uses_date_window and response.status_code == 404 and "no calls" in response.text.lower():+ # Treat an empty date window as an empty page so the sync skips it instead of failing.+ if config.uses_date_window and response.status_code == 404 and _EMPTY_WINDOW_404.search(response.text.lower()):return {}if not response.ok:@@ -233,6 +241,15 @@ def _iter_windowed_rows(end = datetime.now(UTC)last_value = _to_datetime(db_incremental_field_last_value) if should_use_incremental_field else None++ if config.date_filter_keys:+ # Whole-day bounds are read in the company's time zone, which can be up to a day either side+ # of UTC. Re-read the day before the watermark, and stop before UTC yesterday so no window+ # ends after the company's current day, which Gong rejects.+ end = _start_of_day(end) - timedelta(days=1)+ if last_value is not None:+ last_value = _start_of_day(last_value) - timedelta(days=1)+window_start = last_value or (end - timedelta(days=DEFAULT_INITIAL_LOOKBACK_DAYS))resume_config = resumable_source_manager.load_state() if resumable_source_manager.can_resume() else None@@ -243,15 +260,19 @@ def _iter_windowed_rows(window_start = resumedwhile window_start < end:- window_end = min(window_start + timedelta(days=MAX_WINDOW_DAYS), end)+ window_end = min(window_start + timedelta(days=config.window_days or MAX_WINDOW_DAYS), end)if config.uses_call_id_batches:yield from _iter_transcript_rows(config, fetch_page, window_start, window_end)+ elif config.date_filter_keys:+ yield from _iter_date_filtered_rows(config, config.date_filter_keys, fetch_page, window_start, window_end)else:yield from _iter_call_rows(config, fetch_page, window_start, window_end)window_start = window_endresumable_source_manager.save_state(GongResumeConfig(window_start=_format_datetime(window_start)))+ # Daily stats windows can all come back empty, and the pipeline checks for shutdown only when rows arrive.+ resumable_source_manager.safe_point()def _iter_call_rows(@@ -288,6 +309,42 @@ def _iter_call_rows(break+def _iter_date_filtered_rows(+ config: GongEndpointConfig,+ date_filter_keys: tuple[str, str],+ fetch_page,+ window_start: datetime,+ window_end: datetime,+) -> Iterator[Any]:+ """Cursor-paginate one whole-day window of a `/v2/stats/...` POST endpoint."""+ from_key, to_key = date_filter_keys+ from_date = window_start.date().isoformat()+ cursor: str | None = None++ while True:+ body: dict[str, Any] = {+ "filter": {from_key: from_date, to_key: window_end.date().isoformat(), **config.extra_filter}+ }+ if cursor:+ body["cursor"] = cursor++ data = fetch_page(_build_url(config.path, {}), json_body=body)++ rows = data.get(config.response_key, [])+ if config.window_date_column:+ rows = [{**row, config.window_date_column: from_date} for row in rows]+ if rows:+ yield rows++ next_cursor = data.get("records", {}).get("cursor")+ if not next_cursor:+ break+ # A repeated cursor would request the same page forever, and successful responses never hit the retry limit.+ if next_cursor == cursor:+ raise ValueError(f"Gong returned an unchanged pagination cursor for {config.path}")+ cursor = next_cursor++def _iter_transcript_rows(config: GongEndpointConfig, fetch_page, window_start: datetime, window_end: datetime) -> Iterator[Any]:@@ -397,7 +454,7 @@ def gong_source(should_use_incremental_field=should_use_incremental_field,db_incremental_field_last_value=db_incremental_field_last_value,),- primary_keys=[config.primary_key],+ primary_keys=list(config.primary_key) if isinstance(config.primary_key, tuple) else [config.primary_key],# Windows are iterated oldest-first, so the cursor watermark advances correctly.sort_mode="asc",partition_count=1,diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/settings.pyindex 376507dd29b9..4adb93c3753e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/settings.py@@ -12,7 +12,8 @@ class GongEndpointConfig:path: str# Key under which the records array lives in the JSON response (e.g. "calls", "users").response_key: str- primary_key: str+ # A tuple names a composite key, for rows unique only per user and day.+ primary_key: str | tuple[str, ...]# Stable datetime field to partition by (never `updated`/`lastModified`). None disables partitioning.partition_key: Optional[str] = Noneincremental_fields: list[IncrementalField] = field(default_factory=list)@@ -37,6 +38,17 @@ class GongEndpointConfig:# calls supplies the `callIds` filter for one transcript request, and the call's `started`# stamps the rows that come back.uses_call_id_batches: bool = False+ # Keys of the inclusive start and exclusive end `YYYY-MM-DD` bounds in the JSON `filter` of the+ # `/v2/stats/...` POST endpoints. Gong reads these dates in the company's time zone. Endpoints+ # that set this send whole-day windows instead of `fromDateTime`/`toDateTime`.+ date_filter_keys: Optional[tuple[str, str]] = None+ # Filter fields sent with every request alongside the date bounds.+ extra_filter: dict[str, Any] = field(default_factory=dict)+ # Days per request window. Stats endpoints aggregate over the whole window, so a one-day window+ # gives one row per user per day. None keeps the 90-day cap that `/v2/calls` enforces.+ window_days: Optional[int] = None+ # Column that receives the window's start date, for endpoints whose rows carry no date of their own.+ window_date_column: Optional[str] = None# Whether responses from this endpoint may be sampled into HTTP troubleshooting storage.# Disabled for endpoints whose bodies carry participant names, free-form CRM field values, or# verbatim conversation text that the name-based scrubbers can't recognise; requests stay@@ -184,6 +196,67 @@ GONG_ENDPOINTS: dict[str, GongEndpointConfig] = {primary_key="scorecardId",partition_key="created",),+ # Keyword trackers (the phrases Gong listens for on calls) across every workspace. Gong returns+ # them in one unpaginated response. AI trackers are not included.+ # Requires the `api:settings:trackers:read` scope.+ "trackers": GongEndpointConfig(+ name="trackers",+ path="/v2/settings/trackers",+ response_key="keywordTrackers",+ primary_key="trackerId",+ partition_key="created",+ ),+ # Answers to the scorecards in `scorecards`, one row per review of a call. Filtered by review+ # date, so a call reviewed long after it took place still arrives on the next run. Default-off+ # because reviewers' free-text feedback on a rep's call is performance-review data.+ # Requires the `api:stats:scorecards` scope.+ "answered_scorecards": GongEndpointConfig(+ name="answered_scorecards",+ path="/v2/stats/activity/scorecards",+ response_key="answeredScorecards",+ primary_key="answeredScorecardId",+ partition_key="callStartTime",+ supports_incremental=True,+ uses_date_window=True,+ date_filter_keys=("reviewFromDate", "reviewToDate"),+ # Gong defaults to manual reviews only.+ extra_filter={"reviewMethod": "BOTH"},+ capture_http_samples=False,+ should_sync_default=False,+ incremental_fields=[+ {+ "label": "reviewTime",+ "type": IncrementalFieldType.DateTime,+ "field": "reviewTime",+ "field_type": IncrementalFieldType.DateTime,+ },+ ],+ ),+ # Per-user conversation metrics (talk ratio, longest monologue, patience, ...) for each day,+ # requested one day at a time because Gong aggregates over the whole requested range.+ # Requires the `api:stats:interaction` scope.+ "interaction_stats": GongEndpointConfig(+ name="interaction_stats",+ path="/v2/stats/interaction",+ response_key="peopleInteractionStats",+ primary_key=("userId", "day"),+ partition_key="day",+ supports_incremental=True,+ uses_date_window=True,+ date_filter_keys=("fromDate", "toDate"),+ window_days=1,+ window_date_column="day",+ # A day's stats change as Gong finishes processing that day's calls. Re-read the last week.+ default_incremental_lookback_seconds=7 * 24 * 60 * 60,+ incremental_fields=[+ {+ "label": "day",+ "type": IncrementalFieldType.Date,+ "field": "day",+ "field_type": IncrementalFieldType.Date,+ },+ ],+ ),"workspaces": GongEndpointConfig(name="workspaces",path="/v2/workspaces",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/source.pyindex fa5d00b0e675..d92566445af3 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/source.py@@ -59,6 +59,11 @@ To also sync the `calls_extensive` table (call participants and CRM associationsTo also sync the `transcripts` table (what was said on each call), additionally grant:- `api:calls:read:transcript`++To also sync these tables, additionally grant the scope listed next to each:+- `trackers` (keyword tracker definitions): `api:settings:trackers:read`+- `answered_scorecards` (scorecard reviews of calls): `api:stats:scorecards`+- `interaction_stats` (daily talk ratio, patience, and other conversation metrics per user): `api:stats:interaction`""",iconPath="/static/services/gong.png",docsUrl="https://posthog.com/docs/cdp/sources/gong",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong.pyindex 1b5a7bc49aa8..5e5e8ebdd760 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong.py@@ -4,6 +4,7 @@ from typing import Anyfrom urllib.parse import unquoteimport pytest+import time_machinefrom unittest import mockfrom parameterized import parameterized@@ -256,6 +257,11 @@ class TestWindowedCalls:'{"errors":["No calls found corresponding to the provided filters"]}',False,),+ (+ "no_records_of_another_kind_skips_window",+ '{"errors":["No answered scorecards found corresponding to the provided filters"]}',+ False,+ ),# A 404 for any other reason must still surface rather than be swallowed.("unrelated_404_raises", '{"errors":["Not Found"]}', True),]@@ -322,20 +328,24 @@ class TestWindowedCalls:class TestGongSource:@parameterized.expand([- ("calls", "id", "started", "asc"),- ("transcripts", "callId", "started", "asc"),- ("users", "id", "created", "asc"),- ("scorecards", "scorecardId", "created", "asc"),- ("workspaces", "id", None, "asc"),+ ("calls", ["id"], "started", "asc"),+ ("transcripts", ["callId"], "started", "asc"),+ ("users", ["id"], "created", "asc"),+ ("scorecards", ["scorecardId"], "created", "asc"),+ ("trackers", ["trackerId"], "created", "asc"),+ ("answered_scorecards", ["answeredScorecardId"], "callStartTime", "asc"),+ # A user's stats are one row per day, so the user id alone would merge every day into one.+ ("interaction_stats", ["userId", "day"], "day", "asc"),+ ("workspaces", ["id"], None, "asc"),])def test_source_response_shape(- self, endpoint: str, primary_key: str, partition_key: str | None, sort_mode: str+ self, endpoint: str, primary_keys: list[str], partition_key: str | None, sort_mode: str) -> None:response = gong_source("key", "secret", endpoint, mock.MagicMock(), _FakeResumableManager())assert response.name == endpoint- assert response.primary_keys == [primary_key]+ assert response.primary_keys == primary_keysassert response.sort_mode == sort_modeif partition_key:assert response.partition_keys == [partition_key]@@ -352,6 +362,9 @@ class TestGongSource:"transcripts","users","scorecards",+ "trackers",+ "answered_scorecards",+ "interaction_stats","workspaces",}@@ -496,6 +509,7 @@ class TestExtensiveCalls:[{"calls": [{"id": "c1", "started": "2026-03-01T00:00:00Z"}]}, {"callTranscripts": [{"callId": "c1"}]}],False,),+ ("answered_scorecards", [{"answeredScorecards": [{"answeredScorecardId": 1}]}], False),("users", [{"users": [{"id": "u1"}]}], True),])@@ -610,3 +624,110 @@ class TestTranscripts:# it out of the watermark, so no later run would ever correct it.with pytest.raises(ValueError):list(rows)+++class TestDateFilteredStats:+ @time_machine.travel("2026-03-10T15:00:00Z", tick=False)+ def test_answered_scorecards_filter_by_whole_review_days_and_page_in_body(self) -> None:+ session = _FakeSession(+ [+ _FakeResponse(+ json_data={"answeredScorecards": [{"answeredScorecardId": 1}], "records": {"cursor": "page2"}}+ ),+ _FakeResponse(json_data={"answeredScorecards": [{"answeredScorecardId": 2}]}),+ ]+ )+ manager = _FakeResumableManager()++ with mock.patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.gong.gong.make_tracked_session",+ return_value=session,+ ):+ batches = list(+ get_rows(+ "key",+ "secret",+ "answered_scorecards",+ mock.MagicMock(),+ manager,+ should_use_incremental_field=True,+ db_incremental_field_last_value="2026-03-05T18:30:00Z",+ )+ )++ assert batches == [[{"answeredScorecardId": 1}], [{"answeredScorecardId": 2}]]+ assert session.requested_urls == [f"{GONG_BASE_URL}/v2/stats/activity/scorecards"] * 2+ # Gong reads the dates in the company's time zone, so the day before the watermark is+ # re-read, and the window ends at UTC yesterday so it never reaches past the company's today.+ assert session.posted_bodies == [+ {"filter": {"reviewFromDate": "2026-03-04", "reviewToDate": "2026-03-09", "reviewMethod": "BOTH"}},+ {+ "filter": {"reviewFromDate": "2026-03-04", "reviewToDate": "2026-03-09", "reviewMethod": "BOTH"},+ "cursor": "page2",+ },+ ]+ assert manager.saved_states == [GongResumeConfig(window_start="2026-03-09T00:00:00Z")]++ @time_machine.travel("2026-03-10T15:00:00Z", tick=False)+ def test_interaction_stats_request_one_day_at_a_time_and_stamp_the_day(self) -> None:+ session = _FakeSession(+ [+ _FakeResponse(json_data={"peopleInteractionStats": [{"userId": "u1"}]}),+ _FakeResponse(+ status_code=404,+ text='{"errors":["No users found corresponding to the provided filters"]}',+ ),+ _FakeResponse(json_data={"peopleInteractionStats": [{"userId": "u1"}, {"userId": "u2"}]}),+ ]+ )++ with mock.patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.gong.gong.make_tracked_session",+ return_value=session,+ ):+ batches = list(+ get_rows(+ "key",+ "secret",+ "interaction_stats",+ mock.MagicMock(),+ _FakeResumableManager(),+ should_use_incremental_field=True,+ db_incremental_field_last_value=date(2026, 3, 7),+ )+ )++ # Gong aggregates over the whole range it is asked for, so one-day windows are what make+ # each row one user's stats for one day.+ assert [body["filter"] for body in session.posted_bodies if body] == [+ {"fromDate": "2026-03-06", "toDate": "2026-03-07"},+ {"fromDate": "2026-03-07", "toDate": "2026-03-08"},+ {"fromDate": "2026-03-08", "toDate": "2026-03-09"},+ ]+ assert batches == [+ [{"userId": "u1", "day": "2026-03-06"}],+ [{"userId": "u1", "day": "2026-03-08"}, {"userId": "u2", "day": "2026-03-08"}],+ ]++ @time_machine.travel("2026-03-10T15:00:00Z", tick=False)+ def test_unchanged_cursor_stops_the_sync(self) -> None:+ page = {"answeredScorecards": [{"answeredScorecardId": 1}], "records": {"cursor": "same"}}+ session = _FakeSession([_FakeResponse(json_data=page), _FakeResponse(json_data=page)])++ with mock.patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.gong.gong.make_tracked_session",+ return_value=session,+ ):+ rows = get_rows(+ "key",+ "secret",+ "answered_scorecards",+ mock.MagicMock(),+ _FakeResumableManager(),+ should_use_incremental_field=True,+ db_incremental_field_last_value="2026-03-05T18:30:00Z",+ )+ with pytest.raises(ValueError):+ list(rows)++ assert len(session.requested_urls) == 2diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong_source.pyindex 394fc09974fb..a79d76277a65 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gong/tests/test_gong_source.py@@ -20,29 +20,38 @@ class TestGongSource:schemas = {schema.name: schema for schema in self.source.get_schemas(self.config, self.team_id)}# Only the call-date-filtered endpoints expose a server-side timestamp filter.- for name in ("calls", "calls_extensive", "calls_content", "transcripts"):+ for name, field in (+ ("calls", "started"),+ ("calls_extensive", "started"),+ ("calls_content", "started"),+ ("transcripts", "started"),+ ("answered_scorecards", "reviewTime"),+ ("interaction_stats", "day"),+ ):assert schemas[name].supports_incremental is Trueassert schemas[name].supports_append is True- assert any(f["field"] == "started" for f in schemas[name].incremental_fields)+ assert any(f["field"] == field for f in schemas[name].incremental_fields)# Gong transcribes asynchronously, so transcripts re-read a trailing week on every run# rather than leaving a call that had no transcript yet stranded below the watermark.assert schemas["transcripts"].default_incremental_lookback_seconds == 7 * 24 * 60 * 60- for name in ("users", "scorecards", "workspaces"):+ for name in ("users", "scorecards", "trackers", "workspaces"):assert schemas[name].supports_incremental is Falseassert schemas[name].supports_append is False- def test_only_call_content_is_default_off(self):+ def test_only_call_content_and_scorecard_answers_are_default_off(self):schemas = {schema.name: schema for schema in self.source.get_schemas(self.config, self.team_id)}- # Call summaries reach the warehouse only when an admin picks them, so one-shot setup and- # new-schema auto-sync must leave this table alone.- assert schemas["calls_content"].should_sync_default is False+ # Call summaries and reviewers' feedback on calls reach the warehouse only when an admin+ # picks them, so one-shot setup and new-schema auto-sync must leave these tables alone.+ default_off = {"calls_content", "answered_scorecards"}+ for name in default_off:+ assert schemas[name].should_sync_default is False# Derived from ENDPOINTS rather than a fixed list, so a table added later is covered here# without editing this test.- for name in set(ENDPOINTS) - {"calls_content"}:+ for name in set(ENDPOINTS) - default_off:assert schemas[name].should_sync_default is Truedef test_get_schemas_filtered_by_names(self):