: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 Persona verifications table (#79829)
jake sciotto3dc17f8561dc
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/api_inventory.md b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/api_inventory.mdindex 70991b04b705..d7203bfbd509 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/api_inventory.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/api_inventory.md@@ -14,24 +14,44 @@ Reference: <https://docs.withpersona.com/reference> · Base URL: `https://api.wi## Endpoints synced-| Endpoint | Path | Sync mode | Primary key | Partition key |-| ------------------- | -------------------- | ------------ | ----------- | ------------- |-| `inquiries` | `/inquiries` | Incremental | `id` | `created_at` |-| `accounts` | `/accounts` | Incremental | `id` | `created_at` |-| `cases` | `/cases` | Incremental | `id` | `created_at` |-| `transactions` | `/transactions` | Incremental | `id` | `created_at` |-| `events` | `/events` | Append only | `id` | `created_at` |-| `inquiry_templates` | `/inquiry-templates` | Full refresh | `id` | — |--Object ids are globally unique and type-prefixed (`inq_`, `acc_`, `case_`, `txn_`, `evt_`, `itmpl_`), so-`id` is a safe standalone primary key. Persona kebab-case attributes (`created-at`) normalize to the-snake_case warehouse columns (`created_at`).+| Endpoint | Path | Sync mode | Primary key | Partition key |+| ------------------- | --------------------------------------- | ------------ | ----------- | -------------------- |+| `inquiries` | `/inquiries` | Incremental | `id` | `created_at` |+| `verifications` | `/inquiries/{id}?include=verifications` | Incremental | `id` | `inquiry_created_at` |+| `accounts` | `/accounts` | Incremental | `id` | `created_at` |+| `cases` | `/cases` | Incremental | `id` | `created_at` |+| `transactions` | `/transactions` | Incremental | `id` | `created_at` |+| `events` | `/events` | Append only | `id` | `created_at` |+| `inquiry_templates` | `/inquiry-templates` | Full refresh | `id` | — |++Object ids are globally unique and type-prefixed (`inq_`, `ver_`, `acc_`, `case_`, `txn_`, `evt_`,+`itmpl_`), so `id` is a safe standalone primary key. Persona kebab-case attributes (`created-at`)+normalize to the snake_case warehouse columns (`created_at`).++## Verifications are a fan-out, not a list endpoint++Persona's Verifications API exposes no cross-inquiry list — only `GET /verifications/{id}` plus+per-type retrieves ([API index](https://docs.withpersona.com/api-reference/llms.txt)). Related+resources are hydrated with the `include` query parameter, and+[Response Body](https://docs.withpersona.com/serialization) states that `include` **cannot be used on+"list all" endpoints**, so `/inquiries?include=verifications` is not an option either. From API+version `2025-10-27` the `included` array is empty unless `include` is passed explicitly.++So `verifications` walks `/inquiries` like any other list endpoint and re-fetches each inquiry as+`/inquiries/{id}?include=verifications`, reading the rows out of `included`. That costs one extra+request per inquiry in the window, which is why the table is off by default.++Because the window is applied to the inquiry list, the advertised incremental cursor is the parent's+`inquiry_created_at`, not the verification's own `created_at` — filtering the parent list on a child+timestamp would skip inquiries created before the watermark that gained a verification after it.+Retries added to an already-synced inquiry are therefore picked up on a full refresh, consistent with+how this source treats updates elsewhere.## Verification note-Endpoint paths and semantics are taken from the public Persona docs. They could **not** be curl-verified-against the live API because Persona's auth middleware returns `401` for every request (including bogus-paths) without a valid key, so route existence and the cross-page behavior of `filter[created-at-start]`-were not confirmed empirically. As a safeguard the paginator stops client-side once rows predate the+Endpoint paths and semantics are taken from the public Persona docs and the OpenAPI-derived API index+they publish. They could **not** be curl-verified against the live API because Persona's auth+middleware returns `401` for every request (including bogus paths) without a valid key, so route+existence and the cross-page behavior of `filter[created-at-start]` were not confirmed empirically. As a safeguard the paginator stops client-side once rows predate theincremental watermark (newest-first ordering), so even if the created-at filter failed to persist pastpage one we would not re-walk full history on every sync.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/canonical_descriptions.pyindex 77caa355efc2..55167f03a5bc 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/canonical_descriptions.py@@ -21,6 +21,21 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"birthdate": "Date of birth collected or verified during the inquiry.",},},+ "verifications": {+ "description": "A single identity check run inside an inquiry (government ID, selfie, database, phone, email, and others), with its own status and per-check results.",+ "docs_url": "https://docs.withpersona.com/api-reference/verifications",+ "columns": {+ "id": "Unique identifier for the verification (prefixed `ver_`).",+ "type": "The kind of verification that ran (e.g. verification/government-id, verification/selfie).",+ "status": "Current state of the verification (initiated, confirmed, submitted, passed, requires_retry, failed).",+ "checks": "Individual checks the verification ran, each with a name, a passed/failed/not_applicable status, and reasons.",+ "created_at": "Timestamp when the verification was created.",+ "submitted_at": "Timestamp when the claimed information was submitted for processing.",+ "completed_at": "Timestamp when the verification finished processing.",+ "inquiry_id": "Identifier of the inquiry this verification belongs to (prefixed `inq_`).",+ "inquiry_created_at": "Timestamp when the parent inquiry was created.",+ },+ },"accounts": {"description": "A persistent record of an individual, grouping all of their inquiries, verifications, and other activity over time.","docs_url": "https://docs.withpersona.com/reference/accounts",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/persona.py b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/persona.pyindex 7b8a7ed29841..ab6bdfd29493 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/persona.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/persona.py@@ -15,6 +15,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.typfrom products.warehouse_sources.backend.temporal.data_imports.sources.persona.settings import (PERSONA_ENDPOINTS,PersonaEndpointConfig,+ PersonaFanout,)PERSONA_BASE_URL = "https://api.withpersona.com/api/v1"@@ -29,8 +30,9 @@ class PersonaRetryableError(Exception):@dataclasses.dataclassclass PersonaResumeConfig:- # `page[after]` cursor (the id of the last object we durably yielded). On resume we re-window the- # request with the same created-at filter and continue from this object. `None` starts at page one.+ # `page[after]` cursor (the id of the last list object whose rows we durably yielded). On resume+ # we re-window the request with the same created-at filter and continue from this object.+ # `None` starts at page one.after: str | None = None@@ -108,7 +110,10 @@ def validate_credentials(api_key: str) -> int:"""url = _build_url(f"{PERSONA_BASE_URL}/inquiries", {"page[size]": 1})try:- response = make_tracked_session().get(url, headers=_get_headers(api_key), timeout=10)+ # Inquiry and verification bodies carry KYC PII (names, DOBs, government-ID and selfie check+ # results) that the name-based scrubber can't reliably strip, so keep them out of HTTP sample+ # capture, following the same pattern as gusto and workday.+ response = make_tracked_session(capture=False).get(url, headers=_get_headers(api_key), timeout=10)return response.status_codeexcept Exception:return 0@@ -144,6 +149,41 @@ def _fetch_page(return response.json()+def _rows_for_parent(+ session: requests.Session,+ parent_path: str,+ fanout: PersonaFanout,+ parent: dict[str, Any],+ headers: dict[str, str],+ logger: FilteringBoundLogger,+) -> list[dict[str, Any]]:+ """Hydrate one parent object and return its child rows, tagged with the parent's identifiers."""+ parent_id = parent["id"]+ url = _build_url(f"{PERSONA_BASE_URL}{parent_path}/{parent_id}", {"include": fanout.relationship})+ try:+ data = _fetch_page(session, url, headers, logger)+ except requests.HTTPError as e:+ if e.response is not None and e.response.status_code == 404:+ # The parent can be redacted/deleted between the list page and this hydrate call. Skip+ # it rather than aborting the whole sync — the caller still advances its checkpoint past+ # this item, so a resume won't keep re-hitting the same gone parent.+ logger.warning(f"Persona: {parent_path}/{parent_id} returned 404 on fan-out hydrate, skipping")+ return []+ raise++ rows: list[dict[str, Any]] = []+ for item in data.get("included") or []:+ if not str(item.get("type", "")).startswith(fanout.type_prefix):+ continue+ row = _flatten_item(item)+ # Children don't repeat their parent's attributes, so carry the two the warehouse needs: one+ # to join back to the parent table, one for the incremental cursor and partition key.+ row[f"{fanout.parent_key_prefix}-id"] = parent_id+ row[f"{fanout.parent_key_prefix}-created-at"] = parent.get("attributes", {}).get("created-at")+ rows.append(row)+ return rows++def _build_params(config: PersonaEndpointConfig, watermark: Optional[datetime], after: str | None) -> dict[str, Any]:params: dict[str, Any] = {"page[size]": PAGE_SIZE}if watermark is not None:@@ -165,8 +205,10 @@ def get_rows(config = PERSONA_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()+ # One session reused across every page so urllib3 keeps the connection alive. Inquiry and+ # verification bodies carry KYC PII the name-based scrubber can't reliably strip, so keep them+ # out of HTTP sample capture, following the same pattern as gusto and workday.+ session = make_tracked_session(capture=False)use_incremental = should_use_incremental_field and config.supports_incrementalwatermark = _to_datetime(db_incremental_field_last_value) if use_incremental else None@@ -179,6 +221,10 @@ def get_rows(logger.debug(f"Persona: resuming {endpoint} from page[after]={after}")stop = False+ # `page[after]` cursor for the last list object whose rows are all in the batcher. Fan-out rows+ # carry their own ids rather than the list object's, and one list object can straddle a batch+ # boundary, so the cursor is tracked here instead of read back off the yielded table.+ checkpoint_after: str | None = Nonewhile not stop:url = _build_url(f"{PERSONA_BASE_URL}{config.path}", _build_params(config, watermark, after))data = _fetch_page(session, url, headers, logger)@@ -199,16 +245,24 @@ def get_rows(stop = Truebreak- batcher.batch(_flatten_item(item))-- while batcher.should_yield():- py_table = batcher.get_table()- yield py_table- # Save AFTER yielding so a crash re-yields the last batch (merge dedupes on the- # primary key) rather than skipping it. Only checkpoint while more pages remain.- if has_next:- last_id = py_table.column("id")[-1].as_py()- resumable_source_manager.save_state(PersonaResumeConfig(after=last_id))+ rows = (+ _rows_for_parent(session, config.path, config.fanout, item, headers, logger)+ if config.fanout is not None+ else [_flatten_item(item)]+ )+ for row in rows:+ batcher.batch(row)++ while batcher.should_yield():+ yield batcher.get_table()+ # Save AFTER yielding so a crash re-yields the last batch (merge dedupes on the+ # primary key) rather than skipping it. The cursor deliberately stops short of the+ # object being batched, whose remaining rows may still be buffered. Only+ # checkpoint while more pages remain.+ if has_next and checkpoint_after is not None:+ resumable_source_manager.save_state(PersonaResumeConfig(after=checkpoint_after))++ checkpoint_after = item["id"]if stop or not has_next:breakdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/settings.pyindex e3439891e850..a3f31af9f079 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/settings.py@@ -6,26 +6,45 @@ from products.warehouse_sources.backend.types import IncrementalField, Increment# Persona's list endpoints return records newest-first (reverse-chronological on created-at) and are# paginated with a `page[after]=<object id>` cursor. Incremental endpoints expose a server-side# `filter[created-at-start]` window on the immutable `created-at` timestamp; there is no `updated-at`-# filter, so the only advertised incremental cursor is `created_at`. Object ids are globally unique-# and type-prefixed (e.g. `inq_...`, `acc_...`), so `id` is a safe standalone primary key.+# filter, so every advertised incremental cursor is a `created-at` timestamp. Object ids are globally+# unique and type-prefixed (e.g. `inq_...`, `acc_...`), so `id` is a safe standalone primary key.-def _created_at_incremental_fields() -> list[IncrementalField]:+def _created_at_incremental_fields(column: str = "created_at") -> list[IncrementalField]:# Persona attribute `created-at` normalizes to the `created_at` warehouse column (the pipeline# snake-cases identifiers), so both the advertised incremental field and the partition key use it.return [{- "label": "created_at",+ "label": column,"type": IncrementalFieldType.DateTime,- "field": "created_at",+ "field": column,"field_type": IncrementalFieldType.DateTime,},]+@dataclass(frozen=True, kw_only=True)+class PersonaFanout:+ """How to reach a resource Persona only exposes underneath a parent object.++ Persona has no cross-parent list endpoint for these, and it rejects `include` on list endpoints,+ so each parent from the list walk is re-fetched individually with `?include=<relationship>` and+ the hydrated children are read out of the response's `included` array.+ """++ relationship: str+ # Persona sub-types its child objects (`verification/government-id`, `verification/selfie`, …).+ # Matching on the prefix keeps the rows to one resource even if a response carries more.+ type_prefix: str+ # Parent identifiers copied onto every child row, as `{parent_key_prefix}-id` /+ # `{parent_key_prefix}-created-at`.+ parent_key_prefix: str++@dataclassclass PersonaEndpointConfig:name: str+ # For a fan-out endpoint this is the parent's list path, not the child's.path: strincremental_fields: list[IncrementalField] = field(default_factory=list)# A stable created-at column to partition on. Kept in the normalized (snake_case) form the@@ -37,6 +56,8 @@ class PersonaEndpointConfig:append_only: bool = Falseprimary_keys: list[str] = field(default_factory=lambda: ["id"])should_sync_default: bool = True+ # Set when the rows come from hydrating each parent rather than from the list response itself.+ fanout: Optional[PersonaFanout] = NonePERSONA_ENDPOINTS: dict[str, PersonaEndpointConfig] = {@@ -45,6 +66,21 @@ PERSONA_ENDPOINTS: dict[str, PersonaEndpointConfig] = {path="/inquiries",incremental_fields=_created_at_incremental_fields(),),+ # Verification detail is only reachable one inquiry at a time, so this table costs one extra+ # request per inquiry in the window. It's off by default for that reason — a user who wants+ # attempt-level data opts in, and everyone else keeps the cheap inquiry-level sync.+ "verifications": PersonaEndpointConfig(+ name="verifications",+ path="/inquiries",+ fanout=PersonaFanout(relationship="verifications", type_prefix="verification/", parent_key_prefix="inquiry"),+ # A verification's own `created-at` can't drive the window: the window is applied to the+ # inquiry list we walk, and an inquiry created before the watermark can still gain a+ # verification after it. Advertising the parent's timestamp keeps the cursor and the filter+ # on the same field. Retries on an already-synced inquiry are picked up on a full refresh.+ incremental_fields=_created_at_incremental_fields("inquiry_created_at"),+ partition_key="inquiry_created_at",+ should_sync_default=False,+ ),"accounts": PersonaEndpointConfig(name="accounts",path="/accounts",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/source.pyindex dbd2d36a78d8..f9358576daff 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/source.py@@ -51,7 +51,7 @@ class PersonaSource(ResumableSource[PersonaSourceConfig, PersonaResumeConfig]):releaseStatus=ReleaseStatus.ALPHA,caption="""Enter your Persona API key to automatically pull your Persona data into the PostHog Data warehouse.-Create an API key in your Persona dashboard under **Settings → API Keys**. The key needs read access to the resources you want to sync (inquiries, accounts, cases, transactions, events).+Create an API key in your Persona dashboard under **Settings → API Keys**. The key needs read access to the resources you want to sync (inquiries, verifications, accounts, cases, transactions, events).Sandbox and production environments use separate API keys — use the one for the environment whose data you want to import.""",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/tests/test_persona.py b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/tests/test_persona.pyindex 5904fc062bd7..8782df3dd56e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/tests/test_persona.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/tests/test_persona.py@@ -2,7 +2,7 @@ from datetime import UTC, date, datetimefrom typing import Anyimport pytest-from unittest.mock import MagicMock+from unittest.mock import MagicMock, patchimport requestsfrom parameterized import parameterized@@ -97,6 +97,33 @@ class TestFlattenItem:assert "attributes" not in row+class TestSessionCapture:+ def test_validate_credentials_disables_http_sample_capture(self) -> None:+ with patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.persona.persona.make_tracked_session"+ ) as make_session:+ make_session.return_value.get.return_value = MagicMock(status_code=200)+ persona.validate_credentials("persona_test")+ # Inquiry bodies carry KYC PII the name-based scrubber can't reliably strip.+ assert make_session.call_args.kwargs["capture"] is False++ def test_get_rows_disables_http_sample_capture(self, monkeypatch: Any) -> None:+ monkeypatch.setattr(persona, "_fetch_page", lambda *a, **kw: {"data": [], "links": {"next": None}})+ with patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.persona.persona.make_tracked_session"+ ) as make_session:+ list(+ get_rows(+ api_key="persona_test",+ endpoint="inquiries",+ logger=MagicMock(),+ resumable_source_manager=_FakeResumableManager(), # type: ignore[arg-type]+ )+ )+ # Verification bodies carry KYC PII the name-based scrubber can't reliably strip.+ assert make_session.call_args.kwargs["capture"] is False++class TestFetchPageRetryClassification:@parameterized.expand([("rate_limited", 429), ("server_error", 500), ("bad_gateway", 503)])def test_retryable_statuses_raise_retryable_error(self, _name: str, status: int) -> None:@@ -125,7 +152,13 @@ class TestFetchPageRetryClassification:assert session.get.call_count == 1-def _collect(manager: _FakeResumableManager, monkeypatch: Any, pages: list[dict], **kwargs: Any) -> list[dict]:+def _collect(+ manager: _FakeResumableManager,+ monkeypatch: Any,+ pages: list[dict],+ endpoint: str = "inquiries",+ **kwargs: Any,+) -> list[dict]:"""Feed canned pages to get_rows in order and return the flattened rows."""calls: list[str] = []iterator = iter(pages)@@ -139,7 +172,7 @@ def _collect(manager: _FakeResumableManager, monkeypatch: Any, pages: list[dict]rows: list[dict] = []for table in get_rows(api_key="persona_test",- endpoint="inquiries",+ endpoint=endpoint,logger=MagicMock(),resumable_source_manager=manager, # type: ignore[arg-type]**kwargs,@@ -225,8 +258,139 @@ class TestResume:assert "page[after]=inq_saved" in manager.fetched_urls[0] # type: ignore[attr-defined]+def _verifications(count: int, prefix: str) -> list[dict]:+ return [+ {"type": "verification/selfie", "id": f"{prefix}_{index}", "attributes": {"status": "passed"}}+ for index in range(count)+ ]+++class TestVerificationsFanout:+ def test_hydrates_each_inquiry_and_tags_rows_with_the_parent(self, monkeypatch: Any) -> None:+ pages = [+ {+ "data": [{"type": "inquiry", "id": "inq_1", "attributes": {"created-at": "2026-01-03T00:00:00.000Z"}}],+ "links": {"next": None},+ },+ {+ "data": {"type": "inquiry", "id": "inq_1", "attributes": {}},+ "included": [+ {"type": "verification/government-id", "id": "ver_1", "attributes": {"status": "failed"}},+ {"type": "verification/selfie", "id": "ver_2", "attributes": {"status": "passed"}},+ # Accounts on an older API version serialize related resources beyond the ones asked+ # for; only verifications belong in this table.+ {"type": "account", "id": "act_1", "attributes": {"status": "active"}},+ ],+ },+ ]+ manager = _FakeResumableManager()+ rows = _collect(manager, monkeypatch, pages, endpoint="verifications")++ assert [r["id"] for r in rows] == ["ver_1", "ver_2"]+ assert [r["status"] for r in rows] == ["failed", "passed"]+ assert {r["inquiry-id"] for r in rows} == {"inq_1"}+ assert {r["inquiry-created-at"] for r in rows} == {"2026-01-03T00:00:00.000Z"}+ # Persona has no cross-inquiry list of verifications and rejects `include` on list endpoints,+ # so each inquiry has to be hydrated on its own.+ assert manager.fetched_urls[1] == "https://api.withpersona.com/api/v1/inquiries/inq_1?include=verifications" # type: ignore[attr-defined]++ def test_resume_cursor_is_an_inquiry_id_not_a_verification_id(self, monkeypatch: Any) -> None:+ # A `ver_` id is a meaningless `page[after]` on /inquiries, and a cursor that overshoots the+ # inquiry still being batched drops its buffered rows on resume.+ pages: list[dict[str, Any]] = [+ {+ "data": [+ {"type": "inquiry", "id": "inq_a", "attributes": {"created-at": "2026-01-03T00:00:00.000Z"}},+ {"type": "inquiry", "id": "inq_b", "attributes": {"created-at": "2026-01-02T00:00:00.000Z"}},+ ],+ "links": {"next": "/api/v1/inquiries?page[after]=inq_b"},+ },+ # One row short of the batcher's chunk size, so the flush lands part-way through `inq_b`.+ {"data": {}, "included": _verifications(1999, "vera")},+ {"data": {}, "included": _verifications(2, "verb")},+ {"data": [], "links": {"next": None}},+ ]+ manager = _FakeResumableManager()+ _collect(manager, monkeypatch, pages, endpoint="verifications")++ assert [state.after for state in manager.saved] == ["inq_a"]++ def test_hydrate_404_skips_parent_instead_of_aborting_the_sync(self, monkeypatch: Any) -> None:+ # An inquiry can be redacted/deleted between the list page and this hydrate call. Without a+ # 404 guard, that fetch raises and kills the whole generator, and since the checkpoint only+ # advances after an item's rows are processed, a resume re-fetches the same gone inquiry+ # forever instead of moving on to the rest.+ calls: list[str] = []++ def fake_fetch(session: Any, url: str, headers: dict[str, str], logger: Any) -> dict:+ calls.append(url)+ if "/inquiries/inq_gone" in url:+ response = requests.Response()+ response.status_code = 404+ raise requests.HTTPError(response=response)+ if "/inquiries/inq_ok" in url:+ return {+ "data": {"type": "inquiry", "id": "inq_ok", "attributes": {}},+ "included": [{"type": "verification/selfie", "id": "ver_1", "attributes": {"status": "passed"}}],+ }+ return {+ "data": [+ {"type": "inquiry", "id": "inq_gone", "attributes": {"created-at": "2026-01-03T00:00:00.000Z"}},+ {"type": "inquiry", "id": "inq_ok", "attributes": {"created-at": "2026-01-02T00:00:00.000Z"}},+ ],+ "links": {"next": None},+ }++ monkeypatch.setattr(persona, "_fetch_page", fake_fetch)+ manager = _FakeResumableManager()++ rows: list[dict] = []+ for table in get_rows(+ api_key="persona_test",+ endpoint="verifications",+ logger=MagicMock(),+ resumable_source_manager=manager, # type: ignore[arg-type]+ ):+ rows.extend(table.to_pylist())++ assert [r["id"] for r in rows] == ["ver_1"]+ assert calls == [+ "https://api.withpersona.com/api/v1/inquiries?page[size]=100",+ "https://api.withpersona.com/api/v1/inquiries/inq_gone?include=verifications",+ "https://api.withpersona.com/api/v1/inquiries/inq_ok?include=verifications",+ ]++ def test_hydrate_non_404_error_still_aborts_the_sync(self, monkeypatch: Any) -> None:+ # Only a 404 (gone parent) is safe to swallow. A 500 or any other failure must still surface,+ # not get silently treated the same as a deleted inquiry.+ def fake_fetch(session: Any, url: str, headers: dict[str, str], logger: Any) -> dict:+ if "/inquiries/inq_1" in url:+ response = requests.Response()+ response.status_code = 500+ raise requests.HTTPError(response=response)+ return {+ "data": [{"type": "inquiry", "id": "inq_1", "attributes": {"created-at": "2026-01-03T00:00:00.000Z"}}],+ "links": {"next": None},+ }++ monkeypatch.setattr(persona, "_fetch_page", fake_fetch)+ manager = _FakeResumableManager()++ with pytest.raises(requests.HTTPError):+ list(+ get_rows(+ api_key="persona_test",+ endpoint="verifications",+ logger=MagicMock(),+ resumable_source_manager=manager, # type: ignore[arg-type]+ )+ )++class TestPersonaSourceResponse:- @parameterized.expand([("inquiries", "created_at"), ("events", "created_at")])+ @parameterized.expand(+ [("inquiries", "created_at"), ("events", "created_at"), ("verifications", "inquiry_created_at")]+ )def test_incremental_endpoint_partitions_on_created_at_desc(self, endpoint: str, partition_key: str) -> None:response = persona_source(api_key="persona_test",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/tests/test_persona_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/tests/test_persona_source.pyindex 68c6830f31a6..3a40454db12d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/persona/tests/test_persona_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/persona/tests/test_persona_source.py@@ -35,6 +35,7 @@ class TestPersonaGetSchemas:[# (endpoint, supports_incremental, supports_append)("inquiries", True, True),+ ("verifications", True, True),("accounts", True, True),("cases", True, True),("transactions", True, True),@@ -54,12 +55,20 @@ class TestPersonaGetSchemas:schemas = PersonaSource().get_schemas(MagicMock(), team_id=1, names=["cases"])assert [s.name for s in schemas] == ["cases"]+ def test_verifications_is_not_preselected(self) -> None:+ # Verifications cost one extra request per inquiry, so they're opt-in while everything else+ # stays pre-selected.+ schemas = {s.name: s for s in PersonaSource().get_schemas(MagicMock(), team_id=1)}+ assert schemas["verifications"].should_sync_default is False+ assert all(s.should_sync_default for name, s in schemas.items() if name != "verifications")+def test_lists_tables_without_credentials(self) -> None:# Static endpoint catalog (no I/O), so the public docs render the table list.assert PersonaSource.lists_tables_without_credentials is Truetables = PersonaSource().get_documented_tables()assert {t["name"] for t in tables} == {"inquiries",+ "verifications","accounts","cases","transactions",