: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(warehouse-sources): add etsy payments, inventory, return policy and taxonomy tables (#119544)
Tom Owersf4bbc392412b
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 1a4d3a4c64da..8bd083a36d5d 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@@ -4331,12 +4331,12 @@ Today (7): `ledger_entries`, `listings`, `receipts`, `reviews`, `shop`, `shop_seDiffed against: <https://www.etsy.com/openapi/generated/oas/3.0.0.json>-- [ ] `Seller taxonomy nodes (GET /v3/application/seller-taxonomy/nodes)` — resolve taxonomy_id on listings to product categories and their hierarchy (high)-- [ ] `Listing inventory (GET /v3/application/listings/batch/inventory)` — resolve transaction product_id values and analyze variant SKUs, prices, and stock quantities (high)+- [x] `Seller taxonomy nodes (GET /v3/application/seller-taxonomy/nodes)` — resolve taxonomy_id on listings to product categories and their hierarchy (high)+- [x] `Listing inventory (GET /v3/application/listings/batch/inventory)` — resolve transaction product_id values and analyze variant SKUs, prices, and stock quantities (high)- [ ] `Shop shipping profiles (GET /v3/application/shops/{shop_id}/shipping-profiles)` — resolve shipping_profile_id on listings and transactions for shipping cost and service comparisons (high)- [ ] `Shop readiness state definitions (GET /v3/application/shops/{shop_id}/readiness-state-definitions)` — resolve readiness_state_id on listings into preparation states and processing times (high)-- [ ] `Shop return policies (GET /v3/application/shops/{shop_id}/policies/return)` — resolve return_policy_id on listings for returns and catalog analysis (high)-- [ ] `Payment account ledger entry payments (GET /v3/application/shops/{shop_id}/payment-account/ledger-entries/payments)` — reconcile gross sales, fees, net payments, and payment adjustments with receipts and ledger entries (high)+- [x] `Shop return policies (GET /v3/application/shops/{shop_id}/policies/return)` — resolve return_policy_id on listings for returns and catalog analysis (high)+- [x] `Payment account ledger entry payments (GET /v3/application/shops/{shop_id}/payment-account/ledger-entries/payments)` — reconcile gross sales, fees, net payments, and payment adjustments with receipts and ledger entries (high)- [ ] `Listing properties (GET /v3/application/shops/{shop_id}/listings/{listing_id}/properties)` — analyze sales and assortment by product attributes such as size, material, and color (medium)Note: The official OpenAPI spec supplied GET paths, parameters, and listing and transaction fields. Transactions already expand from receipts, so alternate transaction routes are excluded. Inventory and payment reads require parent ID batches; properties require one request per listing. Media and authentication are excluded; business lookups are retained because existing rows reference their IDs.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/canonical_descriptions.pyindex d6981198e738..162c7ee20667 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/canonical_descriptions.py@@ -158,4 +158,62 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"payment_adjustment_id": "Payment adjustment this entry belongs to, when it is a refund.",},},+ "payments": {+ "description": "Etsy Payments records behind the shop's ledger entries, with gross, fee and net amounts and any refunds.",+ "docs_url": f"{_DOCS}#operation/getPaymentAccountLedgerEntryPayments",+ "columns": {+ "payment_id": "Unique identifier for the payment.",+ "buyer_user_id": "Numeric id of the Etsy user who paid.",+ "shop_id": "Numeric id of the shop that received the payment.",+ "receipt_id": "Receipt the payment is for.",+ "amount_gross": "Gross amount of the order in the smallest currency unit, including shipping and taxes.",+ "amount_fees": "Original card processing fee of the order in the smallest currency unit.",+ "amount_net": "amount_gross less amount_fees, in the smallest currency unit.",+ "posted_gross": "Gross amount posted to the ledger once the order ships.",+ "adjusted_gross": "Gross amount after any refunds.",+ "currency": "ISO currency code of the payment.",+ "status": "Current status of the payment, most commonly settled or authed.",+ "created_timestamp": "Unix epoch seconds when the payment was created.",+ "updated_timestamp": "Unix epoch seconds of the last change to a payment adjustment.",+ "payment_adjustments": "Refunds applied to the payment.",+ },+ },+ "listing_inventory": {+ "description": "One row per product (variation) in each listing's inventory, with its SKU, offerings and property values.",+ "docs_url": f"{_DOCS}#operation/getListingsInventoryByListingIds",+ "columns": {+ "listing_id": "Listing the product belongs to.",+ "product_id": "Identifier of the product within the listing. Transactions reference it.",+ "sku": "SKU of the product.",+ "is_deleted": "Whether the product was deleted.",+ "offerings": "Offerings for the product, each with its price, quantity and whether it is enabled.",+ "property_values": "Variation property values that identify the product, e.g. a size or color.",+ "price_on_property": "Ids of the listing properties that change the product price.",+ "quantity_on_property": "Ids of the listing properties that change the product quantity.",+ "sku_on_property": "Ids of the listing properties that change the product SKU.",+ "readiness_state_on_property": "Ids of the listing properties that change the processing profile.",+ },+ },+ "return_policies": {+ "description": "The shop's return policies. Listings reference them by return_policy_id.",+ "docs_url": f"{_DOCS}#operation/getShopReturnPolicies",+ "columns": {+ "return_policy_id": "Unique identifier for the return policy.",+ "shop_id": "Numeric id of the shop that owns the policy.",+ "accepts_returns": "Whether the policy accepts returns.",+ "accepts_exchanges": "Whether the policy accepts exchanges.",+ "return_deadline": "Days the buyer has to return an item.",+ },+ },+ "seller_taxonomy_nodes": {+ "description": "Etsy's seller taxonomy, one row per category node. Listings reference it by taxonomy_id.",+ "docs_url": f"{_DOCS}#operation/getSellerTaxonomyNodes",+ "columns": {+ "id": "Unique identifier for the taxonomy node.",+ "level": "Depth of the node in the taxonomy tree. Roots are level 0.",+ "name": "Name of the category.",+ "parent_id": "Id of the parent node, or null for a root.",+ "full_path_taxonomy_ids": "Ids of this node and all its parents, ordered from root to leaf.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/etsy.py b/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/etsy.pyindex 4a23b405cd04..3925d6c5a88b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/etsy.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/etsy.py@@ -5,7 +5,7 @@ from collections.abc import Iteratorfrom typing import Any, Optionalimport structlog-from requests import Response+from requests import HTTPError, Responsefrom structlog.types import FilteringBoundLoggerfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.http import make_tracked_session@@ -14,6 +14,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.typfrom products.warehouse_sources.backend.temporal.data_imports.sources.etsy.settings import (ETSY_ENDPOINTS,LISTING_STATES,+ EtsyBatchLookup,EtsyEndpointConfig,)@@ -233,8 +234,21 @@ def validate_credentials(return True, None+def _flatten_tree(nodes: list[Any], children_key: str) -> list[dict[str, Any]]:+ rows: list[dict[str, Any]] = []+ stack = [node for node in reversed(nodes) if isinstance(node, dict)]+ while stack:+ node = stack.pop()+ children = node.get(children_key) or []+ rows.append({key: value for key, value in node.items() if key != children_key})+ stack.extend(child for child in reversed(children) if isinstance(child, dict))+ return rows++def _rows_from_results(results: list[Any], config: EtsyEndpointConfig) -> list[dict[str, Any]]:"""Flatten a page of results, expanding the nested child list when the endpoint is derived."""+ if config.flatten_key is not None:+ return _flatten_tree(results, config.flatten_key)if config.expand_key is None:return [row for row in results if isinstance(row, dict)]@@ -267,7 +281,7 @@ def _windowed_pages(window_param: str,start: int,end: int,- manager: ResumableSourceManager[EtsyResumeConfig],+ manager: Optional[ResumableSourceManager[EtsyResumeConfig]],resume: Optional[EtsyResumeConfig],logger: FilteringBoundLogger,) -> Iterator[list[dict[str, Any]]]:@@ -320,7 +334,8 @@ def _windowed_pages(offset += page_size# Saved after the yield so a crash replays the last page (merge dedupes) instead of# skipping it.- manager.save_state(EtsyResumeConfig(offset=offset, window_start=window_start, window_end=window_end))+ if manager is not None:+ manager.save_state(EtsyResumeConfig(offset=offset, window_start=window_start, window_end=window_end))if page_size == 0 or page_size < PAGE_SIZE or offset >= total:offset = 0@@ -338,7 +353,7 @@ def _offset_pages(client: EtsyClient,path: str,config: EtsyEndpointConfig,- manager: ResumableSourceManager[EtsyResumeConfig],+ manager: Optional[ResumableSourceManager[EtsyResumeConfig]],resume: Optional[EtsyResumeConfig],logger: FilteringBoundLogger,) -> Iterator[list[dict[str, Any]]]:@@ -364,7 +379,8 @@ def _offset_pages(if rows:yield rowsoffset += page_size- manager.save_state(EtsyResumeConfig(offset=offset, listing_state=state))+ if manager is not None:+ manager.save_state(EtsyResumeConfig(offset=offset, listing_state=state))if page_size == 0 or page_size < PAGE_SIZE or offset >= total:break@@ -376,6 +392,100 @@ def _offset_pages(break+def _inventory_product_rows(listings: list[Any]) -> list[dict[str, Any]]:+ rows: list[dict[str, Any]] = []+ for listing in listings:+ if not isinstance(listing, dict):+ continue+ inventory = listing.get("inventory") or {}+ # The *_on_property lists say which variation properties drive price, quantity and SKU, so+ # each product row keeps them to stay readable on its own.+ inventory_fields = {key: value for key, value in inventory.items() if key != "products"}+ for product in inventory.get("products") or []:+ if isinstance(product, dict):+ rows.append({**product, **inventory_fields, "listing_id": listing.get("listing_id")})+ return rows+++def _lookup_batch(client: EtsyClient, path: str, lookup: EtsyBatchLookup, ids: list[str]) -> list[Any]:+ try:+ return client.request(path, {lookup.ids_param: ",".join(ids)}).get("results") or []+ except HTTPError as error:+ # Etsy fails the whole batch with a 404 when any one id is gone, e.g. a listing deleted+ # after the parent page was read. Split the batch to keep every id that still resolves.+ if error.response is None or error.response.status_code != 404:+ raise+ if len(ids) == 1:+ return []+ midpoint = len(ids) // 2+ return _lookup_batch(client, path, lookup, ids[:midpoint]) + _lookup_batch(client, path, lookup, ids[midpoint:])+++def _batch_lookup_pages(+ client: EtsyClient,+ lookup: EtsyBatchLookup,+ shop_id: str,+ parent_pages: Iterator[list[dict[str, Any]]],+ manager: ResumableSourceManager[EtsyResumeConfig],+) -> Iterator[list[dict[str, Any]]]:+ path = lookup.path.format(shop_id=shop_id)+ seen: set[Any] = set()++ for parent_rows in parent_pages:+ ids = [str(row[lookup.id_field]) for row in parent_rows if row.get(lookup.id_field) is not None]+ results = _lookup_batch(client, path, lookup, ids) if ids else []+ if lookup.inventory_products:+ rows = _inventory_product_rows(results)+ else:+ rows = [row for row in results if isinstance(row, dict)]++ if lookup.dedupe_key is not None:+ fresh: list[dict[str, Any]] = []+ for row in rows:+ key = row.get(lookup.dedupe_key)+ if key not in seen:+ seen.add(key)+ fresh.append(row)+ rows = fresh++ if rows:+ yield rows+ else:+ # Many parent pages can resolve to nothing, e.g. ledger entries for fees or payouts.+ manager.safe_point()+++def _paged_rows(+ client: EtsyClient,+ shop_id: str,+ path: str,+ config: EtsyEndpointConfig,+ manager: Optional[ResumableSourceManager[EtsyResumeConfig]],+ resume: Optional[EtsyResumeConfig],+ logger: FilteringBoundLogger,+ should_use_incremental_field: bool,+ db_incremental_field_last_value: Optional[Any],+ incremental_field: Optional[str],+) -> Iterator[list[dict[str, Any]]]:+ window_param = _resolve_window_param(config, should_use_incremental_field, incremental_field)+ if window_param is None:+ yield from _offset_pages(client, path, config, manager, resume, logger)+ return++ end = int(time.time())+ start = _window_start(should_use_incremental_field, db_incremental_field_last_value)+ # A resumed walk carries on from its saved window, so `start` is unused and looking the+ # shop up would only spend a request.+ resuming_window = resume is not None and resume.window_start is not None+ if start == ETSY_HISTORY_START and not resuming_window:+ opened_at = client.shop_opened_at(shop_id)+ # A missing or clock-skewed opening date falls back to the full range, so a bad+ # value can never shorten the walk.+ if opened_at is not None and ETSY_HISTORY_START < opened_at <= end:+ start = opened_at+ yield from _windowed_pages(client, path, config, window_param, start, end, manager, resume, logger)++def get_rows(api_key: str,shared_secret: str,@@ -390,44 +500,57 @@ def get_rows() -> Iterator[list[dict[str, Any]]]:config = ETSY_ENDPOINTS[endpoint]client = EtsyClient(api_key, shared_secret, refresh_token, logger)- resolved_shop_id = client.resolve_shop_id(shop_id)- path = f"/shops/{resolved_shop_id}{config.path}"resume = resumable_source_manager.load_state() if resumable_source_manager.can_resume() else None+ if config.shop_scoped:+ resolved_shop_id = client.resolve_shop_id(shop_id)+ path = f"/shops/{resolved_shop_id}{config.path}"+ else:+ # Etsy-wide reference data, so there is no shop to look up.+ resolved_shop_id = ""+ path = config.path+if config.single_object:yield [client.request(path)]elif not config.paginated:rows = _rows_from_results(client.request(path).get("results") or [], config)if rows:yield rows+ elif config.batch_lookup is not None:+ parent = ETSY_ENDPOINTS[config.batch_lookup.parent]+ # The set of rows already yielded does not survive to a resumed attempt, and a resumed full+ # refresh appends, so a deduplicated lookup saves no cursor. A restarted attempt is then a+ # fresh run, which replaces what earlier attempts wrote.+ resumes = config.batch_lookup.dedupe_key is None+ parent_pages = _paged_rows(+ client,+ resolved_shop_id,+ f"/shops/{resolved_shop_id}{parent.path}",+ parent,+ resumable_source_manager if resumes else None,+ resume if resumes else None,+ logger,+ should_use_incremental_field=False,+ db_incremental_field_last_value=None,+ incremental_field=None,+ )+ yield from _batch_lookup_pages(+ client, config.batch_lookup, resolved_shop_id, parent_pages, resumable_source_manager+ )else:- window_param = _resolve_window_param(config, should_use_incremental_field, incremental_field)- if window_param is None:- yield from _offset_pages(client, path, config, resumable_source_manager, resume, logger)- else:- end = int(time.time())- start = _window_start(should_use_incremental_field, db_incremental_field_last_value)- # A resumed walk carries on from its saved window, so `start` is unused and looking the- # shop up would only spend a request.- resuming_window = resume is not None and resume.window_start is not None- if start == ETSY_HISTORY_START and not resuming_window:- opened_at = client.shop_opened_at(resolved_shop_id)- # A missing or clock-skewed opening date falls back to the full range, so a bad- # value can never shorten the walk.- if opened_at is not None and ETSY_HISTORY_START < opened_at <= end:- start = opened_at- yield from _windowed_pages(- client,- path,- config,- window_param,- start,- end,- resumable_source_manager,- resume,- logger,- )+ yield from _paged_rows(+ client,+ resolved_shop_id,+ path,+ config,+ resumable_source_manager,+ resume,+ logger,+ should_use_incremental_field,+ db_incremental_field_last_value,+ incremental_field,+ )# The walk finished, so a later attempt must start clean rather than resume mid-stream.resumable_source_manager.clear_state()diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/settings.pyindex 473ec540394a..3e11ac0c8e8c 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/settings.py@@ -22,6 +22,24 @@ _UPDATED = _epoch_field("updated_timestamp", "updated_timestamp")LISTING_STATES: tuple[str, ...] = ("active", "inactive", "sold_out", "draft", "expired")+@dataclass(frozen=True)+class EtsyBatchLookup:+ """Rows fetched by id from a batch endpoint, one request per page of a parent endpoint."""++ # Endpoint whose pages supply the ids. Its walk, windows and resume state drive the lookup.+ parent: str+ # Absolute path under /v3/application. `{shop_id}` is filled in with the resolved shop.+ path: str+ ids_param: str+ # Field on each parent row that holds the id to look up.+ id_field: str+ # Each result is a listing carrying its inventory record, and every product in it becomes a row.+ inventory_products: bool = False+ # Different parent pages can return the same row, e.g. a payment and its later refund are+ # separate ledger entries, so rows already yielded this run are dropped.+ dedupe_key: str | None = None++@dataclass(frozen=True)class EtsyEndpointConfig:name: str@@ -51,6 +69,12 @@ class EtsyEndpointConfig:# derive transactions from the receipts endpoint, which is the only place Etsy exposes them# behind a time filter.expand_key: str | None = None+ # Path is absolute under /v3/application rather than appended to /shops/{shop_id}.+ shop_scoped: bool = True+ # Results are a tree whose nodes nest under this key. Every node becomes a row.+ flatten_key: str | None = None+ # Rows come from a batch endpoint keyed on ids the parent endpoint pages through.+ batch_lookup: EtsyBatchLookup | None = NoneETSY_ENDPOINTS: dict[str, EtsyEndpointConfig] = {@@ -117,6 +141,49 @@ ETSY_ENDPOINTS: dict[str, EtsyEndpointConfig] = {default_window_param="created",max_window_seconds=31 * 24 * 60 * 60,),+ "payments": EtsyEndpointConfig(+ name="payments",+ path="",+ primary_keys=["payment_id"],+ # Etsy reads payments only by id. The ledger is the one place payment ids appear behind a+ # time filter, so the walk pages the ledger and resolves each page's entries to payments.+ # The window filters ledger entries, not payments, so a payment-level watermark would be+ # wrong. Full refresh only.+ batch_lookup=EtsyBatchLookup(+ parent="ledger_entries",+ path="/shops/{shop_id}/payment-account/ledger-entries/payments",+ ids_param="ledger_entry_ids",+ id_field="entry_id",+ dedupe_key="payment_id",+ ),+ ),+ "listing_inventory": EtsyEndpointConfig(+ name="listing_inventory",+ path="",+ # Product ids are only documented as unique within a listing.+ primary_keys=["listing_id", "product_id"],+ batch_lookup=EtsyBatchLookup(+ parent="listings",+ path="/listings/batch/inventory",+ ids_param="listing_ids",+ id_field="listing_id",+ inventory_products=True,+ ),+ ),+ "return_policies": EtsyEndpointConfig(+ name="return_policies",+ path="/policies/return",+ primary_keys=["return_policy_id"],+ paginated=False,+ ),+ "seller_taxonomy_nodes": EtsyEndpointConfig(+ name="seller_taxonomy_nodes",+ path="/seller-taxonomy/nodes",+ primary_keys=["id"],+ paginated=False,+ shop_scoped=False,+ flatten_key="children",+ ),}ENDPOINTS: tuple[str, ...] = tuple(ETSY_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/tests/test_etsy.py b/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/tests/test_etsy.pyindex 95fe189fbb2f..909ce4232682 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/tests/test_etsy.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/etsy/tests/test_etsy.py@@ -380,6 +380,104 @@ class TestEtsyTransport:assert len(result.rows) == PAGE_SIZE * 2assert _walk_requests(result)[1].param("offset") == str(PAGE_SIZE)+ @time_machine.travel("2005-01-15", tick=False)+ def test_payments_resolve_each_ledger_page_and_drop_payments_already_seen(self) -> None:+ # A sale and its later refund are separate ledger entries for one payment, and a full+ # refresh does not merge on the primary key, so a repeat would land as a duplicate row.+ # A resumed attempt would start with no record of the payments already written, so the+ # walk restarts instead and saves no cursor.+ stale = EtsyResumeConfig(offset=PAGE_SIZE, window_start=ETSY_HISTORY_START, window_end=ETSY_HISTORY_START + 1)+ result = _driver().run(+ "payments",+ route(+ {+ "/oauth/token": [_scripted_token()],+ "/shops/1": [ScriptedResponse(json={"shop_id": 1, "created_timestamp": ETSY_HISTORY_START})],+ "/payment-account/ledger-entries": [+ _scripted_page(_rows(PAGE_SIZE, key="entry_id"), PAGE_SIZE + 2),+ _scripted_page(_rows(2, start=PAGE_SIZE, key="entry_id"), PAGE_SIZE + 2),+ ],+ "/ledger-entries/payments": [+ _scripted_page(_rows(2, start=1, key="payment_id"), 2),+ _scripted_page(_rows(2, start=2, key="payment_id"), 2),+ ],+ }+ ),+ resume_state=stale,+ )++ assert result.raised is None+ assert [row["payment_id"] for row in result.rows] == [1, 2, 3]+ assert result.saved_states == []+ ledger = [request for request in _walk_requests(result) if request.path.endswith("/ledger-entries")]+ assert (ledger[0].param("min_created"), ledger[0].param("offset")) == (str(ETSY_HISTORY_START), "0")+ lookups = [request for request in _get_requests(result) if request.path.endswith("/payments")]+ assert [request.param("ledger_entry_ids") for request in lookups] == [+ ",".join(str(i) for i in range(PAGE_SIZE)),+ f"{PAGE_SIZE},{PAGE_SIZE + 1}",+ ]++ def test_listing_inventory_yields_a_row_per_product_and_splits_a_batch_etsy_rejects(self) -> None:+ # Etsy 404s the whole batch when one listing is gone, which would otherwise fail every sync+ # of a shop that deleted a listing mid-walk.+ listing = {+ "listing_id": 11,+ "inventory": {+ "products": [{"product_id": 1, "sku": "A"}, {"product_id": 2, "sku": "B"}],+ "price_on_property": [200],+ },+ }+ result = _driver().run(+ "listing_inventory",+ route(+ {+ "/oauth/token": [_scripted_token()],+ "/shops/1/listings": [+ _scripted_page(_rows(2, start=10, key="listing_id"), 2),+ *[_scripted_page([], 0) for _ in range(len(LISTING_STATES) - 1)],+ ],+ "/listings/batch/inventory": [+ ScriptedResponse(status=404, json={"error": "Listing not found"}),+ ScriptedResponse(status=404, json={"error": "Listing not found"}),+ _scripted_page([listing], 1),+ ],+ }+ ),+ )++ assert result.raised is None+ assert result.rows == [+ {"product_id": 1, "sku": "A", "price_on_property": [200], "listing_id": 11},+ {"product_id": 2, "sku": "B", "price_on_property": [200], "listing_id": 11},+ ]+ assert [+ request.param("listing_ids")+ for request in _get_requests(result)+ if request.path.endswith("/listings/batch/inventory")+ ] == ["10,11", "10", "11"]++ def test_seller_taxonomy_flattens_the_tree_without_looking_up_a_shop(self) -> None:+ tree: list[dict[str, Any]] = [+ {+ "id": 1,+ "level": 0,+ "parent_id": None,+ "children": [{"id": 2, "level": 1, "parent_id": 1, "children": []}],+ },+ {"id": 3, "level": 0, "parent_id": None, "children": []},+ ]+ result = _driver(shop_id=None).run(+ "seller_taxonomy_nodes",+ route({"/oauth/token": [_scripted_token()], "/seller-taxonomy/nodes": [_scripted_page(tree, 2)]}),+ )++ assert result.raised is None+ assert result.rows == [+ {"id": 1, "level": 0, "parent_id": None},+ {"id": 2, "level": 1, "parent_id": 1},+ {"id": 3, "level": 0, "parent_id": None},+ ]+@parameterized.expand([("updated_timestamp", "min_last_modified"),