: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 4 missing tables to the Conekta source (#118935)
Tom Owersb8d243c4b5cd
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.mdindex f4fb042f29bf..a627603e86e9 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@@ -3130,10 +3130,10 @@ Today (9): `charges`, `checkouts`, `customers`, `events`, `orders`, `payout_ordeDiffed against: <https://raw.githubusercontent.com/conekta/openapi/main/api.yaml>-- [ ] `Subscriptions (GET /customers/{customer_id}/subscriptions)` — measure recurring revenue, subscription status, and plan adoption across all customer subscriptions (high)-- [ ] `Balance (GET /balance)` — track available and pending merchant funds for cash-flow reporting (high)-- [ ] `Payment methods (GET /customers/{id}/payment_sources)` — complete payment-source lookups beyond embedded customer pages and compare saved payment methods (high)-- [ ] `Companies (GET /companies)` — identify child merchants and organize payment reporting for holding companies (medium)+- [x] `Subscriptions (GET /customers/{customer_id}/subscriptions)` — measure recurring revenue, subscription status, and plan adoption across all customer subscriptions (high)+- [x] `Balance (GET /balance)` — track available and pending merchant funds for cash-flow reporting (high)+- [x] `Payment methods (GET /customers/{id}/payment_sources)` — complete payment-source lookups beyond embedded customer pages and compare saved payment methods (high)+- [x] `Companies (GET /companies)` — identify child merchants and organize payment reporting for holding companies (medium)Note: The official OpenAPI root was parsed, and all referenced path documents were fetched to identify GET operations. Customers embed one subscription and paginated payment sources, so dedicated requests are needed for complete coverage. Subscription events use the same event schema as the synced event collection and were excluded. Child merchant coverage requires company discovery and child-company headers; credentials, API logs, and uploads were excluded.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/canonical_descriptions.pyindex 417741571b56..5937ee8c8d70 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/canonical_descriptions.py@@ -8,6 +8,22 @@ _DOCS = "https://developers.conekta.com/reference"# Amounts are integers in the smallest currency unit and timestamps are int64 Unix seconds# throughout the API, so those two facts are repeated on the relevant columns rather than assumed.CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {+ "balance": {+ "description": "The account's current balance, split by state and currency.",+ "docs_url": f"{_DOCS}/getbalance",+ "columns": {+ "available": "Funds available to pay out, as a list of amounts in cents with their currency.",+ "cashout_retention_amount": "Funds held back from payouts, as amounts in cents with their currency.",+ "conekta_retention": "Funds Conekta retains, as amounts in cents with their currency.",+ "gateway": "Gateway balance, as amounts in cents with their currency.",+ "pending": "Funds not yet available to pay out, as amounts in cents with their currency.",+ "retained": "Retained funds, as amounts in cents with their currency.",+ "retention_amount": "Retention amount, as amounts in cents with their currency.",+ "target_collateral_amount": "Target collateral amount for the account.",+ "target_retention_amount": "Target retention amount, as amounts in cents with their currency.",+ "temporarily_retained": "Temporarily retained funds, as amounts in cents with their currency.",+ },+ },"charges": {"description": "A single attempt to collect money for an order through one payment method.","docs_url": f"{_DOCS}/getcharges",@@ -66,6 +82,24 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"url": "Public URL the customer opens to pay.",},},+ "companies": {+ "description": "A child company of a holding company account.",+ "docs_url": f"{_DOCS}/getcompanies",+ "columns": {+ "id": "Unique identifier for the company.",+ "account_status": "Current status of the company's account.",+ "active": "True when the company is active.",+ "created_at": "Time the company was created, in seconds since the Unix epoch.",+ "documents": "Onboarding documents of the company, with their classification and status.",+ "name": "Name of the company.",+ "object": "Object type, always 'company'.",+ "onboarding_status": "Current status of the company's onboarding.",+ "onboarding_url": "URL to resume the company's onboarding.",+ "parent_company_id": "Identifier of the parent company, when there is one.",+ "three_ds_enabled": "True when 3D Secure authentication is enabled for the company.",+ "three_ds_mode": "3D Secure mode, 'smart' or 'strict', when 3D Secure is enabled.",+ },+ },"customers": {"description": "A person or company you charge, along with their saved payment sources.","docs_url": f"{_DOCS}/getcustomers",@@ -135,6 +169,33 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"updated_at": "Time the order was last updated, in seconds since the Unix epoch.",},},+ "payment_sources": {+ "description": "A payment method saved on a customer, such as a card or a recurrent cash or SPEI reference.",+ "docs_url": f"{_DOCS}/getcustomerpaymentmethods",+ "columns": {+ "id": "Identifier of the payment source.",+ "customer_id": "Identifier of the customer the payment source belongs to.",+ "parent_id": "Identifier of the customer the payment source belongs to, as returned by the API.",+ "type": "Payment source type: card, cash, cash_recurrent, or spei_recurrent.",+ "object": "Object type, always 'payment_source'.",+ "created_at": "Time the payment source was created, in seconds since the Unix epoch.",+ "brand": "Card brand, for card payment sources.",+ "bin": "First digits of the card number, for card payment sources.",+ "last4": "Last four digits of the card number, for card payment sources.",+ "card_type": "Card type, such as credit or debit, for card payment sources.",+ "exp_month": "Card expiration month, for card payment sources.",+ "exp_year": "Card expiration year, for card payment sources.",+ "issuer": "Institution that issued the card, for card payment sources.",+ "name": "Cardholder name, for card payment sources.",+ "default": "True when this is the customer's default payment source.",+ "payment_source_status": "Current status of the payment source.",+ "visible_on_checkout": "True when the payment source is offered on checkout.",+ "reference": "Payment reference, for cash and SPEI payment sources.",+ "bank": "Bank name, for SPEI payment sources.",+ "provider": "Provider where the customer pays, for cash payment sources.",+ "expires_at": "Time the reference expires, in seconds since the Unix epoch.",+ },+ },"payout_orders": {"description": "Money paid out from your Conekta balance to a recipient.","docs_url": f"{_DOCS}/getpayoutorders",@@ -174,6 +235,30 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"retry_delay_hours": "Hours waited between retries of a failed charge.",},},+ "subscriptions": {+ "description": "A customer's subscription to a plan.",+ "docs_url": f"{_DOCS}/subscriptionlist",+ "columns": {+ "id": "Identifier of the subscription.",+ "customer_id": "Identifier of the customer the subscription belongs to.",+ "plan_id": "Identifier of the plan the customer subscribes to.",+ "status": "Current status of the subscription, such as active, past_due, paused, or canceled.",+ "created_at": "Time the subscription was created, in seconds since the Unix epoch.",+ "subscription_start": "Time the subscription started, in seconds since the Unix epoch.",+ "billing_cycle_start": "Start of the current billing cycle, in seconds since the Unix epoch.",+ "billing_cycle_end": "End of the current billing cycle, in seconds since the Unix epoch.",+ "trial_start": "Start of the trial, in seconds since the Unix epoch.",+ "trial_end": "End of the trial, in seconds since the Unix epoch.",+ "paused_at": "Time the subscription was paused, in seconds since the Unix epoch.",+ "canceled_at": "Time the subscription was canceled, in seconds since the Unix epoch.",+ "canceled_reason": "Reason for the cancellation, when the subscription is canceled.",+ "card_id": "Identifier of the payment source the subscription charges.",+ "charge_id": "Identifier of the last charge of the subscription.",+ "last_billing_cycle_order_id": "Identifier of the order of the last billing cycle.",+ "customer_custom_reference": "Your own reference for the customer.",+ "object": "Object type, always 'subscription'.",+ },+ },"transactions": {"description": "A movement of money on your Conekta balance, with the fee and net amount for a charge.","docs_url": f"{_DOCS}/gettransactions",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/conekta.py b/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/conekta.pyindex 06fb6eb28b16..d0de53dac018 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/conekta.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/conekta.py@@ -10,7 +10,17 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.resRESTAPIConfig,rest_api_resource,)-from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.paginators import BasePaginator+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.fanout import (+ build_dependent_resource,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.paginators import (+ BasePaginator,+ SinglePagePaginator,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.typing import (+ ClientConfig,+ Endpoint,+)from products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManagerfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.source_helpers import validate_via_probefrom products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceResponse@@ -19,12 +29,17 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.conekta.seBASE_URL,CONEKTA_ENDPOINTS,PAGE_SIZE,+ ConektaEndpointConfig,)[email protected](frozen=True)class ConektaResumeConfig:- next_cursor: str+ # Top-level list endpoints: the `next` cursor of the page to fetch next.+ next_cursor: str = ""+ # Fan-out endpoints: the framework's dependent-resource resume state+ # (`{"completed": [...], "current": ..., "child_state": ...}`).+ fanout_state: Optional[dict[str, Any]] = Nonedef build_headers(api_version: str = API_VERSION) -> dict[str, str]:@@ -167,6 +182,83 @@ def validate_credentials(api_key: str, api_version: str = API_VERSION) -> tuple[)+def _client_config(api_key: str, api_version: str) -> ClientConfig:+ return {+ "base_url": BASE_URL,+ "headers": build_headers(api_version),+ "auth": {"type": "bearer", "token": api_key},+ "paginator": ConektaCursorPaginator(),+ "session": _make_session(api_key, api_version),+ # Pin every request to the Conekta origin and refuse redirects: the cursor comes out+ # of a response-controlled URL, so a poisoned `next_page_url` must not be able to+ # retarget the bearer token.+ "allowed_hosts": [],+ "allow_redirects": False,+ }+++def _fanout_resource(+ api_key: str,+ api_version: str,+ endpoint_config: ConektaEndpointConfig,+ team_id: int,+ job_id: str,+ resumable_source_manager: ResumableSourceManager[ConektaResumeConfig],+) -> Any:+ assert endpoint_config.fanout is not None++ initial_paginator_state: Optional[dict[str, Any]] = None+ if resumable_source_manager.can_resume():+ resume = resumable_source_manager.load_state()+ if resume is not None and resume.fanout_state:+ initial_paginator_state = resume.fanout_state++ def save_checkpoint(state: Optional[dict[str, Any]]) -> None:+ if state is not None:+ resumable_source_manager.save_state(ConektaResumeConfig(fanout_state=state))++ child_endpoint_extra: Endpoint = {+ "data_selector": "data",+ # The spec documents the subscriptions list with a single-object schema next to list+ # pagination params; fail loud on a body without `data` instead of syncing zero rows.+ "data_selector_required": True,+ }+ return build_dependent_resource(+ endpoint_configs=CONEKTA_ENDPOINTS,+ child_endpoint=endpoint_config.name,+ fanout=endpoint_config.fanout,+ client_config=_client_config(api_key, api_version),+ path_format_values={},+ team_id=team_id,+ job_id=job_id,+ db_incremental_field_last_value=None,+ resume_hook=save_checkpoint,+ initial_paginator_state=initial_paginator_state,+ parent_endpoint_extra={"data_selector": "data"},+ child_endpoint_extra=child_endpoint_extra,+ )+++def _source_response(endpoint_config: ConektaEndpointConfig, resource: Any) -> SourceResponse:+ partition_keys = [endpoint_config.partition_key] if endpoint_config.partition_key else None++ return SourceResponse(+ name=endpoint_config.name,+ items=lambda: resource,+ primary_keys=endpoint_config.primary_keys,+ # Conekta documents no ordering for its list endpoints and exposes no sort parameter, so+ # we cannot claim rows arrive oldest-first. "desc" is the conservative branch: it commits+ # the incremental watermark only after a fully successful sync, whereas "asc" would+ # checkpoint after every batch and silently skip rows if the API returns newest-first.+ sort_mode="desc",+ partition_count=1 if partition_keys else None,+ partition_size=1 if partition_keys else None,+ partition_mode="datetime" if partition_keys else None,+ partition_format="month" if partition_keys else None,+ partition_keys=partition_keys,+ )++def conekta_source(api_key: str,endpoint: str,@@ -180,13 +272,19 @@ def conekta_source() -> SourceResponse:endpoint_config = CONEKTA_ENDPOINTS[endpoint]+ if endpoint_config.fanout is not None:+ return _source_response(+ endpoint_config,+ _fanout_resource(api_key, api_version, endpoint_config, team_id, job_id, resumable_source_manager),+ )+# Only `/orders` accepts server-side timestamp filters, and only for the fields it documents;# anything else falls back to a full refresh rather than paging everything and filtering here.supported_cursors = {field["field"] for field in endpoint_config.incremental_fields}cursor_field = incremental_field if incremental_field in supported_cursors else Noneuse_incremental = should_use_incremental_field and cursor_field is not None- params: dict[str, Any] = {"limit": PAGE_SIZE}+ params: dict[str, Any] = {} if endpoint_config.single_object else {"limit": PAGE_SIZE}if use_incremental:params[f"{cursor_field}.gte"] = {"type": "incremental",@@ -195,29 +293,21 @@ def conekta_source("convert": to_epoch_seconds,}+ endpoint_definition: Endpoint = {"path": endpoint_config.path, "params": params}+ if endpoint_config.single_object:+ # Without a selector the whole body becomes the one row.+ endpoint_definition["paginator"] = SinglePagePaginator()+ else:+ endpoint_definition["data_selector"] = "data"+rest_config: RESTAPIConfig = {- "client": {- "base_url": BASE_URL,- "headers": build_headers(api_version),- "auth": {"type": "bearer", "token": api_key},- "paginator": ConektaCursorPaginator(),- "session": _make_session(api_key, api_version),- # Pin every request to the Conekta origin and refuse redirects: the cursor comes out- # of a response-controlled URL, so a poisoned `next_page_url` must not be able to- # retarget the bearer token.- "allowed_hosts": [],- "allow_redirects": False,- },+ "client": _client_config(api_key, api_version),"resources": [{"name": endpoint,"write_disposition": {"disposition": "merge", "strategy": "upsert"} if use_incremental else "replace","table_format": "delta",- "endpoint": {- "path": endpoint_config.path,- "params": params,- "data_selector": "data",- },+ "endpoint": endpoint_definition,}],}@@ -225,7 +315,7 @@ def conekta_source(initial_paginator_state: Optional[dict[str, Any]] = Noneif resumable_source_manager.can_resume():resume = resumable_source_manager.load_state()- if resume is not None:+ if resume is not None and resume.next_cursor:initial_paginator_state = {"next_cursor": resume.next_cursor}def save_checkpoint(state: Optional[dict[str, Any]]) -> None:@@ -243,20 +333,4 @@ def conekta_source(initial_paginator_state=initial_paginator_state,)- partition_keys = [endpoint_config.partition_key] if endpoint_config.partition_key else None-- return SourceResponse(- name=endpoint,- items=lambda: resource,- primary_keys=["id"],- # Conekta documents no ordering for its list endpoints and exposes no sort parameter, so- # we cannot claim rows arrive oldest-first. "desc" is the conservative branch: it commits- # the incremental watermark only after a fully successful sync, whereas "asc" would- # checkpoint after every batch and silently skip rows if the API returns newest-first.- sort_mode="desc",- partition_count=1 if partition_keys else None,- partition_size=1 if partition_keys else None,- partition_mode="datetime" if partition_keys else None,- partition_format="month" if partition_keys else None,- partition_keys=partition_keys,- )+ return _source_response(endpoint_config, resource)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/settings.pyindex 89b6972205f1..efe30f6a14fc 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/settings.py@@ -1,5 +1,8 @@from dataclasses import dataclass, field+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.fanout import (+ DependentEndpointConfig,+)from products.warehouse_sources.backend.types import IncrementalField, IncrementalFieldTypeBASE_URL = "https://api.conekta.io"@@ -23,8 +26,9 @@ def _epoch_incremental_field(name: str) -> IncrementalField:}-@dataclass+@dataclass(frozen=True)class ConektaEndpointConfig:+ name: strpath: str# Only `/orders` documents server-side timestamp filters (`created_at.gte` / `updated_at.gte`),# so it is the only endpoint that can sync incrementally. Everything else is full refresh:@@ -33,22 +37,62 @@ class ConektaEndpointConfig:# Stable creation timestamp used for datetime partitioning. `None` for resources that expose# no creation timestamp at all (checkouts), which therefore stay unpartitioned.partition_key: str | None = "created_at"+ primary_keys: list[str] | None = field(default_factory=lambda: ["id"])+ # `/balance` answers with one object rather than a paginated list envelope.+ single_object: bool = False+ fanout: DependentEndpointConfig | None = None+ # Structural requirements of `FanoutEndpointLike` (see common/rest_source/fanout.py).+ default_incremental_field: str | None = None+ page_size: int = PAGE_SIZE+++def _customer_fanout() -> DependentEndpointConfig:+ return DependentEndpointConfig(+ parent_name="customers",+ resolve_param="customer_id",+ resolve_field="id",+ include_from_parent=["id"],+ parent_field_renames={"id": "customer_id"},+ # A customer deleted between the parent listing and its child fetch answers 404.+ child_response_actions=[{"status_code": 404, "action": "ignore"}],+ )CONEKTA_ENDPOINTS: dict[str, ConektaEndpointConfig] = {- "charges": ConektaEndpointConfig(path="/charges"),+ # The balance is a single point-in-time object with no id, so each full refresh replaces it.+ "balance": ConektaEndpointConfig(+ name="balance", path="/balance", partition_key=None, primary_keys=None, single_object=True+ ),+ "charges": ConektaEndpointConfig(name="charges", path="/charges"),# Payment links carry `starts_at` / `expires_at` but no creation timestamp.- "checkouts": ConektaEndpointConfig(path="/checkouts", partition_key=None),- "customers": ConektaEndpointConfig(path="/customers"),- "events": ConektaEndpointConfig(path="/events"),+ "checkouts": ConektaEndpointConfig(name="checkouts", path="/checkouts", partition_key=None),+ # Child companies of a holding company.+ "companies": ConektaEndpointConfig(name="companies", path="/companies"),+ "customers": ConektaEndpointConfig(name="customers", path="/customers"),+ "events": ConektaEndpointConfig(name="events", path="/events"),"orders": ConektaEndpointConfig(+ name="orders",path="/orders",incremental_fields=[_epoch_incremental_field("updated_at"), _epoch_incremental_field("created_at")],),- "payout_orders": ConektaEndpointConfig(path="/payout_orders"),- "plans": ConektaEndpointConfig(path="/plans"),- "transactions": ConektaEndpointConfig(path="/transactions"),- "transfers": ConektaEndpointConfig(path="/transfers"),+ # Payment source and subscription ids are only documented per customer, so the customer id is+ # part of the key to keep it unique across the whole table.+ "payment_sources": ConektaEndpointConfig(+ name="payment_sources",+ path="/customers/{customer_id}/payment_sources",+ primary_keys=["customer_id", "id"],+ fanout=_customer_fanout(),+ ),+ "payout_orders": ConektaEndpointConfig(name="payout_orders", path="/payout_orders"),+ "plans": ConektaEndpointConfig(name="plans", path="/plans"),+ "subscriptions": ConektaEndpointConfig(+ name="subscriptions",+ path="/customers/{customer_id}/subscriptions",+ primary_keys=["customer_id", "id"],+ fanout=_customer_fanout(),+ ),+ "transactions": ConektaEndpointConfig(name="transactions", path="/transactions"),+ "transfers": ConektaEndpointConfig(name="transfers", path="/transfers"),}ENDPOINTS = tuple(CONEKTA_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/tests/test_conekta.py b/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/tests/test_conekta.pyindex 684df7dc9a1a..0e99808a4801 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/tests/test_conekta.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/conekta/tests/test_conekta.py@@ -9,6 +9,7 @@ from requests import Request, Responsefrom products.warehouse_sources.backend.temporal.data_imports.sources.common.testing import (ScriptedResponse,SourceDriver,+ route,scripted_network,)from products.warehouse_sources.backend.temporal.data_imports.sources.conekta.conekta import (@@ -151,3 +152,92 @@ class TestRequests:assert result.raised is Noneassert [row["id"] for row in result.rows] == ["ord_5"]assert result.queries == [{"limit": (str(PAGE_SIZE),), "next": ("ord_4",)}]+++class TestBalance:+ def test_single_object_becomes_one_row_without_list_params(self) -> None:+ balance = {+ "available": [{"amount": 150000, "currency": "MXN"}],+ "pending": [{"amount": 2500, "currency": "MXN"}],+ "target_collateral_amount": {},+ }++ result = _driver().run("balance", [ScriptedResponse(json=balance)])++ assert result.raised is None+ assert result.rows == [balance]+ assert result.paths == ["/balance"]+ assert result.queries == [{}]+++class TestCustomerFanout:+ @pytest.mark.parametrize("endpoint", ["subscriptions", "payment_sources"])+ def test_walks_every_customer_and_keys_rows_by_customer(self, endpoint: str) -> None:+ script = route(+ {+ "/customers": [+ _scripted_page([{"id": "cus_1"}], "cus_1"),+ _scripted_page([{"id": "cus_2"}, {"id": "cus_3"}], None),+ ],+ f"/customers/cus_1/{endpoint}": [+ _scripted_page([{"id": "item_1"}], "item_1"),+ _scripted_page([{"id": "item_2"}], None),+ ],+ # A customer deleted between the listing and its child fetch.+ f"/customers/cus_2/{endpoint}": [+ ScriptedResponse(status=404, json={"type": "resource_not_found_error"})+ ],+ f"/customers/cus_3/{endpoint}": [_scripted_page([{"id": "item_1"}], None)],+ }+ )++ result = _driver().run(endpoint, script)++ assert result.raised is None+ assert [(row["customer_id"], row["id"]) for row in result.rows] == [+ ("cus_1", "item_1"),+ ("cus_1", "item_2"),+ ("cus_3", "item_1"),+ ]+ child_queries = [+ query for path, query in zip(result.paths, result.queries) if path == f"/customers/cus_1/{endpoint}"+ ]+ assert child_queries == [+ {"limit": (str(PAGE_SIZE),)},+ {"limit": (str(PAGE_SIZE),), "next": ("item_1",)},+ ]++ def test_resume_skips_completed_customers(self) -> None:+ script = route(+ {+ "/customers": [_scripted_page([{"id": "cus_1"}, {"id": "cus_2"}], None)],+ "/customers/cus_2/subscriptions": [_scripted_page([{"id": "sub_2"}], None)],+ }+ )++ result = _driver().run(+ "subscriptions",+ script,+ resume_state=ConektaResumeConfig(+ fanout_state={"completed": ["/customers/cus_1/subscriptions"], "current": None, "child_state": None}+ ),+ )++ assert result.raised is None+ assert [row["id"] for row in result.rows] == ["sub_2"]+ assert result.paths == ["/customers", "/customers/cus_2/subscriptions"]++ def test_subscription_body_without_data_fails_loud(self) -> None:+ script = route(+ {+ "/customers": [_scripted_page([{"id": "cus_1"}], None)],+ "/customers/cus_1/subscriptions": [+ ScriptedResponse(json={"id": "sub_1", "object": "subscription", "status": "active"})+ ],+ }+ )++ result = _driver().run("subscriptions", script)++ assert isinstance(result.raised, ValueError)+ assert result.rows == []