: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): implement roark import source (#70012)
Tom Owers04ade9ba15ea
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md b/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.mdindex 2d2f49a95cfe..6a9e348de8eb 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md@@ -356,6 +356,7 @@ the row lists both.| retently | HTTP | requests | ✅ || revenuecat | HTTP + Webhook | requests + `WebhookSourceManager` | ✅ (pull) / ➖ (webhook) || rippling | HTTP | requests | ✅ |+| roark | HTTP | requests | ✅ || rocketlane | HTTP | requests | ✅ || rollbar | HTTP | requests | ✅ || rootly | HTTP | requests | ✅ |@@ -828,7 +829,6 @@ doesn't conflict with concurrent PRs.- revolut_merchant- ringcentral- rki_covid-- roark- rocket_chat- rocketlane- rssdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs.py b/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs.pyindex 9422ce6b58e5..2fc66c0f7851 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs.py@@ -3503,7 +3503,7 @@ class RipplingSourceConfig(config.Config):@config.configclass RoarkSourceConfig(config.Config):- pass+ api_key: str@config.configdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/roark/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/roark/canonical_descriptions.pynew file mode 100644index 000000000000..4103d8f8d305--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/roark/canonical_descriptions.py@@ -0,0 +1,232 @@+"""Canonical, documentation-sourced descriptions for Roark endpoints and columns.++Sourced from the official Roark API reference (https://docs.roark.ai/api-reference). Keyed by the+endpoint names in `settings.py` `ROARK_ENDPOINTS`, which match the `ExternalDataSchema.name` of a+synced Roark table. Columns absent here fall back to LLM enrichment.+"""++from products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (+ CanonicalDescriptions,+)++CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {+ "call": {+ "description": "A monitored voice call between an AI agent and a customer, with Roark's analysis attached.",+ "docs_url": "https://docs.roark.ai/api-reference/call/list-calls",+ "columns": {+ "id": "Unique identifier of the call.",+ "projectId": "Identifier of the project the call belongs to.",+ "title": "Short generated title summarizing the call.",+ "summary": "Generated summary of the call's content.",+ "status": "Current call status: RINGING, IN_PROGRESS, or ENDED.",+ "callDirection": "Whether the call was INBOUND or OUTBOUND.",+ "startedAt": "Timestamp when the call started.",+ "endedAt": "Timestamp when the call ended.",+ "durationMs": "Total call duration in milliseconds.",+ "endedStatus": "Reason the call ended (e.g. AGENT_ENDED_CALL, CUSTOMER_ENDED_CALL, MAX_DURATION_REACHED).",+ "recordingUrl": "URL of the call recording, when available.",+ "recordingUrlAccess": "Whether the recording is AVAILABLE, NOT_AVAILABLE, or RESTRICTED.",+ "simulationJobId": "Identifier of the simulation job that produced this call, if simulated.",+ "supersededByCallId": "Identifier of a call that supersedes this one (e.g. after a replay).",+ "externalId": "Caller-supplied external identifier for the call.",+ "agents": "The AI agents (and their endpoints) that participated in the call.",+ "customers": "The customer participants, with phone number and label.",+ "properties": "Custom key/value properties attached to the call.",+ "policyIds": "Identifiers of the metric policies applied to the call.",+ "createdAt": "Timestamp when the call record was created.",+ "updatedAt": "Timestamp when the call record was last updated.",+ },+ },+ "chat": {+ "description": "A monitored chat conversation between an AI agent and a customer.",+ "docs_url": "https://docs.roark.ai/api-reference/chat/list-chats",+ "columns": {+ "id": "Unique identifier of the chat.",+ "projectId": "Identifier of the project the chat belongs to.",+ "organizationId": "Identifier of the organization the chat belongs to.",+ "title": "Short generated title summarizing the chat.",+ "summary": "Generated summary of the chat's content.",+ "startTimestamp": "Timestamp when the chat started.",+ "endTimestamp": "Timestamp when the chat ended.",+ "durationMs": "Total chat duration in milliseconds.",+ "simulationJobId": "Identifier of the simulation job that produced this chat, if simulated.",+ "simulationRunPlanJobId": "Identifier of the simulation batch this chat belongs to.",+ "agents": "The AI agents that participated in the chat.",+ "customers": "The customer participants.",+ "properties": "Custom key/value properties attached to the chat.",+ "policyIds": "Identifiers of the metric policies applied to the chat.",+ "externalId": "Caller-supplied external identifier for the chat.",+ "createdAt": "Timestamp when the chat record was created.",+ "updatedAt": "Timestamp when the chat record was last updated.",+ },+ },+ "agent": {+ "description": "A voice or chat AI agent monitored by Roark.",+ "docs_url": "https://docs.roark.ai/api-reference/agent/list-agents",+ "columns": {+ "id": "Unique identifier of the agent.",+ "name": "Display name of the agent.",+ "description": "Description of the agent.",+ "customId": "Caller-supplied custom identifier for the agent.",+ "createdAt": "Timestamp when the agent was created.",+ "updatedAt": "Timestamp when the agent was last updated.",+ },+ },+ "agent_endpoint": {+ "description": "A connection endpoint (phone number, websocket, etc.) an agent uses to place or receive calls.",+ "docs_url": "https://docs.roark.ai/api-reference/agent-endpoint/list-agent-endpoints",+ "columns": {+ "id": "Unique identifier of the agent endpoint.",+ "agentId": "Identifier of the agent this endpoint belongs to.",+ "type": "Endpoint type (e.g. PHONE, WEBSOCKET, LIVEKIT, ELEVENLABS_WS).",+ "value": "The endpoint value, such as a phone number or URL.",+ "environment": "Environment the endpoint runs in.",+ "direction": "Whether the endpoint handles INCOMING, OUTGOING, or both.",+ "outboundDialType": "How outbound dialing is performed (NONE or HTTP_REQUEST).",+ "outboundDialHttpRequestDefinitionId": "HTTP request definition used for outbound dialing, if any.",+ "createdAt": "Timestamp when the endpoint was created.",+ "updatedAt": "Timestamp when the endpoint was last updated.",+ },+ },+ "metric_definition": {+ "description": "A definition of a metric Roark can compute over calls and chats (LLM judge, provider, threshold, formula, or pattern).",+ "docs_url": "https://docs.roark.ai/api-reference/metric/list-metric-definitions",+ "columns": {+ "id": "Unique identifier of the metric definition.",+ "slug": "Stable slug for the metric.",+ "metricId": "Alias of the slug, kept for backwards compatibility.",+ "variantId": "Identifier of the resolved metric variant.",+ "versionId": "Identifier of the variant's current config version.",+ "name": "Display name of the metric.",+ "description": "Description of what the metric measures.",+ "type": "Value type produced (COUNT, NUMERIC, BOOLEAN, SCALE, TEXT, CLASSIFICATION, OFFSET).",+ "scope": "Whether the metric is GLOBAL or PER_PARTICIPANT.",+ "supportedContexts": "The contexts the metric applies to (CALL, SEGMENT, TURN).",+ "unit": "Unit of the metric value, with name and symbol.",+ "calculationType": "How the metric is calculated (LLM_JUDGE, PROVIDER, THRESHOLD, FORMULA, PATTERN).",+ },+ },+ "metric_collection_job": {+ "description": "A job that computes metric values over a set of calls or chats.",+ "docs_url": "https://docs.roark.ai/api-reference/metric-collection-job/list-metric-collection-jobs",+ "columns": {+ "id": "Unique identifier of the metric collection job.",+ "status": "Job status: PENDING, PROCESSING, COMPLETED, FAILED, or CANCELED.",+ "triggeredBy": "What triggered the job (USER_MANUAL, USER_API, METRIC_POLICY, SIMULATION).",+ "totalItems": "Total number of call/metric pairs to process.",+ "completedItems": "Number of items processed successfully.",+ "failedItems": "Number of items that failed.",+ "startedAt": "Timestamp when the job started.",+ "completedAt": "Timestamp when the job completed.",+ "errorMessage": "Error message if the job failed.",+ "policyIds": "Identifiers of the metric policies the job ran.",+ "createdAt": "Timestamp when the job was created.",+ "updatedAt": "Timestamp when the job was last updated.",+ },+ },+ "issue": {+ "description": "An issue Roark opened from an alert, trace failure, or manual report, grouping related evidence.",+ "docs_url": "https://docs.roark.ai/api-reference/issue/list-issues",+ "columns": {+ "id": "Unique identifier of the issue.",+ "organizationId": "Identifier of the organization the issue belongs to.",+ "projectId": "Identifier of the project the issue belongs to.",+ "alertId": "Identifier of the alert that opened the issue, when applicable.",+ "source": "What opened the issue (TREND_ALERT, SINGLE_CALL_ALERT, TRACE_FAILURE, MANUAL, API, AGENT).",+ "title": "Short title of the issue.",+ "summary": "Summary describing the issue.",+ "severity": "Issue severity: LOW, MEDIUM, HIGH, or CRITICAL.",+ "status": "Issue status: OPEN, ACKED, or RESOLVED.",+ "fingerprint": "Dedup key; issues with matching fingerprints merge into one.",+ "eventCount": "Number of events grouped under the issue.",+ "lastEventAt": "Timestamp of the most recent event on the issue.",+ "openedAt": "Timestamp when the issue was opened.",+ "resolvedAt": "Timestamp when the issue was resolved.",+ "assigneeUserId": "Identifier of the user the issue is assigned to.",+ "evidence": "Supporting evidence (calls and chats) linked to the issue.",+ "createdAt": "Timestamp when the issue was created.",+ "updatedAt": "Timestamp when the issue was last updated.",+ },+ },+ "simulation_scenario": {+ "description": "A scripted scenario used to drive simulated calls against an agent.",+ "docs_url": "https://docs.roark.ai/api-reference/simulation-scenario/list-simulation-scenarios",+ "columns": {+ "id": "Unique identifier of the scenario.",+ "name": "Display name of the scenario.",+ "description": "Description of the scenario.",+ "steps": "Ordered steps that make up the scenario.",+ "createdAt": "Timestamp when the scenario was created.",+ "updatedAt": "Timestamp when the scenario was last updated.",+ },+ },+ "persona": {+ "description": "A simulated customer persona (voice, accent, behavior) used to drive simulations.",+ "docs_url": "https://docs.roark.ai/api-reference/simulation-persona/list-personas",+ "columns": {+ "id": "Unique identifier of the persona.",+ "name": "Display name of the persona.",+ "description": "Description of the persona.",+ "language": "Primary language the persona speaks.",+ "accent": "Accent of the persona's voice.",+ "gender": "Gender of the persona's voice.",+ "baseEmotion": "Baseline emotional tone of the persona.",+ "backstoryPrompt": "Backstory prompt shaping the persona's behavior.",+ "properties": "Custom key/value properties attached to the persona.",+ "createdAt": "Timestamp when the persona was created.",+ "updatedAt": "Timestamp when the persona was last updated.",+ },+ },+ "run_plan": {+ "description": "A simulation run plan pairing scenarios, personas, and agent endpoints into a repeatable test suite.",+ "docs_url": "https://docs.roark.ai/api-reference/simulation-run-plan/list-run-plans",+ "columns": {+ "id": "Unique identifier of the run plan.",+ "name": "Display name of the run plan.",+ "description": "Description of the run plan.",+ "direction": "Whether simulated calls are INBOUND or OUTBOUND.",+ "iterationCount": "Number of iterations the plan runs.",+ "maxConcurrentJobs": "Maximum simulation jobs run concurrently.",+ "executionMode": "How the plan executes (PARALLEL, SEQUENTIAL_SAME_RUN_PLAN, SEQUENTIAL_PROJECT).",+ "scenarios": "Scenarios included in the plan.",+ "personas": "Personas included in the plan.",+ "agentEndpoints": "Agent endpoints the plan targets.",+ "metrics": "Metrics evaluated for each simulated call.",+ "testCaseCount": "Number of test cases the plan produces.",+ "createdAt": "Timestamp when the run plan was created.",+ "updatedAt": "Timestamp when the run plan was last updated.",+ },+ },+ "simulation_plan_job": {+ "description": "A single execution of a simulation run plan.",+ "docs_url": "https://docs.roark.ai/api-reference/simulation-run-plan-job/list-simulation-plan-jobs",+ "columns": {+ "simulationRunPlanJobId": "Unique identifier of the simulation plan job.",+ "simulationRunPlanId": "Identifier of the run plan this job executed.",+ "status": "Current job status (e.g. PENDING, RUNNING_SIMULATIONS, COMPLETED, FAILED).",+ "triggeredBy": "What triggered the job (SCHEDULED, USER_TRIGGERED_FROM_UI, RE_RUN, TRIGGERED_FROM_API, SYSTEM).",+ "createdAt": "Timestamp when the job was created.",+ "startedAt": "Timestamp when the job started.",+ "endedAt": "Timestamp when the job ended.",+ },+ },+ "knowledge_base": {+ "description": "A knowledge base document made available to agents.",+ "docs_url": "https://docs.roark.ai/api-reference/knowledge-base/list-knowledge-bases",+ "columns": {+ "id": "Unique identifier of the knowledge base.",+ "name": "Display name of the knowledge base.",+ "description": "Description of the knowledge base.",+ "sourceType": "How the content was provided (TEXT, FILE, JSON, URL).",+ "status": "Processing status (READY, PROCESSING, PENDING_UPLOAD, FAILED).",+ "originalFilename": "Original filename, for file-sourced knowledge bases.",+ "mimeType": "MIME type of the source content.",+ "sourceUrl": "Source URL, for URL-sourced knowledge bases.",+ "byteSize": "Size of the source content in bytes.",+ "contentHash": "Hash of the source content.",+ "errorMessage": "Error message if processing failed.",+ "createdAt": "Timestamp when the knowledge base was created.",+ "updatedAt": "Timestamp when the knowledge base was last updated.",+ },+ },+}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/roark/roark.py b/products/warehouse_sources/backend/temporal/data_imports/sources/roark/roark.pynew file mode 100644index 000000000000..5f991675a5fe--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/roark/roark.py@@ -0,0 +1,207 @@+import dataclasses+from collections.abc import Iterator+from typing import Any+from urllib.parse import urlencode++import requests+from structlog.types import FilteringBoundLogger+from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_exponential_jitter++from products.warehouse_sources.backend.temporal.data_imports.pipelines.pipeline.batcher import Batcher+from products.warehouse_sources.backend.temporal.data_imports.pipelines.pipeline.typings import SourceResponse+from products.warehouse_sources.backend.temporal.data_imports.sources.common.http import make_tracked_session+from products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManager+from products.warehouse_sources.backend.temporal.data_imports.sources.roark.settings import (+ ROARK_ENDPOINTS,+ RoarkEndpointConfig,+)++ROARK_BASE_URL = "https://api.roark.ai/v1"+++class RoarkRetryableError(Exception):+ pass+++class RoarkResumeConfig:+ # Cursor (`after`) that fetched the page currently being processed. `None` means "start at the+ # first page". Saved so a crash mid-page resumes by re-fetching that same page; merge dedupes the+ # rows already written on the primary key.+ after: str | None = None+ # Offset that fetched the page currently being processed, for the offset-paginated endpoints.+ offset: int | None = None+++class _Page:+ items: list[dict[str, Any]]+ # State to persist if a batch is yielded while processing this page, so a resume re-fetches it.+ resume_state: RoarkResumeConfig+++def _get_headers(api_key: str) -> dict[str, str]:+ return {+ "Authorization": f"Bearer {api_key}",+ "Accept": "application/json",+ }+++def _build_url(path: str, params: dict[str, Any]) -> str:+ url = f"{ROARK_BASE_URL}{path}"+ if params:+ return f"{url}?{urlencode(params)}"+ return url+++@retry(+ retry=retry_if_exception_type(+ (+ RoarkRetryableError,+ requests.ReadTimeout,+ requests.ConnectionError,+ requests.exceptions.ChunkedEncodingError,+ )+ ),+ stop=stop_after_attempt(5),+ wait=wait_exponential_jitter(initial=1, max=30),+ reraise=True,+)+def _fetch_page(+ session: requests.Session, url: str, headers: dict[str, str], logger: FilteringBoundLogger+) -> dict[str, Any]:+ response = session.get(url, headers=headers, timeout=60)++ # Roark documents 429s but publishes no numeric limits, so back off on 429 and transient 5xx.+ if response.status_code == 429 or response.status_code >= 500:+ raise RoarkRetryableError(f"Roark API error (retryable): status={response.status_code}, url={url}")++ if not response.ok:+ logger.error(f"Roark API error: status={response.status_code}, body={response.text}, url={url}")+ response.raise_for_status()++ return response.json()+++def validate_credentials(api_key: str) -> bool:+ # `/agent` is a cheap authenticated list endpoint; a 200 confirms the bearer token is genuine.+ url = _build_url("/agent", {"limit": 1})+ try:+ response = make_tracked_session().get(url, headers=_get_headers(api_key), timeout=10)+ return response.status_code == 200+ except Exception:+ return False+++def _base_params(config: RoarkEndpointConfig) -> dict[str, Any]:+ params: dict[str, Any] = {}+ if config.max_page_size > 0:+ params["limit"] = config.max_page_size+ if config.sort_by:+ params["sortBy"] = config.sort_by+ if config.sort_direction:+ params["sortDirection"] = config.sort_direction+ return params+++def _iter_pages(+ session: requests.Session,+ headers: dict[str, str],+ config: RoarkEndpointConfig,+ logger: FilteringBoundLogger,+ resume: RoarkResumeConfig | None,+) -> Iterator[_Page]:+ base = _base_params(config)++ if config.pagination == "none":+ # Unpaginated endpoints (e.g. metric_definition) may reply with either a `{"data": [...]}`+ # envelope or a bare top-level list; treat both as the row set rather than dropping the latter.+ raw: Any = _fetch_page(session, _build_url(config.path, base), headers, logger)+ items = raw if isinstance(raw, list) else (raw.get("data", []) or [])+ yield _Page(items=items, resume_state=RoarkResumeConfig())+ return++ if config.pagination == "cursor":+ after: str | None = resume.after if resume else None+ while True:+ params = {**base, "after": after} if after else base+ data = _fetch_page(session, _build_url(config.path, params), headers, logger)+ yield _Page(items=data.get("data", []) or [], resume_state=RoarkResumeConfig(after=after))++ pagination = data.get("pagination", {}) or {}+ next_cursor = pagination.get("nextCursor")+ if not pagination.get("hasMore") or not next_cursor:+ break+ after = next_cursor+ return++ # offset pagination+ offset: int = resume.offset if resume and resume.offset else 0+ while True:+ params = {**base, "offset": offset}+ data = _fetch_page(session, _build_url(config.path, params), headers, logger)+ items = data.get("data", []) or []+ yield _Page(items=items, resume_state=RoarkResumeConfig(offset=offset))++ pagination = data.get("pagination", {}) or {}+ if not pagination.get("hasMore") or not items:+ break+ # Advance by the rows actually returned, never the requested page size: Roark may cap a page+ # below max_page_size, and jumping by the requested size would skip the rows in the gap.+ offset += len(items)+++def get_rows(+ api_key: str,+ endpoint: str,+ logger: FilteringBoundLogger,+ resumable_source_manager: ResumableSourceManager[RoarkResumeConfig],+) -> Iterator[Any]:+ config = ROARK_ENDPOINTS[endpoint]+ headers = _get_headers(api_key)+ batcher = Batcher(logger=logger, chunk_size=2000, chunk_size_bytes=100 * 1024 * 1024)+ # One session reused across every page so urllib3 keeps the connection alive.+ session = make_tracked_session()++ resume = resumable_source_manager.load_state() if resumable_source_manager.can_resume() else None+ if resume is not None:+ logger.debug(f"Roark: resuming {endpoint} from after={resume.after}, offset={resume.offset}")++ for page in _iter_pages(session, headers, config, logger, resume):+ for item in page.items:+ batcher.batch(item)+ if batcher.should_yield():+ yield batcher.get_table()+ # Save AFTER yielding, recording the token that fetched THIS page so a crash re-fetches+ # it rather than skipping the batched-but-not-yet-yielded tail; merge dedupes on the+ # primary key.+ resumable_source_manager.save_state(page.resume_state)++ if batcher.should_yield(include_incomplete_chunk=True):+ yield batcher.get_table()+++def roark_source(+ api_key: str,+ endpoint: str,+ logger: FilteringBoundLogger,+ resumable_source_manager: ResumableSourceManager[RoarkResumeConfig],+) -> SourceResponse:+ config = ROARK_ENDPOINTS[endpoint]++ return SourceResponse(+ name=endpoint,+ items=lambda: get_rows(+ api_key=api_key,+ endpoint=endpoint,+ logger=logger,+ resumable_source_manager=resumable_source_manager,+ ),+ primary_keys=config.primary_keys,+ sort_mode=config.sort_mode,+ partition_count=1,+ partition_size=1,+ partition_mode="datetime" if config.partition_key else None,+ partition_format="month" if config.partition_key else None,+ partition_keys=[config.partition_key] if config.partition_key else None,+ )diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/roark/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/roark/settings.pynew file mode 100644index 000000000000..9ca7177505b5--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/roark/settings.py@@ -0,0 +1,120 @@+from dataclasses import dataclass, field+from typing import Literal, Optional++from products.warehouse_sources.backend.temporal.data_imports.pipelines.pipeline.typings import SortMode++# Roark exposes no server-side timestamp filter on any list endpoint (only client-side `sortBy`+# ordering plus an opaque `after` cursor), so every table syncs as a full refresh. Incremental sync+# would page through the entire resource each run regardless, so it buys nothing here.+PaginationMode = Literal["cursor", "offset", "none"]+++@dataclass+class RoarkEndpointConfig:+ name: str+ path: str+ pagination: PaginationMode+ # Field to partition by. Must be a STABLE creation-time field (never an `updated_at`), so a row's+ # partition doesn't move between syncs. `None` disables partitioning for the endpoint.+ partition_key: Optional[str] = None+ primary_keys: list[str] = field(default_factory=lambda: ["id"])+ # Max page size the endpoint accepts (Roark caps most list endpoints at 50, calls/chats/issues at+ # 100). `0` means the endpoint takes no pagination params (single unpaginated response).+ max_page_size: int = 50+ # Only `call` and `chat` accept `sortBy`/`sortDirection`. Passing a stable ascending sort keeps+ # pagination from skipping or duplicating rows if records are inserted mid-sync.+ sort_by: Optional[str] = None+ sort_direction: Optional[str] = None+ # Order rows actually arrive in, reported to the pipeline. Full-refresh only uses this defensively;+ # `issue` is fixed newest-first by the API and can't be reordered.+ sort_mode: SortMode = "asc"+ should_sync_default: bool = True+++ROARK_ENDPOINTS: dict[str, RoarkEndpointConfig] = {+ "call": RoarkEndpointConfig(+ name="call",+ path="/call",+ pagination="cursor",+ partition_key="startedAt",+ max_page_size=100,+ sort_by="createdAt",+ sort_direction="asc",+ ),+ "chat": RoarkEndpointConfig(+ name="chat",+ path="/chat",+ pagination="cursor",+ partition_key="startTimestamp",+ max_page_size=100,+ sort_by="createdAt",+ sort_direction="asc",+ ),+ "agent": RoarkEndpointConfig(+ name="agent",+ path="/agent",+ pagination="cursor",+ partition_key="createdAt",+ ),+ "agent_endpoint": RoarkEndpointConfig(+ name="agent_endpoint",+ path="/agent/endpoint",+ pagination="cursor",+ partition_key="createdAt",+ ),+ "metric_definition": RoarkEndpointConfig(+ name="metric_definition",+ path="/metric/definitions",+ pagination="none",+ max_page_size=0,+ ),+ "metric_collection_job": RoarkEndpointConfig(+ name="metric_collection_job",+ path="/metric/collection-jobs",+ pagination="cursor",+ partition_key="createdAt",+ ),+ "issue": RoarkEndpointConfig(+ name="issue",+ path="/issue",+ pagination="offset",+ partition_key="createdAt",+ max_page_size=100,+ # The issue endpoint returns results newest-first with no way to reorder.+ sort_mode="desc",+ ),+ "simulation_scenario": RoarkEndpointConfig(+ name="simulation_scenario",+ path="/simulation/scenario",+ pagination="cursor",+ partition_key="createdAt",+ ),+ "persona": RoarkEndpointConfig(+ name="persona",+ path="/persona",+ pagination="cursor",+ partition_key="createdAt",+ ),+ "run_plan": RoarkEndpointConfig(+ name="run_plan",+ path="/simulation/plan",+ pagination="cursor",+ partition_key="createdAt",+ ),+ "simulation_plan_job": RoarkEndpointConfig(+ name="simulation_plan_job",+ path="/simulation/plan/jobs",+ pagination="cursor",+ partition_key="createdAt",+ # The plan-job resource keys on `simulationRunPlanJobId` rather than a generic `id`.+ primary_keys=["simulationRunPlanJobId"],+ ),+ "knowledge_base": RoarkEndpointConfig(+ name="knowledge_base",+ path="/knowledge-base",+ pagination="cursor",+ partition_key="createdAt",+ ),+}++ENDPOINTS = tuple(ROARK_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/roark/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/roark/source.pyindex 010c70aa0d29..5b8d2ec3678a 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/roark/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/roark/source.py@@ -1,19 +1,39 @@-from typing import cast+from typing import Optional, castfrom posthog.schema import (DataWarehouseSourceCategory,ExternalDataSourceType as SchemaExternalDataSourceType,+ ReleaseStatus,SourceConfig,+ SourceFieldInputConfig,+ SourceFieldInputConfigType,)-from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import FieldType, SimpleSource+from products.warehouse_sources.backend.temporal.data_imports.pipelines.pipeline.typings import (+ SourceInputs,+ SourceResponse,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import FieldType, ResumableSource+from products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (+ CanonicalDescriptions,+)from products.warehouse_sources.backend.temporal.data_imports.sources.common.registry import SourceRegistry+from products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManager+from products.warehouse_sources.backend.temporal.data_imports.sources.common.schema import SourceSchemafrom products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs import RoarkSourceConfig+from products.warehouse_sources.backend.temporal.data_imports.sources.roark.roark import (+ RoarkResumeConfig,+ roark_source,+ validate_credentials as validate_roark_credentials,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.roark.settings import ENDPOINTS, ROARK_ENDPOINTSfrom products.warehouse_sources.backend.types import ExternalDataSourceType@SourceRegistry.register-class RoarkSource(SimpleSource[RoarkSourceConfig]):+class RoarkSource(ResumableSource[RoarkSourceConfig, RoarkResumeConfig]):+ lists_tables_without_credentials = True # static endpoint catalog — safe for public docs+@propertydef source_type(self) -> ExternalDataSourceType:return ExternalDataSourceType.ROARK@@ -24,8 +44,91 @@ class RoarkSource(SimpleSource[RoarkSourceConfig]):name=SchemaExternalDataSourceType.ROARK,category=DataWarehouseSourceCategory.ENGINEERING___MONITORING,label="Roark",+ releaseStatus=ReleaseStatus.ALPHA,+ caption="""Enter your Roark API key to sync your voice and chat AI observability data into the PostHog Data warehouse.++Generate an API key in your [Roark dashboard](https://app.roark.ai). The key is a simple bearer token with read access to your organization's calls, chats, agents, metrics, issues, and simulations.+""",iconPath="/static/services/roark.png",- keywords=["voice", "ai", "observability", "calls"],- fields=cast(list[FieldType], []),- unreleasedSource=True,+ docsUrl="https://posthog.com/docs/cdp/sources/roark",+ keywords=["voice", "ai", "observability", "calls", "chats"],+ fields=cast(+ list[FieldType],+ [+ SourceFieldInputConfig(+ name="api_key",+ label="API key",+ type=SourceFieldInputConfigType.PASSWORD,+ required=True,+ placeholder="",+ secret=True,+ ),+ ],+ ),+ )++ def get_canonical_descriptions(self) -> CanonicalDescriptions:+ from products.warehouse_sources.backend.temporal.data_imports.sources.roark.canonical_descriptions import (+ CANONICAL_DESCRIPTIONS,+ )++ return CANONICAL_DESCRIPTIONS++ def get_non_retryable_errors(self) -> dict[str, str | None]:+ # A bad or revoked bearer token surfaces as an HTTPError from `raise_for_status()`. Retrying+ # never fixes a credential problem, so stop the sync. Match the stable status text and base+ # host, not the per-request path.+ return {+ "401 Client Error: Unauthorized for url: https://api.roark.ai": "Your Roark API key is invalid or has been revoked. Generate a new key in your Roark dashboard, then reconnect.",+ "403 Client Error: Forbidden for url: https://api.roark.ai": "Your Roark API key does not have access to this data. Check the key's permissions in your Roark dashboard, then reconnect.",+ }++ def get_schemas(+ self,+ config: RoarkSourceConfig,+ team_id: int,+ with_counts: bool = False,+ names: list[str] | None = None,+ force_refresh: bool = False,+ ) -> list[SourceSchema]:+ # Roark exposes no server-side timestamp filter on any list endpoint, so every table is+ # full-refresh only (see settings.py). Primary keys come from the endpoint catalog.+ schemas = [+ SourceSchema(+ name=endpoint,+ supports_incremental=False,+ supports_append=False,+ incremental_fields=[],+ should_sync_default=ROARK_ENDPOINTS[endpoint].should_sync_default,+ detected_primary_keys=ROARK_ENDPOINTS[endpoint].primary_keys,+ )+ for endpoint in ENDPOINTS+ ]+ if names is not None:+ names_set = set(names)+ schemas = [s for s in schemas if s.name in names_set]+ return schemas++ def validate_credentials(+ self, config: RoarkSourceConfig, team_id: int, schema_name: Optional[str] = None+ ) -> tuple[bool, str | None]:+ if validate_roark_credentials(config.api_key):+ return True, None++ return False, "Invalid Roark API key"++ def get_resumable_source_manager(self, inputs: SourceInputs) -> ResumableSourceManager[RoarkResumeConfig]:+ return ResumableSourceManager[RoarkResumeConfig](inputs, RoarkResumeConfig)++ def source_for_pipeline(+ self,+ config: RoarkSourceConfig,+ resumable_source_manager: ResumableSourceManager[RoarkResumeConfig],+ inputs: SourceInputs,+ ) -> SourceResponse:+ return roark_source(+ api_key=config.api_key,+ endpoint=inputs.schema_name,+ logger=inputs.logger,+ resumable_source_manager=resumable_source_manager,)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/roark/tests/test_roark.py b/products/warehouse_sources/backend/temporal/data_imports/sources/roark/tests/test_roark.pynew file mode 100644index 000000000000..ec83b2891eab--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/roark/tests/test_roark.py@@ -0,0 +1,263 @@+from typing import Any++import pytest+from unittest.mock import MagicMock, patch++from parameterized import parameterized++from products.warehouse_sources.backend.temporal.data_imports.sources.roark import roark+from products.warehouse_sources.backend.temporal.data_imports.sources.roark.roark import (+ RoarkResumeConfig,+ _base_params,+ _build_url,+ _iter_pages,+ get_rows,+ roark_source,+ validate_credentials,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.roark.settings import ENDPOINTS, ROARK_ENDPOINTS+++def _logger() -> MagicMock:+ return MagicMock()+++class TestBuildUrl:+ def test_no_params(self) -> None:+ assert _build_url("/call", {}) == "https://api.roark.ai/v1/call"++ def test_with_params_is_encoded(self) -> None:+ url = _build_url("/call", {"limit": 100, "after": "abc def"})+ assert url == "https://api.roark.ai/v1/call?limit=100&after=abc+def"+++class TestBaseParams:+ def test_cursor_endpoint_with_sort(self) -> None:+ # call supports sortBy/sortDirection and caps at 100+ params = _base_params(ROARK_ENDPOINTS["call"])+ assert params == {"limit": 100, "sortBy": "createdAt", "sortDirection": "asc"}++ def test_cursor_endpoint_without_sort(self) -> None:+ params = _base_params(ROARK_ENDPOINTS["agent"])+ assert params == {"limit": 50}+ assert "sortBy" not in params++ def test_unpaginated_endpoint_sends_no_limit(self) -> None:+ # metric_definition takes no pagination params at all+ params = _base_params(ROARK_ENDPOINTS["metric_definition"])+ assert params == {}+++class TestIterPagesCursor:+ def test_walks_cursor_until_has_more_false(self) -> None:+ pages = [+ {"data": [{"id": "1"}], "pagination": {"hasMore": True, "nextCursor": "c1"}},+ {"data": [{"id": "2"}], "pagination": {"hasMore": True, "nextCursor": "c2"}},+ {"data": [{"id": "3"}], "pagination": {"hasMore": False, "nextCursor": None}},+ ]+ with patch.object(roark, "_fetch_page", side_effect=pages):+ result = list(_iter_pages(MagicMock(), {}, ROARK_ENDPOINTS["agent"], _logger(), resume=None))++ assert [p.items for p in result] == [[{"id": "1"}], [{"id": "2"}], [{"id": "3"}]]+ # Each page records the cursor that fetched IT, so a resume re-fetches the same page.+ assert [p.resume_state.after for p in result] == [None, "c1", "c2"]++ def test_stops_when_next_cursor_missing_even_if_has_more(self) -> None:+ pages = [{"data": [{"id": "1"}], "pagination": {"hasMore": True, "nextCursor": None}}]+ with patch.object(roark, "_fetch_page", side_effect=pages):+ result = list(_iter_pages(MagicMock(), {}, ROARK_ENDPOINTS["agent"], _logger(), resume=None))+ assert len(result) == 1++ def test_resume_starts_from_saved_cursor(self) -> None:+ pages = [{"data": [{"id": "9"}], "pagination": {"hasMore": False, "nextCursor": None}}]+ captured_urls: list[str] = []++ def fake_fetch(session: Any, url: str, headers: Any, logger: Any) -> dict:+ captured_urls.append(url)+ return pages.pop(0)++ with patch.object(roark, "_fetch_page", side_effect=fake_fetch):+ list(+ _iter_pages(+ MagicMock(),+ {},+ ROARK_ENDPOINTS["agent"],+ _logger(),+ resume=RoarkResumeConfig(after="saved-cursor"),+ )+ )++ assert "after=saved-cursor" in captured_urls[0]+++class TestIterPagesOffset:+ def test_walks_offset_advancing_by_rows_returned(self) -> None:+ # A non-final page returning fewer rows than max_page_size must advance the offset by the+ # rows actually returned, or rows in the gap would be skipped on the next request.+ pages = [+ {"data": [{"id": "1"}, {"id": "2"}, {"id": "3"}], "pagination": {"hasMore": True}},+ {"data": [{"id": "4"}], "pagination": {"hasMore": False}},+ ]+ captured_urls: list[str] = []++ def fake_fetch(session: Any, url: str, headers: Any, logger: Any) -> dict:+ captured_urls.append(url)+ return pages.pop(0)++ with patch.object(roark, "_fetch_page", side_effect=fake_fetch):+ result = list(_iter_pages(MagicMock(), {}, ROARK_ENDPOINTS["issue"], _logger(), resume=None))++ assert [p.resume_state.offset for p in result] == [0, 3]+ assert "offset=0" in captured_urls[0]+ assert "offset=3" in captured_urls[1]++ def test_resume_starts_from_saved_offset(self) -> None:+ pages = [{"data": [], "pagination": {"limit": 100, "offset": 200, "hasMore": False}}]+ captured_urls: list[str] = []++ def fake_fetch(session: Any, url: str, headers: Any, logger: Any) -> dict:+ captured_urls.append(url)+ return pages.pop(0)++ with patch.object(roark, "_fetch_page", side_effect=fake_fetch):+ list(+ _iter_pages(+ MagicMock(),+ {},+ ROARK_ENDPOINTS["issue"],+ _logger(),+ resume=RoarkResumeConfig(offset=200),+ )+ )++ assert "offset=200" in captured_urls[0]+++class TestIterPagesNone:+ def test_single_unpaginated_fetch(self) -> None:+ with patch.object(roark, "_fetch_page", return_value={"data": [{"id": "1"}, {"id": "2"}]}) as fetch:+ result = list(_iter_pages(MagicMock(), {}, ROARK_ENDPOINTS["metric_definition"], _logger(), resume=None))+ assert fetch.call_count == 1+ assert result[0].items == [{"id": "1"}, {"id": "2"}]++ def test_handles_bare_top_level_list_response(self) -> None:+ # Unpaginated endpoints may return a bare list instead of a `{"data": [...]}` envelope; those+ # rows must still be synced rather than silently dropped.+ with patch.object(roark, "_fetch_page", return_value=[{"id": "1"}, {"id": "2"}]):+ result = list(_iter_pages(MagicMock(), {}, ROARK_ENDPOINTS["metric_definition"], _logger(), resume=None))+ assert [item["id"] for page in result for item in page.items] == ["1", "2"]+++class _FakeBatcher:+ """Yields a table after every batched row so save-after-yield is observable in tests."""++ def __init__(self, **kwargs: Any) -> None:+ self._rows: list[dict] = []++ def batch(self, row: dict) -> None:+ self._rows.append(row)++ def should_yield(self, include_incomplete_chunk: bool = False) -> bool:+ return bool(self._rows)++ def get_table(self) -> list[dict]:+ rows = self._rows+ self._rows = []+ return rows+++class TestGetRows:+ def test_saves_current_page_cursor_after_yield(self) -> None:+ pages = [+ {"data": [{"id": "1"}], "pagination": {"hasMore": True, "nextCursor": "c1"}},+ {"data": [{"id": "2"}], "pagination": {"hasMore": False, "nextCursor": None}},+ ]+ manager = MagicMock()+ manager.can_resume.return_value = False++ with (+ patch.object(roark, "_fetch_page", side_effect=pages),+ patch.object(roark, "make_tracked_session", return_value=MagicMock()),+ patch.object(roark, "Batcher", _FakeBatcher),+ ):+ tables = list(get_rows("key", "agent", _logger(), manager))++ assert tables == [[{"id": "1"}], [{"id": "2"}]]+ # The saved cursor is the one that fetched the page being processed (None for page 1, "c1" for+ # page 2) — so a resume re-fetches that page rather than skipping its un-yielded tail.+ saved = [call.args[0].after for call in manager.save_state.call_args_list]+ assert saved == [None, "c1"]++ def test_resume_loads_saved_state(self) -> None:+ manager = MagicMock()+ manager.can_resume.return_value = True+ manager.load_state.return_value = RoarkResumeConfig(after="resume-cursor")+ captured_urls: list[str] = []++ def fake_fetch(session: Any, url: str, headers: Any, logger: Any) -> dict:+ captured_urls.append(url)+ return {"data": [], "pagination": {"hasMore": False, "nextCursor": None}}++ with (+ patch.object(roark, "_fetch_page", side_effect=fake_fetch),+ patch.object(roark, "make_tracked_session", return_value=MagicMock()),+ patch.object(roark, "Batcher", _FakeBatcher),+ ):+ list(get_rows("key", "agent", _logger(), manager))++ assert "after=resume-cursor" in captured_urls[0]+++class TestValidateCredentials:+ @parameterized.expand([(200, True), (401, False), (403, False), (500, False)])+ def test_status_maps_to_validity(self, status: int, expected: bool) -> None:+ session = MagicMock()+ session.get.return_value = MagicMock(status_code=status)+ with patch.object(roark, "make_tracked_session", return_value=session):+ assert validate_credentials("key") is expected++ def test_network_error_is_invalid(self) -> None:+ session = MagicMock()+ session.get.side_effect = Exception("boom")+ with patch.object(roark, "make_tracked_session", return_value=session):+ assert validate_credentials("key") is False+++class TestRoarkSourceResponse:+ def test_response_uses_endpoint_primary_keys_and_partition(self) -> None:+ response = roark_source("key", "call", _logger(), MagicMock())+ assert response.name == "call"+ assert response.primary_keys == ["id"]+ assert response.partition_keys == ["startedAt"]+ assert response.partition_mode == "datetime"+ assert response.sort_mode == "asc"++ def test_plan_job_uses_non_id_primary_key(self) -> None:+ response = roark_source("key", "simulation_plan_job", _logger(), MagicMock())+ assert response.primary_keys == ["simulationRunPlanJobId"]++ def test_issue_reports_desc_sort_mode(self) -> None:+ # The issue endpoint is fixed newest-first, so we must not claim ascending order.+ response = roark_source("key", "issue", _logger(), MagicMock())+ assert response.sort_mode == "desc"++ def test_metric_definition_has_no_partition(self) -> None:+ response = roark_source("key", "metric_definition", _logger(), MagicMock())+ assert response.partition_mode is None+ assert response.partition_keys is None++ @parameterized.expand([(name,) for name in ENDPOINTS])+ def test_every_endpoint_builds_a_response(self, endpoint: str) -> None:+ response = roark_source("key", endpoint, _logger(), MagicMock())+ assert response.name == endpoint+ assert response.primary_keys == ROARK_ENDPOINTS[endpoint].primary_keys+++class TestFetchPageRetry:+ @parameterized.expand([(429,), (500,), (503,)])+ def test_retryable_statuses_raise_retryable_error(self, status: int) -> None:+ session = MagicMock()+ session.get.return_value = MagicMock(status_code=status, ok=False, text="err")+ # Bypass tenacity's retry wrapping to assert the raised error type directly.+ with pytest.raises(roark.RoarkRetryableError):+ roark._fetch_page.__wrapped__(session, "https://api.roark.ai/v1/agent", {}, _logger()) # type: ignore[attr-defined]diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/roark/tests/test_roark_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/roark/tests/test_roark_source.pynew file mode 100644index 000000000000..5fd0a66e2a67--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/roark/tests/test_roark_source.py@@ -0,0 +1,102 @@+from unittest.mock import MagicMock, patch++from parameterized import parameterized++from posthog.schema import ReleaseStatus, SourceFieldInputConfig, SourceFieldInputConfigType++from products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManager+from products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs import RoarkSourceConfig+from products.warehouse_sources.backend.temporal.data_imports.sources.roark import source as source_module+from products.warehouse_sources.backend.temporal.data_imports.sources.roark.canonical_descriptions import (+ CANONICAL_DESCRIPTIONS,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.roark.roark import RoarkResumeConfig+from products.warehouse_sources.backend.temporal.data_imports.sources.roark.settings import ENDPOINTS, ROARK_ENDPOINTS+from products.warehouse_sources.backend.temporal.data_imports.sources.roark.source import RoarkSource+from products.warehouse_sources.backend.types import ExternalDataSourceType+++class TestRoarkSource:+ def setup_method(self) -> None:+ self.source = RoarkSource()+ self.team_id = 123++ def test_source_type(self) -> None:+ assert self.source.source_type == ExternalDataSourceType.ROARK++ def test_lists_tables_without_credentials(self) -> None:+ # get_schemas is a static, no-I/O catalog, so public docs may render the table list.+ assert self.source.lists_tables_without_credentials is True++ def test_source_config_shape(self) -> None:+ config = self.source.get_source_config+ assert config.label == "Roark"+ assert config.releaseStatus == ReleaseStatus.ALPHA+ assert config.docsUrl == "https://posthog.com/docs/cdp/sources/roark"++ def test_source_config_has_secret_api_key_field(self) -> None:+ fields = self.source.get_source_config.fields+ assert len(fields) == 1+ api_key = fields[0]+ assert isinstance(api_key, SourceFieldInputConfig)+ assert api_key.name == "api_key"+ assert api_key.type == SourceFieldInputConfigType.PASSWORD+ assert api_key.required is True+ assert api_key.secret is True++ def test_non_retryable_errors_cover_auth_failures(self) -> None:+ errors = self.source.get_non_retryable_errors()+ assert any("401 Client Error" in key for key in errors)+ assert any("403 Client Error" in key for key in errors)++ def test_get_schemas_returns_every_endpoint_as_full_refresh(self) -> None:+ schemas = self.source.get_schemas(RoarkSourceConfig(api_key="k"), self.team_id)+ assert {s.name for s in schemas} == set(ENDPOINTS)+ for schema in schemas:+ assert schema.supports_incremental is False+ assert schema.supports_append is False+ assert schema.incremental_fields == []+ assert schema.detected_primary_keys == ROARK_ENDPOINTS[schema.name].primary_keys++ def test_get_schemas_filters_by_names(self) -> None:+ schemas = self.source.get_schemas(RoarkSourceConfig(api_key="k"), self.team_id, names=["call", "chat"])+ assert {s.name for s in schemas} == {"call", "chat"}++ @parameterized.expand([(True, True, None), (False, False, "Invalid Roark API key")])+ def test_validate_credentials(self, valid: bool, expected_ok: bool, expected_msg: str | None) -> None:+ with patch.object(source_module, "validate_roark_credentials", return_value=valid):+ ok, msg = self.source.validate_credentials(RoarkSourceConfig(api_key="k"), self.team_id)+ assert ok is expected_ok+ assert msg == expected_msg++ def test_get_resumable_source_manager_binds_resume_config(self) -> None:+ inputs = MagicMock()+ manager = self.source.get_resumable_source_manager(inputs)+ assert isinstance(manager, ResumableSourceManager)+ assert manager._data_class is RoarkResumeConfig++ def test_source_for_pipeline_plumbs_arguments(self) -> None:+ inputs = MagicMock()+ inputs.schema_name = "call"+ config = RoarkSourceConfig(api_key="secret-key")+ manager = MagicMock()++ with patch.object(source_module, "roark_source") as mock_source:+ self.source.source_for_pipeline(config, manager, inputs)++ mock_source.assert_called_once()+ kwargs = mock_source.call_args.kwargs+ assert kwargs["api_key"] == "secret-key"+ assert kwargs["endpoint"] == "call"+ assert kwargs["resumable_source_manager"] is manager++ def test_canonical_descriptions_keys_match_endpoints(self) -> None:+ # Canonical descriptions are keyed by the schema/endpoint name get_schemas returns.+ assert self.source.get_canonical_descriptions() is CANONICAL_DESCRIPTIONS+ assert set(CANONICAL_DESCRIPTIONS).issubset(set(ENDPOINTS))++ def test_documented_tables_render_for_public_docs(self) -> None:+ tables = self.source.get_documented_tables()+ assert {t["name"] for t in tables} == set(ENDPOINTS)+ for table in tables:+ assert "Full refresh" in table["sync_methods"]