: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): support Lightspeed Retail API version 2026-07 (#86324)
Tom Owers032f22c8d423
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/constants.py b/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/constants.pyindex e89ebf2bec8d..46d2b8005022 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/constants.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/constants.py@@ -3,3 +3,4 @@# request layer (the `/api/<version>` path segment) share a single label — never parsed or ordered.LIGHTSPEED_RETAIL_API_VERSION_2_0 = "2.0"LIGHTSPEED_RETAIL_API_VERSION_2026_01 = "2026-01"+LIGHTSPEED_RETAIL_API_VERSION_2026_07 = "2026-07"diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/source.pyindex f7de64e2158e..ddfe7f248475 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/source.py@@ -30,6 +30,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.generated_from products.warehouse_sources.backend.temporal.data_imports.sources.lightspeed_retail.constants import (LIGHTSPEED_RETAIL_API_VERSION_2_0,LIGHTSPEED_RETAIL_API_VERSION_2026_01,+ LIGHTSPEED_RETAIL_API_VERSION_2026_07,)from products.warehouse_sources.backend.temporal.data_imports.sources.lightspeed_retail.lightspeed_retail import (LightspeedRetailResumeConfig,@@ -45,8 +46,12 @@ from products.warehouse_sources.backend.types import ExternalDataSourceType@SourceRegistry.registerclass LightspeedRetailSource(ResumableSource[LightspeedRetailSourceConfig, LightspeedRetailResumeConfig]):- supported_versions = (LIGHTSPEED_RETAIL_API_VERSION_2_0, LIGHTSPEED_RETAIL_API_VERSION_2026_01)- default_version = LIGHTSPEED_RETAIL_API_VERSION_2026_01+ supported_versions = (+ LIGHTSPEED_RETAIL_API_VERSION_2_0,+ LIGHTSPEED_RETAIL_API_VERSION_2026_01,+ LIGHTSPEED_RETAIL_API_VERSION_2026_07,+ )+ default_version = LIGHTSPEED_RETAIL_API_VERSION_2026_07api_docs_url = "https://x-series-api.lightspeedhq.com/docs/introduction"# X-Series deprecated the legacy 2.0 version; no firm sunset date is published (deprecated# endpoints increasingly return 410 Gone before an eventual retirement).diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/tests/test_lightspeed_retail.py b/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/tests/test_lightspeed_retail.pyindex 368323341948..56919941c518 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/tests/test_lightspeed_retail.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/tests/test_lightspeed_retail.py@@ -10,6 +10,7 @@ from requests import Responsefrom products.warehouse_sources.backend.temporal.data_imports.sources.lightspeed_retail.constants import (LIGHTSPEED_RETAIL_API_VERSION_2_0,LIGHTSPEED_RETAIL_API_VERSION_2026_01,+ LIGHTSPEED_RETAIL_API_VERSION_2026_07,)from products.warehouse_sources.backend.temporal.data_imports.sources.lightspeed_retail.lightspeed_retail import (LightspeedRetailResumeConfig,@@ -24,6 +25,12 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.lightspeedLIGHTSPEED_RETAIL_ENDPOINTS,)+SUPPORTED_API_VERSIONS = [+ LIGHTSPEED_RETAIL_API_VERSION_2_0,+ LIGHTSPEED_RETAIL_API_VERSION_2026_01,+ LIGHTSPEED_RETAIL_API_VERSION_2026_07,+]+# RESTClient builds its session via make_tracked_session in the rest_client module.CLIENT_SESSION_PATCH = "products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.rest_client.make_tracked_session"# validate_credentials builds its own tracked session in the lightspeed module.@@ -94,7 +101,7 @@ class TestCleanDomainPrefix:with pytest.raises(ValueError):_clean_domain_prefix(value)- @pytest.mark.parametrize("api_version", [LIGHTSPEED_RETAIL_API_VERSION_2_0, LIGHTSPEED_RETAIL_API_VERSION_2026_01])+ @pytest.mark.parametrize("api_version", SUPPORTED_API_VERSIONS)def test_base_url_carries_the_version_path_segment(self, api_version):assert _base_url("mystore", api_version) == f"https://mystore.retail.lightspeed.app/api/{api_version}"@@ -133,7 +140,7 @@ class TestValidateCredentials:assert validate_credentials("mystore", "token", LIGHTSPEED_RETAIL_API_VERSION_2026_01) is expected- @pytest.mark.parametrize("api_version", [LIGHTSPEED_RETAIL_API_VERSION_2_0, LIGHTSPEED_RETAIL_API_VERSION_2026_01])+ @pytest.mark.parametrize("api_version", SUPPORTED_API_VERSIONS)@mock.patch(LR_SESSION_PATCH)def test_validate_credentials_probes_the_pinned_version(self, mock_session, api_version):mock_session.return_value.get.return_value.status_code = 200@@ -253,7 +260,7 @@ class TestGetRows:assert session.send.call_count == 2assert params[1]["after"] == 0- @pytest.mark.parametrize("api_version", [LIGHTSPEED_RETAIL_API_VERSION_2_0, LIGHTSPEED_RETAIL_API_VERSION_2026_01])+ @pytest.mark.parametrize("api_version", SUPPORTED_API_VERSIONS)@mock.patch(CLIENT_SESSION_PATCH)def test_requests_target_the_pinned_version(self, mock_session, api_version):session = mock_session.return_valuediff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/tests/test_lightspeed_retail_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/tests/test_lightspeed_retail_source.pyindex 4d7c6c32515d..dfd0e129acbb 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/tests/test_lightspeed_retail_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/lightspeed_retail/tests/test_lightspeed_retail_source.py@@ -10,6 +10,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.generated_from products.warehouse_sources.backend.temporal.data_imports.sources.lightspeed_retail.constants import (LIGHTSPEED_RETAIL_API_VERSION_2_0,LIGHTSPEED_RETAIL_API_VERSION_2026_01,+ LIGHTSPEED_RETAIL_API_VERSION_2026_07,)from products.warehouse_sources.backend.temporal.data_imports.sources.lightspeed_retail.lightspeed_retail import (LightspeedRetailResumeConfig,@@ -114,15 +115,18 @@ class TestLightspeedRetailSource:assert is_valid is expected_validassert error_message == expected_message+ # An unpinned source probes the default version.mock_validate.assert_called_once_with(- self.config.domain_prefix, self.config.api_token, LIGHTSPEED_RETAIL_API_VERSION_2026_01+ self.config.domain_prefix, self.config.api_token, LIGHTSPEED_RETAIL_API_VERSION_2026_07)@pytest.mark.parametrize("pinned, expected",[- (None, LIGHTSPEED_RETAIL_API_VERSION_2026_01),+ (None, LIGHTSPEED_RETAIL_API_VERSION_2026_07),(LIGHTSPEED_RETAIL_API_VERSION_2_0, LIGHTSPEED_RETAIL_API_VERSION_2_0),+ (LIGHTSPEED_RETAIL_API_VERSION_2026_01, LIGHTSPEED_RETAIL_API_VERSION_2026_01),+ (LIGHTSPEED_RETAIL_API_VERSION_2026_07, LIGHTSPEED_RETAIL_API_VERSION_2026_07),],)@mock.patch(@@ -170,8 +174,10 @@ class TestLightspeedRetailSource:@pytest.mark.parametrize("pinned, expected",[- (None, LIGHTSPEED_RETAIL_API_VERSION_2026_01),+ (None, LIGHTSPEED_RETAIL_API_VERSION_2026_07),(LIGHTSPEED_RETAIL_API_VERSION_2_0, LIGHTSPEED_RETAIL_API_VERSION_2_0),+ (LIGHTSPEED_RETAIL_API_VERSION_2026_01, LIGHTSPEED_RETAIL_API_VERSION_2026_01),+ (LIGHTSPEED_RETAIL_API_VERSION_2026_07, LIGHTSPEED_RETAIL_API_VERSION_2026_07),],)@mock.patch(