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(data-warehouse): add featurebase survey and category tables (#107695)

Tom Owersb83d29bf0966
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.md
index c8182546a303..72a1bc9caec8 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
@@ -3034,7 +3034,7 @@ Note: Coverage is service configuration objects plus the account/billing family;
## Featurebase — **thin**
-Today (14): `admins`, `boards`, `changelogs`, `comments`, `companies`, `contacts`, `conversation_tags`, `conversations`, `custom_fields`, `post_statuses`, `post_voters`, `posts`, `ticket_statuses`, `tickets`
+Today (17): `admins`, `boards`, `changelogs`, `comments`, `companies`, `contacts`, `conversation_tags`, `conversations`, `custom_fields`, `post_statuses`, `post_voters`, `posts`, `survey_responses`, `surveys`, `ticket_categories`, `ticket_statuses`, `tickets`
Diffed against: <https://developers.featurebase.app/llms.txt>
@@ -3043,13 +3043,13 @@ Diffed against: <https://developers.featurebase.app/llms.txt>
- [x] `support/tickets (list)` — ticket workload and lifecycle, the other half of the support product (high)
- [x] `support/tickets/statuses` — lookup table resolving the status id on every ticket (high)
- [x] `support/conversation_tags (list)` — lookup table for tags applied to conversations - the main support breakdown dimension (high)
-- [ ] `surveys and surveys/list_responses` — survey responses are raw analytical rows (NPS/CSAT style) with no equivalent in the synced tables (high)
-- [ ] `support/tickets/categories` — lookup resolving ticket category ids (medium)
+- [x] `surveys and surveys/list_responses` — survey responses are raw analytical rows (NPS/CSAT style) with no equivalent in the synced tables (high)
+- [x] `support/tickets/categories` — lookup resolving ticket category ids (medium)
- [ ] `help_center/articles (list)` — article inventory for content and deflection analysis (medium)
- [ ] `organization/teams` — lookup resolving the team an admin or conversation is assigned to (medium)
- [ ] `audit_logs (list)` — workspace change history (medium)
- [ ] `users/companies/{id}/contacts` — company-to-contact membership table joining the companies and contacts we already sync (medium)
-- [ ] `support/conversations/{id}/participants` — participant membership per conversation (medium)
+- [ ] `support/conversations/{id}/participants` — participant membership per conversation. No read endpoint exists: the participants subresource only exposes add and remove, and the conversation row already carries its participants (medium)
- [ ] `help_center/collections` — lookup grouping articles into collections (low)
Note: Featurebase has grown well past the feedback board: the reference now spans Support (conversations + tickets), Help Center, Surveys, Reports and Audit Logs. PostHog's 10 tables cover the Feedback pillar plus admins/companies/contacts only. Reports is a query API (list_datasets/query/drill_in) rather than a fixed collection, so it is not listed as a table gap. llms.txt at developers.featurebase.app gives the complete language-neutral resource tree.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/canonical_descriptions.py
index 5498895e37b4..ad867ad1983d 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/canonical_descriptions.py
@@ -233,6 +233,21 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"isDefault": "Whether this is the default status for new tickets.",
},
},
+ "ticket_categories": {
+ "description": "Ticket categories: the containers tickets are filed under, resolving the category ID carried on every ticket. Stored as boards behind the scenes, so rows share the board shape.",
+ "docs_url": "https://developers.featurebase.app/api/resources/support/subresources/tickets/subresources/categories/methods/list/",
+ "columns": {
+ "id": "Unique identifier of the category.",
+ "name": "Display name in the organization's default locale.",
+ "access": "Access controls: adminOnly flag, allowed/denied role IDs, and segment restrictions.",
+ "features": "Feature toggles: whether commenting, posting, and visible creation dates are enabled.",
+ "customFields": "Custom field IDs attached to this category.",
+ "icon": "The category icon: an emoji, a predefined icon name, or a custom image URL.",
+ "postDefaults": "Default visibility for new tickets filed in this category.",
+ "localization": "Localized names, descriptions, and form copy keyed by language code.",
+ "createdAt": "ISO 8601 timestamp when the category was created.",
+ },
+ },
"conversation_tags": {
"description": "The workspace tag catalog, resolving the tag IDs applied to conversations.",
"docs_url": "https://developers.featurebase.app/api/resources/support/subresources/conversation_tags/methods/list/",
@@ -242,6 +257,33 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"type": "Object type identifier for a tag.",
},
},
+ "surveys": {
+ "description": "In-product surveys, one row per survey, with its questions, targeting rules and response count.",
+ "docs_url": "https://developers.featurebase.app/api/resources/surveys/methods/list/",
+ "columns": {
+ "id": "Unique identifier of the survey.",
+ "title": "Survey title.",
+ "description": "Survey description.",
+ "isActive": "Whether the survey is currently active.",
+ "responseCount": "Number of responses received.",
+ "pages": "Survey pages (questions): id, title, type, choices, and branching actions.",
+ "targeting": "Targeting configuration: segment IDs, URL and CSS selector rules, and whether login is required.",
+ "organization": "Organization ID the survey belongs to.",
+ "createdAt": "ISO 8601 timestamp when the survey was created.",
+ "updatedAt": "ISO 8601 timestamp when the survey was last updated.",
+ },
+ },
+ "survey_responses": {
+ "description": "One row per (survey, response): every set of answers submitted to a survey, with the contact who submitted it.",
+ "docs_url": "https://developers.featurebase.app/api/resources/surveys/methods/list_responses/",
+ "columns": {
+ "surveyId": "The survey this response belongs to.",
+ "id": "Unique identifier of the response.",
+ "responses": "The individual answers: page ID, answer type (text, link, rating, multiple-choice), and value.",
+ "user": "The contact who submitted the response, null for anonymous responses.",
+ "createdAt": "ISO 8601 timestamp when the response was submitted.",
+ },
+ },
"post_voters": {
"description": "One row per (post, voter): the users who upvoted each post, in the standard contact format.",
"docs_url": "https://developers.featurebase.app/api/resources/feedback/subresources/posts/subresources/voters/methods/list/",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/featurebase.py b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/featurebase.py
index e234487178aa..cd8c08dbb78b 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/featurebase.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/featurebase.py
@@ -29,27 +29,25 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.featurebas
FEATUREBASE_OBJECT_TYPE_TO_TOPICS,
FEATUREBASE_PAGE_SIZE,
FeaturebaseEndpointConfig,
+ FeaturebaseFanOutConfig,
)
POSTHOG_WEBHOOK_NAME = "PostHog data warehouse"
-# Hard cap on voters pages fetched per post to bound runaway pagination in the fan-out.
-MAX_VOTER_PAGES_PER_POST = 100
-
class FeaturebaseRetryableError(Exception):
pass
[email protected](frozen=True)
class FeaturebaseResumeConfig:
# Cursor of the next page to fetch. None means "start from the first page" — used when the
- # fan-out bookmark advances to a post whose first page has no cursor yet.
+ # fan-out bookmark advances to a parent whose first page has no cursor yet.
cursor: str | None = None
- # The post currently being processed in the post_voters fan-out. A stable post-ID bookmark
- # (not a positional index) so posts created/deleted between a crash and the retry can't
- # resume us into the wrong post. None for the standard endpoints.
- post_id: str | None = None
+ # The parent currently being processed in a fan-out. A stable ID bookmark (not a positional
+ # index) so parents created/deleted between a crash and the retry can't resume us into the
+ # wrong parent. None for the standard endpoints.
+ parent_id: str | None = None
def _get_headers(api_key: str) -> dict[str, str]:
@@ -133,7 +131,7 @@ def _fetch_page(
raise FeaturebaseRetryableError(f"Featurebase API error (retryable): status={response.status_code}, url={url}")
if not response.ok:
- # 404 is expected during the post_voters fan-out (a post deleted mid-sync).
+ # 404 is expected during a fan-out (a parent deleted mid-sync).
log = logger.warning if response.status_code == 404 else logger.error
log(f"Featurebase API error: status={response.status_code}, body={response.text[:500]}, url={url}")
response.raise_for_status()
@@ -269,71 +267,80 @@ def _get_top_level_rows(
return
-def _iter_post_ids(session: requests.Session, headers: dict[str, str], logger: FilteringBoundLogger) -> Iterator[str]:
- params = {"limit": FEATUREBASE_PAGE_SIZE, "sortBy": "createdAt", "sortOrder": "asc"}
- for items, _ in _iter_pages(session, headers, logger, "/posts", params):
+def _iter_parent_ids(
+ session: requests.Session,
+ headers: dict[str, str],
+ logger: FilteringBoundLogger,
+ fan_out: FeaturebaseFanOutConfig,
+) -> Iterator[str]:
+ params: dict[str, Any] = {"limit": FEATUREBASE_PAGE_SIZE, **fan_out.parent_params}
+ for items, _ in _iter_pages(session, headers, logger, fan_out.parent_path, params):
for item in items:
if item.get("id"):
yield item["id"]
-def _get_post_voter_rows(
+def _get_fan_out_rows(
session: requests.Session,
headers: dict[str, str],
logger: FilteringBoundLogger,
config: FeaturebaseEndpointConfig,
resumable_source_manager: ResumableSourceManager[FeaturebaseResumeConfig],
) -> Iterator[list[dict[str, Any]]]:
- """Fan out over every post, materializing upvoters as {postId, ...contact} rows.
+ """Fan out over every parent row, injecting the parent id into each child row.
- Voter removal has no timestamp on the API, so this table is full-refresh only; the resumable
- bookmark just lets a crashed sync pick up at the post it was processing.
+ Neither child endpoint exposes a timestamp filter, so these tables are full-refresh only;
+ the resumable bookmark just lets a crashed sync pick up at the parent it was processing.
"""
- post_ids = list(_iter_post_ids(session, headers, logger))
+ fan_out = config.fan_out
+ assert fan_out is not None
+ parent_ids = list(_iter_parent_ids(session, headers, logger, fan_out))
- # Resolve the saved post-ID bookmark to the slice of posts still to process. If the
- # bookmarked post no longer exists (deleted between attempts), start over from the first
- # post — merge dedupes the re-pulled rows on the composite primary key.
+ # Resolve the saved parent-ID bookmark to the slice of parents still to process. If the
+ # bookmarked parent no longer exists (deleted between attempts), start over from the first
+ # one — merge dedupes the re-pulled rows on the composite primary key.
resume = resumable_source_manager.load_state() if resumable_source_manager.can_resume() else None
- remaining = post_ids
+ remaining = parent_ids
resume_cursor: str | None = None
- if resume is not None and resume.post_id is not None and resume.post_id in post_ids:
- remaining = post_ids[post_ids.index(resume.post_id) :]
+ if resume is not None and resume.parent_id is not None and resume.parent_id in parent_ids:
+ remaining = parent_ids[parent_ids.index(resume.parent_id) :]
resume_cursor = resume.cursor
- logger.debug(f"Featurebase: resuming post_voters from post_id={resume.post_id}")
+ logger.debug(f"Featurebase: resuming {config.name} from parent_id={resume.parent_id}")
- for index, post_id in enumerate(remaining):
- path = config.path.format(post_id=post_id)
+ for index, parent_id in enumerate(remaining):
+ path = config.path.format(**{fan_out.path_placeholder: parent_id})
pages_fetched = 0
try:
for items, next_cursor in _iter_pages(
session, headers, logger, path, {"limit": FEATUREBASE_PAGE_SIZE}, resume_cursor
):
- rows = [{**item, "postId": post_id} for item in items]
+ rows = [{**item, fan_out.parent_id_column: parent_id} for item in items]
if rows:
yield rows
if next_cursor:
- resumable_source_manager.save_state(FeaturebaseResumeConfig(cursor=next_cursor, post_id=post_id))
+ resumable_source_manager.save_state(
+ FeaturebaseResumeConfig(cursor=next_cursor, parent_id=parent_id)
+ )
pages_fetched += 1
- if pages_fetched >= MAX_VOTER_PAGES_PER_POST:
+ if fan_out.max_pages_per_parent is not None and pages_fetched >= fan_out.max_pages_per_parent:
logger.warning(
- f"Featurebase: post_voters page cap reached, truncating. post_id={post_id}, "
+ f"Featurebase: {config.name} page cap reached, truncating. parent_id={parent_id}, "
f"pages={pages_fetched}"
)
break
except requests.HTTPError as exc:
- # A post deleted between enumeration and this fetch 404s. Skip it rather than
- # failing the whole sync — the votes are genuinely gone.
+ # A parent deleted between enumeration and this fetch 404s. Skip it rather than
+ # failing the whole sync — its children are genuinely gone.
if exc.response is not None and exc.response.status_code == 404:
- logger.warning(f"Featurebase: post {post_id} not found while fetching voters, skipping")
+ logger.warning(f"Featurebase: parent {parent_id} not found while fetching {config.name}, skipping")
else:
raise
finally:
- resume_cursor = None # only the resumed-into post uses the saved cursor
+ resume_cursor = None # only the resumed-into parent uses the saved cursor
- # Advance the bookmark to the next post so a crash between posts resumes correctly.
+ # Advance the bookmark to the next parent so a crash between parents resumes correctly.
if index + 1 < len(remaining):
- resumable_source_manager.save_state(FeaturebaseResumeConfig(cursor=None, post_id=remaining[index + 1]))
+ resumable_source_manager.save_state(FeaturebaseResumeConfig(cursor=None, parent_id=remaining[index + 1]))
def get_rows(
@@ -347,12 +354,12 @@ def get_rows(
) -> Iterator[list[dict[str, Any]]]:
config = FEATUREBASE_ENDPOINTS[endpoint]
headers = _get_headers(api_key)
- # One session reused across every page (and, for the fan-out, every post) so urllib3 keeps
+ # One session reused across every page (and, for a fan-out, every parent) so urllib3 keeps
# the connection alive instead of re-handshaking per request.
session = _make_session(api_key)
- if config.fan_out_over_posts:
- yield from _get_post_voter_rows(session, headers, logger, config, resumable_source_manager)
+ if config.fan_out:
+ yield from _get_fan_out_rows(session, headers, logger, config, resumable_source_manager)
return
yield from _get_top_level_rows(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/settings.py
index 96eea08fef5c..be3053f8f251 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/settings.py
@@ -26,10 +26,25 @@ FEATUREBASE_OBJECT_TYPE_TO_TOPICS: dict[str, tuple[str, ...]] = {
}
+@dataclass(frozen=True)
+class FeaturebaseFanOutConfig:
+ """One child request chain per parent row of `parent_path`."""
+
+ parent_path: str
+ # Placeholder in the child endpoint's path, filled with each parent id.
+ path_placeholder: str
+ # Column the parent id is injected into on every child row.
+ parent_id_column: str
+ parent_params: dict[str, str] = field(default_factory=dict)
+ # Cap on child pages per parent. A cap truncates a genuinely large parent, so only set one
+ # where a runaway cursor would multiply across many parents.
+ max_pages_per_parent: Optional[int] = None
+
+
@dataclass(frozen=True)
class FeaturebaseEndpointConfig:
name: str
- path: str # Relative to FEATUREBASE_BASE_URL; may carry a {post_id} placeholder for fan-out
+ path: str # Relative to FEATUREBASE_BASE_URL; may carry a placeholder filled by the fan-out
incremental_fields: list[IncrementalField] = field(default_factory=list)
# How incremental sync is achieved for this endpoint:
# - "desc_cutoff": no server-side timestamp filter exists, but the endpoint supports a
@@ -48,14 +63,15 @@ class FeaturebaseEndpointConfig:
full_refresh_params: dict[str, str] = field(default_factory=dict)
# Extra query params merged into every request (e.g. privacy=all).
extra_params: dict[str, str] = field(default_factory=dict)
- # Whether the endpoint paginates with limit/cursor. Boards, post statuses and ticket
- # statuses return everything in one response (a bare JSON array, no `data` envelope).
+ # Whether the endpoint paginates with limit/cursor. Boards, post statuses, ticket
+ # statuses and ticket categories return everything in one response (a bare JSON array,
+ # no `data` envelope).
paginated: bool = True
partition_key: Optional[str] = None # Stable creation-time field, never updatedAt
primary_keys: list[str] = field(default_factory=lambda: ["id"])
should_sync_default: bool = True
- # Fan out one voters request per post ({post_id} placeholder in path).
- fan_out_over_posts: bool = False
+ # Fan out over a parent listing, one child request chain per parent row.
+ fan_out: Optional[FeaturebaseFanOutConfig] = None
_CREATED_AT_FIELD: IncrementalField = {
@@ -179,10 +195,24 @@ FEATUREBASE_ENDPOINTS: dict[str, FeaturebaseEndpointConfig] = {
# Documented as returning every status at once, as a bare JSON array like boards.
paginated=False,
),
+ "ticket_categories": FeaturebaseEndpointConfig(
+ name="ticket_categories",
+ path="/tickets/categories",
+ # Documented as returning every category at once, as a bare JSON array like boards.
+ # Categories are boards behind the scenes, so rows carry `object: "board"`.
+ paginated=False,
+ ),
"conversation_tags": FeaturebaseEndpointConfig(
name="conversation_tags",
path="/tags",
),
+ "surveys": FeaturebaseEndpointConfig(
+ name="surveys",
+ path="/surveys",
+ partition_key="createdAt",
+ # The list endpoint takes only limit/cursor/type/isActive — no sort and no timestamp
+ # filter — so neither incremental mode applies.
+ ),
# One request per post: materializes the post<->upvoter many-to-many as
# {postId, ...contact} rows. Opt-in (off by default) because it costs one paginated
# request chain per post. Voter ids are contact ids (unique per org, not per post),
@@ -190,10 +220,32 @@ FEATUREBASE_ENDPOINTS: dict[str, FeaturebaseEndpointConfig] = {
"post_voters": FeaturebaseEndpointConfig(
name="post_voters",
path="/posts/{post_id}/voters",
- fan_out_over_posts=True,
+ fan_out=FeaturebaseFanOutConfig(
+ parent_path="/posts",
+ path_placeholder="post_id",
+ parent_id_column="postId",
+ parent_params={"sortBy": "createdAt", "sortOrder": "asc"},
+ max_pages_per_parent=100,
+ ),
primary_keys=["postId", "id"],
should_sync_default=False,
),
+ # One request per survey: materializes each submitted response as a
+ # {surveyId, ...response} row. The responses endpoint takes only pageId/limit/cursor, so
+ # there is no incremental filter. Response ids are documented as optional on the nested
+ # answers but required on the response itself; the composite key keeps rows unique
+ # table-wide in case they are only unique per survey.
+ "survey_responses": FeaturebaseEndpointConfig(
+ name="survey_responses",
+ path="/surveys/{survey_id}/responses",
+ partition_key="createdAt",
+ fan_out=FeaturebaseFanOutConfig(
+ parent_path="/surveys",
+ path_placeholder="survey_id",
+ parent_id_column="surveyId",
+ ),
+ primary_keys=["surveyId", "id"],
+ ),
}
ENDPOINTS = tuple(FEATUREBASE_ENDPOINTS.keys())
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/source.py
index b3fbd8f02d62..24ff8ad8511f 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/source.py
@@ -173,6 +173,8 @@ class FeaturebaseSource(
"Maps which users upvoted which post as one row per (post, voter). "
"Costs one request chain per post, so it's off by default"
)
+ if endpoint == "survey_responses":
+ return "Answers submitted to your surveys as one row per (survey, response)"
return None
def _build_schema(endpoint: str) -> SourceSchema:
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase.py b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase.py
index c4ec2bc57f8b..269236683da1 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase.py
@@ -152,6 +152,20 @@ class TestBuildInitialParams:
None,
{},
),
+ (
+ "ticket_categories_have_no_pagination_params",
+ "ticket_categories",
+ False,
+ None,
+ {},
+ ),
+ (
+ "surveys_have_no_sort_or_filter_param",
+ "surveys",
+ False,
+ None,
+ {"limit": 100},
+ ),
]
)
def test_build_initial_params(
@@ -338,12 +352,6 @@ class TestDescCutoffIncremental:
class TestPostVotersFanOut:
_posts_url = f"{BASE}/posts?limit=100&sortBy=createdAt&sortOrder=asc"
- def test_config_is_opt_in_fan_out_with_composite_pk(self) -> None:
- config = FEATUREBASE_ENDPOINTS["post_voters"]
- assert config.fan_out_over_posts is True
- assert config.should_sync_default is False
- assert config.primary_keys == ["postId", "id"]
-
def test_fans_out_over_every_post_injecting_post_id(self, monkeypatch: Any) -> None:
manager = _FakeResumableManager()
pages = {
@@ -361,7 +369,7 @@ class TestPostVotersFanOut:
assert [(r["postId"], r["id"]) for r in rows] == [("P1", "U1"), ("P2", "U1"), ("P2", "U2")]
# Bookmark advanced to P2 so a crash between posts resumes there, not from scratch.
- assert [(s.post_id, s.cursor) for s in manager.saved] == [("P2", None)]
+ assert [(s.parent_id, s.cursor) for s in manager.saved] == [("P2", None)]
def test_deleted_post_404_is_skipped(self, monkeypatch: Any) -> None:
not_found = requests.HTTPError(response=_response_with_status(404))
@@ -383,7 +391,7 @@ class TestPostVotersFanOut:
_collect_rows(monkeypatch, "post_voters", pages)
def test_resumes_from_bookmarked_post(self, monkeypatch: Any) -> None:
- manager = _FakeResumableManager(FeaturebaseResumeConfig(cursor="vcur", post_id="P2"))
+ manager = _FakeResumableManager(FeaturebaseResumeConfig(cursor="vcur", parent_id="P2"))
fetched: list[str] = []
pages = {
self._posts_url: {"data": [{"id": "P1"}, {"id": "P2"}], "nextCursor": None},
@@ -397,6 +405,32 @@ class TestPostVotersFanOut:
assert f"{BASE}/posts/P1/voters?limit=100" not in fetched
+class TestSurveyResponsesFanOut:
+ _surveys_url = f"{BASE}/surveys?limit=100"
+
+ def test_fans_out_over_every_survey_injecting_survey_id(self, monkeypatch: Any) -> None:
+ manager = _FakeResumableManager()
+ pages = {
+ self._surveys_url: {"data": [{"id": "S1"}, {"id": "S2"}], "nextCursor": None},
+ f"{BASE}/surveys/S1/responses?limit=100": {
+ "data": [{"id": "R1", "object": "survey_response"}],
+ "nextCursor": "rcur",
+ },
+ f"{BASE}/surveys/S1/responses?limit=100&cursor=rcur": {
+ "data": [{"id": "R2", "object": "survey_response"}],
+ "nextCursor": None,
+ },
+ f"{BASE}/surveys/S2/responses?limit=100": {
+ "data": [{"id": "R3", "object": "survey_response"}],
+ "nextCursor": None,
+ },
+ }
+ rows = _collect_rows(monkeypatch, "survey_responses", pages, manager)
+
+ assert [(r["surveyId"], r["id"]) for r in rows] == [("S1", "R1"), ("S1", "R2"), ("S2", "R3")]
+ assert [(s.parent_id, s.cursor) for s in manager.saved] == [("S1", "rcur"), ("S2", None)]
+
+
class TestSourceResponse:
def _source(self, endpoint: str, should_use_incremental_field: bool = False) -> Any:
webhook_manager = MagicMock()
@@ -434,6 +468,9 @@ class TestSourceResponse:
("tickets", ["id"], ["createdAt"]),
("conversations", ["id"], ["createdAt"]),
("conversation_tags", ["id"], None),
+ ("ticket_categories", ["id"], None),
+ ("surveys", ["id"], ["createdAt"]),
+ ("survey_responses", ["surveyId", "id"], ["createdAt"]),
]
)
def test_primary_and_partition_keys(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase_source.py
index b12fb13c7b1f..d5f14d849314 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/featurebase/tests/test_featurebase_source.py
@@ -80,7 +80,11 @@ class TestFeaturebaseSource:
("conversations", False, False),
("tickets", True, False),
("ticket_statuses", False, False),
+ ("ticket_categories", False, False),
("conversation_tags", False, False),
+ # Surveys and their responses take no sort or timestamp param either.
+ ("surveys", False, False),
+ ("survey_responses", False, False),
("post_voters", False, False),
]
)