: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 the slash import source (#111864)
Tom Owers3b64dd49cd17
diff --git a/frontend/public/services/slash.png b/frontend/public/services/slash.pngnew file mode 100644index 000000000000..f6e829d594fdBinary files /dev/null and b/frontend/public/services/slash.png differdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md b/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.mdindex 2352a2b656e8..1996f4a3afa5 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/SOURCES.md@@ -713,6 +713,7 @@ the row lists both.| skio | HTTP (GraphQL) | requests | ✅ || skyvern | HTTP | requests | ✅ || slack | HTTP | requests + `rest_source.RESTClient` | ✅ |+| slash | HTTP | requests | ✅ || sleekplan | HTTP | requests + `rest_source.RESTClient` | ✅ || smaily | HTTP | requests | ✅ || smartengage | HTTP | requests + `rest_source.RESTClient` | ✅ |@@ -1401,7 +1402,6 @@ doesn't conflict with concurrent PRs.- sinch- site24x7- skyvern-- slash- sleuth- smaily- smartlookdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs/slash.py b/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs/slash.pyindex 3cb32a801ee5..f93a5f51200b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs/slash.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/generated_configs/slash.py@@ -6,4 +6,5 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common imp@config.configclass SlashSourceConfig(config.Config):- pass+ api_key: str+ legal_entity_id: str | None = Nonediff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/slash/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/slash/canonical_descriptions.pynew file mode 100644index 000000000000..ac5d52e922fd--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/slash/canonical_descriptions.py@@ -0,0 +1,80 @@+from products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (+ CanonicalDescriptions,+)++CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {+ "accounts": {+ "description": "Slash bank accounts accessible to the API key.",+ "docs_url": "https://docs.slash.com/api-reference/account-get",+ "columns": {+ "id": "Unique account identifier.",+ "name": "Account name.",+ "status": "Whether the account is open or closed.",+ "createdAt": "Time when the account was created.",+ "type": "Whether the account is a debit or charge card account.",+ },+ },+ "transactions": {+ "description": "Transactions across Slash accounts, including card payments, transfers, and fees.",+ "docs_url": "https://docs.slash.com/api-reference/transaction-get",+ "columns": {+ "id": "Unique transaction identifier.",+ "date": "Posting time in UTC. Pending and failed transactions use their creation time.",+ "amountCents": "Amount in US cents. Negative amounts are debits; positive amounts are credits.",+ "status": "Whether the transaction is pending, posted, or failed.",+ "accountId": "Identifier of the account associated with the transaction.",+ "authorizedAt": "Authorization time in UTC, available for card transactions only.",+ },+ },+ "cards": {+ "description": "Physical and virtual cards accessible to the API key.",+ "docs_url": "https://docs.slash.com/api-reference/card-get",+ "columns": {+ "id": "Unique card identifier.",+ "accountId": "Identifier of the account associated with the card.",+ "last4": "Last four digits of the card number.",+ "isPhysical": "Whether a physical card was issued.",+ "createdAt": "Time when the card was created.",+ },+ },+ "invoices": {+ "description": "Invoices for the legal entity, with their details and receiving account information.",+ "docs_url": "https://docs.slash.com/api-reference/invoice-get",+ "columns": {+ "id": "Unique invoice identifier, copied from invoice.id.",+ "invoice": "Invoice record, including its identifier and status.",+ "invoiceDetails": "Details associated with the invoice.",+ "invoiceAccount": "Receiving account information for the invoice.",+ },+ },+ "invoice_series": {+ "description": "Recurring invoice configurations for the legal entity.",+ "docs_url": "https://docs.slash.com/api-reference/invoice-series-get",+ "columns": {+ "id": "Unique invoice series identifier.",+ "recurrenceRule": "Rule that controls how often invoices are created.",+ "paymentTermsDays": "Number of days allowed for payment.",+ "nextScheduledDate": "Date of the next scheduled invoice, if one exists.",+ },+ },+ "expense_reports": {+ "description": "Expense reports submitted for reimbursement, with merchant and review information.",+ "docs_url": "https://docs.slash.com/api-reference/expense-report-get",+ "columns": {+ "id": "Unique expense report identifier.",+ "merchant": "Merchant associated with the expense.",+ "submittedByUser": "User who submitted the report.",+ "review": "Review decision, if the report was reviewed.",+ },+ },+ "contacts": {+ "description": "Counterparties for the legal entity, including customers and vendors.",+ "docs_url": "https://docs.slash.com/api-reference/contact-get",+ "columns": {+ "id": "Unique contact identifier.",+ "name": "Display name of the contact.",+ "recipientEmail": "Email address of the recipient.",+ "archivedAt": "Time when the contact was archived. Empty for active contacts.",+ },+ },+}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/slash/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/slash/settings.pynew file mode 100644index 000000000000..a0a54c60a014--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/slash/settings.py@@ -0,0 +1,19 @@+from products.warehouse_sources.backend.temporal.data_imports.sources.common.schema import incremental_field++BASE_URL = "https://api.slash.com"++ENDPOINTS = {+ "accounts": "account",+ "transactions": "transaction",+ "cards": "card",+ "invoices": "invoice",+ "invoice_series": "invoice-series",+ "expense_reports": "expense-report",+ "contacts": "contact",+}++INCREMENTAL_FIELDS = {"transactions": [incremental_field("date")]}++AUTH_ERROR = "Slash rejected the API key. Check the key in your Slash dashboard."+PERMISSION_ERROR = "Your Slash key cannot access this resource. Check its permissions and the legal entity ID."+REQUEST_ERROR = "Slash rejected the request. User-scoped keys require a valid legal entity ID."diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/slash/slash.py b/products/warehouse_sources/backend/temporal/data_imports/sources/slash/slash.pynew file mode 100644index 000000000000..a7b0b2a663d0--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/slash/slash.py@@ -0,0 +1,135 @@+from datetime import UTC, datetime+from typing import Any++from requests.exceptions import HTTPError++from posthog.dataclasses import frozen++from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source import (+ RESTAPIConfig,+ rest_api_resource,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.auth import APIKeyAuth+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.paginators import (+ SinglePagePaginator,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.rest_client import RESTClient+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.typing import (+ Endpoint,+ EndpointResource,+)+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 schema_for_resource+from products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceResponse+from products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.slash import SlashSourceConfig+from products.warehouse_sources.backend.temporal.data_imports.sources.slash.settings import (+ AUTH_ERROR,+ BASE_URL,+ ENDPOINTS,+ PERMISSION_ERROR,+ REQUEST_ERROR,+)+++@frozen+class SlashResumeConfig:+ cursor: str+++def invoice_with_id(row: dict[str, Any]) -> dict[str, Any]:+ return {**row, "id": row["invoice"]["id"]}+++def validate_credentials(config: SlashSourceConfig, schema_name: str | None) -> tuple[bool, str | None]:+ path = schema_for_resource(ENDPOINTS, schema_name or "accounts")+ client = RESTClient(+ base_url=BASE_URL,+ auth=APIKeyAuth(api_key=config.api_key, name="X-API-Key"),+ headers={"x-legal-entity": config.legal_entity_id} if config.legal_entity_id else {},+ paginator=SinglePagePaginator(),+ allow_redirects=False,+ request_timeout=(10, 60),+ )+ try:+ next(client.paginate(path, data_selector="items"), None)+ except HTTPError as error:+ status = error.response.status_code if error.response is not None else None+ if status == 401:+ return False, AUTH_ERROR+ if status == 403:+ return (True, None) if schema_name is None else (False, PERMISSION_ERROR)+ if status == 400:+ return False, REQUEST_ERROR+ raise+ return True, None+++def slash_source(+ config: SlashSourceConfig,+ endpoint: str,+ team_id: int,+ job_id: str,+ resumable_source_manager: ResumableSourceManager[SlashResumeConfig],+ should_use_incremental_field: bool,+ db_incremental_field_last_value: datetime | str | None,+) -> SourceResponse:+ path = schema_for_resource(ENDPOINTS, endpoint)+ params: dict[str, Any] = {}+ if endpoint == "transactions" and should_use_incremental_field and db_incremental_field_last_value is not None:+ watermark = db_incremental_field_last_value+ if isinstance(watermark, str):+ watermark = datetime.fromisoformat(watermark.replace("Z", "+00:00"))+ if watermark.tzinfo is None:+ watermark = watermark.replace(tzinfo=UTC)+ params["filter:from_date"] = int(watermark.timestamp() * 1000)++ endpoint_config: Endpoint = {+ "path": path,+ "params": params,+ "data_selector": "items",+ "data_selector_required": True,+ "paginator": "single_page"+ if endpoint == "accounts"+ else {+ "type": "cursor",+ "cursor_path": "metadata.nextCursor",+ "cursor_param": "cursor",+ "raise_on_repeated_cursor": True,+ },+ }+ resource_config: EndpointResource = {"name": endpoint, "endpoint": endpoint_config}+ if endpoint == "invoices":+ resource_config["data_map"] = invoice_with_id++ rest_config: RESTAPIConfig = {+ "client": {+ "base_url": BASE_URL,+ "auth": {"type": "api_key", "api_key": config.api_key, "name": "X-API-Key", "location": "header"},+ "headers": {"x-legal-entity": config.legal_entity_id} if config.legal_entity_id else {},+ "allow_redirects": False,+ "request_timeout": (10, 60),+ },+ "resources": [resource_config],+ }+ resume = resumable_source_manager.load_state() if resumable_source_manager.can_resume() else None++ def save_checkpoint(state: dict[str, Any] | None) -> None:+ if state and state.get("cursor"):+ resumable_source_manager.save_state(SlashResumeConfig(cursor=state["cursor"]))++ resource = rest_api_resource(+ rest_config,+ team_id,+ job_id,+ db_incremental_field_last_value=None,+ resume_hook=save_checkpoint,+ initial_paginator_state={"cursor": resume.cursor} if resume else None,+ )+ return SourceResponse(+ name=endpoint,+ items=lambda: resource,+ primary_keys=["id"],+ # Slash does not document an ascending transaction order, so checkpoint only after the complete scan.+ sort_mode="desc",+ supports_resume=endpoint != "accounts",+ )diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/slash/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/slash/source.pyindex 191516d258ce..a7f24a67c7a0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/slash/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/slash/source.py@@ -1,26 +1,135 @@from typing import cast-from products.warehouse_sources.backend.facade.source_config import DataWarehouseSourceCategory, SourceConfig-from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import FieldType, SimpleSource+from products.warehouse_sources.backend.facade.source_config import (+ DataWarehouseSourceCategory,+ ReleaseStatus,+ SourceConfig,+ SourceFieldInputConfig,+ SourceFieldInputConfigType,+)+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 (+ SourceSchema,+ build_endpoint_schemas,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceInputs, SourceResponsefrom products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.slash import SlashSourceConfig+from products.warehouse_sources.backend.temporal.data_imports.sources.slash.canonical_descriptions import (+ CANONICAL_DESCRIPTIONS,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.slash.settings import (+ AUTH_ERROR,+ ENDPOINTS,+ INCREMENTAL_FIELDS,+ PERMISSION_ERROR,+ REQUEST_ERROR,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.slash.slash import (+ SlashResumeConfig,+ slash_source,+ validate_credentials as validate_slash_credentials,+)from products.warehouse_sources.backend.types import ExternalDataSourceType@SourceRegistry.register-class SlashSource(SimpleSource[SlashSourceConfig]):+class SlashSource(ResumableSource[SlashSourceConfig, SlashResumeConfig]):+ lists_tables_without_credentials = True+ api_docs_url = "https://docs.slash.com/changelog"+@propertydef source_type(self) -> ExternalDataSourceType:return ExternalDataSourceType.SLASH+ def get_non_retryable_errors(self) -> dict[str, str | None]:+ return {+ "401 Client Error": AUTH_ERROR,+ "403 Client Error": PERMISSION_ERROR,+ "400 Client Error": REQUEST_ERROR,+ }++ def get_canonical_descriptions(self) -> CanonicalDescriptions:+ return CANONICAL_DESCRIPTIONS++ def get_schemas(+ self,+ config: SlashSourceConfig,+ team_id: int,+ with_counts: bool = False,+ names: list[str] | None = None,+ force_refresh: bool = False,+ api_version: str | None = None,+ ) -> list[SourceSchema]:+ return build_endpoint_schemas(ENDPOINTS, INCREMENTAL_FIELDS, names)++ def validate_credentials(+ self,+ config: SlashSourceConfig,+ team_id: int,+ schema_name: str | None = None,+ api_version: str | None = None,+ ) -> tuple[bool, str | None]:+ return validate_slash_credentials(config, schema_name)++ def get_resumable_source_manager(self, inputs: SourceInputs) -> ResumableSourceManager[SlashResumeConfig]:+ return ResumableSourceManager(inputs, SlashResumeConfig)++ def source_for_pipeline(+ self,+ config: SlashSourceConfig,+ resumable_source_manager: ResumableSourceManager[SlashResumeConfig],+ inputs: SourceInputs,+ ) -> SourceResponse:+ return slash_source(+ config=config,+ endpoint=inputs.schema_name,+ team_id=inputs.team_id,+ job_id=inputs.job_id,+ resumable_source_manager=resumable_source_manager,+ should_use_incremental_field=inputs.should_use_incremental_field,+ db_incremental_field_last_value=inputs.db_incremental_field_last_value,+ )+@propertydef get_source_config(self) -> SourceConfig:return SourceConfig(name=ExternalDataSourceType.SLASH,category=DataWarehouseSourceCategory.FINANCE___ACCOUNTING,label="Slash",+ caption=(+ "Create an API key for your legal entity in the Slash dashboard. "+ "Use a read-only key. User-scoped keys also require the legal entity ID. "+ "Slash requires API access; contact [email protected] if needed. "+ "Transaction date filters do not capture all later status changes. "+ "Use full refresh to reconcile older transactions."+ ),iconPath="/static/services/slash.png",keywords=["banking", "corporate cards", "transactions", "fintech"],- fields=cast(list[FieldType], []),- unreleasedSource=True,+ fields=cast(+ list[FieldType],+ [+ SourceFieldInputConfig(+ name="api_key",+ label="API key",+ type=SourceFieldInputConfigType.PASSWORD,+ required=True,+ placeholder="",+ secret=True,+ ),+ SourceFieldInputConfig(+ name="legal_entity_id",+ label="Legal entity ID",+ type=SourceFieldInputConfigType.TEXT,+ required=False,+ placeholder="",+ secret=False,+ ),+ ],+ ),+ releaseStatus=ReleaseStatus.ALPHA,)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/slash/tests/test_slash.py b/products/warehouse_sources/backend/temporal/data_imports/sources/slash/tests/test_slash.pynew file mode 100644index 000000000000..67327a738f93--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/slash/tests/test_slash.py@@ -0,0 +1,216 @@+from collections.abc import Iterable, Iterator+from datetime import UTC, datetime+from typing import Any, cast++import pytest+from unittest.mock import MagicMock, patch++import requests_mock+from requests.exceptions import HTTPError++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 UnknownResourceError+from products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.slash import SlashSourceConfig+from products.warehouse_sources.backend.temporal.data_imports.sources.slash.slash import (+ SlashResumeConfig,+ slash_source,+ validate_credentials,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.slash.source import SlashSource+++def http() -> Iterator[requests_mock.Mocker]:+ with requests_mock.Mocker() as mock:+ yield mock+++def manager() -> MagicMock:+ manager = MagicMock(spec=ResumableSourceManager)+ manager.can_resume.return_value = False+ return manager+++ ("endpoint", "path", "row"),+ [+ ("accounts", "account", {"id": "account-example"}),+ ("transactions", "transaction", {"id": "transaction-example", "date": "2026-01-02T00:00:00Z"}),+ ("cards", "card", {"id": "card-example"}),+ ("invoices", "invoice", {"invoice": {"id": "invoice-example"}, "invoiceDetails": {"memo": "Example"}}),+ ("invoice_series", "invoice-series", {"id": "series-example"}),+ ("expense_reports", "expense-report", {"id": "expense-example"}),+ ("contacts", "contact", {"id": "contact-example"}),+ ],+)[email protected]("legal_entity_id", [None, "entity-example"])+def test_requests_and_row_identity(+ http: requests_mock.Mocker,+ manager: MagicMock,+ endpoint: str,+ path: str,+ row: dict[str, Any],+ legal_entity_id: str | None,+) -> None:+ http.get(f"https://api.slash.com/{path}", json={"items": [row], "metadata": {"count": 1}})+ response = slash_source(+ SlashSourceConfig(api_key="fake-key", legal_entity_id=legal_entity_id),+ endpoint,+ 1,+ "job-example",+ manager,+ False,+ "2026-01-01T00:00:00Z",+ )+ rows = [item for page in cast(Iterable[Any], response.items()) for item in page]+ expected = {**row, "id": row["invoice"]["id"]} if endpoint == "invoices" else row+ assert rows == [expected]+ assert len(http.request_history) == 1+ request = http.request_history[0]+ assert request.headers["X-API-Key"] == "fake-key"+ assert request.headers.get("x-legal-entity") == legal_entity_id+ assert request.qs == {}+ manager.save_state.assert_not_called()++[email protected]("terminal", [{}, {"nextCursor": None}, {"nextCursor": ""}])[email protected]("resumed", [False, True])+def test_cursor_pages_and_checkpoints(+ http: requests_mock.Mocker, manager: MagicMock, terminal: dict[str, Any], resumed: bool+) -> None:+ manager.can_resume.return_value = resumed+ manager.load_state.return_value = SlashResumeConfig(cursor="saved-cursor")+ http.get(+ "https://api.slash.com/transaction",+ [+ {"json": {"items": [{"id": "first"}], "metadata": {"nextCursor": "next-cursor"}}},+ {"json": {"items": [], "metadata": {"nextCursor": "last-cursor"}}},+ {"json": {"items": [{"id": "last"}], "metadata": terminal}},+ ],+ )+ response = slash_source(+ SlashSourceConfig(api_key="fake-key"),+ "transactions",+ 1,+ "job-example",+ manager,+ True,+ "2026-01-01T00:00:00Z",+ )+ iterator = iter(cast(Iterable[Any], response.items()))+ assert next(iterator) == [{"id": "first"}]+ assert list(iterator) == [[{"id": "last"}]]+ assert [call.args[0].cursor for call in manager.save_state.call_args_list] == ["next-cursor", "last-cursor"]+ assert [request.qs.get("cursor") for request in http.request_history] == [+ ["saved-cursor"] if resumed else None,+ ["next-cursor"],+ ["last-cursor"],+ ]+ assert all(request.qs["filter:from_date"] == ["1767225600000"] for request in http.request_history)+ assert response.sort_mode == "desc"+++ ("incremental", "watermark", "expected"),+ [+ (True, None, {}),+ (False, "2026-01-01T00:00:00Z", {}),+ (True, "2026-01-01T00:00:00Z", {"filter:from_date": ["1767225600000"]}),+ (True, datetime(2026, 1, 1, tzinfo=UTC), {"filter:from_date": ["1767225600000"]}),+ (True, datetime(2026, 1, 1), {"filter:from_date": ["1767225600000"]}),+ (True, "2026-01-01T01:00:00+01:00", {"filter:from_date": ["1767225600000"]}),+ ],+)+def test_transaction_time_filter(+ http: requests_mock.Mocker,+ manager: MagicMock,+ incremental: bool,+ watermark: str | datetime | None,+ expected: dict[str, list[str]],+) -> None:+ http.get("https://api.slash.com/transaction", json={"items": [], "metadata": {}})+ response = slash_source(+ SlashSourceConfig(api_key="fake-key"), "transactions", 1, "job-example", manager, incremental, watermark+ )+ assert list(cast(Iterable[Any], response.items())) == []+ assert http.request_history[0].qs == expected+++def test_repeated_cursor_fails(http: requests_mock.Mocker, manager: MagicMock) -> None:+ http.get("https://api.slash.com/card", json={"items": [{"id": "example"}], "metadata": {"nextCursor": "same"}})+ response = slash_source(SlashSourceConfig(api_key="fake-key"), "cards", 1, "job-example", manager, False, None)+ with pytest.raises(ValueError, match="not advancing"):+ list(cast(Iterable[Any], response.items()))+ assert len(http.request_history) == 2+++ ("status", "schema", "expected", "message"),+ [+ (200, None, True, None),+ (200, "cards", True, None),+ (401, None, False, "Slash rejected the API key. Check the key in your Slash dashboard."),+ (403, None, True, None),+ (+ 403,+ "cards",+ False,+ "Your Slash key cannot access this resource. Check its permissions and the legal entity ID.",+ ),+ (400, None, False, "Slash rejected the request. User-scoped keys require a valid legal entity ID."),+ ],+)+def test_credential_probe(+ http: requests_mock.Mocker, status: int, schema: str | None, expected: bool, message: str | None+) -> None:+ path = "card" if schema else "account"+ http.get(+ f"https://api.slash.com/{path}", status_code=status, json={"items": [], "metadata": {"nextCursor": "unused"}}+ )+ assert validate_credentials(SlashSourceConfig(api_key="fake-key", legal_entity_id="entity-example"), schema) == (+ expected,+ message,+ )+ assert len(http.request_history) == 1+ assert http.request_history[0].headers["X-API-Key"] == "fake-key"+ assert http.request_history[0].headers["x-legal-entity"] == "entity-example"++[email protected]("status", [400, 401, 403, 404])+def test_sync_error_mapping(http: requests_mock.Mocker, manager: MagicMock, status: int) -> None:+ http.get("https://api.slash.com/card", status_code=status, json={"success": False, "rawStatus": status})+ response = slash_source(SlashSourceConfig(api_key="fake-key"), "cards", 1, "job-example", manager, False, None)+ with pytest.raises(HTTPError) as error:+ list(cast(Iterable[Any], response.items()))+ matches = [+ message for pattern, message in SlashSource().get_non_retryable_errors().items() if pattern in str(error.value)+ ]+ assert bool(matches) == (status != 404)+ assert len(http.request_history) == 1++[email protected]("status", [429, 500, 503])+def test_transient_error_retries(http: requests_mock.Mocker, manager: MagicMock, status: int) -> None:+ http.get(+ "https://api.slash.com/card",+ [+ {"status_code": status, "json": {"success": False}},+ {"json": {"items": [{"id": "example"}], "metadata": {}}},+ ],+ )+ response = slash_source(SlashSourceConfig(api_key="fake-key"), "cards", 1, "job-example", manager, False, None)+ with patch("tenacity.nap.time.sleep"):+ assert list(cast(Iterable[Any], response.items())) == [[{"id": "example"}]]+ assert len(http.request_history) == 2+++def test_unknown_endpoint(manager: MagicMock) -> None:+ with pytest.raises(UnknownResourceError):+ slash_source(SlashSourceConfig(api_key="fake-key"), "unknown", 1, "job-example", manager, False, None)+++def test_probe_unexpected_error_propagates(http: requests_mock.Mocker) -> None:+ http.get("https://api.slash.com/account", status_code=404, json={"success": False})+ with pytest.raises(HTTPError):+ validate_credentials(SlashSourceConfig(api_key="fake-key"), None)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_catalog_invariants.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_catalog_invariants.pyindex 285b356f9e57..ad5fd1620b7f 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_catalog_invariants.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_catalog_invariants.py@@ -73,7 +73,6 @@ SOURCES_WITHOUT_AN_ICON_FILE = {"Roark","ScaleAI","Skyvern",- "Slash","Synthesia","TerraApi","TriggerDev",