Skip to content

: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.

feat(warehouse-sources): add zendesk ticket_comments table (#67400)

Marcus Hoff128af144ee0
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/canonical_descriptions.py
index 8cd1e3f42f3a..9c6ce80f2361 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/canonical_descriptions.py
@@ -70,7 +70,11 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
timestamp="Time the event occurred, as a Unix timestamp.",
updater_id="ID of the user who made the change.",
via="How and where the change was made.",
- child_events="Individual property changes that make up this event.",
+ child_events=(
+ "The individual events making up this audit. Comment events carry the full comment "
+ "body (public replies and internal notes, distinguished by their `public` flag); "
+ "other entries are property changes, notifications, and similar."
+ ),
event_type="Type of the event.",
),
},
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/tests/test_zendesk.py b/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/tests/test_zendesk.py
index fc80290335c2..c52ec4497b4a 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/tests/test_zendesk.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/tests/test_zendesk.py
@@ -251,16 +251,22 @@ class TestIncrementalResourceWiring:
`start_time` cursor so incremental sync actually filters data, not just flips write disposition."""
@pytest.mark.parametrize(
- "endpoint,expected_path,expected_paginator,cursor_path",
+ "endpoint,expected_path,expected_paginator,cursor_path,expected_include",
[
pytest.param(
- "users", "/api/v2/incremental/users/cursor", ZendeskCursorIncrementalPaginator, "updated_at", id="users"
+ "users",
+ "/api/v2/incremental/users/cursor",
+ ZendeskCursorIncrementalPaginator,
+ "updated_at",
+ None,
+ id="users",
),
pytest.param(
"organizations",
"/api/v2/incremental/organizations",
ZendeskIncrementalEndpointPaginator,
"updated_at",
+ None,
id="organizations",
),
pytest.param(
@@ -268,6 +274,7 @@ class TestIncrementalResourceWiring:
"/api/v2/incremental/ticket_events",
ZendeskIncrementalEndpointPaginator,
"created_at",
+ "comment_events",
id="ticket_events",
),
pytest.param(
@@ -275,18 +282,27 @@ class TestIncrementalResourceWiring:
"/api/v2/incremental/ticket_metric_events",
ZendeskIncrementalEndpointPaginator,
"time",
+ None,
id="ticket_metric_events",
),
],
)
def test_endpoint_declares_incremental_start_time(
- self, endpoint: str, expected_path: str, expected_paginator: type, cursor_path: str
+ self,
+ endpoint: str,
+ expected_path: str,
+ expected_paginator: type,
+ cursor_path: str,
+ expected_include: str | None,
) -> None:
resource = get_resource(endpoint, should_use_incremental_field=True)
endpoint_config = _endpoint(resource)
assert endpoint_config["path"] == expected_path
assert isinstance(endpoint_config["paginator"], expected_paginator)
+ # Without include=comment_events the ticket_events export strips comment bodies from
+ # child_events — assert the sideload stays wired.
+ assert endpoint_config["params"].get("include") == expected_include
start_time = endpoint_config["params"]["start_time"]
assert start_time["type"] == "incremental"
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/zendesk.py b/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/zendesk.py
index f958e4f536eb..5e9a7adf16fa 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/zendesk.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/zendesk.py
@@ -182,6 +182,9 @@ def get_resource(name: str, should_use_incremental_field: bool) -> EndpointResou
"paginator": ZendeskIncrementalEndpointPaginator(),
"params": {
"per_page": 1000,
+ # Enrich each event's `child_events` with the full comment body
+ # (public replies and internal notes); without it bodies are stripped.
+ "include": "comment_events",
"start_time": {
"type": "incremental",
"cursor_path": "created_at",