: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): deprecate Brex API v1 in favor of v2 (#74144)
Tom Owersbf9235430d7a
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/source.pyindex 71da24095571..d2560a75481b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/source.py@@ -21,7 +21,11 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.brex.brexvalidate_credentials as validate_brex_credentials,)from products.warehouse_sources.backend.temporal.data_imports.sources.brex.settings import ENDPOINTS, INCREMENTAL_FIELDS-from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import FieldType, ResumableSource+from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import (+ FieldType,+ ResumableSource,+ VersionDeprecation,+)from products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (CanonicalDescriptions,)@@ -42,6 +46,10 @@ class BrexSource(ResumableSource[BrexSourceConfig, BrexResumeConfig]):supported_versions = (BREX_API_VERSION_V1, BREX_API_VERSION_V2)default_version = BREX_API_VERSION_V2+ # Brex deprecated its Spend Limits v1 endpoints in favor of the v2 Budgets API; the vendor+ # announced no sunset date. v1 stays supported so existing pins keep working, but carries the+ # deprecation flag so the generic in-product warning fires.+ deprecated_versions = (VersionDeprecation(version=BREX_API_VERSION_V1, sunset_at=None),)@propertydef source_type(self) -> ExternalDataSourceType:diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/tests/test_brex_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/tests/test_brex_source.pyindex f444e50f7342..0ed56d5ab2ea 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/tests/test_brex_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/tests/test_brex_source.py@@ -33,6 +33,14 @@ class TestBrexSource:assert self.source.resolve_api_version(None) == BREX_API_VERSION_V2assert self.source.resolve_api_version(BREX_API_VERSION_V1) == BREX_API_VERSION_V1+ def test_v1_is_deprecated_without_sunset_and_v2_is_not(self):+ # Brex announced no sunset date, so v1 is flagged deprecated with sunset_at=None; the default+ # v2 must never be deprecated.+ deprecation = self.source.get_version_deprecation(BREX_API_VERSION_V1)+ assert deprecation is not None+ assert deprecation.sunset_at is None+ assert self.source.get_version_deprecation(BREX_API_VERSION_V2) is None+def test_get_source_config(self):config = self.source.get_source_config